private void btnSumActionPerformed(java.awt.event.ActionEvent evt) {
String cad;
cad=txtNom.getText()+txtApe.getText();
JOptionPane.showMessageDialog(null, "La suma de nombres y apellidos es:"+cad);
}
private void btnCompaActionPerformed(java.awt.event.ActionEvent evt) {
if (txtNom.getText().compareTo(txtApe.getText())==0){
JOptionPane.showMessageDialog(null, "Las dos cadenas son iguales");
}else{JOptionPane.showMessageDialog(null, "Las dos cadenas son diferentes");}
}
private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {
char c=txtC.getText().charAt(0);
char op='n';
String nom=txtNom.getText();
for(int i=0;i<nom.length();i++){
if (nom.charAt(i)==c){
JOptionPane.showMessageDialog(null, "El caracter esta en la posicion: "+i);
op='s';
}
}
if (op=='n'){JOptionPane.showMessageDialog(null, "El caracter no existe en Nombres");}
}
private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
private void btnLonActionPerformed(java.awt.event.ActionEvent evt) {
int l1=txtNom.getText().length();
int l2=txtApe.getText().length();
JOptionPane.showMessageDialog(null, "Longitud de Nombres: "+l1+"\n Longitud de Apellidos: "+l2);
}
private void btnIzActionPerformed(java.awt.event.ActionEvent evt) {
String cad=txtNom.getText().substring(0, 3);
JOptionPane.showMessageDialog(null, cad);
}
private void btnRiActionPerformed(java.awt.event.ActionEvent evt) {
String cad=txtNom.getText().substring(txtNom.getText().length()-3);
JOptionPane.showMessageDialog(null, cad);
}