0 Replies Latest reply on May 31, 2013 6:09 PM by user4065345

    Use Menu.background in Windows7 for WindowsLookAndFeel

      Hi all,

      I'd like to override JMenuItem and JPopupMenu background and foreground color for an application usiing WindowsLookAndFeel.
      When I set UIManager.put("MenuItem.background", Color.red); //for instance
      or similar for JPopupMenu or MenuItem and it works well on Windows XP but it doesn't work on Windows7.

      When looking at the WindowsPopupMenuUI.paint() method, I can see there is a test :WindowsMenuItemUI.isVistaPainting()
      with some code using a 'Skin'?:
      XPStyle xp = XPStyle.getXP();
      Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);

      Apparently, it uses the current Windows skin/theme. Does anyone know how it works ?
      I don't want to change the global windows theme but only for my own application (and only the popupmenu appearance).
      I don't change the LookAndFeel to use Nimbus or nything else; just overriding the popupmenu bakgkround and foreground color for Windows 7.
      Does anyone have any pointer ?