讲解:Database|R|SQL|Java

COMP2396 Object-oriented programming and JavaAssignment 5: GUIDue date: 15 Apr, 2020 23:59IntroductionThis assignment tests about the Java GUI knowledge. You are asked to write a graphics objecteditor program to complete 3 tasks.With the program, users can draw line, circle, triangle and quadrilateral. The created graphics canbe selected, then user can move, copy, delete, randomly color the graphics object.You need to write JavaDoc for all non-private classes and non-private class members.Here is the detail of 3 tasks:Task 1: DrawObjectEditorCreate the java file DrawObjectEditor.java as follow:You need to create graphics objects with the following classes in Java AWT:java.awt.geom.Line2Djava.awt.geom.Ellipse2Djava.awt.PolygonYou also have to handle mouse events using MouseMotionListener and/or MouseListener.You can use the contains() method defined in classes Line2D, Ellipse2D and Polygon to check ifthe mouse’s position is contained inside the graphics object boundary.import java.awt.*;import javax.swing.JFrame;public class DrawObjectEditor extend JFrame{}The DrawObjectEditor is started with a grey background color editor panel of size 400 x 450 asfollow:You are not required to follow exactly the same position of the JButton objects as in the abovefigure, but should look similar to it.Task 2: Object Creation FunctionWhen the Line button, the Circle button, the Triangle button or the Quadrilateral button is pressed,the user can create the object in the editor panel and the color of the corresponding button willchange to grey and not clickable before the object is created:To draw a line, the user clicks the starting point. The starting point then displays a dot. The userthen clicks the end point and the line will be drawn:Starting Point (x1, y1)Ending Point (x2, y2)To draw a circle, the user clicks the center of the circle. The center displays a dot. The user thenclicks the radius to draw a circle:Center (x1, y1)Radius (x2, y2)To draw a triangle, the user clicks the top corner point, bottom left corner point and then thebottom right corner as follow:Top left corner (x1, y1)Bottom right corner (x3, y3)Bottom left corner (x2, y2)To draw a Quadrilateral, the user clicks the top left corner point, bottom 代写Database|代写R语言程序|代做数据库SQL|帮做Java程序left corner point, thebottom right corner and then the top right corner point as follow:NOTE: You can assume that all objects created by the user will NOT overlapping with each other.Top left corner (x1, y1)Bottom right corner (x3, y3)Bottom left corner (x2, y2)Top right corner (x4, y4)Task 3: Select, Move, Delete, Copy and Random Color function1. When the user presses the Select button, the user can select an object in the editor panel byclicking the area within the object. The Select button color will change to grey and not clickablebefore an object has been selected.2. When an object has been selected, the color of the selected object border will change to green.The user can then perform operations such as move or delete. The operation buttons [Move,Delete, Copy, Random Color] should become clickable.3. When an object has been selected, the user can press the Move button to move the object bypress and release.4. When an object has been selected, user can click the Delete button to delete the selected objectin the editor panel.5. When an object has been selected, the user can press the Copy button to copy the selectedobject. Your program should display the copied object near the original object (No strictrequirement for the position of it, just don’t make it too far away). The copied object shouldjust like other objects, and can be selected, moved, deleted, copied and colored.6. When an object has been selected, user can click the Random Color button to fill thegeometric object with random color. The colored object should just like other objects, and canbe selected, moved, deleted, copied and re-colored.Submission⚫ Please submit your files to Moodle.⚫ Make sure you have submitted .java files but not .class files.⚫ You may create additional classes to complete the tasks.⚫ Late submission is not allowed.Grading➢ 95% marks are given to the functionality of your program.5% --- GUI90% (10% for each function):1.Draw Line / 2.Draw Circle / 3.Draw Triangle / 4.Draw Quadrilateral / 5.Selectfunction / 6.Move function / 7.Delete function / 8.Copy function / 9.Random Colorfunction➢ 5% marks are given to your JavaDoc.A complete JavaDoc includes documentation of every classes, member fields and methods that arenot private.转自:http://www.6daixie.com/contents/9/5074.html

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Here is our training plan. Our agenda for this training m...
    FlyingPeter阅读 3,138评论 0 0
  • The Great A.I. Awakening How Google used artificial intel...
    图羽阅读 5,136评论 0 3
  • 个别员工执行力差是能力的问题,公司整体执行力差就是管理出了问题。 组织结构不对,什么都不对。 1、目标分解。 2、...
    小爷今天有空了阅读 2,463评论 0 0
  • 前天出席婚礼,温度在22度,穿一件打底连衣裙外搭一件风衣,在室外坐着的时候,都是热的流汗。 昨天出去看银杏,上午出...
    900e6335c6d0阅读 3,157评论 1 23
  • 20190315 考试成绩出来了,儿子考了89.5。我们都想不到,原来试卷有点难,可是仍然有粗心大意失分的。...
    酸奶草莓派阅读 1,301评论 0 0

友情链接更多精彩内容