Bom dia,
Alguém sabe porque e que quando eu corro este código em modo debug funciona mas quando corro normal as letras não aparecem?
Borigado
public class Servidor extends JFrame implements Runnable {
JLabel l;
JPanel p;
Font font = new Font("Arial", Font.BOLD, 40);
boolean teste = false;
public Servidor() {
p = new JPanel();
l = new JLabel();
l.setFont(font);
l.setForeground(Color.BLACK);
JButton bt = new JButton("START");
bt.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
teste = true;
}
});
p.add(bt);
p.add(l);
add(p);
setVisible(true);
setTitle("l");
setSize(300, 300);
setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void run() {
while (true) {
if (teste) {
for (int i = 65; i <= 90; i++) {
try {
l.setText("" + (char) i);
Thread.sleep(2000);
} catch (InterruptedException ex) {
Logger.getLogger(Servidor.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
}
public static void main(String[] args) {
Servidor ser = new Servidor();
new Thread(ser).start();
}
}
