Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package rotulo;
- import java.awt.FlowLayout;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.SwingConstants;
- import javax.swing.Icon;
- import javax.swing.ImageIcon;
- public class Rotulo extends JFrame{
- private JLabel label1;
- private JLabel label2;
- private JLabel label3;
- public Rotulo(){
- super ("RotuloTest");
- setLayout( new FlowLayout());
- label1 = new JLabel( "Rotulo com texto");
- label1.setToolTipText("Este é label2");
- add(label1);
- Icon bug = new ImageIcon( getClass().getResource("bug1.png"));
- label2 = new JLabel("Label com texto e icone", bug,SwingConstants.LEFT);
- label2.setToolTipText("Este é label 2");
- add(label2);
- label3 = new JLabel();
- label3.setText("Label está com icones e texto com botões");
- label3.setIcon(bug);
- label3.setHorizontalTextPosition(SwingConstants.CENTER);
- label3.setVerticalTextPosition(SwingConstants.BOTTOM);
- label3.setToolTipText("Este é label 3");
- add(label3);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement