I'm studying Swing with the Java Book Developer's Guide, and this code is not valid.
import javax.swing.*;
@SuppressWarnings("serial")
public class Main extends JFrame{
public Main() {
super(); //ajusta o titulo
setBounds(50, 50, 250, 90); //ajusta a posição e tamanho
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //ação fechar
add(new JLabel("Janela")); //conteúdo
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
Main principal = new Main(); //crai a janela principal
principal.setVisible(true); //exibe a janela principal
SwingDialog dialogo = SwingDialog (principal, true); //cria dialogo //AQUI INFORMA UM ERROR FATAL
dialogo.setVisible(true); //exibe dialogo
}
}
); } }