Hmmmm.... still not sure if it's on the event thread.
To call something on the event thread it either gets called from a listener, or through a Runnable that gets invoked through SwingUtilities.invokeLater()/invokeAndWait() (or uses SwingWorker,etc. which uses invokeLater/invokeAndWait).
Instead of embedding all this code directly in a JMenuBar subclass, it would probably be better to write this code as a listener for whatever component the user uses to login - or at least this code should get called from that listener.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I tried like you said ... but not working
in my Gui class i have this
as you can see i call my setJMenuBar ...
and my setMenuBar() method return a JMenuBar
so when i call it from my class Login
( from the eventListener )
i don't use the return ... ( i was thinking that revalidate(); and repaint(); will work ) but no ...
and i really don't get it.
when i open my programm i have a menu ( like i said here above ) by calling a method
some parts of this menu are hidden this is my class :
when people wanted to login they enter the password and login and click on validate
my class Login is called and the event is checked by
as we can see i check my loggin here and then ( it comes back above to the event to look to the Method set login )
as we can see above ( in my class ) i checke that i'm logged and ( i have a print in shell that i'm logged ) but
the hidden parts of the menu are appearing