Object-Oriented Programming OvalDraw Plus (Java code) Summary: Create a graphical application with Java that that draws an oval Prerequisites: Java, VS Code, and Terminal Create a graphical Java application that runs on Microsoft Windows and MacOS that draws an oval centered in the main application window when the programming starts. The oval should automatically resize and reposition itself when the window is resized.
Object-Oriented Programming
OvalDraw Plus (Java code)
Summary: Create a graphical application with Java that that draws an oval
Prerequisites: Java, VS Code, and Terminal
Create a graphical Java application that runs on Microsoft Windows and MacOS that draws an oval centered in the main application window when the programming starts. The oval should automatically resize and reposition itself when the window is resized.
In this activity you will start with our OvalDraw application in our sample code, review the code, and then make incremental improvements to the application. Be sure to make the resulting application uniquely your own by adding standard comments at the top application (i.e. your name, class, etc.), changing the names of variables, and adding small features. Finally, be sure to save your work as you will often be asked to submit it as part of an assignment.
Be sure to review the example OvalDraw project in the Java section of our example code repository.
Requirement 1: Create an application that:
1. Is implemented in a single Java (.java) file named “OvalDrawPlus.java”
2. Successfully compiles with “javac *.java" and successfully executes with “java OvalDrawPlus”
3. Has a simple yet an aesthetically pleasing user interface
Requirement 2: Be sure that the application also:
1. Opens a resizable main window with an initial height of 500 and a width of 400
2. Positions the upper left corner of the main window at 250 units from the left and 150 units from the top of the screen
3. Prints “Starting OvalDrawPlus...” in the terminal window when the application starts
Requirement 3: Enhance the application so that it:
1. Draws an oval with a filled color other than red, blue, or black when the application starts
2. Centers the oval so that it touches each edge of the window
3. Resizes the oval when the application window is resized
Requirement 4: Finally enhance the application so that it:
1. Draws a dark blue rectangle directly behind the oval
2. Utilizes constants at the top of the file to define the rectangle color
3. Prints “Closing OvalDrawPlus...” in the terminal window when the application is exited
Step by step
Solved in 3 steps