Salve a tutti, stavo compilando un semplice algoritmo di base su piattaforma Java per caricarmi un Frame che contiene una JButton "OK".
Il problema è che non capisco perché quando si apre il JFrame non c'è il JButton.
Ho provato anche a renderlo visibile, ma non appare lo stesso.
Il compilatore che uso non mi da errori, ecco il codice:
codice:
import javax.swing.JFrame;
import javax.swing.JButton;
public class MySoft
{
public static void main(String[] args) {
JFrame frame = new JFrame("My Soft");
frame.setSize(500, 500);
JButton button1 = new JButton("OK");
button1.setSize(50, 50);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
button1.setVisible(true);
}
}