tcl1

[JAVA] Hello World application

Oct 31st, 2013
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. package something; //Package name replaces "something"
  2.  
  3. import javax.swing.*;
  4.  
  5. public class myclass { //Class name replaces "myclass"
  6.     public static void main(String [] args) {
  7.         JFrame frame = new JFrame("Frame"); //Create our JFrame that stores "Hello world!"
  8.         frame.setVisible(true);
  9.         frame.setSize(400, 200);
  10.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  11.         JLabel label = new JLabel("Hello World!"); //This is the text that will appear in our JFrame.
  12.         frame.add(label); //This makes the text appear in the JFrame.
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment