Professional Documents
Culture Documents
Button;
import java.awt.Color;
import java.awt.Event;
import java.awt.Frame;
import javax.swing.JOptionPane;
/**
*
* @author alejonba0498
*/
public class Cruz extends Frame {
public Cruz() {
//color a la letra de los botones
BtnS.setForeground(Color.WHITE);
BtnR.setForeground(Color.BLACK);
BtnM.setForeground(Color.BLACK);
BtnD.setForeground(Color.BLACK);
//color a los botones
BtnS.setBackground(Color.RED);
BtnR.setBackground(Color.RED);
BtnM.setBackground(Color.RED);
BtnD.setBackground(Color.RED);
//posicion de los botones
BtnS.setBounds(0, 0, 100, 100);
BtnR.setBounds(200, 0, 100, 100);
BtnM.setBounds(0, 200, 100, 100);
BtnD.setBounds(200, 200, 100, 100);
//agregamos los botones al frame
this.add(BtnS);
this.add(BtnR);
this.add(BtnM);
this.add(BtnD);
@Override
public boolean action(Event evt, Object arg) {
if (evt.target instanceof Button) {
String opcion = (String) arg;
if (opcion == "Dividir") {
this.dividir();
}
}
return true;
}
//metodos para calcular las operaciones de los botones
panel.setVisible(true);