create jframe java

Solutions on MaxInterview for create jframe java by the best coders in the world

showing results for - "create jframe java"
Sabri
12 Jul 2019
1import javax.swing.*;
2import java.awt.FlowLayout;
3import java.awt.GridBagConstraints;
4import java.awt.GridBagLayout;
5import java.awt.Insets;
6import java.awt.event.*;
7 
8public class JFrameExample{
9     
10    public static void main(String[] args){
11        // Create frame with title Registration Demo
12        JFrame frame= new JFrame(); 
13        frame.setTitle("JFrame Demo");
14        frame.pack();
15        frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
16        frame.setLocationRelativeTo(null);
17        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
18        frame.setVisible(true);
19    }
20}
21
Federico
02 May 2018
1public JFrame frame = new JFrame();//creating jframe
2
3Class main(){
4public static void main(String[] args){
5  frame.setSize(200,200); //setting size
6  frame.setVisable(true); //sets visability 
7  frame.setDefaultCloseOperation.(JFrame.EXIT_ON_CLOSE); //allow jframe to close when clicked
8
9}
10  }