Tema: MDi y Menus
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 02/05/2014, 22:12
gmora100
 
Fecha de Ingreso: abril-2014
Mensajes: 2
Antigüedad: 10 años
Puntos: 0
Respuesta: MDi y Menus

PRINCIPAL
---------------------------------------------------------------------------------------------------

package Menu;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public final class MdiMenuprincipal extends javax.swing.JFrame {
private int controlAcceso=0;

public MdiMenuprincipal() {
initComponents();

}


private void jMenuItem1ActionPerformed(java.awt.event.ActionEve nt evt) {
Acceso iniciosession= new Acceso();// se crea objeto
desktopPane.add(iniciosession); // se añade el objeto al desktopPane
iniciosession.setVisible(true); // Se muestra en pantalla
}



public void getRestrinciones( int controlAcceso)
{
System.out.print("Entro a la Funcion");

if (controlAcceso == 0)
{

mnIngreso.setEnabled(false);
System.out.print("Esta todo deshabilitado");
}
else
if (controlAcceso == 1){
mnIngreso.setEnabled(true);

System.out.print("Esta todo Habilitado");
}}


/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
MdiMenuprincipal p = new MdiMenuprincipal();
p.setVisible(true);
p.mnIngreso.setEnabled(false);
}
});
}
}

LOGUIN
-------------------------------------------------------------------------------------------
package Menu;

import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;

/**
*
* @author gmora
*/
public class Acceso extends javax.swing.JInternalFrame {
public Acceso() {
initComponents();
}



private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
// TODO add your handling code here:
}

private void btningresarActionPerformed(java.awt.event.ActionEv ent evt) {
// TODO add your handling code here:

this.dispose();
JOptionPane.showMessageDialog(this, "Bienvenido al Sistema Automatico de Computadores", "éxito!", JOptionPane.INFORMATION_MESSAGE);
MdiMenuprincipal restrinciones = new MdiMenuprincipal();
restrinciones.getRestrinciones(1);


}


}


eSTE ES MI CODIGO LA FUNCION GETrESTRICIONES ME SALE EN SALIDA POR CONSOLA LA PALABRA HABILITADO Y DESHABILITADO SI LE ENVIO POR PARAMETRO 1 O 0 RESPECTIVAMENTE.......... ESO QUIERE DECIR QUE ESTA TRABAJANDO BIEN PERO EL PQ NO CAMBIA DE ESTADO DESAHABILITADO A HABILITADO AL COLOCARLE mnIngreso.setEnabled(true);

Última edición por gmora100; 02/05/2014 a las 22:20