import javax.swing.*; // needed for the JFrame class /* This is a simple GUI program that creates a window with nothing on it */ public class simpleWindow { public static void main(String[] args) { JFrame window = new JFrame(); // assign JFrame to window final int WINDOW_WIDTH = 300; // sets the width of the window final int WINDOW_HEIGHT = 400; // sets the height of the window window.setTitle("JJ's Simple Show Window"); // creates a title for the window window.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); // sets the size of the window window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//what happens when the user clicks on the X button window.setVisible(true); // set the visibility to be true so the window will appear } } < Java > < GUI > < Home >
import javax.swing.*; // needed for the JFrame class /* This is a simple GUI program that creates a window with nothing on it */ public class simpleWindow { public static void main(String[] args) { JFrame window = new JFrame(); // assign JFrame to window final int WINDOW_WIDTH = 300; // sets the width of the window final int WINDOW_HEIGHT = 400; // sets the height of the window window.setTitle("JJ's Simple Show Window"); // creates a title for the window window.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); // sets the size of the window window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//what happens when the user clicks on the X button window.setVisible(true); // set the visibility to be true so the window will appear } }
< Java > < GUI > < Home >