На данный момент я пытаюсь написать простую программу, но фактический JButton по какой-то причине не появляется, вот мой код ниже.JButtons не отображается
import javax.swing.*;
import java.awt.*;
public class Test extends JFrame {
public static void main(String[] args) {
JFrame window = new JFrame("Shoes");
window.setDefaultCloseOperation(EXIT_ON_CLOSE);
window.setResizable(true);
window.setSize(400,500);
window.setVisible(true);
window.setLocationRelativeTo(null);
JButton welcome = new JButton("Click here");
welcome.setLocation(100,100);
welcome.setVisible(true);
// doesn't work, but is there another way to make it so?
//add(welcome);
}
}
вы не добавляете кнопку в окно –