Merge remote-tracking branch 'origin/main' into styling

This commit is contained in:
Karl Tauber
2021-09-14 19:02:21 +02:00
25 changed files with 1562 additions and 245 deletions

View File

@@ -1,7 +1,7 @@
FlatLaf Change Log FlatLaf Change Log
================== ==================
## 1.6-SNAPSHOT ## 1.6
#### New features and improvements #### New features and improvements
@@ -20,10 +20,20 @@ FlatLaf Change Log
- OptionPane: Fixed rendering of longer HTML text if it is passed as - OptionPane: Fixed rendering of longer HTML text if it is passed as
`StringBuilder`, `StringBuffer`, or any other object that returns HTML text in `StringBuilder`, `StringBuffer`, or any other object that returns HTML text in
method `toString()`. (similar to issue #12) method `toString()`. (similar to issue #12)
- ComboBox: Fixed popup border painting on HiDPI screens (e.g. at 150% scaling).
- ComboBox: Fixed popup location if shown above of combo box (Java 8 only).
- ComboBox (editable): Fixed wrong border of internal text field under special
circumstances.
- Spinner: Fixed painting of border corners on left side. (issue #382;
regression since FlatLaf 1.4)
- TableHeader: Do not show resize cursor for last column if resizing last column - TableHeader: Do not show resize cursor for last column if resizing last column
is not possible because auto resize mode of table is not off. (issue #332) is not possible because auto resize mode of table is not off. (issue #332)
- TableHeader: Fixed missing trailing vertical separator line if used in upper
left corner of scroll pane. (issue #332)
- TextField, FormattedTextField, PasswordField and ComboBox: Fixed alignment of - TextField, FormattedTextField, PasswordField and ComboBox: Fixed alignment of
placeholder text in right-to-left component orientation. placeholder text in right-to-left component orientation.
- Slider: Fixed calculation of baseline, which was wrong under some
circumstances.
## 1.5 ## 1.5

View File

@@ -14,8 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
val releaseVersion = "1.5" val releaseVersion = "1.6"
val developmentVersion = "1.6-SNAPSHOT" val developmentVersion = "2.0-SNAPSHOT"
version = if( java.lang.Boolean.getBoolean( "release" ) ) releaseVersion else developmentVersion version = if( java.lang.Boolean.getBoolean( "release" ) ) releaseVersion else developmentVersion

View File

@@ -21,10 +21,15 @@ plugins {
`flatlaf-publish` `flatlaf-publish`
} }
val sigtest = configurations.create( "sigtest" )
dependencies { dependencies {
testImplementation( "org.junit.jupiter:junit-jupiter-api:5.7.2" ) testImplementation( "org.junit.jupiter:junit-jupiter-api:5.7.2" )
testImplementation( "org.junit.jupiter:junit-jupiter-params" ) testImplementation( "org.junit.jupiter:junit-jupiter-params" )
testRuntimeOnly( "org.junit.jupiter:junit-jupiter-engine" ) testRuntimeOnly( "org.junit.jupiter:junit-jupiter-engine" )
// https://github.com/jtulach/netbeans-apitest
sigtest( "org.netbeans.tools:sigtest-maven-plugin:1.4" )
} }
java { java {
@@ -59,10 +64,60 @@ tasks {
archiveBaseName.set( "flatlaf" ) archiveBaseName.set( "flatlaf" )
} }
check {
dependsOn( "sigtestCheck" )
}
test { test {
useJUnitPlatform() useJUnitPlatform()
testLogging.exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL testLogging.exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
} }
register( "sigtestGenerate" ) {
group = "verification"
dependsOn( "jar" )
doLast {
ant.withGroovyBuilder {
"taskdef"(
"name" to "sigtest",
"classname" to "org.netbeans.apitest.Sigtest",
"classpath" to sigtest.asPath )
"sigtest"(
"action" to "generate",
"fileName" to "${project.name}-sigtest.txt",
"classpath" to jar.get().outputs.files.asPath,
"packages" to "com.formdev.flatlaf,com.formdev.flatlaf.util",
"version" to version,
"release" to "1.8", // Java version
"failonerror" to "true" )
}
}
}
register( "sigtestCheck" ) {
group = "verification"
dependsOn( "jar" )
doLast {
ant.withGroovyBuilder {
"taskdef"(
"name" to "sigtest",
"classname" to "org.netbeans.apitest.Sigtest",
"classpath" to sigtest.asPath )
"sigtest"(
"action" to "check",
"fileName" to "${project.name}-sigtest.txt",
"classpath" to jar.get().outputs.files.asPath,
"packages" to "com.formdev.flatlaf,com.formdev.flatlaf.util",
"version" to version,
"release" to "1.8", // Java version
"failonerror" to "true" )
}
}
}
} }
flatlafPublish { flatlafPublish {

File diff suppressed because it is too large Load Diff

View File

@@ -47,7 +47,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.CellRendererPane; import javax.swing.CellRendererPane;
import javax.swing.ComboBoxEditor;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
import javax.swing.InputMap; import javax.swing.InputMap;
import javax.swing.JButton; import javax.swing.JButton;
@@ -362,33 +361,25 @@ public class FlatComboBoxUI
} }
@Override @Override
protected ComboBoxEditor createEditor() { protected void configureEditor() {
ComboBoxEditor comboBoxEditor = super.createEditor(); super.configureEditor();
Component editor = comboBoxEditor.getEditorComponent();
if( editor instanceof JTextField ) { if( editor instanceof JTextField ) {
JTextField textField = (JTextField) editor; JTextField textField = (JTextField) editor;
textField.setColumns( editorColumns ); textField.setColumns( editorColumns );
// assign a non-null and non-javax.swing.plaf.UIResource border to the text field, // remove default text field border from editor
// otherwise it is replaced with default text field border when switching LaF Border border = textField.getBorder();
// because javax.swing.plaf.basic.BasicComboBoxEditor.BorderlessTextField.setBorder() if( border == null || border instanceof UIResource ) {
// uses "border instanceof javax.swing.plaf.basic.BasicComboBoxEditor.UIResource" // assign a non-null and non-javax.swing.plaf.UIResource border to the text field,
// instead of "border instanceof javax.swing.plaf.UIResource" // otherwise it is replaced with default text field border when switching LaF
textField.setBorder( BorderFactory.createEmptyBorder() ); // because javax.swing.plaf.basic.BasicComboBoxEditor.BorderlessTextField.setBorder()
// uses "border instanceof javax.swing.plaf.basic.BasicComboBoxEditor.UIResource"
// instead of "border instanceof javax.swing.plaf.UIResource"
textField.setBorder( BorderFactory.createEmptyBorder() );
}
} }
return comboBoxEditor;
}
@Override
protected void configureEditor() {
super.configureEditor();
// remove default text field border from editor
if( editor instanceof JTextField && ((JTextField)editor).getBorder() instanceof FlatTextBorder )
((JTextField)editor).setBorder( BorderFactory.createEmptyBorder() );
// explicitly make non-opaque // explicitly make non-opaque
if( editor instanceof JComponent ) if( editor instanceof JComponent )
((JComponent)editor).setOpaque( false ); ((JComponent)editor).setOpaque( false );
@@ -782,6 +773,9 @@ public class FlatComboBoxUI
protected void configurePopup() { protected void configurePopup() {
super.configurePopup(); super.configurePopup();
// make opaque to avoid that background shines thru border (e.g. at 150% scaling)
setOpaque( true );
Border border = UIManager.getBorder( "PopupMenu.border" ); Border border = UIManager.getBorder( "PopupMenu.border" );
if( border != null ) if( border != null )
setBorder( border ); setBorder( border );
@@ -818,6 +812,21 @@ public class FlatComboBoxUI
return height; return height;
} }
@Override
public void show( Component invoker, int x, int y ) {
// Java 8: fix y coordinate if popup is shown above the combobox
// (already fixed in Java 9+ https://bugs.openjdk.java.net/browse/JDK-7072653)
if( y < 0 && !SystemInfo.isJava_9_orLater ) {
Border popupBorder = getBorder();
if( popupBorder != null ) {
Insets insets = popupBorder.getBorderInsets( this );
y -= insets.top + insets.bottom;
}
}
super.show( invoker, x, y );
}
@Override @Override
protected void paintChildren( Graphics g ) { protected void paintChildren( Graphics g ) {
super.paintChildren( g ); super.paintChildren( g );

View File

@@ -283,6 +283,9 @@ public class FlatInternalFrameUI
//---- class FlatBorderListener ------------------------------------------- //---- class FlatBorderListener -------------------------------------------
/**
* @since 1.6
*/
protected class FlatBorderListener protected class FlatBorderListener
extends BorderListener extends BorderListener
{ {

View File

@@ -17,6 +17,7 @@
package com.formdev.flatlaf.ui; package com.formdev.flatlaf.ui;
import java.awt.Color; import java.awt.Color;
import java.awt.Container;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.Window; import java.awt.Window;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
@@ -24,7 +25,6 @@ import java.util.List;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JRootPane; import javax.swing.JRootPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.FlatClientProperties;
@@ -76,6 +76,11 @@ public class FlatNativeWindowBorder
if( !isSupported() ) if( !isSupported() )
return null; return null;
// do nothing if root pane has a parent that is not a window (e.g. a JInternalFrame)
Container parent = rootPane.getParent();
if( parent != null && !(parent instanceof Window) )
return null;
// Check whether root pane already has a window, which is the case when // Check whether root pane already has a window, which is the case when
// switching from another LaF to FlatLaf. // switching from another LaF to FlatLaf.
// Also check whether the window is displayable, which is required to install // Also check whether the window is displayable, which is required to install
@@ -83,9 +88,8 @@ public class FlatNativeWindowBorder
// If the window is not displayable, then it was probably closed/disposed but not yet removed // If the window is not displayable, then it was probably closed/disposed but not yet removed
// from the list of windows that AWT maintains and returns with Window.getWindows(). // from the list of windows that AWT maintains and returns with Window.getWindows().
// It could be also be a window that is currently hidden, but may be shown later. // It could be also be a window that is currently hidden, but may be shown later.
Window window = SwingUtilities.windowForComponent( rootPane ); if( parent instanceof Window && parent.isDisplayable() )
if( window != null && window.isDisplayable() ) install( (Window) parent );
install( window );
// Install FlatLaf native window border, which must be done late, // Install FlatLaf native window border, which must be done late,
// when the native window is already created, because it needs access to the window. // when the native window is already created, because it needs access to the window.
@@ -174,9 +178,9 @@ public class FlatNativeWindowBorder
return; return;
// uninstall native window border // uninstall native window border
Window window = SwingUtilities.windowForComponent( rootPane ); Container parent = rootPane.getParent();
if( window != null ) if( parent instanceof Window )
uninstall( window ); uninstall( (Window) parent );
} }
private static void uninstall( Window window ) { private static void uninstall( Window window ) {

View File

@@ -18,9 +18,11 @@ package com.formdev.flatlaf.ui;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.Shape; import java.awt.Shape;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@@ -223,9 +225,27 @@ public class FlatSliderUI
if( slider.getOrientation() == JSlider.VERTICAL ) if( slider.getOrientation() == JSlider.VERTICAL )
return -1; return -1;
// use default font (instead of slider font) because the slider font size
// may be different to label font size, but we want align the track/thumb with labels
Font font = UIManager.getFont( "defaultFont" );
if( font == null )
font = slider.getFont();
FontMetrics fm = slider.getFontMetrics( font );
// calculate track y coordinate and height
// (not using field trackRect here because slider size may be [0,0]
// and field trackRect may have invalid values in this case)
Insets insets = slider.getInsets();
int thumbHeight = getThumbSize().height;
int contentHeight = height - insets.top - insets.bottom - focusInsets.top - focusInsets.bottom;
int centerSpacing = thumbHeight
+ (slider.getPaintTicks() ? getTickLength() : 0)
+ (slider.getPaintLabels() ? getHeightOfTallestLabel() : 0);
int trackY = insets.top + focusInsets.top + (contentHeight - centerSpacing - 1) / 2;
int trackHeight = thumbHeight;
// compute a baseline so that the track is vertically centered // compute a baseline so that the track is vertically centered
FontMetrics fm = slider.getFontMetrics( slider.getFont() ); return trackY + Math.round( (trackHeight - fm.getHeight()) / 2f ) + fm.getAscent() - 1;
return trackRect.y + Math.round( (trackRect.height - fm.getHeight()) / 2f ) + fm.getAscent() - 1;
} }
@Override @Override

View File

@@ -219,15 +219,7 @@ public class FlatSpinnerUI
@Override @Override
protected JComponent createEditor() { protected JComponent createEditor() {
JComponent editor = super.createEditor(); JComponent editor = super.createEditor();
configureEditor( editor );
// explicitly make non-opaque
editor.setOpaque( false );
JTextField textField = getEditorTextField( editor );
if( textField != null )
textField.setOpaque( false );
updateEditorPadding();
updateEditorColors();
return editor; return editor;
} }
@@ -235,8 +227,19 @@ public class FlatSpinnerUI
protected void replaceEditor( JComponent oldEditor, JComponent newEditor ) { protected void replaceEditor( JComponent oldEditor, JComponent newEditor ) {
super.replaceEditor( oldEditor, newEditor ); super.replaceEditor( oldEditor, newEditor );
configureEditor( newEditor );
removeEditorFocusListener( oldEditor ); removeEditorFocusListener( oldEditor );
addEditorFocusListener( newEditor ); addEditorFocusListener( newEditor );
}
/** @since 1.6 */
protected void configureEditor( JComponent editor ) {
// explicitly make non-opaque
editor.setOpaque( false );
JTextField textField = getEditorTextField( editor );
if( textField != null )
textField.setOpaque( false );
updateEditorPadding(); updateEditorPadding();
updateEditorColors(); updateEditorColors();

View File

@@ -25,6 +25,7 @@ import java.awt.Insets;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import javax.swing.JScrollBar; import javax.swing.JScrollBar;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JViewport;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.table.JTableHeader; import javax.swing.table.JTableHeader;
@@ -45,7 +46,7 @@ public class FlatTableHeaderBorder
{ {
protected Color separatorColor = UIManager.getColor( "TableHeader.separatorColor" ); protected Color separatorColor = UIManager.getColor( "TableHeader.separatorColor" );
protected Color bottomSeparatorColor = UIManager.getColor( "TableHeader.bottomSeparatorColor" ); protected Color bottomSeparatorColor = UIManager.getColor( "TableHeader.bottomSeparatorColor" );
protected boolean showLastVerticalLine = UIManager.getBoolean( "TableHeader.showLastVerticalLine" ); /** @since 1.6 */ protected boolean showTrailingVerticalLine = UIManager.getBoolean( "TableHeader.showTrailingVerticalLine" );
public FlatTableHeaderBorder() { public FlatTableHeaderBorder() {
super( UIManager.getInsets( "TableHeader.cellMargins" ) ); super( UIManager.getInsets( "TableHeader.cellMargins" ) );
@@ -138,15 +139,23 @@ public class FlatTableHeaderBorder
} }
protected boolean hideTrailingVerticalLine( JTableHeader header ) { protected boolean hideTrailingVerticalLine( JTableHeader header ) {
if( showLastVerticalLine ) if( showTrailingVerticalLine )
return false; return false;
// do not hide if table header is not a child of a scroll pane
Container viewport = header.getParent(); Container viewport = header.getParent();
Container viewportParent = (viewport != null) ? viewport.getParent() : null; Container viewportParent = (viewport != null) ? viewport.getParent() : null;
if( !(viewportParent instanceof JScrollPane) ) if( !(viewportParent instanceof JScrollPane) )
return true; return false;
JScrollBar vsb = ((JScrollPane)viewportParent).getVerticalScrollBar(); // do not hide if table header is not the column header of the scroll pane
JScrollPane scrollPane = (JScrollPane) viewportParent;
JViewport columnHeader = scrollPane.getColumnHeader();
if( viewport != columnHeader )
return false;
// hide if vertical scroll bar is not shown
JScrollBar vsb = scrollPane.getVerticalScrollBar();
if( vsb == null || !vsb.isVisible() ) if( vsb == null || !vsb.isVisible() )
return true; return true;

View File

@@ -66,7 +66,7 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault TableHeader.cellMargins Insets * @uiDefault TableHeader.cellMargins Insets
* @uiDefault TableHeader.separatorColor Color * @uiDefault TableHeader.separatorColor Color
* @uiDefault TableHeader.bottomSeparatorColor Color * @uiDefault TableHeader.bottomSeparatorColor Color
* @uiDefault TableHeader.showLastVerticalLine boolean * @uiDefault TableHeader.showTrailingVerticalLine boolean
* *
* <!-- FlatAscendingSortIcon and FlatDescendingSortIcon --> * <!-- FlatAscendingSortIcon and FlatDescendingSortIcon -->
* *

View File

@@ -75,7 +75,7 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault Table.rowHeight int * @uiDefault Table.rowHeight int
* @uiDefault Table.showHorizontalLines boolean * @uiDefault Table.showHorizontalLines boolean
* @uiDefault Table.showVerticalLines boolean * @uiDefault Table.showVerticalLines boolean
* @uiDefault Table.showLastVerticalLine boolean * @uiDefault Table.showTrailingVerticalLine boolean
* @uiDefault Table.intercellSpacing Dimension * @uiDefault Table.intercellSpacing Dimension
* @uiDefault Table.selectionInactiveBackground Color * @uiDefault Table.selectionInactiveBackground Color
* @uiDefault Table.selectionInactiveForeground Color * @uiDefault Table.selectionInactiveForeground Color
@@ -98,7 +98,7 @@ public class FlatTableUI
{ {
protected boolean showHorizontalLines; protected boolean showHorizontalLines;
protected boolean showVerticalLines; protected boolean showVerticalLines;
protected boolean showLastVerticalLine; /** @since 1.6 */ protected boolean showTrailingVerticalLine;
protected Dimension intercellSpacing; protected Dimension intercellSpacing;
@Styleable protected Color selectionBackground; @Styleable protected Color selectionBackground;
@@ -135,7 +135,7 @@ public class FlatTableUI
showHorizontalLines = UIManager.getBoolean( "Table.showHorizontalLines" ); showHorizontalLines = UIManager.getBoolean( "Table.showHorizontalLines" );
showVerticalLines = UIManager.getBoolean( "Table.showVerticalLines" ); showVerticalLines = UIManager.getBoolean( "Table.showVerticalLines" );
showLastVerticalLine = UIManager.getBoolean( "Table.showLastVerticalLine" ); showTrailingVerticalLine = UIManager.getBoolean( "Table.showTrailingVerticalLine" );
intercellSpacing = UIManager.getDimension( "Table.intercellSpacing" ); intercellSpacing = UIManager.getDimension( "Table.intercellSpacing" );
selectionBackground = UIManager.getColor( "Table.selectionBackground" ); selectionBackground = UIManager.getColor( "Table.selectionBackground" );
@@ -392,9 +392,10 @@ public class FlatTableUI
} }
protected boolean hideLastVerticalLine() { protected boolean hideLastVerticalLine() {
if( showLastVerticalLine ) if( showTrailingVerticalLine )
return false; return false;
// do not hide if table is not a child of a scroll pane
Container viewport = SwingUtilities.getUnwrappedParent( table ); Container viewport = SwingUtilities.getUnwrappedParent( table );
Container viewportParent = (viewport != null) ? viewport.getParent() : null; Container viewportParent = (viewport != null) ? viewport.getParent() : null;
if( !(viewportParent instanceof JScrollPane) ) if( !(viewportParent instanceof JScrollPane) )

View File

@@ -70,9 +70,10 @@ public class JBRCustomDecorations
return null; return null;
// check whether root pane already has a parent, which is the case when switching LaF // check whether root pane already has a parent, which is the case when switching LaF
Window window = SwingUtilities.windowForComponent( rootPane ); Container parent = rootPane.getParent();
if( window != null ) { if( parent != null ) {
FlatNativeWindowBorder.install( window ); if( parent instanceof Window )
FlatNativeWindowBorder.install( (Window) parent );
return null; return null;
} }
@@ -110,9 +111,9 @@ public class JBRCustomDecorations
// since it is actually not possible to uninstall JBR decorations, // since it is actually not possible to uninstall JBR decorations,
// simply reduce titleBarHeight so that it is still possible to resize window // simply reduce titleBarHeight so that it is still possible to resize window
// and remove hitTestSpots // and remove hitTestSpots
Window window = SwingUtilities.windowForComponent( rootPane ); Container parent = rootPane.getParent();
if( window != null ) if( parent instanceof Window )
setHasCustomDecoration( window, false ); setHasCustomDecoration( (Window) parent, false );
} }
static boolean hasCustomDecoration( Window window ) { static boolean hasCustomDecoration( Window window ) {

View File

@@ -628,7 +628,7 @@ TabbedPane.closeCrossLineWidth = {float}1
Table.rowHeight = 20 Table.rowHeight = 20
Table.showHorizontalLines = false Table.showHorizontalLines = false
Table.showVerticalLines = false Table.showVerticalLines = false
Table.showLastVerticalLine = false Table.showTrailingVerticalLine = false
Table.consistentHomeEndKeyBehavior = true Table.consistentHomeEndKeyBehavior = true
Table.intercellSpacing = {dimension}0,0 Table.intercellSpacing = {dimension}0,0
Table.scrollPaneBorder = com.formdev.flatlaf.ui.FlatBorder Table.scrollPaneBorder = com.formdev.flatlaf.ui.FlatBorder
@@ -658,7 +658,7 @@ TableHeader.cellBorder = com.formdev.flatlaf.ui.FlatTableHeaderBorder
TableHeader.cellMargins = 2,3,2,3 TableHeader.cellMargins = 2,3,2,3
TableHeader.focusCellBackground = $TableHeader.background TableHeader.focusCellBackground = $TableHeader.background
TableHeader.background = @textComponentBackground TableHeader.background = @textComponentBackground
TableHeader.showLastVerticalLine = false TableHeader.showTrailingVerticalLine = false
#---- TextArea ---- #---- TextArea ----

View File

@@ -1078,7 +1078,7 @@ Table.selectionForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.Colo
Table.selectionInactiveBackground #0d293e HSL 206 65 15 javax.swing.plaf.ColorUIResource [UI] Table.selectionInactiveBackground #0d293e HSL 206 65 15 javax.swing.plaf.ColorUIResource [UI]
Table.selectionInactiveForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] Table.selectionInactiveForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
Table.showHorizontalLines false Table.showHorizontalLines false
Table.showLastVerticalLine false Table.showTrailingVerticalLine false
Table.showVerticalLines false Table.showVerticalLines false
Table.sortIconColor #adadad HSL 0 0 68 javax.swing.plaf.ColorUIResource [UI] Table.sortIconColor #adadad HSL 0 0 68 javax.swing.plaf.ColorUIResource [UI]
@@ -1094,7 +1094,7 @@ TableHeader.font [active] $defaultFont [UI]
TableHeader.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] TableHeader.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
TableHeader.height 25 TableHeader.height 25
TableHeader.separatorColor #5e6364 HSL 190 3 38 javax.swing.plaf.ColorUIResource [UI] TableHeader.separatorColor #5e6364 HSL 190 3 38 javax.swing.plaf.ColorUIResource [UI]
TableHeader.showLastVerticalLine false TableHeader.showTrailingVerticalLine false
TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI

View File

@@ -1083,7 +1083,7 @@ Table.selectionForeground #ffffff HSL 0 0 100 javax.swing.plaf.Colo
Table.selectionInactiveBackground #d4d4d4 HSL 0 0 83 javax.swing.plaf.ColorUIResource [UI] Table.selectionInactiveBackground #d4d4d4 HSL 0 0 83 javax.swing.plaf.ColorUIResource [UI]
Table.selectionInactiveForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] Table.selectionInactiveForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
Table.showHorizontalLines false Table.showHorizontalLines false
Table.showLastVerticalLine false Table.showTrailingVerticalLine false
Table.showVerticalLines false Table.showVerticalLines false
Table.sortIconColor #afafaf HSL 0 0 69 javax.swing.plaf.ColorUIResource [UI] Table.sortIconColor #afafaf HSL 0 0 69 javax.swing.plaf.ColorUIResource [UI]
@@ -1099,7 +1099,7 @@ TableHeader.font [active] $defaultFont [UI]
TableHeader.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] TableHeader.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
TableHeader.height 25 TableHeader.height 25
TableHeader.separatorColor #e6e6e6 HSL 0 0 90 javax.swing.plaf.ColorUIResource [UI] TableHeader.separatorColor #e6e6e6 HSL 0 0 90 javax.swing.plaf.ColorUIResource [UI]
TableHeader.showLastVerticalLine false TableHeader.showTrailingVerticalLine false
TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI

View File

@@ -1088,7 +1088,7 @@ Table.selectionForeground #ffff00 HSL 60 100 50 javax.swing.plaf.Colo
Table.selectionInactiveBackground #888888 HSL 0 0 53 javax.swing.plaf.ColorUIResource [UI] Table.selectionInactiveBackground #888888 HSL 0 0 53 javax.swing.plaf.ColorUIResource [UI]
Table.selectionInactiveForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] Table.selectionInactiveForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
Table.showHorizontalLines false Table.showHorizontalLines false
Table.showLastVerticalLine false Table.showTrailingVerticalLine false
Table.showVerticalLines false Table.showVerticalLines false
Table.sortIconColor #ffff00 HSL 60 100 50 javax.swing.plaf.ColorUIResource [UI] Table.sortIconColor #ffff00 HSL 60 100 50 javax.swing.plaf.ColorUIResource [UI]
@@ -1104,7 +1104,7 @@ TableHeader.font [active] $defaultFont [UI]
TableHeader.foreground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] TableHeader.foreground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
TableHeader.height 25 TableHeader.height 25
TableHeader.separatorColor #00ff00 HSL 120 100 50 javax.swing.plaf.ColorUIResource [UI] TableHeader.separatorColor #00ff00 HSL 120 100 50 javax.swing.plaf.ColorUIResource [UI]
TableHeader.showLastVerticalLine false TableHeader.showTrailingVerticalLine false
TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI

View File

@@ -1621,6 +1621,10 @@ public class FlatComponentsTest
// customRenderer.setBorder( new LineBorder( Color.red ) ); // customRenderer.setBorder( new LineBorder( Color.red ) );
// comboBox1.setRenderer( customRenderer ); // comboBox1.setRenderer( customRenderer );
// comboBox3.setRenderer( customRenderer ); // comboBox3.setRenderer( customRenderer );
// for testing issue #382
// spinner1.setModel( new SpinnerNumberModel( 0, null, 100, 1 ) );
// comboBox1.setEditor( new BasicComboBoxEditor() );
} }
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables

View File

@@ -139,6 +139,8 @@ public class FlatSingleComponentTest
applyComponentOrientation( getComponentOrientation().isLeftToRight() applyComponentOrientation( getComponentOrientation().isLeftToRight()
? ComponentOrientation.RIGHT_TO_LEFT ? ComponentOrientation.RIGHT_TO_LEFT
: ComponentOrientation.LEFT_TO_RIGHT ); : ComponentOrientation.LEFT_TO_RIGHT );
revalidate();
repaint();
}, },
KeyStroke.getKeyStroke( "alt R" ), KeyStroke.getKeyStroke( "alt R" ),
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ); JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );

