Como hacer un palíndromo en java
Los palíndromos son textossimétricos, es decir, que se leen de adelante hacia atrás y de atrás hacia adelante. Por ejemplo
.
Imágenes del ejemplo en JAVA, acontinuación muestro el código para que pueda correr.
packageCadenas; //Yo organizo mis programas por lo tanto hago paquetes.
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Rectangle;
importjavax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JDialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JOptionPane;
publicclass Principal extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel lbl1 = null;
private JTextFieldtxtboxCadena = null;
private JButton btnValida = null;
private JOptionPane jOptionPane1 = null; // @jve:decl-index=0:visual-constraint=”406,48″
/**
* This is thedefault constructor
*/
public Principal() {
super();
initialize();
}
/**
* This method initializes this
** @return void
*/
private void initialize() {
this.setSize(393, 181);
this.setContentPane(getJContentPane());
this.setTitle(“Validación deun Palindromo“);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {if (jContentPane == null) {
lbl1 = new JLabel();
lbl1.setBounds(new Rectangle(3, 4, 376, 26));
lbl1.setText(“Introduzca una...
Regístrate para leer el documento completo.