Inheritance and GUI's
Intro to Inheritance and GUI's Examples of Inheritance GUI's
GUI Example
Home
JFrame � Making a Window

public static void main (String args[])
{
     JFrame jf = new JFrame (�This is a test frame!�);
     jf.setSize (800,600);
     jf.setVisible (true);
}

Result � frame with size 800x600 pixels





To create JFrames that do what we want, we create a new class that inherits from the JFrame.

Take a look at the inheritance hierarchy of the javax.swing.JFrame class in the standard runtime API documentation. This hierarchy indicates that JFrame is a Frame and Frame is a Window and Window is a Container and Container is a Component and finally Component is an Object (just like all the other classes are in Java since the Object class is the root class from which they all descend). A more general way to look at this is to say a child class can be used any place any of its ancestor classes can be used. This means that JFrame is a Frame and a Window and a Container and a Component and an Object.
Hosted by www.Geocities.ws

1