Advertisement
thenewboston

Java Programming Tutorial - 51 - GUI with JFrame

Aug 22nd, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. import javax.swing.JFrame;
  2.  
  3. public class apples {
  4.    public static void main(String[] args){
  5.      
  6.       tuna bucky = new tuna();
  7.       bucky.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  8.       bucky.setSize(275, 180);
  9.       bucky.setVisible(true);
  10.      
  11.    }
  12. }
  13.  
  14. import java.awt.FlowLayout;
  15. import javax.swing.JFrame;
  16. import javax.swing.JLabel;
  17.  
  18. public class tuna extends JFrame{
  19.    
  20.    private JLabel item1;
  21.    
  22.    public tuna(){
  23.       super("The title bar");
  24.       setLayout(new FlowLayout());
  25.      
  26.       item1 = new JLabel("This is a sentence");
  27.       item1.setToolTipText("This is gonna show up on hover");
  28.       add(item1);
  29.    }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement