mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
support different component border colors to indicate errors, warnings or custom state (set client property JComponent.outline to error, warning or any java.awt.Color)
This commit is contained in:
@@ -5,6 +5,9 @@ FlatLaf Change Log
|
|||||||
|
|
||||||
- Added drop shadows to popup menus, combobox popups, tooltips and internal
|
- Added drop shadows to popup menus, combobox popups, tooltips and internal
|
||||||
frames. (issue #94)
|
frames. (issue #94)
|
||||||
|
- Support different component border colors to indicate errors, warnings or
|
||||||
|
custom state (set client property `JComponent.outline` to `error`, `warning`
|
||||||
|
or any `java.awt.Color`).
|
||||||
- Button and ToggleButton: Support round button style (set client property
|
- Button and ToggleButton: Support round button style (set client property
|
||||||
`JButton.buttonType` to `roundRect`).
|
`JButton.buttonType` to `roundRect`).
|
||||||
- ComboBox, Spinner and TextField: Support round border style (set client
|
- ComboBox, Spinner and TextField: Support round border style (set client
|
||||||
|
|||||||
@@ -103,6 +103,34 @@ public interface FlatClientProperties
|
|||||||
*/
|
*/
|
||||||
String MINIMUM_HEIGHT = "JComponent.minimumHeight";
|
String MINIMUM_HEIGHT = "JComponent.minimumHeight";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the outline color of the component border.
|
||||||
|
* <p>
|
||||||
|
* <strong>Components</strong> {@link javax.swing.JButton}, {@link javax.swing.JComboBox},
|
||||||
|
* {@link javax.swing.JFormattedTextField}, {@link javax.swing.JPasswordField},
|
||||||
|
* {@link javax.swing.JScrollPane}, {@link javax.swing.JSpinner},
|
||||||
|
* {@link javax.swing.JTextField} and {@link javax.swing.JToggleButton}<br>
|
||||||
|
* <strong>Value type</strong> {@link java.lang.String} or {@link java.awt.Color} or {@link java.awt.Color}[2]<br>
|
||||||
|
* <strong>Allowed Values</strong> {@link #OUTLINE_ERROR}, {@link #OUTLINE_WARNING},
|
||||||
|
* any color (type {@link java.awt.Color}) or an array of two colors (type {@link java.awt.Color}[2])
|
||||||
|
* where the first color is for focused state and the second for unfocused state
|
||||||
|
*/
|
||||||
|
String OUTLINE = "JComponent.outline";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paint the component border in another color (usually reddish) to indicate an error.
|
||||||
|
*
|
||||||
|
* @see #OUTLINE
|
||||||
|
*/
|
||||||
|
String OUTLINE_ERROR = "error";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paint the component border in another color (usually yellowish) to indicate a warning.
|
||||||
|
*
|
||||||
|
* @see #OUTLINE
|
||||||
|
*/
|
||||||
|
String OUTLINE_WARNING = "warning";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paint the component with round edges.
|
* Paint the component with round edges.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -467,6 +467,12 @@ public class IntelliJTheme
|
|||||||
uiKeyMapping.put( "ComboBox.ArrowButton.iconColor", "ComboBox.buttonArrowColor" );
|
uiKeyMapping.put( "ComboBox.ArrowButton.iconColor", "ComboBox.buttonArrowColor" );
|
||||||
uiKeyMapping.put( "ComboBox.ArrowButton.nonEditableBackground", "ComboBox.buttonBackground" );
|
uiKeyMapping.put( "ComboBox.ArrowButton.nonEditableBackground", "ComboBox.buttonBackground" );
|
||||||
|
|
||||||
|
// Component
|
||||||
|
uiKeyMapping.put( "Component.inactiveErrorFocusColor", "Component.error.borderColor" );
|
||||||
|
uiKeyMapping.put( "Component.errorFocusColor", "Component.error.focusedBorderColor" );
|
||||||
|
uiKeyMapping.put( "Component.inactiveWarningFocusColor", "Component.warning.borderColor" );
|
||||||
|
uiKeyMapping.put( "Component.warningFocusColor", "Component.warning.focusedBorderColor" );
|
||||||
|
|
||||||
// Link
|
// Link
|
||||||
uiKeyMapping.put( "Link.activeForeground", "Component.linkColor" );
|
uiKeyMapping.put( "Link.activeForeground", "Component.linkColor" );
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ import javax.swing.SwingUtilities;
|
|||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import javax.swing.plaf.basic.BasicBorders;
|
import javax.swing.plaf.basic.BasicBorders;
|
||||||
import javax.swing.text.JTextComponent;
|
import javax.swing.text.JTextComponent;
|
||||||
|
import com.formdev.flatlaf.FlatClientProperties;
|
||||||
|
import com.formdev.flatlaf.util.DerivedColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Border for various components (e.g. {@link javax.swing.JTextField}).
|
* Border for various components (e.g. {@link javax.swing.JTextField}).
|
||||||
@@ -54,6 +56,12 @@ import javax.swing.text.JTextComponent;
|
|||||||
* @uiDefault Component.disabledBorderColor Color
|
* @uiDefault Component.disabledBorderColor Color
|
||||||
* @uiDefault Component.focusedBorderColor Color
|
* @uiDefault Component.focusedBorderColor Color
|
||||||
*
|
*
|
||||||
|
* @uiDefault Component.error.borderColor Color
|
||||||
|
* @uiDefault Component.error.focusedBorderColor Color
|
||||||
|
* @uiDefault Component.warning.borderColor Color
|
||||||
|
* @uiDefault Component.warning.focusedBorderColor Color
|
||||||
|
* @uiDefault Component.custom.borderColor Color
|
||||||
|
*
|
||||||
* @author Karl Tauber
|
* @author Karl Tauber
|
||||||
*/
|
*/
|
||||||
public class FlatBorder
|
public class FlatBorder
|
||||||
@@ -66,6 +74,12 @@ public class FlatBorder
|
|||||||
protected final Color disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" );
|
protected final Color disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" );
|
||||||
protected final Color focusedBorderColor = UIManager.getColor( "Component.focusedBorderColor" );
|
protected final Color focusedBorderColor = UIManager.getColor( "Component.focusedBorderColor" );
|
||||||
|
|
||||||
|
protected final Color errorBorderColor = UIManager.getColor( "Component.error.borderColor" );
|
||||||
|
protected final Color errorFocusedBorderColor = UIManager.getColor( "Component.error.focusedBorderColor" );
|
||||||
|
protected final Color warningBorderColor = UIManager.getColor( "Component.warning.borderColor" );
|
||||||
|
protected final Color warningFocusedBorderColor = UIManager.getColor( "Component.warning.focusedBorderColor" );
|
||||||
|
protected final Color customBorderColor = UIManager.getColor( "Component.custom.borderColor" );
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
|
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
|
||||||
Graphics2D g2 = (Graphics2D) g.create();
|
Graphics2D g2 = (Graphics2D) g.create();
|
||||||
@@ -76,22 +90,48 @@ public class FlatBorder
|
|||||||
float focusWidth = isCellEditor ? 0 : scale( (float) getFocusWidth( c ) );
|
float focusWidth = isCellEditor ? 0 : scale( (float) getFocusWidth( c ) );
|
||||||
float borderWidth = scale( (float) getBorderWidth( c ) );
|
float borderWidth = scale( (float) getBorderWidth( c ) );
|
||||||
float arc = isCellEditor ? 0 : scale( (float) getArc( c ) );
|
float arc = isCellEditor ? 0 : scale( (float) getArc( c ) );
|
||||||
|
Color outlineColor = getOutlineColor( c );
|
||||||
|
|
||||||
if( isFocused( c ) ) {
|
if( outlineColor != null || isFocused( c ) ) {
|
||||||
float innerFocusWidth = !(c instanceof JScrollPane) ? this.innerFocusWidth : 0;
|
float innerFocusWidth = !(c instanceof JScrollPane) ? this.innerFocusWidth : 0;
|
||||||
|
|
||||||
g2.setColor( getFocusColor( c ) );
|
g2.setColor( (outlineColor != null) ? outlineColor : getFocusColor( c ) );
|
||||||
FlatUIUtils.paintComponentOuterBorder( g2, x, y, width, height, focusWidth,
|
FlatUIUtils.paintComponentOuterBorder( g2, x, y, width, height, focusWidth,
|
||||||
scale( (float) getLineWidth( c ) ) + scale( innerFocusWidth ), arc );
|
scale( (float) getLineWidth( c ) ) + scale( innerFocusWidth ), arc );
|
||||||
}
|
}
|
||||||
|
|
||||||
g2.setPaint( getBorderColor( c ) );
|
g2.setPaint( (outlineColor != null) ? outlineColor : getBorderColor( c ) );
|
||||||
FlatUIUtils.paintComponentBorder( g2, x, y, width, height, focusWidth, borderWidth, arc );
|
FlatUIUtils.paintComponentBorder( g2, x, y, width, height, focusWidth, borderWidth, arc );
|
||||||
} finally {
|
} finally {
|
||||||
g2.dispose();
|
g2.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Color getOutlineColor( Component c ) {
|
||||||
|
if( !(c instanceof JComponent) )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
Object outline = ((JComponent)c).getClientProperty( FlatClientProperties.OUTLINE );
|
||||||
|
if( outline instanceof String ) {
|
||||||
|
switch( (String) outline ) {
|
||||||
|
case FlatClientProperties.OUTLINE_ERROR:
|
||||||
|
return isFocused( c ) ? errorFocusedBorderColor : errorBorderColor;
|
||||||
|
|
||||||
|
case FlatClientProperties.OUTLINE_WARNING:
|
||||||
|
return isFocused( c ) ? warningFocusedBorderColor : warningBorderColor;
|
||||||
|
}
|
||||||
|
} else if( outline instanceof Color ) {
|
||||||
|
Color color = (Color) outline;
|
||||||
|
// use color functions to compute color for unfocused state
|
||||||
|
if( !isFocused( c ) && customBorderColor instanceof DerivedColor )
|
||||||
|
color = ((DerivedColor)customBorderColor).derive( color );
|
||||||
|
return color;
|
||||||
|
} else if( outline instanceof Color[] && ((Color[])outline).length >= 2 )
|
||||||
|
return ((Color[])outline)[isFocused( c ) ? 0 : 1];
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
protected Color getFocusColor( Component c ) {
|
protected Color getFocusColor( Component c ) {
|
||||||
return focusColor;
|
return focusColor;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,6 +130,12 @@ Component.focusColor=#3d6185
|
|||||||
Component.linkColor=#589df6
|
Component.linkColor=#589df6
|
||||||
Component.grayFilter=-20,-70,100
|
Component.grayFilter=-20,-70,100
|
||||||
|
|
||||||
|
Component.error.borderColor=desaturate($Component.error.focusedBorderColor,25%)
|
||||||
|
Component.error.focusedBorderColor=#8b3c3c
|
||||||
|
Component.warning.borderColor=darken(desaturate($Component.warning.focusedBorderColor,20%),10%)
|
||||||
|
Component.warning.focusedBorderColor=#ac7920
|
||||||
|
Component.custom.borderColor=desaturate(#f00,50%,relative derived)
|
||||||
|
|
||||||
|
|
||||||
#---- Desktop ----
|
#---- Desktop ----
|
||||||
|
|
||||||
|
|||||||
@@ -132,6 +132,12 @@ Component.focusColor=#97c3f3
|
|||||||
Component.linkColor=#2470B3
|
Component.linkColor=#2470B3
|
||||||
Component.grayFilter=25,-25,100
|
Component.grayFilter=25,-25,100
|
||||||
|
|
||||||
|
Component.error.borderColor=lighten(desaturate($Component.error.focusedBorderColor,20%),25%)
|
||||||
|
Component.error.focusedBorderColor=#e53e4d
|
||||||
|
Component.warning.borderColor=lighten(saturate($Component.warning.focusedBorderColor,25%),20%)
|
||||||
|
Component.warning.focusedBorderColor=#e2a53a
|
||||||
|
Component.custom.borderColor=lighten(desaturate(#f00,20%,derived),25%,derived)
|
||||||
|
|
||||||
|
|
||||||
#---- Desktop ----
|
#---- Desktop ----
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,14 @@ class BasicComponentsPanel
|
|||||||
JScrollPane scrollPane12 = new JScrollPane();
|
JScrollPane scrollPane12 = new JScrollPane();
|
||||||
JTextPane textPane4 = new JTextPane();
|
JTextPane textPane4 = new JTextPane();
|
||||||
JTextPane textPane5 = new JTextPane();
|
JTextPane textPane5 = new JTextPane();
|
||||||
|
JLabel label3 = new JLabel();
|
||||||
|
JTextField textField5 = new JTextField();
|
||||||
|
JComboBox comboBox7 = new JComboBox();
|
||||||
|
JSpinner spinner3 = new JSpinner();
|
||||||
|
JLabel label4 = new JLabel();
|
||||||
|
JTextField textField7 = new JTextField();
|
||||||
|
JComboBox comboBox8 = new JComboBox();
|
||||||
|
JSpinner spinner4 = new JSpinner();
|
||||||
JPopupMenu popupMenu1 = new JPopupMenu();
|
JPopupMenu popupMenu1 = new JPopupMenu();
|
||||||
JMenuItem cutMenuItem = new JMenuItem();
|
JMenuItem cutMenuItem = new JMenuItem();
|
||||||
JMenuItem copyMenuItem = new JMenuItem();
|
JMenuItem copyMenuItem = new JMenuItem();
|
||||||
@@ -141,6 +149,8 @@ class BasicComponentsPanel
|
|||||||
"[]" +
|
"[]" +
|
||||||
"[]" +
|
"[]" +
|
||||||
"[]" +
|
"[]" +
|
||||||
|
"[]para" +
|
||||||
|
"[]" +
|
||||||
"[]"));
|
"[]"));
|
||||||
|
|
||||||
//---- labelLabel ----
|
//---- labelLabel ----
|
||||||
@@ -596,6 +606,38 @@ class BasicComponentsPanel
|
|||||||
textPane5.setText("no scroll pane");
|
textPane5.setText("no scroll pane");
|
||||||
add(textPane5, "cell 5 11,growx");
|
add(textPane5, "cell 5 11,growx");
|
||||||
|
|
||||||
|
//---- label3 ----
|
||||||
|
label3.setText("Error:");
|
||||||
|
add(label3, "cell 0 12");
|
||||||
|
|
||||||
|
//---- textField5 ----
|
||||||
|
textField5.putClientProperty("JComponent.outline", "error");
|
||||||
|
add(textField5, "cell 1 12,growx");
|
||||||
|
|
||||||
|
//---- comboBox7 ----
|
||||||
|
comboBox7.putClientProperty("JComponent.outline", "error");
|
||||||
|
add(comboBox7, "cell 2 12,growx");
|
||||||
|
|
||||||
|
//---- spinner3 ----
|
||||||
|
spinner3.putClientProperty("JComponent.outline", "error");
|
||||||
|
add(spinner3, "cell 3 12,growx");
|
||||||
|
|
||||||
|
//---- label4 ----
|
||||||
|
label4.setText("Warning:");
|
||||||
|
add(label4, "cell 0 13");
|
||||||
|
|
||||||
|
//---- textField7 ----
|
||||||
|
textField7.putClientProperty("JComponent.outline", "warning");
|
||||||
|
add(textField7, "cell 1 13,growx");
|
||||||
|
|
||||||
|
//---- comboBox8 ----
|
||||||
|
comboBox8.putClientProperty("JComponent.outline", "warning");
|
||||||
|
add(comboBox8, "cell 2 13,growx");
|
||||||
|
|
||||||
|
//---- spinner4 ----
|
||||||
|
spinner4.putClientProperty("JComponent.outline", "warning");
|
||||||
|
add(spinner4, "cell 3 13,growx");
|
||||||
|
|
||||||
//======== popupMenu1 ========
|
//======== popupMenu1 ========
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ new FormModel {
|
|||||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
"$layoutConstraints": "hidemode 3"
|
"$layoutConstraints": "hidemode 3"
|
||||||
"$columnConstraints": "[][][][][][]"
|
"$columnConstraints": "[][][][][][]"
|
||||||
"$rowConstraints": "[][][][][][][][][][][][]"
|
"$rowConstraints": "[][][][][][][][][][][][]para[][]"
|
||||||
} ) {
|
} ) {
|
||||||
name: "this"
|
name: "this"
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
@@ -591,9 +591,57 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 5 11,growx"
|
"value": "cell 5 11,growx"
|
||||||
} )
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label3"
|
||||||
|
"text": "Error:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 12"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
|
name: "textField5"
|
||||||
|
"$client.JComponent.outline": "error"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 12,growx"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||||
|
name: "comboBox7"
|
||||||
|
"$client.JComponent.outline": "error"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 2 12,growx"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||||
|
name: "spinner3"
|
||||||
|
"$client.JComponent.outline": "error"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 3 12,growx"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label4"
|
||||||
|
"text": "Warning:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 13"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
|
name: "textField7"
|
||||||
|
"$client.JComponent.outline": "warning"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 13,growx"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||||
|
name: "comboBox8"
|
||||||
|
"$client.JComponent.outline": "warning"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 2 13,growx"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||||
|
name: "spinner4"
|
||||||
|
"$client.JComponent.outline": "warning"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 3 13,growx"
|
||||||
|
} )
|
||||||
}, new FormLayoutConstraints( null ) {
|
}, new FormLayoutConstraints( null ) {
|
||||||
"location": new java.awt.Point( 0, 0 )
|
"location": new java.awt.Point( 0, 0 )
|
||||||
"size": new java.awt.Dimension( 790, 440 )
|
"size": new java.awt.Dimension( 920, 440 )
|
||||||
} )
|
} )
|
||||||
add( new FormContainer( "javax.swing.JPopupMenu", new FormLayoutManager( class javax.swing.JPopupMenu ) ) {
|
add( new FormContainer( "javax.swing.JPopupMenu", new FormLayoutManager( class javax.swing.JPopupMenu ) ) {
|
||||||
name: "popupMenu1"
|
name: "popupMenu1"
|
||||||
|
|||||||
@@ -84,6 +84,26 @@ public class FlatComponentsTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void outlineChanged() {
|
||||||
|
FlatTestFrame frame = (FlatTestFrame) SwingUtilities.getAncestorOfClass( FlatTestFrame.class, this );
|
||||||
|
if( frame == null )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Object outline = errorOutlineRadioButton.isSelected() ? "error"
|
||||||
|
: warningOutlineRadioButton.isSelected() ? "warning"
|
||||||
|
: magentaOutlineRadioButton.isSelected() ? Color.magenta
|
||||||
|
: magentaCyanOutlineRadioButton.isSelected() ? new Color[] { Color.magenta, Color.cyan }
|
||||||
|
: null;
|
||||||
|
|
||||||
|
frame.updateComponentsRecur( this, (c, type) -> {
|
||||||
|
if( c instanceof JComponent )
|
||||||
|
((JComponent)c).putClientProperty( FlatClientProperties.OUTLINE, outline );
|
||||||
|
} );
|
||||||
|
|
||||||
|
frame.repaint();
|
||||||
|
textField1.requestFocusInWindow();
|
||||||
|
}
|
||||||
|
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||||
JLabel labelLabel = new JLabel();
|
JLabel labelLabel = new JLabel();
|
||||||
@@ -146,7 +166,7 @@ public class FlatComponentsTest
|
|||||||
JComboBox<String> comboBox7 = new JComboBox<>();
|
JComboBox<String> comboBox7 = new JComboBox<>();
|
||||||
JSpinner spinner3 = new JSpinner();
|
JSpinner spinner3 = new JSpinner();
|
||||||
JLabel textFieldLabel = new JLabel();
|
JLabel textFieldLabel = new JLabel();
|
||||||
JTextField textField1 = new JTextField();
|
textField1 = new JTextField();
|
||||||
JTextField textField2 = new JTextField();
|
JTextField textField2 = new JTextField();
|
||||||
JTextField textField3 = new JTextField();
|
JTextField textField3 = new JTextField();
|
||||||
JTextField textField4 = new JTextField();
|
JTextField textField4 = new JTextField();
|
||||||
@@ -215,6 +235,12 @@ public class FlatComponentsTest
|
|||||||
JButton button10 = new JButton();
|
JButton button10 = new JButton();
|
||||||
JButton button11 = new JButton();
|
JButton button11 = new JButton();
|
||||||
JToggleButton toggleButton7 = new JToggleButton();
|
JToggleButton toggleButton7 = new JToggleButton();
|
||||||
|
JPanel panel4 = new JPanel();
|
||||||
|
noOutlineRadioButton = new JRadioButton();
|
||||||
|
errorOutlineRadioButton = new JRadioButton();
|
||||||
|
warningOutlineRadioButton = new JRadioButton();
|
||||||
|
magentaOutlineRadioButton = new JRadioButton();
|
||||||
|
magentaCyanOutlineRadioButton = new JRadioButton();
|
||||||
JScrollPane scrollPane15 = new JScrollPane();
|
JScrollPane scrollPane15 = new JScrollPane();
|
||||||
JPanel panel3 = new JPanel();
|
JPanel panel3 = new JPanel();
|
||||||
JButton button21 = new JButton();
|
JButton button21 = new JButton();
|
||||||
@@ -1013,6 +1039,38 @@ public class FlatComponentsTest
|
|||||||
}
|
}
|
||||||
add(toolBar2, "cell 4 13 1 6,growy");
|
add(toolBar2, "cell 4 13 1 6,growy");
|
||||||
|
|
||||||
|
//======== panel4 ========
|
||||||
|
{
|
||||||
|
panel4.setLayout(new BoxLayout(panel4, BoxLayout.Y_AXIS));
|
||||||
|
|
||||||
|
//---- noOutlineRadioButton ----
|
||||||
|
noOutlineRadioButton.setText("no outline");
|
||||||
|
noOutlineRadioButton.setSelected(true);
|
||||||
|
noOutlineRadioButton.addActionListener(e -> outlineChanged());
|
||||||
|
panel4.add(noOutlineRadioButton);
|
||||||
|
|
||||||
|
//---- errorOutlineRadioButton ----
|
||||||
|
errorOutlineRadioButton.setText("error");
|
||||||
|
errorOutlineRadioButton.addActionListener(e -> outlineChanged());
|
||||||
|
panel4.add(errorOutlineRadioButton);
|
||||||
|
|
||||||
|
//---- warningOutlineRadioButton ----
|
||||||
|
warningOutlineRadioButton.setText("warning");
|
||||||
|
warningOutlineRadioButton.addActionListener(e -> outlineChanged());
|
||||||
|
panel4.add(warningOutlineRadioButton);
|
||||||
|
|
||||||
|
//---- magentaOutlineRadioButton ----
|
||||||
|
magentaOutlineRadioButton.setText("magenta");
|
||||||
|
magentaOutlineRadioButton.addActionListener(e -> outlineChanged());
|
||||||
|
panel4.add(magentaOutlineRadioButton);
|
||||||
|
|
||||||
|
//---- magentaCyanOutlineRadioButton ----
|
||||||
|
magentaCyanOutlineRadioButton.setText("magenta / cyan");
|
||||||
|
magentaCyanOutlineRadioButton.addActionListener(e -> outlineChanged());
|
||||||
|
panel4.add(magentaCyanOutlineRadioButton);
|
||||||
|
}
|
||||||
|
add(panel4, "cell 5 13");
|
||||||
|
|
||||||
//======== scrollPane15 ========
|
//======== scrollPane15 ========
|
||||||
{
|
{
|
||||||
scrollPane15.setBorder(BorderFactory.createEmptyBorder());
|
scrollPane15.setBorder(BorderFactory.createEmptyBorder());
|
||||||
@@ -1240,6 +1298,14 @@ public class FlatComponentsTest
|
|||||||
toolBar4.add(toggleButton26);
|
toolBar4.add(toggleButton26);
|
||||||
}
|
}
|
||||||
add(toolBar4, "cell 3 23 3 1");
|
add(toolBar4, "cell 3 23 3 1");
|
||||||
|
|
||||||
|
//---- buttonGroup1 ----
|
||||||
|
ButtonGroup buttonGroup1 = new ButtonGroup();
|
||||||
|
buttonGroup1.add(noOutlineRadioButton);
|
||||||
|
buttonGroup1.add(errorOutlineRadioButton);
|
||||||
|
buttonGroup1.add(warningOutlineRadioButton);
|
||||||
|
buttonGroup1.add(magentaOutlineRadioButton);
|
||||||
|
buttonGroup1.add(magentaCyanOutlineRadioButton);
|
||||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||||
|
|
||||||
// BasicComboBoxRenderer customRenderer = new BasicComboBoxRenderer();
|
// BasicComboBoxRenderer customRenderer = new BasicComboBoxRenderer();
|
||||||
@@ -1252,8 +1318,14 @@ public class FlatComponentsTest
|
|||||||
private JComboBox<String> buttonTypeComboBox;
|
private JComboBox<String> buttonTypeComboBox;
|
||||||
private JCheckBox contentAreaFilledCheckBox;
|
private JCheckBox contentAreaFilledCheckBox;
|
||||||
private JCheckBox roundRectCheckBox;
|
private JCheckBox roundRectCheckBox;
|
||||||
|
private JTextField textField1;
|
||||||
private JProgressBar progressBar3;
|
private JProgressBar progressBar3;
|
||||||
private JProgressBar progressBar4;
|
private JProgressBar progressBar4;
|
||||||
|
private JRadioButton noOutlineRadioButton;
|
||||||
|
private JRadioButton errorOutlineRadioButton;
|
||||||
|
private JRadioButton warningOutlineRadioButton;
|
||||||
|
private JRadioButton magentaOutlineRadioButton;
|
||||||
|
private JRadioButton magentaCyanOutlineRadioButton;
|
||||||
private JSlider slider3;
|
private JSlider slider3;
|
||||||
private JProgressBar progressBar1;
|
private JProgressBar progressBar1;
|
||||||
private JProgressBar progressBar2;
|
private JProgressBar progressBar2;
|
||||||
|
|||||||
@@ -514,6 +514,9 @@ new FormModel {
|
|||||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
name: "textField1"
|
name: "textField1"
|
||||||
"text": "editable"
|
"text": "editable"
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 1 7,growx"
|
"value": "cell 1 7,growx"
|
||||||
} )
|
} )
|
||||||
@@ -955,6 +958,59 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 4 13 1 6,growy"
|
"value": "cell 4 13 1 6,growy"
|
||||||
} )
|
} )
|
||||||
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class javax.swing.BoxLayout ) {
|
||||||
|
"axis": 1
|
||||||
|
} ) {
|
||||||
|
name: "panel4"
|
||||||
|
add( new FormComponent( "javax.swing.JRadioButton" ) {
|
||||||
|
name: "noOutlineRadioButton"
|
||||||
|
"text": "no outline"
|
||||||
|
"$buttonGroup": new FormReference( "buttonGroup1" )
|
||||||
|
"selected": true
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "outlineChanged", false ) )
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JRadioButton" ) {
|
||||||
|
name: "errorOutlineRadioButton"
|
||||||
|
"text": "error"
|
||||||
|
"$buttonGroup": new FormReference( "buttonGroup1" )
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "outlineChanged", false ) )
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JRadioButton" ) {
|
||||||
|
name: "warningOutlineRadioButton"
|
||||||
|
"text": "warning"
|
||||||
|
"$buttonGroup": new FormReference( "buttonGroup1" )
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "outlineChanged", false ) )
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JRadioButton" ) {
|
||||||
|
name: "magentaOutlineRadioButton"
|
||||||
|
"text": "magenta"
|
||||||
|
"$buttonGroup": &FormReference0 new FormReference( "buttonGroup1" )
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "outlineChanged", false ) )
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JRadioButton" ) {
|
||||||
|
name: "magentaCyanOutlineRadioButton"
|
||||||
|
"text": "magenta / cyan"
|
||||||
|
"$buttonGroup": #FormReference0
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "outlineChanged", false ) )
|
||||||
|
} )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 5 13"
|
||||||
|
} )
|
||||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||||
name: "scrollPane15"
|
name: "scrollPane15"
|
||||||
"border": new javax.swing.border.EmptyBorder( 0, 0, 0, 0 )
|
"border": new javax.swing.border.EmptyBorder( 0, 0, 0, 0 )
|
||||||
@@ -1247,5 +1303,10 @@ new FormModel {
|
|||||||
"location": new java.awt.Point( 0, 0 )
|
"location": new java.awt.Point( 0, 0 )
|
||||||
"size": new java.awt.Dimension( 1135, 800 )
|
"size": new java.awt.Dimension( 1135, 800 )
|
||||||
} )
|
} )
|
||||||
|
add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
|
||||||
|
name: "buttonGroup1"
|
||||||
|
}, new FormLayoutConstraints( null ) {
|
||||||
|
"location": new java.awt.Point( 0, 810 )
|
||||||
|
} )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ public class FlatTestFrame
|
|||||||
sizeVariantComboBox.setVisible( visible );
|
sizeVariantComboBox.setVisible( visible );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateComponentsRecur( Container container, BiConsumer<Component, String> action ) {
|
void updateComponentsRecur( Container container, BiConsumer<Component, String> action ) {
|
||||||
for( Component c : container.getComponents() ) {
|
for( Component c : container.getComponents() ) {
|
||||||
if( c instanceof JPanel || c instanceof JDesktopPane ) {
|
if( c instanceof JPanel || c instanceof JDesktopPane ) {
|
||||||
updateComponentsRecur( (Container) c, action );
|
updateComponentsRecur( (Container) c, action );
|
||||||
|
|||||||
@@ -202,7 +202,10 @@ ComboBoxUI com.formdev.flatlaf.ui.FlatComboBoxUI
|
|||||||
Component.arc 5
|
Component.arc 5
|
||||||
Component.arrowType chevron
|
Component.arrowType chevron
|
||||||
Component.borderColor #646464 javax.swing.plaf.ColorUIResource [UI]
|
Component.borderColor #646464 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.custom.borderColor #bf4040 com.formdev.flatlaf.util.DerivedColor [UI] desaturate(50% relative)
|
||||||
Component.disabledBorderColor #646464 javax.swing.plaf.ColorUIResource [UI]
|
Component.disabledBorderColor #646464 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.error.borderColor #725555 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.error.focusedBorderColor #8b3c3c javax.swing.plaf.ColorUIResource [UI]
|
||||||
Component.focusColor #3d6185 javax.swing.plaf.ColorUIResource [UI]
|
Component.focusColor #3d6185 javax.swing.plaf.ColorUIResource [UI]
|
||||||
Component.focusWidth 0
|
Component.focusWidth 0
|
||||||
Component.focusedBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
|
Component.focusedBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
|
||||||
@@ -211,6 +214,8 @@ Component.hideMnemonics true
|
|||||||
Component.innerFocusWidth 0.5
|
Component.innerFocusWidth 0.5
|
||||||
Component.linkColor #589df6 javax.swing.plaf.ColorUIResource [UI]
|
Component.linkColor #589df6 javax.swing.plaf.ColorUIResource [UI]
|
||||||
Component.minimumWidth 64
|
Component.minimumWidth 64
|
||||||
|
Component.warning.borderColor #725627 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.warning.focusedBorderColor #ac7920 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
|
||||||
|
|
||||||
#---- DatePicker ----
|
#---- DatePicker ----
|
||||||
|
|||||||
@@ -201,7 +201,10 @@ ComboBoxUI com.formdev.flatlaf.ui.FlatComboBoxUI
|
|||||||
Component.arc 5
|
Component.arc 5
|
||||||
Component.arrowType chevron
|
Component.arrowType chevron
|
||||||
Component.borderColor #646464 javax.swing.plaf.ColorUIResource [UI]
|
Component.borderColor #646464 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.custom.borderColor #bf4040 com.formdev.flatlaf.util.DerivedColor [UI] desaturate(50% relative)
|
||||||
Component.disabledBorderColor #646464 javax.swing.plaf.ColorUIResource [UI]
|
Component.disabledBorderColor #646464 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.error.borderColor #725555 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.error.focusedBorderColor #8b3c3c javax.swing.plaf.ColorUIResource [UI]
|
||||||
Component.focusColor #3d6185 javax.swing.plaf.ColorUIResource [UI]
|
Component.focusColor #3d6185 javax.swing.plaf.ColorUIResource [UI]
|
||||||
Component.focusWidth 0
|
Component.focusWidth 0
|
||||||
Component.focusedBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
|
Component.focusedBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
|
||||||
@@ -210,6 +213,8 @@ Component.hideMnemonics true
|
|||||||
Component.innerFocusWidth 0.5
|
Component.innerFocusWidth 0.5
|
||||||
Component.linkColor #589df6 javax.swing.plaf.ColorUIResource [UI]
|
Component.linkColor #589df6 javax.swing.plaf.ColorUIResource [UI]
|
||||||
Component.minimumWidth 64
|
Component.minimumWidth 64
|
||||||
|
Component.warning.borderColor #725627 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.warning.focusedBorderColor #ac7920 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
|
||||||
|
|
||||||
#---- DatePicker ----
|
#---- DatePicker ----
|
||||||
|
|||||||
@@ -203,7 +203,10 @@ ComboBoxUI com.formdev.flatlaf.ui.FlatComboBoxUI
|
|||||||
Component.arc 5
|
Component.arc 5
|
||||||
Component.arrowType chevron
|
Component.arrowType chevron
|
||||||
Component.borderColor #c4c4c4 javax.swing.plaf.ColorUIResource [UI]
|
Component.borderColor #c4c4c4 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.custom.borderColor #f38d8d com.formdev.flatlaf.util.DerivedColor [UI] desaturate(20%) lighten(25%)
|
||||||
Component.disabledBorderColor #cfcfcf javax.swing.plaf.ColorUIResource [UI]
|
Component.disabledBorderColor #cfcfcf javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.error.borderColor #ebb8bc javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.error.focusedBorderColor #e53e4d javax.swing.plaf.ColorUIResource [UI]
|
||||||
Component.focusColor #97c3f3 javax.swing.plaf.ColorUIResource [UI]
|
Component.focusColor #97c3f3 javax.swing.plaf.ColorUIResource [UI]
|
||||||
Component.focusWidth 0
|
Component.focusWidth 0
|
||||||
Component.focusedBorderColor #87afda javax.swing.plaf.ColorUIResource [UI]
|
Component.focusedBorderColor #87afda javax.swing.plaf.ColorUIResource [UI]
|
||||||
@@ -212,6 +215,8 @@ Component.hideMnemonics true
|
|||||||
Component.innerFocusWidth 0.5
|
Component.innerFocusWidth 0.5
|
||||||
Component.linkColor #2470b3 javax.swing.plaf.ColorUIResource [UI]
|
Component.linkColor #2470b3 javax.swing.plaf.ColorUIResource [UI]
|
||||||
Component.minimumWidth 64
|
Component.minimumWidth 64
|
||||||
|
Component.warning.borderColor #fed284 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.warning.focusedBorderColor #e2a53a javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
|
||||||
|
|
||||||
#---- DatePicker ----
|
#---- DatePicker ----
|
||||||
|
|||||||
@@ -202,7 +202,10 @@ ComboBoxUI com.formdev.flatlaf.ui.FlatComboBoxUI
|
|||||||
Component.arc 5
|
Component.arc 5
|
||||||
Component.arrowType chevron
|
Component.arrowType chevron
|
||||||
Component.borderColor #c4c4c4 javax.swing.plaf.ColorUIResource [UI]
|
Component.borderColor #c4c4c4 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.custom.borderColor #f38d8d com.formdev.flatlaf.util.DerivedColor [UI] desaturate(20%) lighten(25%)
|
||||||
Component.disabledBorderColor #cfcfcf javax.swing.plaf.ColorUIResource [UI]
|
Component.disabledBorderColor #cfcfcf javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.error.borderColor #ebb8bc javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.error.focusedBorderColor #e53e4d javax.swing.plaf.ColorUIResource [UI]
|
||||||
Component.focusColor #97c3f3 javax.swing.plaf.ColorUIResource [UI]
|
Component.focusColor #97c3f3 javax.swing.plaf.ColorUIResource [UI]
|
||||||
Component.focusWidth 0
|
Component.focusWidth 0
|
||||||
Component.focusedBorderColor #87afda javax.swing.plaf.ColorUIResource [UI]
|
Component.focusedBorderColor #87afda javax.swing.plaf.ColorUIResource [UI]
|
||||||
@@ -211,6 +214,8 @@ Component.hideMnemonics true
|
|||||||
Component.innerFocusWidth 0.5
|
Component.innerFocusWidth 0.5
|
||||||
Component.linkColor #2470b3 javax.swing.plaf.ColorUIResource [UI]
|
Component.linkColor #2470b3 javax.swing.plaf.ColorUIResource [UI]
|
||||||
Component.minimumWidth 64
|
Component.minimumWidth 64
|
||||||
|
Component.warning.borderColor #fed284 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
Component.warning.focusedBorderColor #e2a53a javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
|
||||||
|
|
||||||
#---- DatePicker ----
|
#---- DatePicker ----
|
||||||
|
|||||||
Reference in New Issue
Block a user