As we know, the pop-up of a (J)Menu will be disappeared after click on its (J)MenuItem or JCheckBoxMenuItem (the latter is my case).
So i want to know either if it is possible to force it not disappear or if i should another equivalent
Actually I'm looking a way for check box menu item, because user may want to switch between checking/unchecking without disappearing the pop-up and have to click on menu(s) again and again
I'm really tired of being engaged with stuff other than Java and programming
Here's a UI delegate I wrote some time ago for the same purpose.You can set this UI to individual JCheckBoxMenuItems using setUI(...) or, if this is the behavior you want for ALL JCheckBoxMenuItems in your application, you can make it the default using
There are no new questions, but there may be new answers.
Joined: Feb 22, 2010
0umm,that looks pretty nice...
Thank you Darryl, i used your deligate as an inner class in my UI class and then invoked setUI() and that worked well, but for overriding the UI Manager, i got Error!
I should mention that i override the JCheckBoxMenuItem class too! lets look at the snippets:
before creating my class i have several overrides, latest is your suggestion, and i used it as several flavors:
the method below does the all gUI stuff creation:
and the same error i get every time:
I think i should compile your given delegate and place its class in the extension folder..., or something else
Isn't your UI class in a package? You need to put the fully qualified class name to the UIManager, as shown in my code sample.
The other two attempts, where you put an instance of the class, just don't make sense.
For a better understanding of how this stuff works, read the source code for the relevant classes. You can find the JDK sources in src.zip in your JDK folder.
Joined: Feb 22, 2010
I was using your given delligate in the same file as UI was saved (as an inner class), now i create a seperate file for that and placed that in the same package as my UI class exists, so this resolved an currently works perfect.
Thank you for all your gentleness.
P.S: No, i just created a new project in NetBeans and this have no package (just two class, now three ) and the pranthesses in the value in the statement was just a typo ,sorry for that.