Extend JMenu to check the box?

I plan to combine JMenu and JCheckBoxMenuItem so that I can: (1) a popup menu containing instances of this new component. (2) this new component would have a flag on the left, and could also expand to the right and show other submenus (for example, the usual JMenu).

I had a few questions:

First, am I reinventing the wheel? / Was this done before?

Secondly, I am trying to understand how swing knows how to get the user interface class for the extended Component class? (I see that JMenu, for example, has a String uiClassID member that was somehow used for this, but that is not the exact name of the class ... I debugged it to search for HashTable in UIDefaults)

+5
source share
1 answer
  • , , JMenu ( , JMenuBar). , , :)

  • UI . . javax.swing.plaf.MenuItemUI

Swing : http://java.sun.com/products/jfc/tsc/articles/architecture/

" " . , Windows WindowsButtonUI, WindowsScrollBarUI .. , . -, getUIClassID() . plaf .

EDIT: , , JPopupMenu JComponent, -, JCheckBoxes. : http://www.javarichclient.com/do-more-with-jpopupmenu/

+2

All Articles