> private Menus MyMenu;
> .
[quoted text clipped - 14 lines]
>
> anyone talk to me, what is my problem?
My guess is that either jMenubar as not been initialised or
MyMenu.returnJMenu() returns a null reference. What does the stack
trace say?
> anyone talk to me, what is my problem?
Please post your entire code, at the moment it does not make any sense
whatsoever. Your "main" class is certainly not "private Menus MyMenu",
since this is not how a class is denoted. Nor is it your "main method",
since this has the structure
public static void main(String args[]) {
}
So please clarify. Also you might want to move this thread over to
comp.lang.java.help, since this is obviously a newby question.
Kind regards, Jonck
Ahn SeungRye - 12 Oct 2005 12:30 GMT
Wed, 12 Oct 2005 04:28:08 -0700¿¡, jonck ½è½À´Ï´Ù:
..
>> anyone talk to me, what is my problem?
>
[quoted text clipped - 9 lines]
>
> Kind regards, Jonck
> my 'Menu' class
> ------
[quoted text clipped - 5 lines]
> jMenu = new JMenu(menu);
> }
Please show us real code. Not this junk. What you posted doesn't match
at all. You say you have a 'Menu' class, but your class is called
'Menus' (with an 's'), but even worth you claim the 'Menus" class has a
constructor 'PublicNoteMenu'.
>
> public void addSeparator(){
[quoted text clipped - 5 lines]
> jMenu.add(jMenuItem);
> }
You call that method multiple times. Each time the old jMenuItem
instance variable is overwritten. That doesn't make much sense.
>
> public JMenu returnJMenu(){
[quoted text clipped - 10 lines]
> .
> .
> private Menus MyMenu;
> .
> .
> <setMenu Method>
> MyMenu = new PublicNoteMenu("File");
Really? Is PublicNoteMenu a subclass of Menus?
> MyMenu.setMenuItem("New");
> MyMenu.setMenuItem("Open");
[quoted text clipped - 6 lines]
>
> why 'jMenubar.add(MyMenu.returnJMenu());' line make err?
Since you are not showing us your real code we can't tell. Maybe you
never initialized jMenubar.
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Ahn SeungRye - 12 Oct 2005 12:49 GMT
sorry about my tharead..
becaouse I dont know comp.lang.java.help,
and I moved my thread to comp.lang.java.help.
again really sorry about my thread...
Wed, 12 Oct 2005 13:33:41 +0200¿¡, Thomas Weidenfeller ½è½À´Ï´Ù:
>> my 'Menu' class
>> ------
[quoted text clipped - 62 lines]
>
> /Thomas
>class Menus{
...
> PublicNoteMenu(String menu){
> jMenu = new JMenu(menu)
...
> MyMenu = new PublicNoteMenu("File");
This could not have compiled. The constructor must have the same name
as the class.
Please post your actual code.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.