View File

@@ -831,14 +831,14 @@ class FlatThemeFileEditor
state.put( KEY_WINDOW_BOUNDS, x + "," + y + ',' + width + ',' + height ); state.put( KEY_WINDOW_BOUNDS, x + "," + y + ',' + width + ',' + height );
} }
private static void putPrefsBoolean( Preferences prefs, String key, boolean value, boolean defaultValue ) { static void putPrefsBoolean( Preferences prefs, String key, boolean value, boolean defaultValue ) {
if( value != defaultValue ) if( value != defaultValue )
prefs.putBoolean( key, value ); prefs.putBoolean( key, value );
else else
prefs.remove( key ); prefs.remove( key );
} }
private static void putPrefsString( Preferences prefs, String key, String value ) { static void putPrefsString( Preferences prefs, String key, String value ) {
if( !StringUtils.isEmpty( value ) ) if( !StringUtils.isEmpty( value ) )
prefs.put( key, value ); prefs.put( key, value );
else else

View File

@@ -41,7 +41,11 @@ class FlatThemePreview
private final FlatSyntaxTextArea textArea; private final FlatSyntaxTextArea textArea;
private final Timer timer; private final Timer timer;
private final Preferences state; final Preferences state;
private final FlatThemePreviewAll allTab;
private final FlatThemePreviewButtons buttonsTab;
private final FlatThemePreviewSwitches switchesTab;
private final Map<LazyValue, Object> lazyValueCache = new WeakHashMap<>(); private final Map<LazyValue, Object> lazyValueCache = new WeakHashMap<>();
private int runWithUIDefaultsGetterLevel; private int runWithUIDefaultsGetterLevel;
@@ -53,9 +57,12 @@ class FlatThemePreview
initComponents(); initComponents();
// add tabs // add tabs
tabbedPane.addTab( "All", createPreviewTab( new FlatThemePreviewAll( this ) ) ); allTab = new FlatThemePreviewAll( this );
tabbedPane.addTab( "Buttons", createPreviewTab( new FlatThemePreviewButtons() ) ); buttonsTab = new FlatThemePreviewButtons( this );
tabbedPane.addTab( "Switches", createPreviewTab( new FlatThemePreviewSwitches() ) ); switchesTab = new FlatThemePreviewSwitches();
tabbedPane.addTab( "All", createPreviewTab( allTab ) );
tabbedPane.addTab( "Buttons", createPreviewTab( buttonsTab ) );
tabbedPane.addTab( "Switches", createPreviewTab( switchesTab ) );
selectRecentTab(); selectRecentTab();
tabbedPane.addChangeListener( e -> selectedTabChanged() ); tabbedPane.addChangeListener( e -> selectedTabChanged() );
@@ -85,8 +92,14 @@ class FlatThemePreview
private void selectRecentTab() { private void selectRecentTab() {
int selectedTab = state.getInt( KEY_SELECTED_TAB, -1 ); int selectedTab = state.getInt( KEY_SELECTED_TAB, -1 );
if( selectedTab >= 0 && selectedTab < tabbedPane.getTabCount() ) if( selectedTab >= 0 && selectedTab < tabbedPane.getTabCount() ) {
tabbedPane.setSelectedIndex( selectedTab ); tabbedPane.setSelectedIndex( selectedTab );
switch( selectedTab ) {
case 0: allTab.activated(); break;
case 1: buttonsTab.activated(); break;
}
}
} }
private void selectedTabChanged() { private void selectedTabChanged() {

View File

@@ -19,6 +19,7 @@ package com.formdev.flatlaf.themeeditor;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.beans.Beans;
import java.beans.PropertyVetoException; import java.beans.PropertyVetoException;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
@@ -39,6 +40,11 @@ import net.miginfocom.swing.*;
class FlatThemePreviewAll class FlatThemePreviewAll
extends JPanel extends JPanel
{ {
private static final String KEY_ENABLED = "preview.enabled";
private static final String KEY_EDITABLE = "preview.editable";
private static final String KEY_FOCUSED = "preview.focused";
private static final String KEY_MENU_UNDERLINE_SELECTION = "preview.menuUnderlineSelection";
private final FlatThemePreview preview; private final FlatThemePreview preview;
FlatThemePreviewAll( FlatThemePreview preview ) { FlatThemePreviewAll( FlatThemePreview preview ) {
@@ -78,6 +84,33 @@ class FlatThemePreviewAll
} ); } );
} }
void activated() {
boolean enabled = preview.state.getBoolean( KEY_ENABLED, true );
boolean editable = preview.state.getBoolean( KEY_EDITABLE, true );
boolean focused = preview.state.getBoolean( KEY_FOCUSED, false );
boolean menuUnderlineSelection = preview.state.getBoolean( KEY_MENU_UNDERLINE_SELECTION, false );
if( enabled != enabledCheckBox.isSelected() ) {
enabledCheckBox.setSelected( enabled );
enabledChanged();
}
if( editable != editableCheckBox.isSelected() ) {
editableCheckBox.setSelected( editable );
editableChanged();
}
if( focused != focusedCheckBox.isSelected() ) {
focusedCheckBox.setSelected( focused );
focusedChanged();
}
if( menuUnderlineSelection != menuUnderlineSelectionButton.isSelected() ) {
menuUnderlineSelectionButton.setSelected( menuUnderlineSelection );
menuUnderlineSelectionChanged();
}
}
private void enabledChanged() { private void enabledChanged() {
boolean enabled = enabledCheckBox.isSelected(); boolean enabled = enabledCheckBox.isSelected();
@@ -89,10 +122,12 @@ class FlatThemePreviewAll
preview.runWithUIDefaultsGetter( () -> { preview.runWithUIDefaultsGetter( () -> {
enableDisable( this, enabled ); enableDisable( this, enabled );
} ); } );
FlatThemeFileEditor.putPrefsBoolean( preview.state, KEY_ENABLED, enabled, true );
} }
private void enableDisable( Component comp, boolean enabled ) { private void enableDisable( Component comp, boolean enabled ) {
if( comp != enabledCheckBox && comp != focusedCheckBox && comp != menu2 ) if( !isControlComponent( comp ) )
comp.setEnabled( enabled ); comp.setEnabled( enabled );
if( !(comp instanceof Container) || comp instanceof JInternalFrame ) if( !(comp instanceof Container) || comp instanceof JInternalFrame )
@@ -119,16 +154,38 @@ class FlatThemePreviewAll
} }
} }
private void editableChanged() {
boolean editable = editableCheckBox.isSelected();
preview.runWithUIDefaultsGetter( () -> {
textField1.setEditable( editable );
formattedTextField1.setEditable( editable );
passwordField1.setEditable( editable );
textArea1.setEditable( editable );
editorPane1.setEditable( editable );
textPane1.setEditable( editable );
editorPane1.updateUI();
textPane1.updateUI();
} );
FlatThemeFileEditor.putPrefsBoolean( preview.state, KEY_EDITABLE, editable, true );
}
private void focusedChanged() { private void focusedChanged() {
Predicate<JComponent> value = focusedCheckBox.isSelected() && enabledCheckBox.isSelected() boolean focused = focusedCheckBox.isSelected();
Predicate<JComponent> value = focused && enabledCheckBox.isSelected()
? value = c -> true ? value = c -> true
: null; : null;
focusComponent( this, value ); focusComponent( this, value );
repaint(); repaint();
FlatThemeFileEditor.putPrefsBoolean( preview.state, KEY_FOCUSED, focused,false );
} }
private void focusComponent( Component comp, Object value ) { private void focusComponent( Component comp, Object value ) {
if( comp != enabledCheckBox && comp != focusedCheckBox && comp != menu2 && comp instanceof JComponent ) if( !isControlComponent( comp ) && comp instanceof JComponent )
((JComponent)comp).putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER, value ); ((JComponent)comp).putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER, value );
if( !(comp instanceof Container) || comp instanceof JInternalFrame ) if( !(comp instanceof Container) || comp instanceof JInternalFrame )
@@ -142,6 +199,21 @@ class FlatThemePreviewAll
} }
} }
private boolean isControlComponent( Component c ) {
return c == enabledCheckBox ||
c == editableCheckBox ||
c == focusedCheckBox ||
c == menuUnderlineSelectionButton ||
c == menu2;
}
private void menuUnderlineSelectionChanged() {
boolean menuUnderlineSelection = menuUnderlineSelectionButton.isSelected();
UIManager.put( "MenuItem.selectionType", menuUnderlineSelection ? "underline" : null );
FlatThemeFileEditor.putPrefsBoolean( preview.state, KEY_MENU_UNDERLINE_SELECTION, menuUnderlineSelection, false );
}
private void changeProgress() { private void changeProgress() {
int value = slider3.getValue(); int value = slider3.getValue();
progressBar1.setValue( value ); progressBar1.setValue( value );
@@ -165,7 +237,9 @@ class FlatThemePreviewAll
private void initComponents() { private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JPanel hSpacer1 = new JPanel(null);
enabledCheckBox = new JCheckBox(); enabledCheckBox = new JCheckBox();
editableCheckBox = new JCheckBox();
focusedCheckBox = new JCheckBox(); focusedCheckBox = new JCheckBox();
JLabel labelLabel = new JLabel(); JLabel labelLabel = new JLabel();
JLabel label1 = new JLabel(); JLabel label1 = new JLabel();
@@ -173,20 +247,15 @@ class FlatThemePreviewAll
JLabel buttonLabel = new JLabel(); JLabel buttonLabel = new JLabel();
JButton button1 = new JButton(); JButton button1 = new JButton();
FlatThemePreviewAll.PreviewDefaultButton testDefaultButton1 = new FlatThemePreviewAll.PreviewDefaultButton(); FlatThemePreviewAll.PreviewDefaultButton testDefaultButton1 = new FlatThemePreviewAll.PreviewDefaultButton();
FlatButton helpButton = new FlatButton();
JPanel hSpacer2 = new JPanel(null);
JLabel toggleButtonLabel = new JLabel(); JLabel toggleButtonLabel = new JLabel();
JToggleButton toggleButton1 = new JToggleButton(); JToggleButton toggleButton1 = new JToggleButton();
JToggleButton toggleButton3 = new JToggleButton(); JToggleButton toggleButton3 = new JToggleButton();
JPanel hSpacer1 = new JPanel(null);
JLabel checkBoxLabel = new JLabel(); JLabel checkBoxLabel = new JLabel();
JCheckBox checkBox1 = new JCheckBox(); JCheckBox checkBox1 = new JCheckBox();
JCheckBox checkBox3 = new JCheckBox(); JCheckBox checkBox3 = new JCheckBox();
JPanel hSpacer3 = new JPanel(null);
JLabel radioButtonLabel = new JLabel(); JLabel radioButtonLabel = new JLabel();
JRadioButton radioButton1 = new JRadioButton(); JRadioButton radioButton1 = new JRadioButton();
JRadioButton radioButton3 = new JRadioButton(); JRadioButton radioButton3 = new JRadioButton();
JPanel hSpacer4 = new JPanel(null);
JLabel comboBoxLabel = new JLabel(); JLabel comboBoxLabel = new JLabel();
FlatComboBox<String> comboBox1 = new FlatComboBox<>(); FlatComboBox<String> comboBox1 = new FlatComboBox<>();
JComboBox<String> comboBox3 = new JComboBox<>(); JComboBox<String> comboBox3 = new JComboBox<>();
@@ -194,16 +263,17 @@ class FlatThemePreviewAll
JSpinner spinner1 = new JSpinner(); JSpinner spinner1 = new JSpinner();
JLabel textFieldLabel = new JLabel(); JLabel textFieldLabel = new JLabel();
textField1 = new FlatTextField(); textField1 = new FlatTextField();
FlatFormattedTextField formattedTextField1 = new FlatFormattedTextField(); formattedTextField1 = new FlatFormattedTextField();
FlatPasswordField passwordField1 = new FlatPasswordField(); passwordField1 = new FlatPasswordField();
JLabel textAreaLabel = new JLabel(); JLabel textAreaLabel = new JLabel();
JScrollPane scrollPane1 = new JScrollPane(); JScrollPane scrollPane1 = new JScrollPane();
JTextArea textArea1 = new JTextArea(); textArea1 = new JTextArea();
JScrollPane scrollPane5 = new JScrollPane(); JScrollPane scrollPane5 = new JScrollPane();
JEditorPane editorPane1 = new JEditorPane(); editorPane1 = new JEditorPane();
JScrollPane scrollPane9 = new JScrollPane(); JScrollPane scrollPane9 = new JScrollPane();
JTextPane textPane1 = new JTextPane(); textPane1 = new JTextPane();
JLabel menuBarLabel = new JLabel(); JLabel menuBarLabel = new JLabel();
menuUnderlineSelectionButton = new FlatToggleButton();
JMenuBar menuBar1 = new JMenuBar(); JMenuBar menuBar1 = new JMenuBar();
menu2 = new JMenu(); menu2 = new JMenu();
JMenuItem menuItem3 = new JMenuItem(); JMenuItem menuItem3 = new JMenuItem();
@@ -239,6 +309,7 @@ class FlatThemePreviewAll
JButton button6 = new JButton(); JButton button6 = new JButton();
JToggleButton button7 = new JToggleButton(); JToggleButton button7 = new JToggleButton();
JToggleButton button8 = new JToggleButton(); JToggleButton button8 = new JToggleButton();
JToggleButton button9 = new JToggleButton();
JLabel tabbedPaneLabel = new JLabel(); JLabel tabbedPaneLabel = new JLabel();
tabbedPane1 = new FlatThemePreviewAll.PreviewTabbedPane(); tabbedPane1 = new FlatThemePreviewAll.PreviewTabbedPane();
JLabel listTreeLabel = new JLabel(); JLabel listTreeLabel = new JLabel();
@@ -260,15 +331,10 @@ class FlatThemePreviewAll
"insets dialog,hidemode 3", "insets dialog,hidemode 3",
// columns // columns
"[fill]" + "[fill]" +
"[130,fill]", "[60,sizegroup 1,fill]" +
"[60,sizegroup 1,fill]",
// rows // rows
"[]unrel" + "[]para" +
"[]" +
"[]" +
"[]" +
"[]" +
"[]" +
"[]" +
"[]" + "[]" +
"[]" + "[]" +
"[]" + "[]" +
@@ -278,9 +344,14 @@ class FlatThemePreviewAll
"[]" + "[]" +
"[]" + "[]" +
"[]" + "[]" +
"[fill]" +
"[]" +
"[]4" +
"[]" + "[]" +
"[]" + "[]" +
"[]0" +
"[]" + "[]" +
"[]0" +
"[]" + "[]" +
"[]" + "[]" +
"[]" + "[]" +
@@ -289,17 +360,24 @@ class FlatThemePreviewAll
"[]" + "[]" +
"[100,fill]" + "[100,fill]" +
"[grow]")); "[grow]"));
add(hSpacer1, "cell 0 0 3 1,growx");
//---- enabledCheckBox ---- //---- enabledCheckBox ----
enabledCheckBox.setText("Enabled"); enabledCheckBox.setText("Enabled");
enabledCheckBox.setSelected(true); enabledCheckBox.setSelected(true);
enabledCheckBox.addActionListener(e -> enabledChanged()); enabledCheckBox.addActionListener(e -> enabledChanged());
add(enabledCheckBox, "cell 0 0 2 1,alignx left,growx 0"); add(enabledCheckBox, "cell 0 0 3 1");
//---- editableCheckBox ----
editableCheckBox.setText("Editable");
editableCheckBox.setSelected(true);
editableCheckBox.addActionListener(e -> editableChanged());
add(editableCheckBox, "cell 0 0 3 1");
//---- focusedCheckBox ---- //---- focusedCheckBox ----
focusedCheckBox.setText("Focused"); focusedCheckBox.setText("Focused");
focusedCheckBox.addActionListener(e -> focusedChanged()); focusedCheckBox.addActionListener(e -> focusedChanged());
add(focusedCheckBox, "cell 0 0 2 1"); add(focusedCheckBox, "cell 0 0 3 1");
//---- labelLabel ---- //---- labelLabel ----
labelLabel.setText("JLabel:"); labelLabel.setText("JLabel:");
@@ -307,7 +385,7 @@ class FlatThemePreviewAll
//---- label1 ---- //---- label1 ----
label1.setText("Some Text"); label1.setText("Some Text");
add(label1, "cell 1 1"); add(label1, "cell 1 1 2 1");
//---- flatButton1 ---- //---- flatButton1 ----
flatButton1.setText("Help"); flatButton1.setText("Help");
@@ -321,16 +399,11 @@ class FlatThemePreviewAll
//---- button1 ---- //---- button1 ----
button1.setText("OK"); button1.setText("OK");
add(button1, "cell 1 2,alignx left,growx 0"); add(button1, "cell 1 2");
//---- testDefaultButton1 ---- //---- testDefaultButton1 ----
testDefaultButton1.setText("Default"); testDefaultButton1.setText("Default");
add(testDefaultButton1, "cell 1 2"); add(testDefaultButton1, "cell 2 2");
//---- helpButton ----
helpButton.setButtonType(FlatButton.ButtonType.help);
add(helpButton, "cell 1 2");
add(hSpacer2, "cell 1 2");
//---- toggleButtonLabel ---- //---- toggleButtonLabel ----
toggleButtonLabel.setText("JToggleButton:"); toggleButtonLabel.setText("JToggleButton:");
@@ -338,13 +411,12 @@ class FlatThemePreviewAll
//---- toggleButton1 ---- //---- toggleButton1 ----
toggleButton1.setText("Unselected"); toggleButton1.setText("Unselected");
add(toggleButton1, "cell 1 3,alignx left,growx 0"); add(toggleButton1, "cell 1 3");
//---- toggleButton3 ---- //---- toggleButton3 ----
toggleButton3.setText("Selected"); toggleButton3.setText("Selected");
toggleButton3.setSelected(true); toggleButton3.setSelected(true);
add(toggleButton3, "cell 1 3"); add(toggleButton3, "cell 2 3");
add(hSpacer1, "cell 1 3");
//---- checkBoxLabel ---- //---- checkBoxLabel ----
checkBoxLabel.setText("JCheckBox"); checkBoxLabel.setText("JCheckBox");
@@ -357,8 +429,7 @@ class FlatThemePreviewAll
//---- checkBox3 ---- //---- checkBox3 ----
checkBox3.setText("Selected"); checkBox3.setText("Selected");
checkBox3.setSelected(true); checkBox3.setSelected(true);
add(checkBox3, "cell 1 4,alignx left,growx 0"); add(checkBox3, "cell 2 4,alignx left,growx 0");
add(hSpacer3, "cell 1 4");
//---- radioButtonLabel ---- //---- radioButtonLabel ----
radioButtonLabel.setText("JRadioButton:"); radioButtonLabel.setText("JRadioButton:");
@@ -371,8 +442,7 @@ class FlatThemePreviewAll
//---- radioButton3 ---- //---- radioButton3 ----
radioButton3.setText("Selected"); radioButton3.setText("Selected");
radioButton3.setSelected(true); radioButton3.setSelected(true);
add(radioButton3, "cell 1 5,alignx left,growx 0"); add(radioButton3, "cell 2 5,alignx left,growx 0");
add(hSpacer4, "cell 1 5");
//---- comboBoxLabel ---- //---- comboBoxLabel ----
comboBoxLabel.setText("JComboBox:"); comboBoxLabel.setText("JComboBox:");
@@ -396,7 +466,7 @@ class FlatThemePreviewAll
})); }));
comboBox1.setMaximumRowCount(6); comboBox1.setMaximumRowCount(6);
comboBox1.setPlaceholderText("placeholder text"); comboBox1.setPlaceholderText("placeholder text");
add(comboBox1, "cell 1 6,width 50"); add(comboBox1, "cell 1 6");
//---- comboBox3 ---- //---- comboBox3 ----
comboBox3.setModel(new DefaultComboBoxModel<>(new String[] { comboBox3.setModel(new DefaultComboBoxModel<>(new String[] {
@@ -414,12 +484,12 @@ class FlatThemePreviewAll
"kkk" "kkk"
})); }));
comboBox3.setMaximumRowCount(6); comboBox3.setMaximumRowCount(6);
add(comboBox3, "cell 1 6,width 50"); add(comboBox3, "cell 2 6");
//---- spinnerLabel ---- //---- spinnerLabel ----
spinnerLabel.setText("JSpinner:"); spinnerLabel.setText("JSpinner:");
add(spinnerLabel, "cell 0 7"); add(spinnerLabel, "cell 0 7");
add(spinner1, "cell 1 7"); add(spinner1, "cell 1 7 2 1");
//---- textFieldLabel ---- //---- textFieldLabel ----
textFieldLabel.setText("<html>JTextField:<br>JFormattedTextF.:<br>JPasswordField:</html>"); textFieldLabel.setText("<html>JTextField:<br>JFormattedTextF.:<br>JPasswordField:</html>");
@@ -428,21 +498,21 @@ class FlatThemePreviewAll
//---- textField1 ---- //---- textField1 ----
textField1.setText("Some Text"); textField1.setText("Some Text");
textField1.setPlaceholderText("placeholder text"); textField1.setPlaceholderText("placeholder text");
add(textField1, "cell 1 8"); add(textField1, "cell 1 8 2 1");
//---- formattedTextField1 ---- //---- formattedTextField1 ----
formattedTextField1.setText("Some Text"); formattedTextField1.setText("Some Text");
formattedTextField1.setPlaceholderText("placeholder text"); formattedTextField1.setPlaceholderText("placeholder text");
add(formattedTextField1, "cell 1 9,width 50"); add(formattedTextField1, "cell 1 9");
//---- passwordField1 ---- //---- passwordField1 ----
passwordField1.setText("Some Text"); passwordField1.setText("Some Text");
passwordField1.setPlaceholderText("placeholder text"); passwordField1.setPlaceholderText("placeholder text");
add(passwordField1, "cell 1 9,width 50"); add(passwordField1, "cell 2 9");
//---- textAreaLabel ---- //---- textAreaLabel ----
textAreaLabel.setText("<html>JTextArea:<br><br>JEditorPane:<br>JTextPane:</html>"); textAreaLabel.setText("<html>JTextArea:<br>JEditorPane:<br>JTextPane:</html>");
add(textAreaLabel, "cell 0 10 1 2"); add(textAreaLabel, "cell 0 10");
//======== scrollPane1 ======== //======== scrollPane1 ========
{ {
@@ -450,11 +520,11 @@ class FlatThemePreviewAll
scrollPane1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- textArea1 ---- //---- textArea1 ----
textArea1.setText("Some Text"); textArea1.setText("Text");
textArea1.setRows(2); textArea1.setRows(2);
scrollPane1.setViewportView(textArea1); scrollPane1.setViewportView(textArea1);
} }
add(scrollPane1, "cell 1 10"); add(scrollPane1, "cell 1 10 2 1,width 40");
//======== scrollPane5 ======== //======== scrollPane5 ========
{ {
@@ -462,10 +532,10 @@ class FlatThemePreviewAll
scrollPane5.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane5.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- editorPane1 ---- //---- editorPane1 ----
editorPane1.setText("Some Text"); editorPane1.setText("Text");
scrollPane5.setViewportView(editorPane1); scrollPane5.setViewportView(editorPane1);
} }
add(scrollPane5, "cell 1 11,width 50"); add(scrollPane5, "cell 1 10 2 1,width 40");
//======== scrollPane9 ======== //======== scrollPane9 ========
{ {
@@ -473,14 +543,23 @@ class FlatThemePreviewAll
scrollPane9.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane9.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- textPane1 ---- //---- textPane1 ----
textPane1.setText("Some Text"); textPane1.setText("Text");
scrollPane9.setViewportView(textPane1); scrollPane9.setViewportView(textPane1);
} }
add(scrollPane9, "cell 1 11,width 50"); add(scrollPane9, "cell 1 10 2 1,width 40");
//---- menuBarLabel ---- //---- menuBarLabel ----
menuBarLabel.setText("JMenuBar:"); menuBarLabel.setText("JMenuBar:");
add(menuBarLabel, "cell 0 12"); add(menuBarLabel, "cell 0 11");
//---- menuUnderlineSelectionButton ----
menuUnderlineSelectionButton.setText("_");
menuUnderlineSelectionButton.setButtonType(FlatButton.ButtonType.toolBarButton);
menuUnderlineSelectionButton.setToolTipText("menu underline selection");
menuUnderlineSelectionButton.setFocusable(false);
menuUnderlineSelectionButton.setFont(menuUnderlineSelectionButton.getFont().deriveFont(menuUnderlineSelectionButton.getFont().getSize() - 2f));
menuUnderlineSelectionButton.addActionListener(e -> menuUnderlineSelectionChanged());
add(menuUnderlineSelectionButton, "cell 0 11");
//======== menuBar1 ======== //======== menuBar1 ========
{ {
@@ -558,33 +637,33 @@ class FlatThemePreviewAll
} }
menuBar1.add(menu3); menuBar1.add(menu3);
} }
add(menuBar1, "cell 1 12"); add(menuBar1, "cell 1 11 2 1");
//---- scrollBarLabel ---- //---- scrollBarLabel ----
scrollBarLabel.setText("JScrollBar:"); scrollBarLabel.setText("JScrollBar:");
add(scrollBarLabel, "cell 0 13"); add(scrollBarLabel, "cell 0 12 1 2,aligny top,growy 0");
//---- scrollBar1 ---- //---- scrollBar1 ----
scrollBar1.setOrientation(Adjustable.HORIZONTAL); scrollBar1.setOrientation(Adjustable.HORIZONTAL);
add(scrollBar1, "cell 1 13"); add(scrollBar1, "cell 1 12 2 1");
//---- scrollBar5 ---- //---- scrollBar5 ----
scrollBar5.setOrientation(Adjustable.HORIZONTAL); scrollBar5.setOrientation(Adjustable.HORIZONTAL);
scrollBar5.setShowButtons(true); scrollBar5.setShowButtons(true);
add(scrollBar5, "cell 1 14"); add(scrollBar5, "cell 1 13 2 1");
//---- separatorLabel ---- //---- separatorLabel ----
separatorLabel.setText("JSeparator:"); separatorLabel.setText("JSeparator:");
add(separatorLabel, "cell 0 15"); add(separatorLabel, "cell 0 14");
add(separator1, "cell 1 15"); add(separator1, "cell 1 14 2 1");
//---- sliderLabel ---- //---- sliderLabel ----
sliderLabel.setText("JSlider:"); sliderLabel.setText("JSlider:");
add(sliderLabel, "cell 0 16"); add(sliderLabel, "cell 0 15");
//---- slider1 ---- //---- slider1 ----
slider1.setValue(30); slider1.setValue(30);
add(slider1, "cell 1 16"); add(slider1, "cell 1 15 2 1,width 100");
//---- slider3 ---- //---- slider3 ----
slider3.setMinorTickSpacing(10); slider3.setMinorTickSpacing(10);
@@ -593,32 +672,32 @@ class FlatThemePreviewAll
slider3.setPaintLabels(true); slider3.setPaintLabels(true);
slider3.setValue(30); slider3.setValue(30);
slider3.addChangeListener(e -> changeProgress()); slider3.addChangeListener(e -> changeProgress());
add(slider3, "cell 1 17"); add(slider3, "cell 1 16 2 1,width 100");
//---- progressBarLabel ---- //---- progressBarLabel ----
progressBarLabel.setText("JProgressBar:"); progressBarLabel.setText("JProgressBar:");
add(progressBarLabel, "cell 0 18"); add(progressBarLabel, "cell 0 17");
//---- progressBar1 ---- //---- progressBar1 ----
progressBar1.setValue(60); progressBar1.setValue(60);
add(progressBar1, "cell 1 18"); add(progressBar1, "cell 1 17 2 1");
//---- progressBar2 ---- //---- progressBar2 ----
progressBar2.setValue(50); progressBar2.setValue(50);
progressBar2.setStringPainted(true); progressBar2.setStringPainted(true);
add(progressBar2, "cell 1 19"); add(progressBar2, "cell 1 18 2 1");
//---- toolTipLabel ---- //---- toolTipLabel ----
toolTipLabel.setText("JToolTip:"); toolTipLabel.setText("JToolTip:");
add(toolTipLabel, "cell 0 20"); add(toolTipLabel, "cell 0 19");
//---- toolTip1 ---- //---- toolTip1 ----
toolTip1.setTipText("Some text in tool tip."); toolTip1.setTipText("Some text in tool tip.");
add(toolTip1, "cell 1 20,alignx left,growx 0"); add(toolTip1, "cell 1 19 2 1,alignx left,growx 0");
//---- toolBarLabel ---- //---- toolBarLabel ----
toolBarLabel.setText("JToolBar:"); toolBarLabel.setText("JToolBar:");
add(toolBarLabel, "cell 0 21"); add(toolBarLabel, "cell 0 20");
//======== toolBar1 ======== //======== toolBar1 ========
{ {
@@ -640,17 +719,22 @@ class FlatThemePreviewAll
button8.setIcon(UIManager.getIcon("Tree.leafIcon")); button8.setIcon(UIManager.getIcon("Tree.leafIcon"));
button8.setSelected(true); button8.setSelected(true);
toolBar1.add(button8); toolBar1.add(button8);
//---- button9 ----
button9.setIcon(UIManager.getIcon("Tree.leafIcon"));
button9.setSelected(true);
toolBar1.add(button9);
} }
add(toolBar1, "cell 1 21"); add(toolBar1, "cell 1 20 2 1");
//---- tabbedPaneLabel ---- //---- tabbedPaneLabel ----
tabbedPaneLabel.setText("JTabbedPane:"); tabbedPaneLabel.setText("JTabbedPane:");
add(tabbedPaneLabel, "cell 0 22"); add(tabbedPaneLabel, "cell 0 21");
add(tabbedPane1, "cell 1 22"); add(tabbedPane1, "cell 1 21 2 1");
//---- listTreeLabel ---- //---- listTreeLabel ----
listTreeLabel.setText("<html>JList / JTree:<br>JSplitPane:</html>"); listTreeLabel.setText("<html>JList / JTree:<br>JSplitPane:</html>");
add(listTreeLabel, "cell 0 23,aligny top,growy 0"); add(listTreeLabel, "cell 0 22,aligny top,growy 0");
//======== splitPane1 ======== //======== splitPane1 ========
{ {
@@ -693,11 +777,11 @@ class FlatThemePreviewAll
} }
splitPane1.setRightComponent(scrollPane3); splitPane1.setRightComponent(scrollPane3);
} }
add(splitPane1, "cell 1 23,height 50"); add(splitPane1, "cell 1 22 2 1,height 50");
//---- tableLabel ---- //---- tableLabel ----
tableLabel.setText("JTable:"); tableLabel.setText("JTable:");
add(tableLabel, "cell 0 24"); add(tableLabel, "cell 0 23");
//======== scrollPane4 ======== //======== scrollPane4 ========
{ {
@@ -714,11 +798,11 @@ class FlatThemePreviewAll
)); ));
scrollPane4.setViewportView(table1); scrollPane4.setViewportView(table1);
} }
add(scrollPane4, "cell 1 24,height 70"); add(scrollPane4, "cell 1 23 2 1,width 100,height 70");
//---- internalFrameLabel ---- //---- internalFrameLabel ----
internalFrameLabel.setText("<html>JDesktopPane:<br>JInternalFrame:</html>"); internalFrameLabel.setText("<html>JDesktopPane:<br>JInternalFrame:</html>");
add(internalFrameLabel, "cell 0 25,aligny top,growy 0"); add(internalFrameLabel, "cell 0 24,aligny top,growy 0");
//======== desktopPane1 ======== //======== desktopPane1 ========
{ {
@@ -751,7 +835,7 @@ class FlatThemePreviewAll
desktopPane1.add(internalFrame2, JLayeredPane.DEFAULT_LAYER); desktopPane1.add(internalFrame2, JLayeredPane.DEFAULT_LAYER);
internalFrame2.setBounds(new Rectangle(new Point(5, 50), internalFrame2.getPreferredSize())); internalFrame2.setBounds(new Rectangle(new Point(5, 50), internalFrame2.getPreferredSize()));
} }
add(desktopPane1, "cell 1 25"); add(desktopPane1, "cell 1 24 2 1");
//---- buttonGroup1 ---- //---- buttonGroup1 ----
ButtonGroup buttonGroup1 = new ButtonGroup(); ButtonGroup buttonGroup1 = new ButtonGroup();
@@ -767,8 +851,15 @@ class FlatThemePreviewAll
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JCheckBox enabledCheckBox; private JCheckBox enabledCheckBox;
private JCheckBox editableCheckBox;
private JCheckBox focusedCheckBox; private JCheckBox focusedCheckBox;
private FlatTextField textField1; private FlatTextField textField1;
private FlatFormattedTextField formattedTextField1;
private FlatPasswordField passwordField1;
private JTextArea textArea1;
private JEditorPane editorPane1;
private JTextPane textPane1;
private FlatToggleButton menuUnderlineSelectionButton;
private JMenu menu2; private JMenu menu2;
private JSlider slider1; private JSlider slider1;
private JSlider slider3; private JSlider slider3;
@@ -804,7 +895,10 @@ class FlatThemePreviewAll
@Override @Override
public void updateUI() { public void updateUI() {
setUI( new PreviewFlatTabbedPaneUI( uiDefaultsGetter ) ); if( !Beans.isDesignTime() )
setUI( new PreviewFlatTabbedPaneUI( uiDefaultsGetter ) );
else
super.updateUI();
} }
} }
@@ -848,10 +942,13 @@ class FlatThemePreviewAll
@Override @Override
public void paint( Graphics g ) { public void paint( Graphics g ) {
// needed for DefaultTableCellRenderer if( !Beans.isDesignTime() ) {
FlatLaf.runWithUIDefaultsGetter( uiDefaultsGetter, () -> { // needed for DefaultTableCellRenderer
FlatLaf.runWithUIDefaultsGetter( uiDefaultsGetter, () -> {
super.paint( g );
} );
} else
super.paint( g ); super.paint( g );
} );
} }
} }
} }

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.4.0.360" Java: "16" encoding: "UTF-8" JFDML JFormDesigner: "999.9.9.9.9999" Java: "1.8.0_202" encoding: "UTF-8"
new FormModel { new FormModel {
contentType: "form/swing" contentType: "form/swing"
@@ -8,10 +8,15 @@ 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": "insets dialog,hidemode 3" "$layoutConstraints": "insets dialog,hidemode 3"
"$columnConstraints": "[fill][130,fill]" "$columnConstraints": "[fill][60,sizegroup 1,fill][60,sizegroup 1,fill]"
"$rowConstraints": "[]unrel[][][][][][][][][][][][][][][][][][][][][][][][][100,fill][grow]" "$rowConstraints": "[]para[][][][][][][][][][fill][][]4[][][]0[][]0[][][][][][][100,fill][grow]"
} ) { } ) {
name: "this" name: "this"
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
name: "hSpacer1"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0 3 1,growx"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "enabledCheckBox" name: "enabledCheckBox"
"text": "Enabled" "text": "Enabled"
@@ -21,7 +26,18 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "enabledChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "enabledChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0 2 1,alignx left,growx 0" "value": "cell 0 0 3 1"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "editableCheckBox"
"text": "Editable"
"selected": true
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "editableChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0 3 1"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "focusedCheckBox" name: "focusedCheckBox"
@@ -31,7 +47,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "focusedChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "focusedChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0 2 1" "value": "cell 0 0 3 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "labelLabel" name: "labelLabel"
@@ -43,7 +59,7 @@ new FormModel {
name: "label1" name: "label1"
"text": "Some Text" "text": "Some Text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1" "value": "cell 1 1 2 1"
} ) } )
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) { add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
name: "flatButton1" name: "flatButton1"
@@ -63,24 +79,13 @@ new FormModel {
name: "button1" name: "button1"
"text": "OK" "text": "OK"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2,alignx left,growx 0" "value": "cell 1 2"
} ) } )
add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewAll$PreviewDefaultButton" ) { add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewAll$PreviewDefaultButton" ) {
name: "testDefaultButton1" name: "testDefaultButton1"
"text": "Default" "text": "Default"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2" "value": "cell 2 2"
} )
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
name: "helpButton"
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType help
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
name: "hSpacer2"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "toggleButtonLabel" name: "toggleButtonLabel"
@@ -92,19 +97,14 @@ new FormModel {
name: "toggleButton1" name: "toggleButton1"
"text": "Unselected" "text": "Unselected"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3,alignx left,growx 0" "value": "cell 1 3"
} ) } )
add( new FormComponent( "javax.swing.JToggleButton" ) { add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton3" name: "toggleButton3"
"text": "Selected" "text": "Selected"
"selected": true "selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3" "value": "cell 2 3"
} )
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
name: "hSpacer1"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "checkBoxLabel" name: "checkBoxLabel"
@@ -123,12 +123,7 @@ new FormModel {
"text": "Selected" "text": "Selected"
"selected": true "selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4,alignx left,growx 0" "value": "cell 2 4,alignx left,growx 0"
} )
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
name: "hSpacer3"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "radioButtonLabel" name: "radioButtonLabel"
@@ -149,12 +144,7 @@ new FormModel {
"selected": true "selected": true
"$buttonGroup": new FormReference( "buttonGroup1" ) "$buttonGroup": new FormReference( "buttonGroup1" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 5,alignx left,growx 0" "value": "cell 2 5,alignx left,growx 0"
} )
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
name: "hSpacer4"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 5"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "comboBoxLabel" name: "comboBoxLabel"
@@ -186,7 +176,7 @@ new FormModel {
"JavaCodeGenerator.typeParameters": "String" "JavaCodeGenerator.typeParameters": "String"
} }
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 6,width 50" "value": "cell 1 6"
} ) } )
add( new FormComponent( "javax.swing.JComboBox" ) { add( new FormComponent( "javax.swing.JComboBox" ) {
name: "comboBox3" name: "comboBox3"
@@ -207,7 +197,7 @@ new FormModel {
} }
"maximumRowCount": 6 "maximumRowCount": 6
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 6,width 50" "value": "cell 2 6"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "spinnerLabel" name: "spinnerLabel"
@@ -218,7 +208,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JSpinner" ) { add( new FormComponent( "javax.swing.JSpinner" ) {
name: "spinner1" name: "spinner1"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 7" "value": "cell 1 7 2 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "textFieldLabel" name: "textFieldLabel"
@@ -234,27 +224,33 @@ new FormModel {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 8" "value": "cell 1 8 2 1"
} ) } )
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatFormattedTextField" ) { add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatFormattedTextField" ) {
name: "formattedTextField1" name: "formattedTextField1"
"text": "Some Text" "text": "Some Text"
"placeholderText": "placeholder text" "placeholderText": "placeholder text"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 9,width 50" "value": "cell 1 9"
} ) } )
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatPasswordField" ) { add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatPasswordField" ) {
name: "passwordField1" name: "passwordField1"
"text": "Some Text" "text": "Some Text"
"placeholderText": "placeholder text" "placeholderText": "placeholder text"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 9,width 50" "value": "cell 2 9"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "textAreaLabel" name: "textAreaLabel"
"text": "<html>JTextArea:<br><br>JEditorPane:<br>JTextPane:</html>" "text": "<html>JTextArea:<br>JEditorPane:<br>JTextPane:</html>"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 10 1 2" "value": "cell 0 10"
} ) } )
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: "scrollPane1" name: "scrollPane1"
@@ -262,11 +258,14 @@ new FormModel {
"horizontalScrollBarPolicy": 31 "horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JTextArea" ) { add( new FormComponent( "javax.swing.JTextArea" ) {
name: "textArea1" name: "textArea1"
"text": "Some Text" "text": "Text"
"rows": 2 "rows": 2
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 10" "value": "cell 1 10 2 1,width 40"
} ) } )
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: "scrollPane5" name: "scrollPane5"
@@ -274,10 +273,13 @@ new FormModel {
"horizontalScrollBarPolicy": 31 "horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JEditorPane" ) { add( new FormComponent( "javax.swing.JEditorPane" ) {
name: "editorPane1" name: "editorPane1"
"text": "Some Text" "text": "Text"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 11,width 50" "value": "cell 1 10 2 1,width 40"
} ) } )
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: "scrollPane9" name: "scrollPane9"
@@ -285,16 +287,33 @@ new FormModel {
"horizontalScrollBarPolicy": 31 "horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JTextPane" ) { add( new FormComponent( "javax.swing.JTextPane" ) {
name: "textPane1" name: "textPane1"
"text": "Some Text" "text": "Text"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 11,width 50" "value": "cell 1 10 2 1,width 40"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "menuBarLabel" name: "menuBarLabel"
"text": "JMenuBar:" "text": "JMenuBar:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 12" "value": "cell 0 11"
} )
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatToggleButton" ) {
name: "menuUnderlineSelectionButton"
"text": "_"
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType toolBarButton
"toolTipText": "menu underline selection"
"focusable": false
"font": new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false )
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuUnderlineSelectionChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 11"
} ) } )
add( new FormContainer( "javax.swing.JMenuBar", new FormLayoutManager( class javax.swing.JMenuBar ) ) { add( new FormContainer( "javax.swing.JMenuBar", new FormLayoutManager( class javax.swing.JMenuBar ) ) {
name: "menuBar1" name: "menuBar1"
@@ -375,43 +394,43 @@ new FormModel {
} ) } )
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 12" "value": "cell 1 11 2 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "scrollBarLabel" name: "scrollBarLabel"
"text": "JScrollBar:" "text": "JScrollBar:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 13" "value": "cell 0 12 1 2,aligny top,growy 0"
} ) } )
add( new FormComponent( "javax.swing.JScrollBar" ) { add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar1" name: "scrollBar1"
"orientation": 0 "orientation": 0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 13" "value": "cell 1 12 2 1"
} ) } )
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatScrollBar" ) { add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatScrollBar" ) {
name: "scrollBar5" name: "scrollBar5"
"orientation": 0 "orientation": 0
"showButtons": true "showButtons": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 14" "value": "cell 1 13 2 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "separatorLabel" name: "separatorLabel"
"text": "JSeparator:" "text": "JSeparator:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 15" "value": "cell 0 14"
} ) } )
add( new FormComponent( "javax.swing.JSeparator" ) { add( new FormComponent( "javax.swing.JSeparator" ) {
name: "separator1" name: "separator1"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15" "value": "cell 1 14 2 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "sliderLabel" name: "sliderLabel"
"text": "JSlider:" "text": "JSlider:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 16" "value": "cell 0 15"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider1" name: "slider1"
@@ -420,7 +439,7 @@ new FormModel {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 16" "value": "cell 1 15 2 1,width 100"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider3" name: "slider3"
@@ -434,13 +453,13 @@ new FormModel {
} }
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "changeProgress", false ) ) addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "changeProgress", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 17" "value": "cell 1 16 2 1,width 100"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "progressBarLabel" name: "progressBarLabel"
"text": "JProgressBar:" "text": "JProgressBar:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 18" "value": "cell 0 17"
} ) } )
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) { add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) {
name: "progressBar1" name: "progressBar1"
@@ -449,7 +468,7 @@ new FormModel {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 18" "value": "cell 1 17 2 1"
} ) } )
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) { add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) {
name: "progressBar2" name: "progressBar2"
@@ -459,25 +478,25 @@ new FormModel {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 19" "value": "cell 1 18 2 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "toolTipLabel" name: "toolTipLabel"
"text": "JToolTip:" "text": "JToolTip:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 20" "value": "cell 0 19"
} ) } )
add( new FormComponent( "javax.swing.JToolTip" ) { add( new FormComponent( "javax.swing.JToolTip" ) {
name: "toolTip1" name: "toolTip1"
"tipText": "Some text in tool tip." "tipText": "Some text in tool tip."
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 20,alignx left,growx 0" "value": "cell 1 19 2 1,alignx left,growx 0"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "toolBarLabel" name: "toolBarLabel"
"text": "JToolBar:" "text": "JToolBar:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 21" "value": "cell 0 20"
} ) } )
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
name: "toolBar1" name: "toolBar1"
@@ -504,14 +523,19 @@ new FormModel {
"icon": #SwingIcon0 "icon": #SwingIcon0
"selected": true "selected": true
} ) } )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "button9"
"icon": #SwingIcon0
"selected": true
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 21" "value": "cell 1 20 2 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "tabbedPaneLabel" name: "tabbedPaneLabel"
"text": "JTabbedPane:" "text": "JTabbedPane:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 22" "value": "cell 0 21"
} ) } )
add( new FormContainer( "com.formdev.flatlaf.themeeditor.FlatThemePreviewAll$PreviewTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) { add( new FormContainer( "com.formdev.flatlaf.themeeditor.FlatThemePreviewAll$PreviewTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
name: "tabbedPane1" name: "tabbedPane1"
@@ -519,13 +543,13 @@ new FormModel {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 22" "value": "cell 1 21 2 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "listTreeLabel" name: "listTreeLabel"
"text": "<html>JList / JTree:<br>JSplitPane:</html>" "text": "<html>JList / JTree:<br>JSplitPane:</html>"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 23,aligny top,growy 0" "value": "cell 0 22,aligny top,growy 0"
} ) } )
add( new FormContainer( "javax.swing.JSplitPane", new FormLayoutManager( class javax.swing.JSplitPane ) ) { add( new FormContainer( "javax.swing.JSplitPane", new FormLayoutManager( class javax.swing.JSplitPane ) ) {
name: "splitPane1" name: "splitPane1"
@@ -570,13 +594,13 @@ new FormModel {
"value": "right" "value": "right"
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 23,height 50" "value": "cell 1 22 2 1,height 50"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "tableLabel" name: "tableLabel"
"text": "JTable:" "text": "JTable:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 24" "value": "cell 0 23"
} ) } )
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: "scrollPane4" name: "scrollPane4"
@@ -609,13 +633,13 @@ new FormModel {
} }
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 24,height 70" "value": "cell 1 23 2 1,width 100,height 70"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "internalFrameLabel" name: "internalFrameLabel"
"text": "<html>JDesktopPane:<br>JInternalFrame:</html>" "text": "<html>JDesktopPane:<br>JInternalFrame:</html>"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 25,aligny top,growy 0" "value": "cell 0 24,aligny top,growy 0"
} ) } )
add( new FormContainer( "javax.swing.JDesktopPane", new FormLayoutManager( class javax.swing.JDesktopPane ) ) { add( new FormContainer( "javax.swing.JDesktopPane", new FormLayoutManager( class javax.swing.JDesktopPane ) ) {
name: "desktopPane1" name: "desktopPane1"
@@ -653,7 +677,7 @@ new FormModel {
"y": 50 "y": 50
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 25" "value": "cell 1 24 2 1"
} ) } )
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 ) "location": new java.awt.Point( 0, 0 )

