Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CalculatorGUI extends JFrame implements ActionListener {
- // Number buttons
- JButton bone = new JButton("1");
- JButton btwo = new JButton("2");
- // Operation buttons
- JButton bplus = new JButton("+");
- // Reset Buttons
- JButton bac = new JButton("AC");
- JButton bc = new JButton("C");
- // Textfield for operations and results
- JTextField mathop = new JTextField();
- CalculatorCtrl ctrl;
- CalculatorGUI(String s, CalculatorCtrl c) {
- super(s);
- getContentPane().setLayout(new BorderLayout());
- // Panel for the numbers (0-9)
- // Panel for aritmethic operations
- mathop.setHorizontalAlignment(JTextField.RIGHT);
- getContentPane().add(mathop, BorderLayout.NORTH);
- ctrl = c;
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- pack();
- setResizable(false);
- setVisible(true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement