Saturday, April 26, 2008

Change the foreground and background selection color of a JMenuItem.

JCheckBoxMenuItem standard = new JCheckBoxMenuItem(); 
standard.setUI(new chkboxMenuItem(menuSelFore,menuSelBack)); 

class chkboxMenuItem extends BasicCheckBoxMenuItemUI { 
    public chkboxMenuItem(Color selFore,Color selBack) { 
        selectionForeground = selFore; 
        selectionBackground = selBack; 
    } 
}

No comments:

Post a Comment