Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package something; //Package name replaces "something"
- import javax.swing.*;
- public class myclass { //Class name replaces "myclass"
- public static void main(String [] args) {
- JFrame frame = new JFrame("Frame"); //Create our JFrame that stores "Hello world!"
- frame.setVisible(true);
- frame.setSize(400, 200);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- JLabel label = new JLabel("Hello World!"); //This is the text that will appear in our JFrame.
- frame.add(label); //This makes the text appear in the JFrame.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment