Entrega Calculadora - Sergio Bohada - 20191020033
Entrega Calculadora - Sergio Bohada - 20191020033
Entrega Calculadora - Sergio Bohada - 20191020033
package co.Calculadora.POA;
this.num1 = num1;
this.num2 = num2;
this.res = 0;
this.num1 = 0;
this.num2 = 0;
}
public String showRes() {
return res;
}
Paquete: co.Calculadora.POA;
Clase hija: Operaciones.java
package co.Calculadora.POA;
return res;
}
Paquete: co.Calculadora.POA;
Clase vista: Operaciones.java
package co.Calculadora.POA;
import java.awt.Color;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.LineBorder;
import javax.swing.JButton;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JLabel;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Vista window = new Vista();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Vista() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 398, 472);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
}
});
btnNewButtonAC.setFont(new Font("Microsoft JhengHei UI Light",
Font.PLAIN, 11));
btnNewButtonAC.setForeground(Color.WHITE);
btnNewButtonAC.setBounds(0, 82, 130, 58);
btnNewButtonAC.setBackground(new Color(48, 186, 255));
btnNewButtonAC.setBorderPainted(false);
frame.getContentPane().add(btnNewButtonAC);
op = new Operaciones(cal.getNum1(),cal.getNum2());
op.mult();
lblNewLabel_res.setText(op.showRes());
}
});
btnNewButton_mult.setBackground(new Color(48, 186, 255));
btnNewButton_mult.setForeground(Color.WHITE);
btnNewButton_mult.setFont(new Font("Microsoft YaHei UI Light",
Font.PLAIN, 11));
btnNewButton_mult.setBounds(255, 194, 130, 58);
btnNewButton_mult.setBorderPainted(false);
frame.getContentPane().add(btnNewButton_mult);
}
});
btnNewButtonAC_2.setBackground(Color.WHITE);
btnNewButtonAC_2.setFont(new Font("Microsoft YaHei UI Light",
Font.PLAIN, 11));
btnNewButtonAC_2.setForeground(Color.BLACK);
btnNewButtonAC_2.setBounds(127, 138, 130, 58);
btnNewButtonAC_2.setBorderPainted(false);
frame.getContentPane().add(btnNewButtonAC_2);
if (cont > 2) {
cont = 0;
}
textField_nums.setText(null);
}
});
btnNewButton_Poten.setBackground(new Color(48, 186, 255));
btnNewButton_Poten.setForeground(Color.WHITE);
btnNewButton_Poten.setFont(new Font("Microsoft YaHei UI Light",
Font.PLAIN, 11));
btnNewButton_Poten.setBounds(255, 308, 130, 58);
btnNewButton_Poten.setBorderPainted(false);
frame.getContentPane().add(btnNewButton_Poten);
lblNewLabel_res.setBackground(Color.WHITE);
lblNewLabel_res.setForeground(Color.BLACK);
lblNewLabel_res.setFont(new Font("Microsoft JhengHei UI Light",
Font.PLAIN, 17));
lblNewLabel_res.setBounds(166, 0, 218, 82);
frame.getContentPane().add(lblNewLabel_res);
}
}