You are on page 1of 1

//Boton de cifrado:

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
try
{
int ind=(int)lstInd.getValue();
String cad=txtInicio.getText();
String res="";
Convertir con=new Convertir(cad,ind);
int txt[]=con.cad1;
for (int i=0;i<cad.length();i++)
{
res+=(char)txt[i];
}
txtRes.setText(res);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null,"Ingrese texto");
}
}
//Boton de descifrado:
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try
{
int ind=27-(int)lstInd.getValue();
String cad=txtInicio.getText();
String res="";
Convertir con=new Convertir(cad,ind);
int txt[]=con.cad1;
for (int i=0;i<cad.length();i++)
{
res+=(char)txt[i];
}
txtRes.setText(res);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null,"Ingrese texto");
}
}

You might also like