Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.FlowLayout;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- public class MyFrame extends JFrame{
- // Variables
- private JLabel myLabel; // Each frame must have a label to contain words, text, images
- // Constructor
- public MyFrame(){
- super("JFrame's title"); // JFrame's title
- setLayout(new FlowLayout()); // JFrame must follow the rules of a layout
- myLabel = new JLabel("JLabel's text container"); // The container
- myLabel.setToolTipText("Text appearing while hovering");
- add(myLabel);
- }
- // Main
- public static void main(String args[]){
- MyFrame frame = new MyFrame();
- frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
- frame.setSize(600, 600);
- frame.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement