import javax.swing.JFrame;
public class GraphicsDemo extends JFrame {
// The constructor follows.
public GraphicsDemo() {
setTitle("Graphics demo");
setSize(800, 480);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
// Main method - necessary in all classes.
public static void main(String[] args) {
// Creation of a GraphicsDemo Object.
GraphicsDemo demo = new GraphicsDemo();
}
}
Example of a Java swing window using JFrame
Ejemplo de una ventana JFrame usando java swing