Menus: if checkbox/radiobutton menu item is selected and also has a custom icon, then use filled icon background to indicate selection (instead of using checkIcon) (issue #3)

This commit is contained in:
Karl Tauber
2020-04-28 18:00:01 +02:00
parent dd2cf50a39
commit bd2f5dd6fe
14 changed files with 176 additions and 89 deletions

View File

@@ -16,10 +16,12 @@
package com.formdev.flatlaf.ui; package com.formdev.flatlaf.ui;
import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI; import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI;
@@ -28,36 +30,41 @@ import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI;
* *
* <!-- BasicCheckBoxMenuItemUI --> * <!-- BasicCheckBoxMenuItemUI -->
* *
* @uiDefault CheckBoxMenuItem.font Font * @uiDefault CheckBoxMenuItem.font Font
* @uiDefault CheckBoxMenuItem.background Color * @uiDefault CheckBoxMenuItem.background Color
* @uiDefault CheckBoxMenuItem.foreground Color * @uiDefault CheckBoxMenuItem.foreground Color
* @uiDefault CheckBoxMenuItem.disabledForeground Color * @uiDefault CheckBoxMenuItem.disabledForeground Color
* @uiDefault CheckBoxMenuItem.selectionBackground Color * @uiDefault CheckBoxMenuItem.selectionBackground Color
* @uiDefault CheckBoxMenuItem.selectionForeground Color * @uiDefault CheckBoxMenuItem.selectionForeground Color
* @uiDefault CheckBoxMenuItem.acceleratorForeground Color * @uiDefault CheckBoxMenuItem.acceleratorForeground Color
* @uiDefault CheckBoxMenuItem.acceleratorSelectionForeground Color * @uiDefault CheckBoxMenuItem.acceleratorSelectionForeground Color
* @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font * @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font
* @uiDefault MenuItem.acceleratorDelimiter String * @uiDefault MenuItem.acceleratorDelimiter String
* @uiDefault CheckBoxMenuItem.border Border * @uiDefault CheckBoxMenuItem.border Border
* @uiDefault CheckBoxMenuItem.borderPainted boolean * @uiDefault CheckBoxMenuItem.borderPainted boolean
* @uiDefault CheckBoxMenuItem.margin Insets * @uiDefault CheckBoxMenuItem.margin Insets
* @uiDefault CheckBoxMenuItem.arrowIcon Icon * @uiDefault CheckBoxMenuItem.arrowIcon Icon
* @uiDefault CheckBoxMenuItem.checkIcon Icon * @uiDefault CheckBoxMenuItem.checkIcon Icon
* @uiDefault CheckBoxMenuItem.opaque boolean * @uiDefault CheckBoxMenuItem.opaque boolean
* @uiDefault CheckBoxMenuItem.evenHeight boolean * @uiDefault CheckBoxMenuItem.evenHeight boolean
*
* <!-- FlatCheckBoxMenuItemUI -->
*
* @uiDefault CheckBoxMenuItem.checkBackground Color
* *
* <!-- FlatMenuItemRenderer --> * <!-- FlatMenuItemRenderer -->
* *
* @uiDefault MenuItem.minimumIconSize Dimension * @uiDefault MenuItem.minimumIconSize Dimension
* @uiDefault MenuItem.textAcceleratorGap int * @uiDefault MenuItem.textAcceleratorGap int
* @uiDefault MenuItem.acceleratorArrowGap int * @uiDefault MenuItem.acceleratorArrowGap int
* @uiDefault MenuItem.textArrowGap int * @uiDefault MenuItem.textArrowGap int
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatCheckBoxMenuItemUI public class FlatCheckBoxMenuItemUI
extends BasicCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI
{ {
private Color checkBackground;
private FlatMenuItemRenderer renderer; private FlatMenuItemRenderer renderer;
public static ComponentUI createUI( JComponent c ) { public static ComponentUI createUI( JComponent c ) {
@@ -68,6 +75,7 @@ public class FlatCheckBoxMenuItemUI
protected void installDefaults() { protected void installDefaults() {
super.installDefaults(); super.installDefaults();
checkBackground = UIManager.getColor( "CheckBoxMenuItem.checkBackground" );
renderer = createRenderer(); renderer = createRenderer();
} }
@@ -75,6 +83,7 @@ public class FlatCheckBoxMenuItemUI
protected void uninstallDefaults() { protected void uninstallDefaults() {
super.uninstallDefaults(); super.uninstallDefaults();
checkBackground = null;
renderer = null; renderer = null;
} }
@@ -90,6 +99,6 @@ public class FlatCheckBoxMenuItemUI
@Override @Override
public void paint( Graphics g, JComponent c ) { public void paint( Graphics g, JComponent c ) {
renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground, renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground,
acceleratorForeground, acceleratorSelectionForeground ); checkBackground, acceleratorForeground, acceleratorSelectionForeground );
} }
} }

View File

@@ -188,7 +188,8 @@ public class FlatMenuItemRenderer
} }
protected void paintMenuItem( Graphics g, Color selectionBackground, Color selectionForeground, protected void paintMenuItem( Graphics g, Color selectionBackground, Color selectionForeground,
Color disabledForeground, Color acceleratorForeground, Color acceleratorSelectionForeground ) Color disabledForeground, Color checkBackground,
Color acceleratorForeground, Color acceleratorSelectionForeground )
{ {
Rectangle viewRect = new Rectangle( menuItem.getWidth(), menuItem.getHeight() ); Rectangle viewRect = new Rectangle( menuItem.getWidth(), menuItem.getHeight() );
@@ -215,7 +216,7 @@ public class FlatMenuItemRenderer
debug*/ debug*/
paintBackground( g, selectionBackground ); paintBackground( g, selectionBackground );
paintIcon( g, iconRect, getIconForPainting() ); paintIcon( g, iconRect, getIconForPainting(), checkBackground );
paintText( g, textRect, menuItem.getText(), selectionForeground, disabledForeground ); paintText( g, textRect, menuItem.getText(), selectionForeground, disabledForeground );
paintAccelerator( g, accelRect, getAcceleratorText(), acceleratorForeground, acceleratorSelectionForeground, disabledForeground ); paintAccelerator( g, accelRect, getAcceleratorText(), acceleratorForeground, acceleratorSelectionForeground, disabledForeground );
if( !isTopLevelMenu( menuItem ) ) if( !isTopLevelMenu( menuItem ) )
@@ -230,7 +231,16 @@ debug*/
} }
} }
protected void paintIcon( Graphics g, Rectangle iconRect, Icon icon ) { protected void paintIcon( Graphics g, Rectangle iconRect, Icon icon, Color checkBackground ) {
// if checkbox/radiobutton menu item is selected and also has a custom icon,
// then use filled icon background to indicate selection (instead of using checkIcon)
if( menuItem.isSelected() && checkIcon != null && icon != checkIcon ) {
int outset = scale( Math.max( menuItem.getIconTextGap() / 2, 2 ) );
g.setColor( checkBackground );
g.fillRect( iconRect.x - outset, iconRect.y - outset,
iconRect.width + (outset * 2), iconRect.height + (outset * 2) );
}
paintIcon( g, menuItem, icon, iconRect ); paintIcon( g, menuItem, icon, iconRect );
} }
@@ -302,10 +312,11 @@ debug*/
} }
private Icon getIconForPainting() { private Icon getIconForPainting() {
if( checkIcon != null && !isTopLevelMenu( menuItem ) ) Icon icon = menuItem.getIcon();
if( icon == null && checkIcon != null && !isTopLevelMenu( menuItem ) )
return checkIcon; return checkIcon;
Icon icon = menuItem.getIcon();
if( icon == null ) if( icon == null )
return null; return null;
@@ -322,12 +333,12 @@ debug*/
} }
private Icon getIconForLayout() { private Icon getIconForLayout() {
if( isTopLevelMenu( menuItem ) ) { Icon icon = menuItem.getIcon();
Icon icon = menuItem.getIcon();
return (icon != null) ? new MinSizeIcon( icon ) : null;
}
return new MinSizeIcon( (checkIcon != null) ? checkIcon : menuItem.getIcon() ); if( isTopLevelMenu( menuItem ) )
return (icon != null) ? new MinSizeIcon( icon ) : null;
return new MinSizeIcon( (icon != null) ? icon : checkIcon );
} }
private KeyStroke cachedAccelerator; private KeyStroke cachedAccelerator;

