Question
Task 6. Creating Methods that Use the Screen Size Add a void method to the MaxWindow class called maximizeHeight. The method will move the window
Task 6.
Creating Methods that Use the Screen Size Add a void method to the MaxWindow class called maximizeHeight. The method will move the window to the top of the screen and make it as tall as the screen. The method should begin: public void maximizeHeight() { Your method will need to use the Toolkit and Dimension classes described above. First, you need to import the classes import java.awt.Dimension; import java.awt.Toolkit; Now, you will add code from above to your method to get the screen height and width. Note, you do not add all the code you typed into the Interactions pane, just what is needed to get the required screen dimension. Save your code, compile it, and fix any errors. Test your code in the interactions pane. Create a MaxWindow instance and move it to somewhere other than the upper left corner. Call the maximizeHeight method, and if correct, the window should now stretch from the top to the bottom of the screen without changing in width or moving left or right. Place a comment above your method explaining what the method does. You should indent your comment so that it starts in the same column as the method. Add the void method maximizeWidth to the class that moves the window to the left of the screen and makes it as wide as the screen. Save, compile, and test your class.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started