Olá pessoal.
Bom, estou tentando posicionar um JLabel, mas sequer ele aparece na tela…
Segue o codigo:
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Teste extends JFrame{
public Teste(){
JLabel l1 = new JLabel("HELLO WORLD!");
getContentPane().add(l1);
l1.setBounds(40, 40, 80, 20);
}
public static void main(String[] args){
JFrame janela = new JFrame();
janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
janela.setVisible(true);
}
}
Se os amigos poderem me dizer aonde ta errado, fico grato!
Att.
Thiago.