View File

@@ -28,30 +28,30 @@ import javax.swing.plaf.basic.BasicMenuItemUI;
* *
* <!-- BasicMenuItemUI --> * <!-- BasicMenuItemUI -->
* *
* @uiDefault MenuItem.font Font * @uiDefault MenuItem.font Font
* @uiDefault MenuItem.background Color * @uiDefault MenuItem.background Color
* @uiDefault MenuItem.foreground Color * @uiDefault MenuItem.foreground Color
* @uiDefault MenuItem.disabledForeground Color * @uiDefault MenuItem.disabledForeground Color
* @uiDefault MenuItem.selectionBackground Color * @uiDefault MenuItem.selectionBackground Color
* @uiDefault MenuItem.selectionForeground Color * @uiDefault MenuItem.selectionForeground Color
* @uiDefault MenuItem.acceleratorForeground Color * @uiDefault MenuItem.acceleratorForeground Color
* @uiDefault MenuItem.acceleratorSelectionForeground Color * @uiDefault MenuItem.acceleratorSelectionForeground Color
* @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font * @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font
* @uiDefault MenuItem.acceleratorDelimiter String * @uiDefault MenuItem.acceleratorDelimiter String
* @uiDefault MenuItem.border Border * @uiDefault MenuItem.border Border
* @uiDefault MenuItem.borderPainted boolean * @uiDefault MenuItem.borderPainted boolean
* @uiDefault MenuItem.margin Insets * @uiDefault MenuItem.margin Insets
* @uiDefault MenuItem.arrowIcon Icon * @uiDefault MenuItem.arrowIcon Icon
* @uiDefault MenuItem.checkIcon Icon * @uiDefault MenuItem.checkIcon Icon
* @uiDefault MenuItem.opaque boolean * @uiDefault MenuItem.opaque boolean
* @uiDefault MenuItem.evenHeight boolean * @uiDefault MenuItem.evenHeight boolean
* *
* <!-- FlatMenuItemRenderer --> * <!-- FlatMenuItemRenderer -->
* *
* @uiDefault MenuItem.minimumIconSize Dimension * @uiDefault MenuItem.minimumIconSize Dimension
* @uiDefault MenuItem.textAcceleratorGap int * @uiDefault MenuItem.textAcceleratorGap int
* @uiDefault MenuItem.acceleratorArrowGap int * @uiDefault MenuItem.acceleratorArrowGap int
* @uiDefault MenuItem.textArrowGap int * @uiDefault MenuItem.textArrowGap int
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
@@ -90,6 +90,6 @@ public class FlatMenuItemUI
@Override @Override
public void paint( Graphics g, JComponent c ) { public void paint( Graphics g, JComponent c ) {
renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground, renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground,
acceleratorForeground, acceleratorSelectionForeground ); null, acceleratorForeground, acceleratorSelectionForeground );
} }
} }

View File

@@ -36,37 +36,37 @@ import javax.swing.plaf.basic.BasicMenuUI;
* *
* <!-- BasicMenuUI --> * <!-- BasicMenuUI -->
* *
* @uiDefault Menu.font Font * @uiDefault Menu.font Font
* @uiDefault Menu.background Color * @uiDefault Menu.background Color
* @uiDefault Menu.foreground Color * @uiDefault Menu.foreground Color
* @uiDefault Menu.disabledForeground Color * @uiDefault Menu.disabledForeground Color
* @uiDefault Menu.selectionBackground Color * @uiDefault Menu.selectionBackground Color
* @uiDefault Menu.selectionForeground Color * @uiDefault Menu.selectionForeground Color
* @uiDefault Menu.acceleratorForeground Color * @uiDefault Menu.acceleratorForeground Color
* @uiDefault Menu.acceleratorSelectionForeground Color * @uiDefault Menu.acceleratorSelectionForeground Color
* @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font * @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font
* @uiDefault MenuItem.acceleratorDelimiter String * @uiDefault MenuItem.acceleratorDelimiter String
* @uiDefault Menu.border Border * @uiDefault Menu.border Border
* @uiDefault Menu.borderPainted boolean * @uiDefault Menu.borderPainted boolean
* @uiDefault Menu.margin Insets * @uiDefault Menu.margin Insets
* @uiDefault Menu.arrowIcon Icon * @uiDefault Menu.arrowIcon Icon
* @uiDefault Menu.checkIcon Icon * @uiDefault Menu.checkIcon Icon
* @uiDefault Menu.opaque boolean * @uiDefault Menu.opaque boolean
* @uiDefault Menu.evenHeight boolean * @uiDefault Menu.evenHeight boolean
* @uiDefault Menu.crossMenuMnemonic boolean default is false * @uiDefault Menu.crossMenuMnemonic boolean default is false
* @uiDefault Menu.useMenuBarBackgroundForTopLevel boolean default is false * @uiDefault Menu.useMenuBarBackgroundForTopLevel boolean default is false
* @uiDefault MenuBar.background Color used if Menu.useMenuBarBackgroundForTopLevel is true * @uiDefault MenuBar.background Color used if Menu.useMenuBarBackgroundForTopLevel is true
* *
* <!-- FlatMenuUI --> * <!-- FlatMenuUI -->
* *
* @uiDefault MenuBar.hoverBackground Color * @uiDefault MenuBar.hoverBackground Color
* *
* <!-- FlatMenuItemRenderer --> * <!-- FlatMenuItemRenderer -->
* *
* @uiDefault MenuItem.minimumIconSize Dimension * @uiDefault MenuItem.minimumIconSize Dimension
* @uiDefault MenuItem.textAcceleratorGap int * @uiDefault MenuItem.textAcceleratorGap int
* @uiDefault MenuItem.acceleratorArrowGap int * @uiDefault MenuItem.acceleratorArrowGap int
* @uiDefault MenuItem.textArrowGap int * @uiDefault MenuItem.textArrowGap int
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
@@ -135,7 +135,7 @@ public class FlatMenuUI
@Override @Override
public void paint( Graphics g, JComponent c ) { public void paint( Graphics g, JComponent c ) {
renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground, renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground,
acceleratorForeground, acceleratorSelectionForeground ); null, acceleratorForeground, acceleratorSelectionForeground );
} }
//---- class FlatMenuRenderer --------------------------------------------- //---- class FlatMenuRenderer ---------------------------------------------