View File

@@ -16,11 +16,11 @@
package com.formdev.flatlaf.themeeditor; package com.formdev.flatlaf.themeeditor;
import static com.formdev.flatlaf.FlatClientProperties.*;
import java.awt.Component; import java.awt.Component;
import java.util.Objects; import java.util.Objects;
import java.util.function.Predicate; import java.util.function.Predicate;
import javax.swing.*; import javax.swing.*;
import com.formdev.flatlaf.FlatClientProperties;
import net.miginfocom.swing.*; import net.miginfocom.swing.*;
/** /**
@@ -29,31 +29,64 @@ import net.miginfocom.swing.*;
class FlatThemePreviewButtons class FlatThemePreviewButtons
extends JPanel extends JPanel
{ {
FlatThemePreviewButtons() { private static final String KEY_BUTTON_TYPE = "preview.buttonType";
private final FlatThemePreview preview;
FlatThemePreviewButtons( FlatThemePreview preview ) {
this.preview = preview;
initComponents(); initComponents();
} }
private void buttonTypeChanged() { void activated() {
Object buttonType = null; String buttonType = preview.state.get( KEY_BUTTON_TYPE, null );
if( !Objects.equals( buttonType, getButtonType() ) ) {
setButtonType( buttonType );
buttonTypeChanged();
}
}
private String getButtonType() {
String buttonType = null;
if( squareButton.isSelected() ) if( squareButton.isSelected() )
buttonType = FlatClientProperties.BUTTON_TYPE_SQUARE; buttonType = BUTTON_TYPE_SQUARE;
else if( roundRectButton.isSelected() ) else if( roundRectButton.isSelected() )
buttonType = FlatClientProperties.BUTTON_TYPE_ROUND_RECT; buttonType = BUTTON_TYPE_ROUND_RECT;
else if( tabButton.isSelected() ) else if( tabButton.isSelected() )
buttonType = FlatClientProperties.BUTTON_TYPE_TAB; buttonType = BUTTON_TYPE_TAB;
else if( toolBarButtonButton.isSelected() ) else if( toolBarButtonButton.isSelected() )
buttonType = FlatClientProperties.BUTTON_TYPE_TOOLBAR_BUTTON; buttonType = BUTTON_TYPE_TOOLBAR_BUTTON;
else if( borderlessButton.isSelected() ) else if( borderlessButton.isSelected() )
buttonType = FlatClientProperties.BUTTON_TYPE_BORDERLESS; buttonType = BUTTON_TYPE_BORDERLESS;
return buttonType;
}
private void setButtonType( String buttonType ) {
switch( String.valueOf( buttonType ) ) {
case BUTTON_TYPE_SQUARE: squareButton.setSelected( true ); break;
case BUTTON_TYPE_ROUND_RECT: roundRectButton.setSelected( true ); break;
case BUTTON_TYPE_TAB: tabButton.setSelected( true ); break;
case BUTTON_TYPE_TOOLBAR_BUTTON: toolBarButtonButton.setSelected( true ); break;
case BUTTON_TYPE_BORDERLESS: borderlessButton.setSelected( true ); break;
default: noneButton.setSelected( true ); break;
}
}
private void buttonTypeChanged() {
String buttonType = getButtonType();
for( Component c : getComponents() ) { for( Component c : getComponents() ) {
if( !(c instanceof AbstractButton) ) if( !(c instanceof AbstractButton) )
continue; continue;
AbstractButton b = (AbstractButton) c; AbstractButton b = (AbstractButton) c;
if( !Objects.equals( b.getClientProperty( FlatClientProperties.BUTTON_TYPE ), FlatClientProperties.BUTTON_TYPE_HELP ) ) if( !Objects.equals( b.getClientProperty( BUTTON_TYPE ), BUTTON_TYPE_HELP ) )
b.putClientProperty( FlatClientProperties.BUTTON_TYPE, buttonType ); b.putClientProperty( BUTTON_TYPE, buttonType );
} }
FlatThemeFileEditor.putPrefsString( preview.state, KEY_BUTTON_TYPE, buttonType );
} }
private void initComponents() { private void initComponents() {
@@ -664,7 +697,7 @@ class FlatThemePreviewButtons
} }
} ); } );
putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER, putClientProperty( COMPONENT_FOCUS_OWNER,
(Predicate<JComponent>) c -> { (Predicate<JComponent>) c -> {
return ((TestStateButton)c).isStateFocused(); return ((TestStateButton)c).isStateFocused();
} ); } );
@@ -734,7 +767,7 @@ class FlatThemePreviewButtons
} }
} ); } );
putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER, putClientProperty( COMPONENT_FOCUS_OWNER,
(Predicate<JComponent>) c -> { (Predicate<JComponent>) c -> {
return ((TestStateToggleButton)c).isStateFocused(); return ((TestStateToggleButton)c).isStateFocused();
} ); } );

View File

@@ -830,7 +830,7 @@ Table.selectionForeground
Table.selectionInactiveBackground Table.selectionInactiveBackground
Table.selectionInactiveForeground Table.selectionInactiveForeground
Table.showHorizontalLines Table.showHorizontalLines
Table.showLastVerticalLine Table.showTrailingVerticalLine
Table.showVerticalLines Table.showVerticalLines
Table.sortIconColor Table.sortIconColor
TableHeader.ancestorInputMap TableHeader.ancestorInputMap
@@ -843,7 +843,7 @@ TableHeader.font
TableHeader.foreground TableHeader.foreground
TableHeader.height TableHeader.height
TableHeader.separatorColor TableHeader.separatorColor
TableHeader.showLastVerticalLine TableHeader.showTrailingVerticalLine
TableHeaderUI TableHeaderUI
TableUI TableUI
TaskPane.background TaskPane.background