在线等!菜单栏setEnabled无效【期末大作业,明早要交】
大神们快来帮帮我的忙啊~~~明天要交了,谢谢。问题代码如下:
package score;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JSeparator;
public class MainFrame {
/**
* @return the login
*/
public Login getLogin() {
return login;
}
/**
* @param login
* the login to set
*/
public void setLogin(Login login) {
this.login = login;
}
private JFrame frame;
private JMenuBar menuBar;
private JMenu mnFile;
private JMenuItem mntmLogin;
private JMenuItem mntmExit;
private JMenu mnStudentInfo;
private static JMenu mnStudentScore; private JMenuItem mntmAddStudent;
private JMenuItem mntmEditStudent;
private JMenuItem mntmDeleteStudent;
private Login login;
private JMenuItem mntmLogout;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainFrame window = new MainFrame();
Login userLogin = new Login(window);
window.setLogin(userLogin);
window.mnStudentScore.setEnabled(false); window.setMenuItems(false);
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public MainFrame() {
initialize();
}
标注红色的地方为错误的地方,蓝色的地方是相关的地方,谢谢各位帮忙~ --------------------编程问答-------------------- 报错内容是:mnStudentScore cannot be resolved --------------------编程问答-------------------- 代码不全,没法搞定。
补充:Java , Java SE