View File

@@ -16,10 +16,12 @@
package com.formdev.flatlaf.ui; package com.formdev.flatlaf.ui;
import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicRadioButtonMenuItemUI; import javax.swing.plaf.basic.BasicRadioButtonMenuItemUI;
@@ -46,6 +48,10 @@ import javax.swing.plaf.basic.BasicRadioButtonMenuItemUI;
* @uiDefault RadioButtonMenuItem.opaque boolean * @uiDefault RadioButtonMenuItem.opaque boolean
* @uiDefault RadioButtonMenuItem.evenHeight boolean * @uiDefault RadioButtonMenuItem.evenHeight boolean
* *
* <!-- FlatRadioButtonMenuItemUI -->
*
* @uiDefault RadioButtonMenuItem.checkBackground Color
*
* <!-- FlatMenuItemRenderer --> * <!-- FlatMenuItemRenderer -->
* *
* @uiDefault MenuItem.minimumIconSize Dimension * @uiDefault MenuItem.minimumIconSize Dimension
@@ -58,6 +64,7 @@ import javax.swing.plaf.basic.BasicRadioButtonMenuItemUI;
public class FlatRadioButtonMenuItemUI public class FlatRadioButtonMenuItemUI
extends BasicRadioButtonMenuItemUI extends BasicRadioButtonMenuItemUI
{ {
private Color checkBackground;
private FlatMenuItemRenderer renderer; private FlatMenuItemRenderer renderer;
public static ComponentUI createUI( JComponent c ) { public static ComponentUI createUI( JComponent c ) {
@@ -68,6 +75,7 @@ public class FlatRadioButtonMenuItemUI
protected void installDefaults() { protected void installDefaults() {
super.installDefaults(); super.installDefaults();
checkBackground = UIManager.getColor( "RadioButtonMenuItem.checkBackground" );
renderer = createRenderer(); renderer = createRenderer();
} }
@@ -75,6 +83,7 @@ public class FlatRadioButtonMenuItemUI
protected void uninstallDefaults() { protected void uninstallDefaults() {
super.uninstallDefaults(); super.uninstallDefaults();
checkBackground = null;
renderer = null; renderer = null;
} }
@@ -90,6 +99,6 @@ public class FlatRadioButtonMenuItemUI
@Override @Override
public void paint( Graphics g, JComponent c ) { public void paint( Graphics g, JComponent c ) {
renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground, renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground,
acceleratorForeground, acceleratorSelectionForeground ); checkBackground, acceleratorForeground, acceleratorSelectionForeground );
} }
} }

