• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to keep the popup while clicking on JCheckBoxMenuItem?

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there;
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

Thank you
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Esmaeil Ashrafi
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

Again, thank you very much
 
Darryl Burke
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



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.
 
Esmaeil Ashrafi
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Darryl,
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.

best of regards
Esmaeil Ashrafi
 
reply
    Bookmark Topic Watch Topic
  • New Topic