Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. public class CalculatorGUI extends JFrame implements ActionListener {
  2.    
  3.     // Number buttons
  4.     JButton bone = new JButton("1");
  5.     JButton btwo = new JButton("2");
  6.  
  7.    
  8.     // Operation buttons
  9.     JButton bplus = new JButton("+");
  10.  
  11.    
  12.     // Reset Buttons
  13.     JButton bac = new JButton("AC");
  14.     JButton bc = new JButton("C");
  15.    
  16.     // Textfield for operations and results
  17.     JTextField mathop = new JTextField();
  18.    
  19.     CalculatorCtrl ctrl;
  20.    
  21.     CalculatorGUI(String s, CalculatorCtrl c) {
  22.         super(s);
  23.         getContentPane().setLayout(new BorderLayout());
  24.        
  25.         // Panel for the numbers (0-9)
  26.        
  27.        
  28.         // Panel for aritmethic operations
  29.        
  30.         mathop.setHorizontalAlignment(JTextField.RIGHT);
  31.         getContentPane().add(mathop, BorderLayout.NORTH);
  32.    
  33.         ctrl = c;
  34.        
  35.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  36.         pack();
  37.         setResizable(false);
  38.         setVisible(true);
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement