mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
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:
@@ -16,10 +16,12 @@
|
||||
|
||||
package com.formdev.flatlaf.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI;
|
||||
|
||||
@@ -28,36 +30,41 @@ import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI;
|
||||
*
|
||||
* <!-- BasicCheckBoxMenuItemUI -->
|
||||
*
|
||||
* @uiDefault CheckBoxMenuItem.font Font
|
||||
* @uiDefault CheckBoxMenuItem.background Color
|
||||
* @uiDefault CheckBoxMenuItem.foreground Color
|
||||
* @uiDefault CheckBoxMenuItem.disabledForeground Color
|
||||
* @uiDefault CheckBoxMenuItem.selectionBackground Color
|
||||
* @uiDefault CheckBoxMenuItem.selectionForeground Color
|
||||
* @uiDefault CheckBoxMenuItem.acceleratorForeground Color
|
||||
* @uiDefault CheckBoxMenuItem.acceleratorSelectionForeground Color
|
||||
* @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font
|
||||
* @uiDefault MenuItem.acceleratorDelimiter String
|
||||
* @uiDefault CheckBoxMenuItem.border Border
|
||||
* @uiDefault CheckBoxMenuItem.borderPainted boolean
|
||||
* @uiDefault CheckBoxMenuItem.margin Insets
|
||||
* @uiDefault CheckBoxMenuItem.arrowIcon Icon
|
||||
* @uiDefault CheckBoxMenuItem.checkIcon Icon
|
||||
* @uiDefault CheckBoxMenuItem.opaque boolean
|
||||
* @uiDefault CheckBoxMenuItem.evenHeight boolean
|
||||
* @uiDefault CheckBoxMenuItem.font Font
|
||||
* @uiDefault CheckBoxMenuItem.background Color
|
||||
* @uiDefault CheckBoxMenuItem.foreground Color
|
||||
* @uiDefault CheckBoxMenuItem.disabledForeground Color
|
||||
* @uiDefault CheckBoxMenuItem.selectionBackground Color
|
||||
* @uiDefault CheckBoxMenuItem.selectionForeground Color
|
||||
* @uiDefault CheckBoxMenuItem.acceleratorForeground Color
|
||||
* @uiDefault CheckBoxMenuItem.acceleratorSelectionForeground Color
|
||||
* @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font
|
||||
* @uiDefault MenuItem.acceleratorDelimiter String
|
||||
* @uiDefault CheckBoxMenuItem.border Border
|
||||
* @uiDefault CheckBoxMenuItem.borderPainted boolean
|
||||
* @uiDefault CheckBoxMenuItem.margin Insets
|
||||
* @uiDefault CheckBoxMenuItem.arrowIcon Icon
|
||||
* @uiDefault CheckBoxMenuItem.checkIcon Icon
|
||||
* @uiDefault CheckBoxMenuItem.opaque boolean
|
||||
* @uiDefault CheckBoxMenuItem.evenHeight boolean
|
||||
*
|
||||
* <!-- FlatCheckBoxMenuItemUI -->
|
||||
*
|
||||
* @uiDefault CheckBoxMenuItem.checkBackground Color
|
||||
*
|
||||
* <!-- FlatMenuItemRenderer -->
|
||||
*
|
||||
* @uiDefault MenuItem.minimumIconSize Dimension
|
||||
* @uiDefault MenuItem.textAcceleratorGap int
|
||||
* @uiDefault MenuItem.acceleratorArrowGap int
|
||||
* @uiDefault MenuItem.textArrowGap int
|
||||
* @uiDefault MenuItem.minimumIconSize Dimension
|
||||
* @uiDefault MenuItem.textAcceleratorGap int
|
||||
* @uiDefault MenuItem.acceleratorArrowGap int
|
||||
* @uiDefault MenuItem.textArrowGap int
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatCheckBoxMenuItemUI
|
||||
extends BasicCheckBoxMenuItemUI
|
||||
{
|
||||
private Color checkBackground;
|
||||
private FlatMenuItemRenderer renderer;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
@@ -68,6 +75,7 @@ public class FlatCheckBoxMenuItemUI
|
||||
protected void installDefaults() {
|
||||
super.installDefaults();
|
||||
|
||||
checkBackground = UIManager.getColor( "CheckBoxMenuItem.checkBackground" );
|
||||
renderer = createRenderer();
|
||||
}
|
||||
|
||||
@@ -75,6 +83,7 @@ public class FlatCheckBoxMenuItemUI
|
||||
protected void uninstallDefaults() {
|
||||
super.uninstallDefaults();
|
||||
|
||||
checkBackground = null;
|
||||
renderer = null;
|
||||
}
|
||||
|
||||
@@ -90,6 +99,6 @@ public class FlatCheckBoxMenuItemUI
|
||||
@Override
|
||||
public void paint( Graphics g, JComponent c ) {
|
||||
renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground,
|
||||
acceleratorForeground, acceleratorSelectionForeground );
|
||||
checkBackground, acceleratorForeground, acceleratorSelectionForeground );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +188,8 @@ public class FlatMenuItemRenderer
|
||||
}
|
||||
|
||||
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() );
|
||||
|
||||
@@ -215,7 +216,7 @@ public class FlatMenuItemRenderer
|
||||
debug*/
|
||||
|
||||
paintBackground( g, selectionBackground );
|
||||
paintIcon( g, iconRect, getIconForPainting() );
|
||||
paintIcon( g, iconRect, getIconForPainting(), checkBackground );
|
||||
paintText( g, textRect, menuItem.getText(), selectionForeground, disabledForeground );
|
||||
paintAccelerator( g, accelRect, getAcceleratorText(), acceleratorForeground, acceleratorSelectionForeground, disabledForeground );
|
||||
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 );
|
||||
}
|
||||
|
||||
@@ -302,10 +312,11 @@ debug*/
|
||||
}
|
||||
|
||||
private Icon getIconForPainting() {
|
||||
if( checkIcon != null && !isTopLevelMenu( menuItem ) )
|
||||
Icon icon = menuItem.getIcon();
|
||||
|
||||
if( icon == null && checkIcon != null && !isTopLevelMenu( menuItem ) )
|
||||
return checkIcon;
|
||||
|
||||
Icon icon = menuItem.getIcon();
|
||||
if( icon == null )
|
||||
return null;
|
||||
|
||||
@@ -322,12 +333,12 @@ debug*/
|
||||
}
|
||||
|
||||
private Icon getIconForLayout() {
|
||||
if( isTopLevelMenu( menuItem ) ) {
|
||||
Icon icon = menuItem.getIcon();
|
||||
return (icon != null) ? new MinSizeIcon( icon ) : null;
|
||||
}
|
||||
Icon icon = menuItem.getIcon();
|
||||
|
||||
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;
|
||||
|
||||
@@ -28,30 +28,30 @@ import javax.swing.plaf.basic.BasicMenuItemUI;
|
||||
*
|
||||
* <!-- BasicMenuItemUI -->
|
||||
*
|
||||
* @uiDefault MenuItem.font Font
|
||||
* @uiDefault MenuItem.background Color
|
||||
* @uiDefault MenuItem.foreground Color
|
||||
* @uiDefault MenuItem.disabledForeground Color
|
||||
* @uiDefault MenuItem.selectionBackground Color
|
||||
* @uiDefault MenuItem.selectionForeground Color
|
||||
* @uiDefault MenuItem.acceleratorForeground Color
|
||||
* @uiDefault MenuItem.acceleratorSelectionForeground Color
|
||||
* @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font
|
||||
* @uiDefault MenuItem.acceleratorDelimiter String
|
||||
* @uiDefault MenuItem.border Border
|
||||
* @uiDefault MenuItem.borderPainted boolean
|
||||
* @uiDefault MenuItem.margin Insets
|
||||
* @uiDefault MenuItem.arrowIcon Icon
|
||||
* @uiDefault MenuItem.checkIcon Icon
|
||||
* @uiDefault MenuItem.opaque boolean
|
||||
* @uiDefault MenuItem.evenHeight boolean
|
||||
* @uiDefault MenuItem.font Font
|
||||
* @uiDefault MenuItem.background Color
|
||||
* @uiDefault MenuItem.foreground Color
|
||||
* @uiDefault MenuItem.disabledForeground Color
|
||||
* @uiDefault MenuItem.selectionBackground Color
|
||||
* @uiDefault MenuItem.selectionForeground Color
|
||||
* @uiDefault MenuItem.acceleratorForeground Color
|
||||
* @uiDefault MenuItem.acceleratorSelectionForeground Color
|
||||
* @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font
|
||||
* @uiDefault MenuItem.acceleratorDelimiter String
|
||||
* @uiDefault MenuItem.border Border
|
||||
* @uiDefault MenuItem.borderPainted boolean
|
||||
* @uiDefault MenuItem.margin Insets
|
||||
* @uiDefault MenuItem.arrowIcon Icon
|
||||
* @uiDefault MenuItem.checkIcon Icon
|
||||
* @uiDefault MenuItem.opaque boolean
|
||||
* @uiDefault MenuItem.evenHeight boolean
|
||||
*
|
||||
* <!-- FlatMenuItemRenderer -->
|
||||
*
|
||||
* @uiDefault MenuItem.minimumIconSize Dimension
|
||||
* @uiDefault MenuItem.textAcceleratorGap int
|
||||
* @uiDefault MenuItem.acceleratorArrowGap int
|
||||
* @uiDefault MenuItem.textArrowGap int
|
||||
* @uiDefault MenuItem.minimumIconSize Dimension
|
||||
* @uiDefault MenuItem.textAcceleratorGap int
|
||||
* @uiDefault MenuItem.acceleratorArrowGap int
|
||||
* @uiDefault MenuItem.textArrowGap int
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
@@ -90,6 +90,6 @@ public class FlatMenuItemUI
|
||||
@Override
|
||||
public void paint( Graphics g, JComponent c ) {
|
||||
renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground,
|
||||
acceleratorForeground, acceleratorSelectionForeground );
|
||||
null, acceleratorForeground, acceleratorSelectionForeground );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,37 +36,37 @@ import javax.swing.plaf.basic.BasicMenuUI;
|
||||
*
|
||||
* <!-- BasicMenuUI -->
|
||||
*
|
||||
* @uiDefault Menu.font Font
|
||||
* @uiDefault Menu.background Color
|
||||
* @uiDefault Menu.foreground Color
|
||||
* @uiDefault Menu.disabledForeground Color
|
||||
* @uiDefault Menu.selectionBackground Color
|
||||
* @uiDefault Menu.selectionForeground Color
|
||||
* @uiDefault Menu.acceleratorForeground Color
|
||||
* @uiDefault Menu.acceleratorSelectionForeground Color
|
||||
* @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font
|
||||
* @uiDefault MenuItem.acceleratorDelimiter String
|
||||
* @uiDefault Menu.border Border
|
||||
* @uiDefault Menu.borderPainted boolean
|
||||
* @uiDefault Menu.margin Insets
|
||||
* @uiDefault Menu.arrowIcon Icon
|
||||
* @uiDefault Menu.checkIcon Icon
|
||||
* @uiDefault Menu.opaque boolean
|
||||
* @uiDefault Menu.evenHeight boolean
|
||||
* @uiDefault Menu.crossMenuMnemonic boolean default is false
|
||||
* @uiDefault Menu.useMenuBarBackgroundForTopLevel boolean default is false
|
||||
* @uiDefault MenuBar.background Color used if Menu.useMenuBarBackgroundForTopLevel is true
|
||||
* @uiDefault Menu.font Font
|
||||
* @uiDefault Menu.background Color
|
||||
* @uiDefault Menu.foreground Color
|
||||
* @uiDefault Menu.disabledForeground Color
|
||||
* @uiDefault Menu.selectionBackground Color
|
||||
* @uiDefault Menu.selectionForeground Color
|
||||
* @uiDefault Menu.acceleratorForeground Color
|
||||
* @uiDefault Menu.acceleratorSelectionForeground Color
|
||||
* @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font
|
||||
* @uiDefault MenuItem.acceleratorDelimiter String
|
||||
* @uiDefault Menu.border Border
|
||||
* @uiDefault Menu.borderPainted boolean
|
||||
* @uiDefault Menu.margin Insets
|
||||
* @uiDefault Menu.arrowIcon Icon
|
||||
* @uiDefault Menu.checkIcon Icon
|
||||
* @uiDefault Menu.opaque boolean
|
||||
* @uiDefault Menu.evenHeight boolean
|
||||
* @uiDefault Menu.crossMenuMnemonic boolean default is false
|
||||
* @uiDefault Menu.useMenuBarBackgroundForTopLevel boolean default is false
|
||||
* @uiDefault MenuBar.background Color used if Menu.useMenuBarBackgroundForTopLevel is true
|
||||
*
|
||||
* <!-- FlatMenuUI -->
|
||||
*
|
||||
* @uiDefault MenuBar.hoverBackground Color
|
||||
* @uiDefault MenuBar.hoverBackground Color
|
||||
*
|
||||
* <!-- FlatMenuItemRenderer -->
|
||||
*
|
||||
* @uiDefault MenuItem.minimumIconSize Dimension
|
||||
* @uiDefault MenuItem.textAcceleratorGap int
|
||||
* @uiDefault MenuItem.acceleratorArrowGap int
|
||||
* @uiDefault MenuItem.textArrowGap int
|
||||
* @uiDefault MenuItem.minimumIconSize Dimension
|
||||
* @uiDefault MenuItem.textAcceleratorGap int
|
||||
* @uiDefault MenuItem.acceleratorArrowGap int
|
||||
* @uiDefault MenuItem.textArrowGap int
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
@@ -135,7 +135,7 @@ public class FlatMenuUI
|
||||
@Override
|
||||
public void paint( Graphics g, JComponent c ) {
|
||||
renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground,
|
||||
acceleratorForeground, acceleratorSelectionForeground );
|
||||
null, acceleratorForeground, acceleratorSelectionForeground );
|
||||
}
|
||||
|
||||
//---- class FlatMenuRenderer ---------------------------------------------
|
||||
|
||||
@@ -16,10 +16,12 @@
|
||||
|
||||
package com.formdev.flatlaf.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicRadioButtonMenuItemUI;
|
||||
|
||||
@@ -46,6 +48,10 @@ import javax.swing.plaf.basic.BasicRadioButtonMenuItemUI;
|
||||
* @uiDefault RadioButtonMenuItem.opaque boolean
|
||||
* @uiDefault RadioButtonMenuItem.evenHeight boolean
|
||||
*
|
||||
* <!-- FlatRadioButtonMenuItemUI -->
|
||||
*
|
||||
* @uiDefault RadioButtonMenuItem.checkBackground Color
|
||||
*
|
||||
* <!-- FlatMenuItemRenderer -->
|
||||
*
|
||||
* @uiDefault MenuItem.minimumIconSize Dimension
|
||||
@@ -58,6 +64,7 @@ import javax.swing.plaf.basic.BasicRadioButtonMenuItemUI;
|
||||
public class FlatRadioButtonMenuItemUI
|
||||
extends BasicRadioButtonMenuItemUI
|
||||
{
|
||||
private Color checkBackground;
|
||||
private FlatMenuItemRenderer renderer;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
@@ -68,6 +75,7 @@ public class FlatRadioButtonMenuItemUI
|
||||
protected void installDefaults() {
|
||||
super.installDefaults();
|
||||
|
||||
checkBackground = UIManager.getColor( "RadioButtonMenuItem.checkBackground" );
|
||||
renderer = createRenderer();
|
||||
}
|
||||
|
||||
@@ -75,6 +83,7 @@ public class FlatRadioButtonMenuItemUI
|
||||
protected void uninstallDefaults() {
|
||||
super.uninstallDefaults();
|
||||
|
||||
checkBackground = null;
|
||||
renderer = null;
|
||||
}
|
||||
|
||||
@@ -90,6 +99,6 @@ public class FlatRadioButtonMenuItemUI
|
||||
@Override
|
||||
public void paint( Graphics g, JComponent c ) {
|
||||
renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground,
|
||||
acceleratorForeground, acceleratorSelectionForeground );
|
||||
checkBackground, acceleratorForeground, acceleratorSelectionForeground );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
@disabledText=#777777
|
||||
@textComponentBackground=#45494A
|
||||
@menuBackground=darken(@background,5%)
|
||||
@menuCheckBackground=lighten(@menuBackground,15%)
|
||||
@cellFocusColor=#000000
|
||||
@icon=#adadad
|
||||
|
||||
|
||||
@@ -165,6 +165,7 @@ CheckBoxMenuItem.margin=@menuItemMargin
|
||||
CheckBoxMenuItem.opaque=false
|
||||
CheckBoxMenuItem.borderPainted=true
|
||||
CheckBoxMenuItem.background=@menuBackground
|
||||
CheckBoxMenuItem.checkBackground=@menuCheckBackground
|
||||
|
||||
|
||||
#---- ColorChooser ----
|
||||
@@ -395,6 +396,7 @@ RadioButtonMenuItem.margin=@menuItemMargin
|
||||
RadioButtonMenuItem.opaque=false
|
||||
RadioButtonMenuItem.borderPainted=true
|
||||
RadioButtonMenuItem.background=@menuBackground
|
||||
RadioButtonMenuItem.checkBackground=@menuCheckBackground
|
||||
|
||||
|
||||
#---- ScrollBar ----
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
@disabledText=#8C8C8C
|
||||
@textComponentBackground=#ffffff
|
||||
@menuBackground=#fff
|
||||
@menuCheckBackground=darken(@menuBackground,15%)
|
||||
@cellFocusColor=#000000
|
||||
@icon=#afafaf
|
||||
|
||||
|
||||
@@ -128,9 +128,11 @@ public class FlatMenusTest
|
||||
JMenuItem menuItem36 = new JMenuItem();
|
||||
JMenuItem menuItem37 = new JMenuItem();
|
||||
JCheckBoxMenuItem checkBoxMenuItem6 = new JCheckBoxMenuItem();
|
||||
JCheckBoxMenuItem checkBoxMenuItem7 = new JCheckBoxMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem5 = new JRadioButtonMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem6 = new JRadioButtonMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem7 = new JRadioButtonMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem8 = new JRadioButtonMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem9 = new JRadioButtonMenuItem();
|
||||
JMenu menu6 = new JMenu();
|
||||
JMenuItem menuItem5 = new JMenuItem();
|
||||
JMenuItem menuItem6 = new JMenuItem();
|
||||
@@ -262,6 +264,13 @@ public class FlatMenusTest
|
||||
checkBoxMenuItem6.setSelected(true);
|
||||
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.setText("radio 1");
|
||||
radioButtonMenuItem5.setSelected(true);
|
||||
@@ -270,10 +279,18 @@ public class FlatMenusTest
|
||||
//---- radioButtonMenuItem6 ----
|
||||
radioButtonMenuItem6.setText("radio 2");
|
||||
menu5.add(radioButtonMenuItem6);
|
||||
menu5.addSeparator();
|
||||
|
||||
//---- radioButtonMenuItem7 ----
|
||||
radioButtonMenuItem7.setText("radio 3");
|
||||
menu5.add(radioButtonMenuItem7);
|
||||
//---- radioButtonMenuItem8 ----
|
||||
radioButtonMenuItem8.setText("radio with icon 1");
|
||||
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);
|
||||
|
||||
@@ -678,7 +695,11 @@ public class FlatMenusTest
|
||||
ButtonGroup buttonGroup1 = new ButtonGroup();
|
||||
buttonGroup1.add(radioButtonMenuItem5);
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,15 @@ new FormModel {
|
||||
"text": "check"
|
||||
"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" ) {
|
||||
name: "radioButtonMenuItem5"
|
||||
"text": "radio 1"
|
||||
@@ -78,10 +87,21 @@ new FormModel {
|
||||
"text": "radio 2"
|
||||
"$buttonGroup": new FormReference( "buttonGroup1" )
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
|
||||
name: "separator4"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
||||
name: "radioButtonMenuItem7"
|
||||
"text": "radio 3"
|
||||
"$buttonGroup": new FormReference( "buttonGroup1" )
|
||||
name: "radioButtonMenuItem8"
|
||||
"text": "radio with icon 1"
|
||||
"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 ) ) {
|
||||
@@ -554,5 +574,10 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"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 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +144,7 @@ CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
|
||||
CheckBoxMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
|
||||
CheckBoxMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
||||
CheckBoxMenuItem.borderPainted true
|
||||
CheckBoxMenuItem.checkBackground #55585c javax.swing.plaf.ColorUIResource [UI]
|
||||
CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon [UI]
|
||||
CheckBoxMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [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.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
||||
RadioButtonMenuItem.borderPainted true
|
||||
RadioButtonMenuItem.checkBackground #55585c javax.swing.plaf.ColorUIResource [UI]
|
||||
RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon [UI]
|
||||
RadioButtonMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI]
|
||||
RadioButtonMenuItem.font [active] $defaultFont [UI]
|
||||
|
||||
@@ -144,6 +144,7 @@ CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
|
||||
CheckBoxMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
|
||||
CheckBoxMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
||||
CheckBoxMenuItem.borderPainted true
|
||||
CheckBoxMenuItem.checkBackground #55585c javax.swing.plaf.ColorUIResource [UI]
|
||||
CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon [UI]
|
||||
CheckBoxMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [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.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
||||
RadioButtonMenuItem.borderPainted true
|
||||
RadioButtonMenuItem.checkBackground #55585c javax.swing.plaf.ColorUIResource [UI]
|
||||
RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon [UI]
|
||||
RadioButtonMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI]
|
||||
RadioButtonMenuItem.font [active] $defaultFont [UI]
|
||||
|
||||
@@ -145,6 +145,7 @@ CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
|
||||
CheckBoxMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
|
||||
CheckBoxMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
||||
CheckBoxMenuItem.borderPainted true
|
||||
CheckBoxMenuItem.checkBackground #d9d9d9 javax.swing.plaf.ColorUIResource [UI]
|
||||
CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon [UI]
|
||||
CheckBoxMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [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.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
||||
RadioButtonMenuItem.borderPainted true
|
||||
RadioButtonMenuItem.checkBackground #d9d9d9 javax.swing.plaf.ColorUIResource [UI]
|
||||
RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon [UI]
|
||||
RadioButtonMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
|
||||
RadioButtonMenuItem.font [active] $defaultFont [UI]
|
||||
|
||||
@@ -145,6 +145,7 @@ CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
|
||||
CheckBoxMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
|
||||
CheckBoxMenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
||||
CheckBoxMenuItem.borderPainted true
|
||||
CheckBoxMenuItem.checkBackground #d9d9d9 javax.swing.plaf.ColorUIResource [UI]
|
||||
CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon [UI]
|
||||
CheckBoxMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [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.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
|
||||
RadioButtonMenuItem.borderPainted true
|
||||
RadioButtonMenuItem.checkBackground #d9d9d9 javax.swing.plaf.ColorUIResource [UI]
|
||||
RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon [UI]
|
||||
RadioButtonMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
|
||||
RadioButtonMenuItem.font [active] $defaultFont [UI]
|
||||
|
||||
Reference in New Issue
Block a user