import java.awt.*;
public class Taschenrechner extends Frame {
private static final long serialVersionUID = 1L;
private TextField textField = null;
private Button button0 = null;
private Button button1 = null;
private Button button2 = null;
private Button button3 = null;
public Taschenrechner() {
super();
initialize();
}
private void initialize() {
this.setLayout(null);
this.setSize(251, 300);
this.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
this.setBackground(new Color(255, 128, 0));
this.setTitle("Taschenrechner © Elmar K.");
this.add(getTextField(), null);
this.add(getButton0(), null);
this.add(getButton1(), null);
this.add(getButton2(), null);
this.add(getButton3(), null);
this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
}
});
}
private TextField getTextField() {
if (textField == null) {
textField = new TextField();
textField.setBounds(new Rectangle(5, 34, 240, 34));
textField.setBackground(Color.darkGray);
textField.setSelectionStart(100);
textField.setForeground(SystemColor.activeCaptionText);
textField.setFont(new Font("Dialog", Font.BOLD, 18));
}
return textField;
}
private Button getButton0() {
if (button0 == null) {
button0 = new Button();
button0.setBounds(new Rectangle(10, 250, 55, 40));
button0.setLabel("0");
button0.setFont(new Font("Dialog", Font.BOLD, 18));
}
return button0;
}
private Button getButton1() {
if (button1 == null) {
button1 = new Button();
button1.setBounds(new Rectangle(10, 205, 55, 40));
button1.setLabel("1");
button1.setFont(new Font("Dialog", Font.BOLD, 18));
}
return button1;
}
private Button getButton2() {
if (button2 == null) {
button2 = new Button();
button2.setBounds(new Rectangle(70, 205, 55, 40));
button2.setLabel("2");
button2.setFont(new Font("Dialog", Font.BOLD, 18));
}
return button2;
}
private Button getButton3() {
if (button3 == null) {
button3 = new Button();
button3.setBounds(new Rectangle(130, 205, 55, 40));
button3.setLabel("3");
button3.setFont(new Font("Dialog", Font.BOLD, 18));
}
return button3;
}
}