-   
-   
- // Archivo LibretaContactos.java 
-   
- import javax.swing.*; 
-   
- public class LibretaContactos 
- { 
-   public static void main( String args[] ) 
-   { 
-     MenuPrincipal frame = new MenuPrincipal(); 
-      
-     frame.setResizable( false ); 
-     frame.setVisible( true ); 
-   } 
- } 
-   
- // Archivo MenuPrincipal.java  
-   
- import javax.swing.*; 
- import java.awt.*; 
- import java.awt.event.*; 
-   
- public class MenuPrincipal extends JFrame 
- { 
-   private JButton btnIngresar; 
-   private JButton btnSalir; 
-   private JLabel lblTitulo; 
-   private JLabel lblEstadoServidor; 
-   private JPanel panelTitulo; 
-   private JPanel panelCentral; 
-   private JPanel panelInferior; 
-   
-   public MenuPrincipal() 
-   { 
-     super( " CONTACTOS :: Darkness_Twilight :: " ); 
-   
-     inicializarComponentes(); 
-   } 
-   
-   private void inicializarComponentes() 
-   { 
-     setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); 
-     setSize( 240, 350 ); 
-     setLayout( new BorderLayout( 15, 5 ) ); 
-     setLocationRelativeTo( null ); 
-     setUndecorated( false ); 
-   
-     // JPanel's 
-     panelTitulo = new JPanel(); 
-     panelTitulo.setBackground( Color.BLUE ); 
-     panelCentral = new JPanel(); 
-     panelCentral.setBackground( Color.BLUE ); 
-     panelInferior = new JPanel(); 
-     panelInferior.setBackground( Color.WHITE ); 
-   
-     ManejadorBoton handler = new ManejadorBoton(); 
-   
-     // JButton's 
-     btnIngresar = new JButton( "Ingresa tus datos!!..." ); 
-     btnIngresar.setFont( new Font( "Arial", Font.BOLD, 14 ) ); 
-     btnIngresar.setForeground( Color.BLACK ); 
-     btnIngresar.addActionListener( handler ); 
-   
-     btnSalir = new JButton( "Salir" ); 
-     btnSalir.setFont( new Font( "Arial", Font.BOLD, 14 ) ); 
-     btnSalir.setForeground( Color.BLACK ); 
-     btnSalir.addActionListener( handler  ); 
-   
-     // JLabel's 
-     lblTitulo = new JLabel( "Menu Principal" ); 
-     lblTitulo.setFont( new Font( "Century Gothic", Font.BOLD, 26 ) ); 
-     lblTitulo.setForeground( Color.BLACK ); 
-   
-     lblEstadoServidor = new JLabel( "Servidor Desconectado..." ); 
-     lblEstadoServidor.setFont( new Font( "SansSerif", Font.BOLD, 16 ) ); 
-     lblEstadoServidor.setForeground( Color.RED ); 
-   
-     agregarComponentes(); 
-   
-   } 
-   
-   private class ManejadorBoton implements ActionListener 
-   { 
-     public void actionPerformed( ActionEvent evento ) 
-     { 
-       if( evento.getSource() == btnSalir ) 
-         System.exit( 0 ); 
-   
-       if ( evento.getSource() == btnIngresar ) 
-       { 
-                               setVisible( false ); 
-                               JFrameIngreso frameIngreso = new JFrameIngreso(); 
-                               frameIngreso.setVisible( true ); 
-                               frameIngreso.toFront(); 
-                         } 
-     } 
-   } 
-   
-   private void agregarComponentes() 
-   { 
-     panelTitulo.add( lblTitulo ); 
-     panelCentral.add( btnIngresar ); 
-     panelCentral.add( btnSalir ); 
-     panelInferior.add( lblEstadoServidor ); 
-   
-     add( panelTitulo, BorderLayout.NORTH ); 
-     add( panelCentral, BorderLayout.CENTER ); 
-     add( panelInferior, BorderLayout.SOUTH ); 
-   
-   } 
- } 
-   
- // Archivo JFrameIngreso.java 
-   
- import javax.swing.*; 
- import java.awt.*; 
- import java.awt.event.*; 
-   
- public class JFrameIngreso extends JFrame 
- { 
-   private JLabel lblTitulo; 
-   private JPanel panelCampos, panelBotones, panelNombre, panelApellido,                        
-                              panelCorreo; 
-   private JLabel lblNombre, lblApellido, lblFechaNac, lblCorreo, lblFonoFijo,  
-                             lblFonoMovil; 
-   private JTextField txtNombre, txtApellido, txtFechaNac, txtCorreo, txtFonoFijo,  
-                                   txtFonoMovil; 
-         private JButton btnIngresar, btnVolver; 
-   
-   public JFrameIngreso() 
-   { 
-     inicializarComponentes(); 
-   } 
-   
-   private void inicializarComponentes() 
-   { 
-     inicializarJFrame(); 
-     inicializarJPanel(); 
-     inicializarJLabel(); 
-     inicializarJTextField(); 
-     inicializarJButton(); 
-   
-     agregarComponentes(); 
-   } 
-   
-   private void inicializarJFrame() 
-   { 
-               setVisible( false ); 
-     setSize( 250, 250 ); 
-     setTitle( "Informacion Contacto" ); 
-     setLayout( new BorderLayout( 0, 10 ) ); 
-     setLocationRelativeTo( null ); 
-     setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE); 
-   
-   } 
-   
-   private void inicializarJLabel() 
-   { 
-     lblTitulo = new JLabel( "Ingreso de Datos" ); 
-     lblTitulo.setFont( new Font( "Chlorinar", Font.BOLD, 24 ) ); 
-     lblTitulo.setHorizontalAlignment( SwingConstants.CENTER ); 
-   
-     lblNombre = new JLabel( "Nombre: " ); 
-     lblNombre.setFont( new Font( "Arial", Font.PLAIN, 12 ) ); 
-   
-     lblApellido = new JLabel( "Apellido: " ); 
-     lblApellido.setFont( new Font( "Arial", Font.PLAIN, 12 ) ); 
-   
-     lblCorreo = new JLabel( "Correo: " ); 
-     lblCorreo.setFont( new Font( "Arial", Font.PLAIN, 12 ) ); 
-   } 
-   
-   private void inicializarJPanel() 
-   { 
-     panelCampos = new JPanel( new GridLayout( 3, 1 ) ); 
-   
-     panelBotones = new JPanel( new FlowLayout( ) ); 
-   
-     panelNombre = new JPanel( new FlowLayout( SwingConstants.LEFT ) ); 
-   
-     panelApellido = new JPanel( new FlowLayout( SwingConstants.LEFT ) ); 
-   
-     panelCorreo = new JPanel( new FlowLayout( SwingConstants.LEFT ) ); 
-   } 
-   
-   private void inicializarJTextField() 
-   { 
-     txtNombre = new JTextField(); 
-     txtNombre.setColumns( 15 ); 
-   
-     txtApellido = new JTextField(); 
-     txtApellido.setColumns( 15 ); 
-   
-     txtCorreo = new JTextField(); 
-     txtCorreo.setColumns( 15 ); 
-   } 
-   
-   private void inicializarJButton() 
-   { 
-               ManejadorBoton handler = new ManejadorBoton(); 
-   
-               btnIngresar = new JButton( "Ingresar" ); 
-               btnIngresar.setFont( new Font( "Monospaced", Font.BOLD, 14 ) ); 
-                 btnIngresar.setBounds( new Rectangle( 30, 40 )); 
-   
-              btnVolver = new JButton( "Volver" ); 
-               btnVolver.setFont( new Font( "Monospaced", Font.BOLD, 14 ) ); 
-               btnVolver.addActionListener( handler ); 
-   } 
-   
-   private void agregarComponentes() 
-   { 
-              panelNombre.add( lblNombre ); 
-              panelNombre.add( txtNombre ); 
-              panelApellido.add( lblApellido ); 
-              panelApellido.add( txtApellido ); 
-              panelCorreo.add( lblCorreo ); 
-              panelCorreo.add( txtCorreo ); 
-   
-     panelCampos.add( panelNombre ); 
-     panelCampos.add( panelApellido ); 
-     panelCampos.add( panelCorreo ); 
-   
-     panelBotones.add( btnIngresar ); 
-     panelBotones.add( btnVolver ); 
-   
-     add( lblTitulo, BorderLayout.NORTH ); 
-     add( panelCampos, BorderLayout.WEST ); 
-     add( panelBotones, BorderLayout.SOUTH ); 
-   } 
-   
-   private class ManejadorBoton implements ActionListener 
-   { 
-     public void actionPerformed( ActionEvent evento ) 
-     { 
-       if ( evento.getSource() == btnVolver ) 
-       { 
-                                setVisible( false ); 
-                               //Aqui quiero volver a mostrar el JFrame MenuPrincipal 
-                              //con setVisible( true ), pero no se como me puedo referir a el 
-                         } 
-     } 
-   } 
- } 
-   
-