What I am not understanding is how the THIS keyword is used in the screen,setFullScreen(displayMode,this);
That method requires a DisplayMode object and JFrame object to be passed to it. Im not following how THIS is referencing a JFrame object.
Also setBackground(Color.blue); setForeground(Color.white); setFont(new Font("Dialog", Font.PLAIN, 24)); in the Run method. Seems answering the first ?
would answer how setForeground ect is being applied to a JFrame that is being displayed.
Your class is FullScreenTest which extends JFrame; this is referencing instance of that class, and that's why you can use it where JFrame is expected.
The quieter you are, the more you are able to hear.
Joined: Feb 23, 2011
Ok lets me see if I understand this. You extend a class FullScreenTest extends JFrame. When the FullScreenTest class is loaded is automatically creates a JFrame object as well. Which is why in the Run() method setBackground setForegroundround and font methods.
do not create an error. So its like having an invisible object?
Chad McAtee wrote:Ok lets me see if I understand this. You extend a class FullScreenTest extends JFrame.
Actually, it's the other way around, becaus you extend JFrame class to create your own one.
An important thing to remember is that derived class object always contains a complete base class object within itself (with all inherited members of the base class - fields and methods), and that's why you can do things you asked in the first place.