View File

@@ -29,6 +29,7 @@
@disabledText=#777777 @disabledText=#777777
@textComponentBackground=#45494A @textComponentBackground=#45494A
@menuBackground=darken(@background,5%) @menuBackground=darken(@background,5%)
@menuCheckBackground=lighten(@menuBackground,15%)
@cellFocusColor=#000000 @cellFocusColor=#000000
@icon=#adadad @icon=#adadad

View File

@@ -165,6 +165,7 @@ CheckBoxMenuItem.margin=@menuItemMargin
CheckBoxMenuItem.opaque=false CheckBoxMenuItem.opaque=false
CheckBoxMenuItem.borderPainted=true CheckBoxMenuItem.borderPainted=true
CheckBoxMenuItem.background=@menuBackground CheckBoxMenuItem.background=@menuBackground
CheckBoxMenuItem.checkBackground=@menuCheckBackground
#---- ColorChooser ---- #---- ColorChooser ----
@@ -395,6 +396,7 @@ RadioButtonMenuItem.margin=@menuItemMargin
RadioButtonMenuItem.opaque=false RadioButtonMenuItem.opaque=false
RadioButtonMenuItem.borderPainted=true RadioButtonMenuItem.borderPainted=true
RadioButtonMenuItem.background=@menuBackground RadioButtonMenuItem.background=@menuBackground
RadioButtonMenuItem.checkBackground=@menuCheckBackground
#---- ScrollBar ---- #---- ScrollBar ----

View File

@@ -29,6 +29,7 @@
@disabledText=#8C8C8C @disabledText=#8C8C8C
@textComponentBackground=#ffffff @textComponentBackground=#ffffff
@menuBackground=#fff @menuBackground=#fff
@menuCheckBackground=darken(@menuBackground,15%)
@cellFocusColor=#000000 @cellFocusColor=#000000
@icon=#afafaf @icon=#afafaf

View File

