posted 20 years ago
hello all..
im building an MDI swing application..
ive got a jinternal frame called RegisterFrame with a jbutton.when i press that button..i need to disable some menu items on the main desktop pain..
can anyone help me about how to do that,..
here is a snapshot of the code.
MDIapplication.java
*****************************************************
MDI APPLICATION
package mainprogram
import register.*;
.
.
private javax.swing.JMenuItem alertMenuItem;
private javax.swing.JDesktopPane desktopPane;
private javax.swing.JMenuItem examresultsMenuItem;
private javax.swing.JMenuItem exitMenuItem;
private javax.swing.JMenu fileMenu;
private javax.swing.JMenuItem lecturenotesMenuItem;
private javax.swing.JMenuItem loginMenuItem;
private javax.swing.JMenuItem logoutMenuItem;
private javax.swing.JMenuBar menuBar;
private javax.swing.JMenuItem registerMenuItem;
private javax.swing.JMenu servicesMenu;
private void registerMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
//call the jinternal frame ..located in another .java file
registerFrame frame=new registerFrame();
desktopPane.add(frame);
frame.moveToFront();
frame.setVisible(true);
}
RegisterFrame.java
******************************************
package register;
import mainprogram.*;
public class registerFrame extends JInternalFrame {
private JButton okRegistered;
public registerFrame(){
super("Registration",true,true,true,true);
okRegistered = new JButton();
setLocation(100,100);
setSize(500,500);
okRegistered.setSize(10,10);
okRegistered.setLocation(100,100);
getContentPane().setLayout(new FlowLayout());
getContentPane().add(okRegistered);
okRegistered.setText("OK");
okRegistered.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
okRegisteredActionPerformed(evt);
}
});
}
private void okRegisteredActionPerformed(ActionEvent evt) {
//when the user presses the button...one of the menuitems should be disabled...i cant figure out how to access the menu item login for example..i need to enable it
okRegistered.setText("Registration ok!!");
//how to enable the menu item??
}
----------