Olá pessoal,
Já li até alguns tópicos aqui mas não consegui entender direito. Li sobre threads e tal. Li que o Swing não é seguro para threads, e que ele tem uma única thread que é a “thread de despacho de eventos” para fazer as interações com os usuários e atualizar a GUI…Ham? aHDSUAHDOHASDIH Não entendi muito bem o que ele quis dizer com isso. E qual a diferença de eu criar uma classe separada para criar um objeto e executar o método que cria a GUI desse objeto ao inves de eu usar só uma classe, como aquelas de formulários do NetBeans e usar o método:
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Server.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Server.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Server.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Server.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new Server().setVisible(true);
}
});
}
para criar a GUI na própria classe?