@@ -128,9 +128,11 @@ public class FlatMenusTest
JMenuItem menuItem36 = new JMenuItem(); JMenuItem menuItem36 = new JMenuItem();
JMenuItem menuItem37 = new JMenuItem(); JMenuItem menuItem37 = new JMenuItem();
JCheckBoxMenuItem checkBoxMenuItem6 = new JCheckBoxMenuItem(); JCheckBoxMenuItem checkBoxMenuItem6 = new JCheckBoxMenuItem();
JCheckBoxMenuItem checkBoxMenuItem7 = new JCheckBoxMenuItem();
JRadioButtonMenuItem radioButtonMenuItem5 = new JRadioButtonMenuItem(); JRadioButtonMenuItem radioButtonMenuItem5 = new JRadioButtonMenuItem();
JRadioButtonMenuItem radioButtonMenuItem6 = new JRadioButtonMenuItem(); JRadioButtonMenuItem radioButtonMenuItem6 = new JRadioButtonMenuItem();
JRadioButtonMenuItem radioButtonMenuItem7 = new JRadioButtonMenuItem(); JRadioButtonMenuItem radioButtonMenuItem8 = new JRadioButtonMenuItem();
JRadioButtonMenuItem radioButtonMenuItem9 = new JRadioButtonMenuItem();
JMenu menu6 = new JMenu(); JMenu menu6 = new JMenu();
JMenuItem menuItem5 = new JMenuItem(); JMenuItem menuItem5 = new JMenuItem();
JMenuItem menuItem6 = new JMenuItem(); JMenuItem menuItem6 = new JMenuItem();
@@ -262,6 +264,13 @@ public class FlatMenusTest
checkBoxMenuItem6.setSelected(true); checkBoxMenuItem6.setSelected(true);
menu5.add(checkBoxMenuItem6); menu5.add(checkBoxMenuItem6);
//---- checkBoxMenuItem7 ----
checkBoxMenuItem7.setText("check with icon");
checkBoxMenuItem7.setSelected(true);
checkBoxMenuItem7.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
menu5.add(checkBoxMenuItem7);
menu5.addSeparator();
//---- radioButtonMenuItem5 ---- //---- radioButtonMenuItem5 ----
radioButtonMenuItem5.setText("radio 1"); radioButtonMenuItem5.setText("radio 1");
radioButtonMenuItem5.setSelected(true); radioButtonMenuItem5.setSelected(true);
@@ -270,10 +279,18 @@ public class FlatMenusTest
//---- radioButtonMenuItem6 ---- //---- radioButtonMenuItem6 ----
radioButtonMenuItem6.setText("radio 2"); radioButtonMenuItem6.setText("radio 2");
menu5.add(radioButtonMenuItem6); menu5.add(radioButtonMenuItem6);
menu5.addSeparator();
//---- radioButtonMenuItem7 ---- //---- radioButtonMenuItem8 ----
radioButtonMenuItem7.setText("radio 3"); radioButtonMenuItem8.setText("radio with icon 1");
menu5.add(radioButtonMenuItem7); radioButtonMenuItem8.setSelected(true);
radioButtonMenuItem8.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
menu5.add(radioButtonMenuItem8);
//---- radioButtonMenuItem9 ----
radioButtonMenuItem9.setText("radio with icon 2");
radioButtonMenuItem9.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png")));
menu5.add(radioButtonMenuItem9);
} }
menuBar1.add(menu5); menuBar1.add(menu5);
@@ -678,7 +695,11 @@ public class FlatMenusTest
ButtonGroup buttonGroup1 = new ButtonGroup(); ButtonGroup buttonGroup1 = new ButtonGroup();
buttonGroup1.add(radioButtonMenuItem5); buttonGroup1.add(radioButtonMenuItem5);
buttonGroup1.add(radioButtonMenuItem6); buttonGroup1.add(radioButtonMenuItem6);
buttonGroup1.add(radioButtonMenuItem7);
//---- buttonGroup2 ----
ButtonGroup buttonGroup2 = new ButtonGroup();
buttonGroup2.add(radioButtonMenuItem8);
buttonGroup2.add(radioButtonMenuItem9);
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
} }

View File

@@ -67,6 +67,15 @@ new FormModel {
"text": "check" "text": "check"
"selected": true "selected": true
} ) } )
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
name: "checkBoxMenuItem7"
"text": "check with icon"
"selected": true
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png" )
} )
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
name: "separator5"
} )
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) { add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
name: "radioButtonMenuItem5" name: "radioButtonMenuItem5"
"text": "radio 1" "text": "radio 1"
@@ -78,10 +87,21 @@ new FormModel {
"text": "radio 2" "text": "radio 2"
"$buttonGroup": new FormReference( "buttonGroup1" ) "$buttonGroup": new FormReference( "buttonGroup1" )
} ) } )
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
name: "separator4"
} )
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) { add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
name: "radioButtonMenuItem7" name: "radioButtonMenuItem8"
"text": "radio 3" "text": "radio with icon 1"
"$buttonGroup": new FormReference( "buttonGroup1" ) "selected": true
"$buttonGroup": new FormReference( "buttonGroup2" )
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png" )
} )
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
name: "radioButtonMenuItem9"
"text": "radio with icon 2"
"$buttonGroup": new FormReference( "buttonGroup2" )
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png" )
} ) } )
} ) } )
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
@@ -554,5 +574,10 @@ new FormModel {
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 564 ) "location": new java.awt.Point( 0, 564 )
} ) } )
add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
name: "buttonGroup2"
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 616 )
} )
} }
} }

