import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Testelabel extends JFrame { private JLabel label; private Icon icone = new ImageIcon( "javinha.jpeg" ); private JButton botao1; private String str = "eu aqui"; public Testelabel (){ super ("Minha janela"); Container caixao = getContentPane(); caixao.setLayout(new FlowLayout()); label = new JLabel(); botao1 = new JButton(str); botao1.setToolTipText("botaozinho"); label.setText("primeiro teste do label"); label.setIcon(icone); label.setToolTipText("este é o label"); label.setHorizontalTextPosition( SwingConstants.CENTER ); label.setVerticalTextPosition( SwingConstants.TOP); caixao.add (label); setSize(360, 150); setVisible(true); } public static void main(String[] args) { Testelabel application = new Testelabel(); application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); } }