javacodex.com
Java Examples
Java Examples
memu home questions

JFrame

A JFrame is a window that has decorations such as a border, a title, and supports button components that close or iconify the window. Applications with a GUI usually include at least one frame.

Below is an example that creates an empty JFrame.

Source: (JFrameExample.java)

import javax.swing.*;
 
public class JFrameExample {
 
  public static void main(String[] arguments) {
 
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("JFrame Example");
    frame.setSize(300,150);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
    frame.setVisible(true);
 
  }
}
 

Output:

$ java JFrameExample

Output



Contact: javacodex@yahoo.com