Match theme color in MenuBarCustomizer?
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 44
- Joined: Wed Aug 08, 2007 5:56 am
Match theme color in MenuBarCustomizer?
Hi,
I know very little Swing. How can I match the theme color when adding a menu and menu item? My latest attempt:
I also tried menuBar.getBackground()/getForeground() instead of UIManager.get.
Kendall
I know very little Swing. How can I match the theme color when adding a menu and menu item? My latest attempt:
Code: Select all
Color bg = (Color) UIManager.get("MenuBar.background");
Color fg = (Color) UIManager.get("MenuBar.foreground");
UIManager.put("MenuItem.background", bg);
UIManager.put("MenuItem.foreground", fg);
UIManager.put("Menu.background", bg);
UIManager.put("Menu.foreground", fg);
JMenu menu = new JMenu("Some");
JMenuItem item = new JMenuItem(createSyncAction(...));
item.setSelected(false);
item.setMnemonic(KeyEvent.VK_ALT | KeyEvent.VK_S);
item.setBackground(bg);
item.setForeground(fg);
item.setOpaque(true);
menu.add(item);
menu.setSelected(false);
menu.setMnemonic(KeyEvent.VK_ALT | KeyEvent.VK_A);
menu.setBackground(bg);
menu.setForeground(fg);
menu.setOpaque(true);
menuBar.add(menu, menuBar.getMenuCount() - 1);
Kendall
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Match theme color in MenuBarCustomizer?
Hi Kendall,
Instead of JMenu you should create an Oxygen specific ro.sync.exml.workspace.api.standalone.ui.Menu.
After this avoid creating the JMenuItem, use the method javax.swing.JMenu.add(Action) to directly add the action to the menu.
Regards,
Radu
Instead of JMenu you should create an Oxygen specific ro.sync.exml.workspace.api.standalone.ui.Menu.
After this avoid creating the JMenuItem, use the method javax.swing.JMenu.add(Action) to directly add the action to the menu.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service