Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Arthur Polon Lemos - Info 3B
- */
- package labelframe;
- import java.awt.FlowLayout;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.SwingConstants;
- import javax.swing.JButton;
- import javax.swing.Icon;
- import javax.swing.ImageIcon;
- import javax.swing.JOptionPane;
- public class LabelFrame extends JFrame{
- private JLabel label1;
- private JLabel label2;
- private JLabel label3;
- public LabelFrame(){
- super("Testing JLabel");
- setLayout (new FlowLayout ());
- label1 = new JLabel("Label with text");
- label1.setToolTipText ("This is Label 1");
- add(label1);
- Icon bug = new ImageIcon(getClass().getResource("bug1.png"));
- label2 = new JLabel("Label with text and icon", bug , SwingConstants.LEFT);
- label2.setToolTipText("This is label2");
- add(label2);
- label3 = new JLabel ();
- label3.setText("Label with icon and text at bottom");
- label3.setIcon (bug);
- label3.setHorizontalTextPosition(SwingConstants.BOTTOM);
- label3.setToolTipText("this is label 3");
- add(label3);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement