Sto usando una classe personalizzata che estende JFame, ma a volte non mostra nulla. Non ho mai avuto difetti, quindi sono curioso di sapere se si tratta di un comando java che può aiutarmi a stampare qualcosa. Ho cercato altre domande, ma non ho trovato nulla di simile. Non sto facendo nulla di veramente pazzo, ma curioso sul perché questo accada. Vorrei correggere il problema per evitare problemi futuri.GUI Java compila senza errori, ma a volte non mostra nulla
Blank
GUI
public MemberPanel(int i) throws IOException {
Container contentPane = getContentPane();
GridLayout layout = new GridLayout(2, 1);
contentPane.setLayout(layout);
setVisible(true);
setLocation(0, 0);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(640, 170);
setResizable(false);
greenStatus = new JButton("Non-Critical");
yellowStatus = new JButton("Important");
redStatus = new JButton("Mission Critical");
greenStatus.setFont(fontTextOne);
yellowStatus.setFont(fontTextOne);
redStatus.setFont(fontTextOne);
greenStatus.addActionListener(this);
yellowStatus.addActionListener(this);
redStatus.addActionListener(this);
buttonPanel.add(greenStatus);
buttonPanel.add(yellowStatus);
buttonPanel.add(redStatus);
statusLabel = new JLabel("In 75 letters or less... What are you working on?");
statusLabel.setVerticalAlignment(JLabel.CENTER);
statusLabel.setHorizontalAlignment(JLabel.CENTER);
statusLabel.setFont(fontTextTwo);
textFieldPanel.add(statusLabel);
textFieldPanel.add(statusMessage);
contentPane.add(buttonPanel);
contentPane.add(textFieldPanel);
}
Gli oggetti GUI Swing devono essere costruiti e modificati _solo_ sul [thread di invio eventi] (http://download.oracle.com/javase/tutorial/uiswing/concurrency/initial.html). – trashgod