A
Ahn SeungRye
my 'Menu' class
------
class Menus{
private JMenu jMenu;
private JMenuItem jMenuItem;
PublicNoteMenu(String menu){
jMenu = new JMenu(menu);
}
public void addSeparator(){
jMenu.addSeparator();
}
public void setMenuItem(String item){
jMenuItem = new JMenuItem(item);
jMenu.add(jMenuItem);
}
public JMenu returnJMenu(){
return jMenu;
}
public JMenuItem returnJMenuItem(){
return jMenuItem;
}
}
------
and my main class is
..
..
private Menus MyMenu;
..
..
<setMenu Method>
MyMenu = new PublicNoteMenu("File");
MyMenu.setMenuItem("New");
MyMenu.setMenuItem("Open");
MyMenu.setMenuItem("Save");
MyMenu.addSeparator();
MyMenu.setMenuItem("Quit");
(err) jMenubar.add(MyMenu.returnJMenu());
------
why 'jMenubar.add(MyMenu.returnJMenu());' line make err?
I think MyMenu.returnJMenu() has no problem...
anyone talk to me, what is my problem?
------
class Menus{
private JMenu jMenu;
private JMenuItem jMenuItem;
PublicNoteMenu(String menu){
jMenu = new JMenu(menu);
}
public void addSeparator(){
jMenu.addSeparator();
}
public void setMenuItem(String item){
jMenuItem = new JMenuItem(item);
jMenu.add(jMenuItem);
}
public JMenu returnJMenu(){
return jMenu;
}
public JMenuItem returnJMenuItem(){
return jMenuItem;
}
}
------
and my main class is
..
..
private Menus MyMenu;
..
..
<setMenu Method>
MyMenu = new PublicNoteMenu("File");
MyMenu.setMenuItem("New");
MyMenu.setMenuItem("Open");
MyMenu.setMenuItem("Save");
MyMenu.addSeparator();
MyMenu.setMenuItem("Quit");
(err) jMenubar.add(MyMenu.returnJMenu());
------
why 'jMenubar.add(MyMenu.returnJMenu());' line make err?
I think MyMenu.returnJMenu() has no problem...
anyone talk to me, what is my problem?