extends JFrame

The JFrame is a class like any other and can be extended.

Program

1 - Copy

 

 

 

Program Source

import javax.swing.JFrame;

class Frame extends JFrame{
    
    Frame()
    {
        setTitle("First java GUI application");
        setSize(700, 200);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}

public class Javaapp {
   
    public static void main(String[] args) {
        
        Frame frame = new Frame();
    }
}

Leave a Comment