code for Jframe code example
Example: java simple jframe example
import javax.swing.*;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.*;
public class JFrameExample{
public static void main(String[] args){
JFrame frame= new JFrame();
frame.setTitle("JFrame Demo");
frame.pack();
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}