Salve,
ho alcuni problemi nella visualizzazione di un JButton contenuto in un JPanel.
L'output dovrebbe essere cosi:
Test 1
PULSANTE
Se elimino la parte JButton il JPanel + JLabel funziona correttamente.codice:public class Prova extends JFrame { Prova(){ super(); setTitle("Nome Applicazione"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setPreferredSize(new Dimension(500, 300)); setVisible(true); JPanel panel = new JPanel(new GridLayout(2,1)); add(panel); JLabel mess = new JLabel("Test1"); panel.add(mess); JButton button = new JButton("PULSANTE"); button.setSize(100, 40); button.setLocation(10, 10); this.add(button); panel.add(button); this.pack(); } public static void main(String[] args) { new PrimaryScreen(); }
Grazie mille

Rispondi quotando