Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package es.uv.eu.calculadora.vista;
- import java.awt.Color;
- import java.awt.GridLayout;
- import java.awt.event.ActionListener;
- import javax.swing.JButton;
- import javax.swing.JPanel;
- import javax.swing.border.EmptyBorder;
- import javax.swing.border.LineBorder;
- /**
- *
- * @author
- */
- class OperacionesPanel extends JPanel {
- private JButton bmas,bmenos,bmult,bdiv,bresult;
- public OperacionesPanel(){
- //setBackground(CalculadoraVista.BACKGROUND);
- bmas=new JButton("+");
- bmenos=new JButton("-");
- bmult=new JButton("*");
- bdiv=new JButton("/");
- bresult=new JButton("=");
- bmas.setActionCommand("+");
- bmenos.setActionCommand("-");
- bmult.setActionCommand("*");
- bdiv.setActionCommand("/");
- bresult.setActionCommand("=");
- this.setLayout(new GridLayout(5,1));
- this.setBorder(new EmptyBorder(4, 4, 4, 4));
- //this.setBorder(new LineBorder(Color.BLUE));
- this.add(bmas);
- this.add(bmenos);
- this.add(bmult);
- this.add(bdiv);
- this.add(bresult);
- }
- public void addOpListener(ActionListener l) {
- this.bmas.addActionListener(l);
- this.bmenos.addActionListener(l);
- this.bmult.addActionListener(l);
- this.bdiv.addActionListener(l);
- this.bresult.addActionListener(l);
- }
- }
Add Comment
Please, Sign In to add comment