Essays.club - Ensayos gratis, notas de cursos, notas de libros, tareas, monografías y trabajos de investigación
Buscar

Convertidor digital a octal

Enviado por   •  8 de Diciembre de 2017  •  693 Palabras (3 Páginas)  •  329 Visitas

Página 1 de 3

...

}

btnBotones[i].addActionListener(this);

cpane.add(btnBotones[i]);

}

jrbSistemas[2].setSelected(true);

elegirSistema(10);

frame.pack();

frame.setSize(290,350);

frame.setResizable(false);

frame.setVisible(true);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

private void elegirSistema(int sistema){

for(int i=0;i

if(!btnBotones[i].getText().equals("+")&&

!btnBotones[i].getText().equals("-")&&

!btnBotones[i].getText().equals("*")&&

!btnBotones[i].getText().equals("/")&&

!btnBotones[i].getText().equals("=")){

btnBotones[i].setEnabled(false);

}

}

switch(sistema){

case 2:

for(int i=0;i

if(!btnBotones[i].getText().equals("A")&&

!btnBotones[i].getText().equals("B")&&

!btnBotones[i].getText().equals("C")&&

!btnBotones[i].getText().equals("D")&&

!btnBotones[i].getText().equals("E")&&

!btnBotones[i].getText().equals("F")&&

!btnBotones[i].getText().equals("9")&&

!btnBotones[i].getText().equals("8")&&

!btnBotones[i].getText().equals("7")&&

!btnBotones[i].getText().equals("6")&&

!btnBotones[i].getText().equals("5")&&

!btnBotones[i].getText().equals("4")&&

!btnBotones[i].getText().equals("3")&&

!btnBotones[i].getText().equals("2")){

btnBotones[i].setEnabled(true);

}

}

break;

case 8:

for(int i=0;i

if(!btnBotones[i].getText().equals("A")&&

!btnBotones[i].getText().equals("B")&&

!btnBotones[i].getText().equals("C")&&

!btnBotones[i].getText().equals("D")&&

!btnBotones[i].getText().equals("E")&&

!btnBotones[i].getText().equals("F")&&

!btnBotones[i].getText().equals("9")&&

!btnBotones[i].getText().equals("8")){

btnBotones[i].setEnabled(true);

}

}

break;

case 10:

for(int i=0;i

if(!btnBotones[i].getText().equals("A")&&

!btnBotones[i].getText().equals("B")&&

!btnBotones[i].getText().equals("C")&&

!btnBotones[i].getText().equals("D")&&

!btnBotones[i].getText().equals("E")&&

!btnBotones[i].getText().equals("F")){

btnBotones[i].setEnabled(true);

}

}

break;

case 16:

for(int i=0;i

btnBotones[i].setEnabled(true);

}

break;

}

txtResultado.setText(c.combertirSistema(s, sistema, txtResultado.getText()));

s=sistema;

}

public static void main(String[] args) {

Calculadora c = new Calculadora();

}

public void actionPerformed(ActionEvent e){

if(e.getActionCommand().equals("Cl")){

txtResultado.setText("");

}

if(e.getActionCommand().equals("BIN")){

elegirSistema(2);

d = new Binario();

}

if(e.getActionCommand().equals("OCT")){

elegirSistema(8);

...

Descargar como  txt (12.8 Kb)   pdf (94.5 Kb)   docx (24.2 Kb)  
Leer 2 páginas más »
Disponible sólo en Essays.club