Cajero java applet codigo fuente

941 palabras 4 páginas
import java.applet.*; import java.awt.*; import java.awt.event.*; class ATM extends Applet { private TextField display=new TextField(); private Keypad pad= new Keypad(); private Button cancelar=new Button("Cancelar"), aceptar=new Button("Aceptar"), deposito=new Button("Deposito"), retiro=new Button("Retiro"); private TextArea help=new TextArea(6,20); public void init() { //Construir el panel de botones de control Panel p1=new Panel(); //p1=(new GridLayout(4,1,0,3)); p1.setLayout(new GridLayout(4,1,0,3)); p1.add(cancelar); p1.add(aceptar); p1.add(deposito); p1.add(retiro); //juntar el keypad y el panel de botones de control Panel p2=new Panel(); p2.setLayout(new BorderLayout(3,0)); …ver más…

//SetLayout(new GrindLayout(4,1,2,2)); Panel p3=new Panel(); p3.setLayout(new GridLayout(1,3,4,4)); b1=new Button("1"); p2.add(b1); b2=new Button("2"); p2.add(b2); b3=new Button("3"); p2.add(b3); add(p3); //fila inferior boton cero ancho y boton punto angosto Panel p4= new Panel(); p4.setLayout(new BorderLayout(7,4)); b0=new Button("0"); p4.add(BorderLayout.CENTER,b0); bpoint=new Button ("."); p4.add(BorderLayout.EAST,bpoint); add(p4); } }

// Para las opciones de deposito y retiro class cajero extends Applet implements ActionListener{ private final int START_MODE =0, DEPOSIT_MODE =1, WITHDRAW_MODE=2; private int mode= START_MODE;

private TextArea display =new TextArea(1, 10); private Keypad pad= new Keypad(); private Button cancelar = new Button ("Cancelar"), aceptar =new Button ("Aceptar"), deposit = new Button ("Deposito"), retiro = new Button ("Retiro"); private TextArea help = new TextArea(6,35);

public void init(){ //desde aqui Panel p1 = new Panel(); //p1.setLayout(new GridLayout(4, 1 0, 3)); p1.setLayout(new GridLayout(4, 1, 0, 3)); p1.add(cancelar); p1.add(aceptar); p1.add(deposit);

Documentos relacionados