Java:
import javax.swing.JButton;
import javax.swing.JFrame;
public class Fenster {
public static final int SCEEEN_WIDTH = 300;
public static final int SCEEEN_HEIGHT = 300;
JFrame frame;
JButton button;
public Fenster() {
frame = new JFrame("Rechner");
frame.setSize(SCEEEN_WIDTH,SCEEEN_HEIGHT);
frame.setResizable(false);
frame.setLocationRelativeTo(null);
frame.getContentPane().add(createButton("Button 1", 20, 20));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
private JButton createButton(String text, int x, int y){
button = new JButton();
button.setLocation(x, y);
button.setSize(20,20);
button.setText(text);
return button;
}
}