Question: Create a subclass of JFrame called MaxWindow. Include a comment at the top of the file with your and your lab partner's names. If you
Create a subclass of JFrame called MaxWindow. Include a comment at the top of the file with your and your lab partner's names. If you remember how to do this, create the class now and skip to Task 4. If not, keep reading for the necessary steps.
-
You will type the code into the upper right window of DrJava (the text editor). The left hand window lists all the files you have open and highlights the file you are currently editing. In Java, every public class is placed in its own file so be certain to start typing your code into a new file and not into a file that already contains other data.
-
The first step to create the class is to place a comment at the top of the file that contains your name and your lab partner's name. There are two types of comments. Single line comments begin with //:
// This is a comment. The entire comment must be on this line.
Multiline comments are bracketed by /* and */:/* This is a multiline comment. The comment continues for as many lines as you want until the closing star-slash is encountered. */
Write a multiline comment with your names at the top of the file. -
To create the subclass, the code for your class should go below the comment, and it will start with
public class MaxWindow extends JFrame {Be certain to add the line
import javax.swing.JFrame;
to the top of your file, above the class definition so you can use the JFrame class, but below the comment with your name. -
Add a closing curly brace } to the end of your file, and save the file as MaxWindow.java.Important: In Java, every public class must go into a file with the same name as the class and ending with .java. You should also start your class name with a capital letter. This is not required in Java, but it is the style that has become the industry standard.
-
Now compile your code by selecting Compile. If the code has no mistakes, move on to the next step. If it does, fix the errors, save, and recompile before continuing.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
