mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
MenuItems: borders and icons added
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2019 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.icons;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Path2D;
|
||||
import javax.swing.AbstractButton;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
/**
|
||||
* Icon for {@link javax.swing.JCheckBoxMenuItem}.
|
||||
*
|
||||
* @uiDefault MenuItemCheckBox.icon.checkmarkColor Color
|
||||
* @uiDefault MenuItemCheckBox.icon.disabledCheckmarkColor Color
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatCheckBoxMenuItemIcon
|
||||
extends FlatAbstractIcon
|
||||
{
|
||||
protected final Color checkmarkColor = UIManager.getColor( "MenuItemCheckBox.icon.checkmarkColor" );
|
||||
protected final Color disabledCheckmarkColor = UIManager.getColor( "MenuItemCheckBox.icon.disabledCheckmarkColor" );
|
||||
|
||||
public FlatCheckBoxMenuItemIcon() {
|
||||
super( 15, 15, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintIcon( Component c, Graphics2D g2 ) {
|
||||
boolean selected = (c instanceof AbstractButton) && ((AbstractButton)c).isSelected();
|
||||
|
||||
// paint checkmark
|
||||
if( selected ) {
|
||||
g2.setColor( c.isEnabled() ? checkmarkColor : disabledCheckmarkColor );
|
||||
paintCheckmark( g2 );
|
||||
}
|
||||
}
|
||||
|
||||
protected void paintCheckmark( Graphics2D g2 ) {
|
||||
Path2D.Float path = new Path2D.Float();
|
||||
path.moveTo( 4.5f, 7.5f );
|
||||
path.lineTo( 6.6f, 10f );
|
||||
path.lineTo( 11.25f, 3.5f );
|
||||
|
||||
g2.setStroke( new BasicStroke( 1.9f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND ) );
|
||||
g2.draw( path );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2019 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.icons;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Path2D;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
/**
|
||||
* "arrow" icon for {@link javax.swing.JMenu}.
|
||||
*
|
||||
* @uiDefault Menu.icon.arrowColor Color
|
||||
* @uiDefault Menu.icon.disabledArrowColor Color
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatMenuArrowIcon
|
||||
extends FlatAbstractIcon
|
||||
{
|
||||
protected final Color checkmarkColor = UIManager.getColor( "Menu.icon.arrowColor" );
|
||||
protected final Color disabledCheckmarkColor = UIManager.getColor( "Menu.icon.disabledArrowColor" );
|
||||
|
||||
public FlatMenuArrowIcon() {
|
||||
super( 5, 10, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintIcon( Component c, Graphics2D g ) {
|
||||
Path2D arrow = new Path2D.Float();
|
||||
arrow.moveTo( 0, 0.5 );
|
||||
arrow.lineTo( 0, 9.5 );
|
||||
arrow.lineTo( 5, 5 );
|
||||
arrow.closePath();
|
||||
|
||||
if( !c.getComponentOrientation().isLeftToRight() )
|
||||
g.rotate( Math.toRadians( 180 ), width / 2., height / 2. );
|
||||
|
||||
g.setColor( c.isEnabled() ? checkmarkColor : disabledCheckmarkColor );
|
||||
g.fill( arrow );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2019 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.icons;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
/**
|
||||
* "arrow" icon for {@link javax.swing.JMenuItem}.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatMenuItemArrowIcon
|
||||
extends FlatMenuArrowIcon
|
||||
{
|
||||
public FlatMenuItemArrowIcon() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon( Component c, Graphics g, int x, int y ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintIcon( Component c, Graphics2D g ) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2019 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.icons;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
/**
|
||||
* Icon for {@link javax.swing.JRadioButtonMenuItem}.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatRadioButtonMenuItemIcon
|
||||
extends FlatCheckBoxMenuItemIcon
|
||||
{
|
||||
@Override
|
||||
protected void paintCheckmark( Graphics2D g2 ) {
|
||||
g2.fillOval( 4, 4, 7, 7 );
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,18 @@ Component.focusedBorderColor=466d94
|
||||
Component.focusColor=3d6185
|
||||
|
||||
|
||||
#---- Menu ----
|
||||
|
||||
Menu.icon.arrowColor=A7A7A7
|
||||
Menu.icon.disabledArrowColor=606060
|
||||
|
||||
|
||||
#---- MenuItemCheckBox ----
|
||||
|
||||
MenuItemCheckBox.icon.checkmarkColor=A7A7A7
|
||||
MenuItemCheckBox.icon.disabledCheckmarkColor=606060
|
||||
|
||||
|
||||
#---- ProgressBar ----
|
||||
|
||||
ProgressBar.background=555555
|
||||
|
||||
@@ -54,6 +54,13 @@ CheckBox.border=com.formdev.flatlaf.ui.FlatMarginBorder
|
||||
CheckBox.icon=com.formdev.flatlaf.icons.FlatCheckBoxIcon
|
||||
|
||||
|
||||
#---- CheckBoxMenuItem ----
|
||||
|
||||
CheckBoxMenuItem.border=com.formdev.flatlaf.ui.FlatMarginBorder
|
||||
CheckBoxMenuItem.checkIcon=com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon
|
||||
CheckBoxMenuItem.arrowIcon=com.formdev.flatlaf.icons.FlatMenuItemArrowIcon
|
||||
|
||||
|
||||
#---- ComboBox ----
|
||||
|
||||
ComboBox.border=com.formdev.flatlaf.ui.FlatRoundBorder
|
||||
@@ -87,6 +94,18 @@ List.focusCellHighlightBorder=1,6,1,6,@selectionBackground
|
||||
List.focusSelectedCellHighlightBorder=1,6,1,6,@selectionBackground
|
||||
|
||||
|
||||
#---- Menu ----
|
||||
|
||||
Menu.border=com.formdev.flatlaf.ui.FlatMarginBorder
|
||||
Menu.arrowIcon=com.formdev.flatlaf.icons.FlatMenuArrowIcon
|
||||
|
||||
|
||||
#---- MenuItem ----
|
||||
|
||||
MenuItem.border=com.formdev.flatlaf.ui.FlatMarginBorder
|
||||
MenuItem.arrowIcon=com.formdev.flatlaf.icons.FlatMenuItemArrowIcon
|
||||
|
||||
|
||||
#---- PasswordField ----
|
||||
|
||||
PasswordField.border=com.formdev.flatlaf.ui.FlatBorder
|
||||
@@ -107,6 +126,13 @@ RadioButton.border=com.formdev.flatlaf.ui.FlatMarginBorder
|
||||
RadioButton.icon=com.formdev.flatlaf.icons.FlatRadioButtonIcon
|
||||
|
||||
|
||||
#---- RadioButtonMenuItem ----
|
||||
|
||||
RadioButtonMenuItem.border=com.formdev.flatlaf.ui.FlatMarginBorder
|
||||
RadioButtonMenuItem.checkIcon=com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon
|
||||
RadioButtonMenuItem.arrowIcon=com.formdev.flatlaf.icons.FlatMenuItemArrowIcon
|
||||
|
||||
|
||||
#---- ScrollBar ----
|
||||
|
||||
ScrollBar.width=10
|
||||
|
||||
@@ -102,6 +102,18 @@ Component.focusedBorderColor=87afda
|
||||
Component.focusColor=97c3f3
|
||||
|
||||
|
||||
#---- Menu ----
|
||||
|
||||
Menu.icon.arrowColor=666666
|
||||
Menu.icon.disabledArrowColor=ABABAB
|
||||
|
||||
|
||||
#---- MenuItemCheckBox ----
|
||||
|
||||
MenuItemCheckBox.icon.checkmarkColor=4D89C9
|
||||
MenuItemCheckBox.icon.disabledCheckmarkColor=ABABAB
|
||||
|
||||
|
||||
#---- ProgressBar ----
|
||||
|
||||
ProgressBar.background=c4c4c4
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
/*
|
||||
* Copyright 2019 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
import net.miginfocom.swing.*;
|
||||
|
||||
/**
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatMenusTest
|
||||
extends JPanel
|
||||
{
|
||||
public static void main( String[] args ) {
|
||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatMenusTest" );
|
||||
frame.showFrame( new FlatMenusTest() );
|
||||
}
|
||||
|
||||
FlatMenusTest() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
private void armedChanged() {
|
||||
boolean armed = armedCheckBox.isSelected();
|
||||
arm( this, armed );
|
||||
}
|
||||
|
||||
private void arm( Container container, boolean armed ) {
|
||||
for( Component c : container.getComponents() ) {
|
||||
if( c instanceof JMenuItem )
|
||||
((JMenuItem)c).setArmed( armed );
|
||||
|
||||
if( c instanceof Container )
|
||||
arm( (Container) c, armed );
|
||||
}
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||
JPanel panel1 = new JPanel();
|
||||
JLabel menuLabel = new JLabel();
|
||||
JMenu menu1 = new JMenu();
|
||||
JLabel menuItemLabel = new JLabel();
|
||||
JMenuItem menuItem1 = new JMenuItem();
|
||||
JLabel checkBoxMenuItemLabel = new JLabel();
|
||||
JCheckBoxMenuItem checkBoxMenuItem1 = new JCheckBoxMenuItem();
|
||||
JLabel radioButtonMenuItemLabel = new JLabel();
|
||||
JRadioButtonMenuItem radioButtonMenuItem1 = new JRadioButtonMenuItem();
|
||||
JPanel panel2 = new JPanel();
|
||||
JMenu menu2 = new JMenu();
|
||||
JMenuItem menuItem2 = new JMenuItem();
|
||||
JCheckBoxMenuItem checkBoxMenuItem2 = new JCheckBoxMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem2 = new JRadioButtonMenuItem();
|
||||
JPanel panel3 = new JPanel();
|
||||
JMenu menu3 = new JMenu();
|
||||
JMenuItem menuItem3 = new JMenuItem();
|
||||
JCheckBoxMenuItem checkBoxMenuItem3 = new JCheckBoxMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem3 = new JRadioButtonMenuItem();
|
||||
JPanel panel4 = new JPanel();
|
||||
JMenu menu4 = new JMenu();
|
||||
JMenuItem menuItem4 = new JMenuItem();
|
||||
JCheckBoxMenuItem checkBoxMenuItem4 = new JCheckBoxMenuItem();
|
||||
JRadioButtonMenuItem radioButtonMenuItem4 = new JRadioButtonMenuItem();
|
||||
armedCheckBox = new JCheckBox();
|
||||
|
||||
//======== this ========
|
||||
setLayout(new MigLayout(
|
||||
"insets 0,hidemode 3,gap 5 5,ltr",
|
||||
// columns
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]",
|
||||
// rows
|
||||
"[top]" +
|
||||
"[]"));
|
||||
|
||||
//======== panel1 ========
|
||||
{
|
||||
panel1.setLayout(new MigLayout(
|
||||
"insets 0,hidemode 3,gap 5 5,ltr",
|
||||
// columns
|
||||
"[left]" +
|
||||
"[fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- menuLabel ----
|
||||
menuLabel.setText("JMenu:");
|
||||
panel1.add(menuLabel, "cell 0 0");
|
||||
|
||||
//======== menu1 ========
|
||||
{
|
||||
menu1.setText("enabled");
|
||||
}
|
||||
panel1.add(menu1, "cell 1 0");
|
||||
|
||||
//---- menuItemLabel ----
|
||||
menuItemLabel.setText("JMenuItem:");
|
||||
panel1.add(menuItemLabel, "cell 0 1");
|
||||
|
||||
//---- menuItem1 ----
|
||||
menuItem1.setText("enabled");
|
||||
menuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.CTRL_MASK));
|
||||
panel1.add(menuItem1, "cell 1 1");
|
||||
|
||||
//---- checkBoxMenuItemLabel ----
|
||||
checkBoxMenuItemLabel.setText("JCheckBoxMenuItem:");
|
||||
panel1.add(checkBoxMenuItemLabel, "cell 0 2");
|
||||
|
||||
//---- checkBoxMenuItem1 ----
|
||||
checkBoxMenuItem1.setText("enabled");
|
||||
checkBoxMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
|
||||
panel1.add(checkBoxMenuItem1, "cell 1 2");
|
||||
|
||||
//---- radioButtonMenuItemLabel ----
|
||||
radioButtonMenuItemLabel.setText("JRadioButtonMenuItem:");
|
||||
panel1.add(radioButtonMenuItemLabel, "cell 0 3");
|
||||
|
||||
//---- radioButtonMenuItem1 ----
|
||||
radioButtonMenuItem1.setText("enabled");
|
||||
radioButtonMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
|
||||
panel1.add(radioButtonMenuItem1, "cell 1 3");
|
||||
}
|
||||
add(panel1, "cell 0 0");
|
||||
|
||||
//======== panel2 ========
|
||||
{
|
||||
panel2.setLayout(new MigLayout(
|
||||
"insets 0,hidemode 3,gap 5 5",
|
||||
// columns
|
||||
"[fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//======== menu2 ========
|
||||
{
|
||||
menu2.setText("disabled");
|
||||
menu2.setEnabled(false);
|
||||
}
|
||||
panel2.add(menu2, "cell 0 0");
|
||||
|
||||
//---- menuItem2 ----
|
||||
menuItem2.setText("disabled");
|
||||
menuItem2.setEnabled(false);
|
||||
menuItem2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, KeyEvent.ALT_MASK|KeyEvent.SHIFT_MASK));
|
||||
panel2.add(menuItem2, "cell 0 1");
|
||||
|
||||
//---- checkBoxMenuItem2 ----
|
||||
checkBoxMenuItem2.setText("disabled");
|
||||
checkBoxMenuItem2.setEnabled(false);
|
||||
checkBoxMenuItem2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
|
||||
panel2.add(checkBoxMenuItem2, "cell 0 2");
|
||||
|
||||
//---- radioButtonMenuItem2 ----
|
||||
radioButtonMenuItem2.setText("disabled");
|
||||
radioButtonMenuItem2.setEnabled(false);
|
||||
radioButtonMenuItem2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
|
||||
panel2.add(radioButtonMenuItem2, "cell 0 3");
|
||||
}
|
||||
add(panel2, "cell 1 0");
|
||||
|
||||
//======== panel3 ========
|
||||
{
|
||||
panel3.setLayout(new MigLayout(
|
||||
"insets 0,gap 5 5",
|
||||
// columns
|
||||
"[fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//======== menu3 ========
|
||||
{
|
||||
menu3.setText("text");
|
||||
menu3.setVisible(false);
|
||||
}
|
||||
panel3.add(menu3, "cell 0 0");
|
||||
|
||||
//---- menuItem3 ----
|
||||
menuItem3.setText("selected");
|
||||
menuItem3.setSelected(true);
|
||||
menuItem3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
|
||||
panel3.add(menuItem3, "cell 0 1");
|
||||
|
||||
//---- checkBoxMenuItem3 ----
|
||||
checkBoxMenuItem3.setText("selected");
|
||||
checkBoxMenuItem3.setSelected(true);
|
||||
checkBoxMenuItem3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
|
||||
panel3.add(checkBoxMenuItem3, "cell 0 2");
|
||||
|
||||
//---- radioButtonMenuItem3 ----
|
||||
radioButtonMenuItem3.setText("selected");
|
||||
radioButtonMenuItem3.setSelected(true);
|
||||
radioButtonMenuItem3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
|
||||
panel3.add(radioButtonMenuItem3, "cell 0 3");
|
||||
}
|
||||
add(panel3, "cell 2 0");
|
||||
|
||||
//======== panel4 ========
|
||||
{
|
||||
panel4.setLayout(new MigLayout(
|
||||
"insets 0,gap 5 5",
|
||||
// columns
|
||||
"[fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//======== menu4 ========
|
||||
{
|
||||
menu4.setText("text");
|
||||
menu4.setVisible(false);
|
||||
}
|
||||
panel4.add(menu4, "cell 0 0");
|
||||
|
||||
//---- menuItem4 ----
|
||||
menuItem4.setText("selected disabled");
|
||||
menuItem4.setSelected(true);
|
||||
menuItem4.setEnabled(false);
|
||||
menuItem4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
|
||||
panel4.add(menuItem4, "cell 0 1");
|
||||
|
||||
//---- checkBoxMenuItem4 ----
|
||||
checkBoxMenuItem4.setText("selected disabled");
|
||||
checkBoxMenuItem4.setEnabled(false);
|
||||
checkBoxMenuItem4.setSelected(true);
|
||||
checkBoxMenuItem4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
|
||||
panel4.add(checkBoxMenuItem4, "cell 0 2");
|
||||
|
||||
//---- radioButtonMenuItem4 ----
|
||||
radioButtonMenuItem4.setText("selected disabled");
|
||||
radioButtonMenuItem4.setEnabled(false);
|
||||
radioButtonMenuItem4.setSelected(true);
|
||||
radioButtonMenuItem4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
|
||||
panel4.add(radioButtonMenuItem4, "cell 0 3");
|
||||
}
|
||||
add(panel4, "cell 3 0");
|
||||
|
||||
//---- armedCheckBox ----
|
||||
armedCheckBox.setText("armed");
|
||||
armedCheckBox.setMnemonic('A');
|
||||
armedCheckBox.addActionListener(e -> armedChanged());
|
||||
add(armedCheckBox, "cell 0 1");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
}
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
private JCheckBox armedCheckBox;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
}
|
||||
214
flatlaf-core/src/test/java/com/formdev/flatlaf/FlatMenusTest.jfd
Normal file
214
flatlaf-core/src/test/java/com/formdev/flatlaf/FlatMenusTest.jfd
Normal file
@@ -0,0 +1,214 @@
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
root: new FormRoot {
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.defaultVariableLocal": true
|
||||
}
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5,ltr"
|
||||
"$columnConstraints": "[][][][]"
|
||||
"$rowConstraints": "[top][]"
|
||||
} ) {
|
||||
name: "this"
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$columnConstraints": "[left][fill]"
|
||||
"$rowConstraints": "[][][][]"
|
||||
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5,ltr"
|
||||
} ) {
|
||||
name: "panel1"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "menuLabel"
|
||||
"text": "JMenu:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
name: "menu1"
|
||||
"text": "enabled"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "menuItemLabel"
|
||||
"text": "JMenuItem:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem1"
|
||||
"text": "enabled"
|
||||
"accelerator": static javax.swing.KeyStroke getKeyStroke( 65, 130, false )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "checkBoxMenuItemLabel"
|
||||
"text": "JCheckBoxMenuItem:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
|
||||
name: "checkBoxMenuItem1"
|
||||
"text": "enabled"
|
||||
"accelerator": &KeyStroke0 static javax.swing.KeyStroke getKeyStroke( 112, 0, false )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "radioButtonMenuItemLabel"
|
||||
"text": "JRadioButtonMenuItem:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
||||
name: "radioButtonMenuItem1"
|
||||
"text": "enabled"
|
||||
"accelerator": #KeyStroke0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$columnConstraints": "[fill]"
|
||||
"$rowConstraints": "[][][][]"
|
||||
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5"
|
||||
} ) {
|
||||
name: "panel2"
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
name: "menu2"
|
||||
"text": "disabled"
|
||||
"enabled": false
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem2"
|
||||
"text": "disabled"
|
||||
"enabled": false
|
||||
"accelerator": static javax.swing.KeyStroke getKeyStroke( 68, 585, false )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
|
||||
name: "checkBoxMenuItem2"
|
||||
"text": "disabled"
|
||||
"enabled": false
|
||||
"accelerator": #KeyStroke0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
||||
name: "radioButtonMenuItem2"
|
||||
"text": "disabled"
|
||||
"enabled": false
|
||||
"accelerator": #KeyStroke0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$columnConstraints": "[fill]"
|
||||
"$rowConstraints": "[][][][]"
|
||||
"$layoutConstraints": "insets 0,gap 5 5"
|
||||
} ) {
|
||||
name: "panel3"
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
name: "menu3"
|
||||
"text": "text"
|
||||
"visible": false
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem3"
|
||||
"text": "selected"
|
||||
"selected": true
|
||||
"accelerator": #KeyStroke0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
|
||||
name: "checkBoxMenuItem3"
|
||||
"text": "selected"
|
||||
"selected": true
|
||||
"accelerator": #KeyStroke0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
||||
name: "radioButtonMenuItem3"
|
||||
"text": "selected"
|
||||
"selected": true
|
||||
"accelerator": #KeyStroke0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 0"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$columnConstraints": "[fill]"
|
||||
"$rowConstraints": "[][][][]"
|
||||
"$layoutConstraints": "insets 0,gap 5 5"
|
||||
} ) {
|
||||
name: "panel4"
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
name: "menu4"
|
||||
"text": "text"
|
||||
"visible": false
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem4"
|
||||
"text": "selected disabled"
|
||||
"selected": true
|
||||
"enabled": false
|
||||
"accelerator": #KeyStroke0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
|
||||
name: "checkBoxMenuItem4"
|
||||
"text": "selected disabled"
|
||||
"enabled": false
|
||||
"selected": true
|
||||
"accelerator": #KeyStroke0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
||||
name: "radioButtonMenuItem4"
|
||||
"text": "selected disabled"
|
||||
"enabled": false
|
||||
"selected": true
|
||||
"accelerator": #KeyStroke0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "armedCheckBox"
|
||||
"text": "armed"
|
||||
"mnemonic": 65
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "armedChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 790, 715 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,18 @@ List.focusSelectedCellHighlightBorder=1,6,1,6,880000
|
||||
List.focusCellHighlightBorder=1,6,1,6,880000
|
||||
|
||||
|
||||
#---- Menu ----
|
||||
|
||||
Menu.icon.arrowColor=4D89C9
|
||||
Menu.icon.disabledArrowColor=ABABAB
|
||||
|
||||
|
||||
#---- MenuItemCheckBox ----
|
||||
|
||||
MenuItemCheckBox.icon.checkmarkColor=4D89C9
|
||||
MenuItemCheckBox.icon.disabledCheckmarkColor=ABABAB
|
||||
|
||||
|
||||
#---- ProgressBar ----
|
||||
|
||||
ProgressBar.background=88ff88
|
||||
|
||||
Reference in New Issue
Block a user