View File

@@ -144,6 +144,7 @@ CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
CheckBoxMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI] CheckBoxMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
CheckBoxMenuItem.borderPainted true CheckBoxMenuItem.borderPainted true
CheckBoxMenuItem.checkBackground #55585c javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon [UI] CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon [UI]
CheckBoxMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.font [active] $defaultFont [UI] CheckBoxMenuItem.font [active] $defaultFont [UI]
@@ -693,6 +694,7 @@ RadioButtonMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
RadioButtonMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI] RadioButtonMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
RadioButtonMenuItem.borderPainted true RadioButtonMenuItem.borderPainted true
RadioButtonMenuItem.checkBackground #55585c javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon [UI] RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon [UI]
RadioButtonMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.font [active] $defaultFont [UI] RadioButtonMenuItem.font [active] $defaultFont [UI]

View File

@@ -144,6 +144,7 @@ CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
CheckBoxMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI] CheckBoxMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
CheckBoxMenuItem.borderPainted true CheckBoxMenuItem.borderPainted true
CheckBoxMenuItem.checkBackground #55585c javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon [UI] CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon [UI]
CheckBoxMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.font [active] $defaultFont [UI] CheckBoxMenuItem.font [active] $defaultFont [UI]
@@ -691,6 +692,7 @@ RadioButtonMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
RadioButtonMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI] RadioButtonMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
RadioButtonMenuItem.borderPainted true RadioButtonMenuItem.borderPainted true
RadioButtonMenuItem.checkBackground #55585c javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon [UI] RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon [UI]
RadioButtonMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.font [active] $defaultFont [UI] RadioButtonMenuItem.font [active] $defaultFont [UI]

View File

@@ -145,6 +145,7 @@ CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
CheckBoxMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI] CheckBoxMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
CheckBoxMenuItem.borderPainted true CheckBoxMenuItem.borderPainted true
CheckBoxMenuItem.checkBackground #d9d9d9 javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon [UI] CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon [UI]
CheckBoxMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.font [active] $defaultFont [UI] CheckBoxMenuItem.font [active] $defaultFont [UI]
@@ -695,6 +696,7 @@ RadioButtonMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
RadioButtonMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI] RadioButtonMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
RadioButtonMenuItem.borderPainted true RadioButtonMenuItem.borderPainted true
RadioButtonMenuItem.checkBackground #d9d9d9 javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon [UI] RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon [UI]
RadioButtonMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.font [active] $defaultFont [UI] RadioButtonMenuItem.font [active] $defaultFont [UI]

View File

@@ -145,6 +145,7 @@ CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
CheckBoxMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI] CheckBoxMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
CheckBoxMenuItem.borderPainted true CheckBoxMenuItem.borderPainted true
CheckBoxMenuItem.checkBackground #d9d9d9 javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon [UI] CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon [UI]
CheckBoxMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.font [active] $defaultFont [UI] CheckBoxMenuItem.font [active] $defaultFont [UI]
@@ -693,6 +694,7 @@ RadioButtonMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
RadioButtonMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI] RadioButtonMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
RadioButtonMenuItem.borderPainted true RadioButtonMenuItem.borderPainted true
RadioButtonMenuItem.checkBackground #d9d9d9 javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon [UI] RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon [UI]
RadioButtonMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.font [active] $defaultFont [UI] RadioButtonMenuItem.font [active] $defaultFont [UI]