mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
Merge remote-tracking branch 'origin/main' into styling
This commit is contained in:
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,7 +1,7 @@
|
||||
FlatLaf Change Log
|
||||
==================
|
||||
|
||||
## 1.6-SNAPSHOT
|
||||
## 1.6
|
||||
|
||||
#### New features and improvements
|
||||
|
||||
@@ -20,10 +20,20 @@ FlatLaf Change Log
|
||||
- OptionPane: Fixed rendering of longer HTML text if it is passed as
|
||||
`StringBuilder`, `StringBuffer`, or any other object that returns HTML text in
|
||||
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
|
||||
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
|
||||
placeholder text in right-to-left component orientation.
|
||||
- Slider: Fixed calculation of baseline, which was wrong under some
|
||||
circumstances.
|
||||
|
||||
|
||||
## 1.5
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
val releaseVersion = "1.5"
|
||||
val developmentVersion = "1.6-SNAPSHOT"
|
||||
val releaseVersion = "1.6"
|
||||
val developmentVersion = "2.0-SNAPSHOT"
|
||||
|
||||
version = if( java.lang.Boolean.getBoolean( "release" ) ) releaseVersion else developmentVersion
|
||||
|
||||
|
||||
@@ -21,10 +21,15 @@ plugins {
|
||||
`flatlaf-publish`
|
||||
}
|
||||
|
||||
val sigtest = configurations.create( "sigtest" )
|
||||
|
||||
dependencies {
|
||||
testImplementation( "org.junit.jupiter:junit-jupiter-api:5.7.2" )
|
||||
testImplementation( "org.junit.jupiter:junit-jupiter-params" )
|
||||
testRuntimeOnly( "org.junit.jupiter:junit-jupiter-engine" )
|
||||
|
||||
// https://github.com/jtulach/netbeans-apitest
|
||||
sigtest( "org.netbeans.tools:sigtest-maven-plugin:1.4" )
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -59,10 +64,60 @@ tasks {
|
||||
archiveBaseName.set( "flatlaf" )
|
||||
}
|
||||
|
||||
check {
|
||||
dependsOn( "sigtestCheck" )
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
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 {
|
||||
|
||||
1029
flatlaf-core/flatlaf-core-sigtest.txt
Normal file
1029
flatlaf-core/flatlaf-core-sigtest.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -47,7 +47,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.CellRendererPane;
|
||||
import javax.swing.ComboBoxEditor;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.InputMap;
|
||||
import javax.swing.JButton;
|
||||
@@ -362,33 +361,25 @@ public class FlatComboBoxUI
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ComboBoxEditor createEditor() {
|
||||
ComboBoxEditor comboBoxEditor = super.createEditor();
|
||||
protected void configureEditor() {
|
||||
super.configureEditor();
|
||||
|
||||
Component editor = comboBoxEditor.getEditorComponent();
|
||||
if( editor instanceof JTextField ) {
|
||||
JTextField textField = (JTextField) editor;
|
||||
textField.setColumns( editorColumns );
|
||||
|
||||
// assign a non-null and non-javax.swing.plaf.UIResource border to the text field,
|
||||
// otherwise it is replaced with default text field border when switching LaF
|
||||
// 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() );
|
||||
// remove default text field border from editor
|
||||
Border border = textField.getBorder();
|
||||
if( border == null || border instanceof UIResource ) {
|
||||
// assign a non-null and non-javax.swing.plaf.UIResource border to the text field,
|
||||
// otherwise it is replaced with default text field border when switching LaF
|
||||
// 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
|
||||
if( editor instanceof JComponent )
|
||||
((JComponent)editor).setOpaque( false );
|
||||
@@ -782,6 +773,9 @@ public class FlatComboBoxUI
|
||||
protected void 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" );
|
||||
if( border != null )
|
||||
setBorder( border );
|
||||
@@ -818,6 +812,21 @@ public class FlatComboBoxUI
|
||||
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
|
||||
protected void paintChildren( Graphics g ) {
|
||||
super.paintChildren( g );
|
||||
|
||||
@@ -283,6 +283,9 @@ public class FlatInternalFrameUI
|
||||
|
||||
//---- class FlatBorderListener -------------------------------------------
|
||||
|
||||
/**
|
||||
* @since 1.6
|
||||
*/
|
||||
protected class FlatBorderListener
|
||||
extends BorderListener
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.formdev.flatlaf.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Window;
|
||||
import java.beans.PropertyChangeListener;
|
||||
@@ -24,7 +25,6 @@ import java.util.List;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JRootPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import com.formdev.flatlaf.FlatClientProperties;
|
||||
@@ -76,6 +76,11 @@ public class FlatNativeWindowBorder
|
||||
if( !isSupported() )
|
||||
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
|
||||
// switching from another LaF to FlatLaf.
|
||||
// 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
|
||||
// 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.
|
||||
Window window = SwingUtilities.windowForComponent( rootPane );
|
||||
if( window != null && window.isDisplayable() )
|
||||
install( window );
|
||||
if( parent instanceof Window && parent.isDisplayable() )
|
||||
install( (Window) parent );
|
||||
|
||||
// Install FlatLaf native window border, which must be done late,
|
||||
// when the native window is already created, because it needs access to the window.
|
||||
@@ -174,9 +178,9 @@ public class FlatNativeWindowBorder
|
||||
return;
|
||||
|
||||
// uninstall native window border
|
||||
Window window = SwingUtilities.windowForComponent( rootPane );
|
||||
if( window != null )
|
||||
uninstall( window );
|
||||
Container parent = rootPane.getParent();
|
||||
if( parent instanceof Window )
|
||||
uninstall( (Window) parent );
|
||||
}
|
||||
|
||||
private static void uninstall( Window window ) {
|
||||
|
||||
@@ -18,9 +18,11 @@ package com.formdev.flatlaf.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Shape;
|
||||
import java.awt.event.MouseEvent;
|
||||
@@ -223,9 +225,27 @@ public class FlatSliderUI
|
||||
if( slider.getOrientation() == JSlider.VERTICAL )
|
||||
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
|
||||
FontMetrics fm = slider.getFontMetrics( slider.getFont() );
|
||||
return trackRect.y + Math.round( (trackRect.height - fm.getHeight()) / 2f ) + fm.getAscent() - 1;
|
||||
return trackY + Math.round( (trackHeight - fm.getHeight()) / 2f ) + fm.getAscent() - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -219,15 +219,7 @@ public class FlatSpinnerUI
|
||||
@Override
|
||||
protected JComponent createEditor() {
|
||||
JComponent editor = super.createEditor();
|
||||
|
||||
// explicitly make non-opaque
|
||||
editor.setOpaque( false );
|
||||
JTextField textField = getEditorTextField( editor );
|
||||
if( textField != null )
|
||||
textField.setOpaque( false );
|
||||
|
||||
updateEditorPadding();
|
||||
updateEditorColors();
|
||||
configureEditor( editor );
|
||||
return editor;
|
||||
}
|
||||
|
||||
@@ -235,8 +227,19 @@ public class FlatSpinnerUI
|
||||
protected void replaceEditor( JComponent oldEditor, JComponent newEditor ) {
|
||||
super.replaceEditor( oldEditor, newEditor );
|
||||
|
||||
configureEditor( newEditor );
|
||||
|
||||
removeEditorFocusListener( oldEditor );
|
||||
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();
|
||||
updateEditorColors();
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.awt.Insets;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import javax.swing.JScrollBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JViewport;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.table.JTableHeader;
|
||||
@@ -45,7 +46,7 @@ public class FlatTableHeaderBorder
|
||||
{
|
||||
protected Color separatorColor = UIManager.getColor( "TableHeader.separatorColor" );
|
||||
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() {
|
||||
super( UIManager.getInsets( "TableHeader.cellMargins" ) );
|
||||
@@ -138,15 +139,23 @@ public class FlatTableHeaderBorder
|
||||
}
|
||||
|
||||
protected boolean hideTrailingVerticalLine( JTableHeader header ) {
|
||||
if( showLastVerticalLine )
|
||||
if( showTrailingVerticalLine )
|
||||
return false;
|
||||
|
||||
// do not hide if table header is not a child of a scroll pane
|
||||
Container viewport = header.getParent();
|
||||
Container viewportParent = (viewport != null) ? viewport.getParent() : null;
|
||||
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() )
|
||||
return true;
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ import com.formdev.flatlaf.util.UIScale;
|
||||
* @uiDefault TableHeader.cellMargins Insets
|
||||
* @uiDefault TableHeader.separatorColor Color
|
||||
* @uiDefault TableHeader.bottomSeparatorColor Color
|
||||
* @uiDefault TableHeader.showLastVerticalLine boolean
|
||||
* @uiDefault TableHeader.showTrailingVerticalLine boolean
|
||||
*
|
||||
* <!-- FlatAscendingSortIcon and FlatDescendingSortIcon -->
|
||||
*
|
||||
|
||||
@@ -75,7 +75,7 @@ import com.formdev.flatlaf.util.UIScale;
|
||||
* @uiDefault Table.rowHeight int
|
||||
* @uiDefault Table.showHorizontalLines boolean
|
||||
* @uiDefault Table.showVerticalLines boolean
|
||||
* @uiDefault Table.showLastVerticalLine boolean
|
||||
* @uiDefault Table.showTrailingVerticalLine boolean
|
||||
* @uiDefault Table.intercellSpacing Dimension
|
||||
* @uiDefault Table.selectionInactiveBackground Color
|
||||
* @uiDefault Table.selectionInactiveForeground Color
|
||||
@@ -98,7 +98,7 @@ public class FlatTableUI
|
||||
{
|
||||
protected boolean showHorizontalLines;
|
||||
protected boolean showVerticalLines;
|
||||
protected boolean showLastVerticalLine;
|
||||
/** @since 1.6 */ protected boolean showTrailingVerticalLine;
|
||||
protected Dimension intercellSpacing;
|
||||
|
||||
@Styleable protected Color selectionBackground;
|
||||
@@ -135,7 +135,7 @@ public class FlatTableUI
|
||||
|
||||
showHorizontalLines = UIManager.getBoolean( "Table.showHorizontalLines" );
|
||||
showVerticalLines = UIManager.getBoolean( "Table.showVerticalLines" );
|
||||
showLastVerticalLine = UIManager.getBoolean( "Table.showLastVerticalLine" );
|
||||
showTrailingVerticalLine = UIManager.getBoolean( "Table.showTrailingVerticalLine" );
|
||||
intercellSpacing = UIManager.getDimension( "Table.intercellSpacing" );
|
||||
|
||||
selectionBackground = UIManager.getColor( "Table.selectionBackground" );
|
||||
@@ -392,9 +392,10 @@ public class FlatTableUI
|
||||
}
|
||||
|
||||
protected boolean hideLastVerticalLine() {
|
||||
if( showLastVerticalLine )
|
||||
if( showTrailingVerticalLine )
|
||||
return false;
|
||||
|
||||
// do not hide if table is not a child of a scroll pane
|
||||
Container viewport = SwingUtilities.getUnwrappedParent( table );
|
||||
Container viewportParent = (viewport != null) ? viewport.getParent() : null;
|
||||
if( !(viewportParent instanceof JScrollPane) )
|
||||
|
||||
@@ -70,9 +70,10 @@ public class JBRCustomDecorations
|
||||
return null;
|
||||
|
||||
// check whether root pane already has a parent, which is the case when switching LaF
|
||||
Window window = SwingUtilities.windowForComponent( rootPane );
|
||||
if( window != null ) {
|
||||
FlatNativeWindowBorder.install( window );
|
||||
Container parent = rootPane.getParent();
|
||||
if( parent != null ) {
|
||||
if( parent instanceof Window )
|
||||
FlatNativeWindowBorder.install( (Window) parent );
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -110,9 +111,9 @@ public class JBRCustomDecorations
|
||||
// since it is actually not possible to uninstall JBR decorations,
|
||||
// simply reduce titleBarHeight so that it is still possible to resize window
|
||||
// and remove hitTestSpots
|
||||
Window window = SwingUtilities.windowForComponent( rootPane );
|
||||
if( window != null )
|
||||
setHasCustomDecoration( window, false );
|
||||
Container parent = rootPane.getParent();
|
||||
if( parent instanceof Window )
|
||||
setHasCustomDecoration( (Window) parent, false );
|
||||
}
|
||||
|
||||
static boolean hasCustomDecoration( Window window ) {
|
||||
|
||||
@@ -628,7 +628,7 @@ TabbedPane.closeCrossLineWidth = {float}1
|
||||
Table.rowHeight = 20
|
||||
Table.showHorizontalLines = false
|
||||
Table.showVerticalLines = false
|
||||
Table.showLastVerticalLine = false
|
||||
Table.showTrailingVerticalLine = false
|
||||
Table.consistentHomeEndKeyBehavior = true
|
||||
Table.intercellSpacing = {dimension}0,0
|
||||
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.focusCellBackground = $TableHeader.background
|
||||
TableHeader.background = @textComponentBackground
|
||||
TableHeader.showLastVerticalLine = false
|
||||
TableHeader.showTrailingVerticalLine = false
|
||||
|
||||
#---- TextArea ----
|
||||
|
||||
|
||||
@@ -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.selectionInactiveForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
|
||||
Table.showHorizontalLines false
|
||||
Table.showLastVerticalLine false
|
||||
Table.showTrailingVerticalLine false
|
||||
Table.showVerticalLines false
|
||||
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.height 25
|
||||
TableHeader.separatorColor #5e6364 HSL 190 3 38 javax.swing.plaf.ColorUIResource [UI]
|
||||
TableHeader.showLastVerticalLine false
|
||||
TableHeader.showTrailingVerticalLine false
|
||||
TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI
|
||||
|
||||
|
||||
|
||||
@@ -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.selectionInactiveForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
|
||||
Table.showHorizontalLines false
|
||||
Table.showLastVerticalLine false
|
||||
Table.showTrailingVerticalLine false
|
||||
Table.showVerticalLines false
|
||||
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.height 25
|
||||
TableHeader.separatorColor #e6e6e6 HSL 0 0 90 javax.swing.plaf.ColorUIResource [UI]
|
||||
TableHeader.showLastVerticalLine false
|
||||
TableHeader.showTrailingVerticalLine false
|
||||
TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI
|
||||
|
||||
|
||||
|
||||
@@ -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.selectionInactiveForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
|
||||
Table.showHorizontalLines false
|
||||
Table.showLastVerticalLine false
|
||||
Table.showTrailingVerticalLine false
|
||||
Table.showVerticalLines false
|
||||
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.height 25
|
||||
TableHeader.separatorColor #00ff00 HSL 120 100 50 javax.swing.plaf.ColorUIResource [UI]
|
||||
TableHeader.showLastVerticalLine false
|
||||
TableHeader.showTrailingVerticalLine false
|
||||
TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI
|
||||
|
||||
|
||||
|
||||
@@ -1621,6 +1621,10 @@ public class FlatComponentsTest
|
||||
// customRenderer.setBorder( new LineBorder( Color.red ) );
|
||||
// comboBox1.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
|
||||
|
||||
@@ -139,6 +139,8 @@ public class FlatSingleComponentTest
|
||||
applyComponentOrientation( getComponentOrientation().isLeftToRight()
|
||||
? ComponentOrientation.RIGHT_TO_LEFT
|
||||
: ComponentOrientation.LEFT_TO_RIGHT );
|
||||
revalidate();
|
||||
repaint();
|
||||
},
|
||||
KeyStroke.getKeyStroke( "alt R" ),
|
||||
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
|
||||
|
||||
@@ -831,14 +831,14 @@ class FlatThemeFileEditor
|
||||
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 )
|
||||
prefs.putBoolean( key, value );
|
||||
else
|
||||
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 ) )
|
||||
prefs.put( key, value );
|
||||
else
|
||||
|
||||
@@ -41,7 +41,11 @@ class FlatThemePreview
|
||||
|
||||
private final FlatSyntaxTextArea textArea;
|
||||
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 int runWithUIDefaultsGetterLevel;
|
||||
@@ -53,9 +57,12 @@ class FlatThemePreview
|
||||
initComponents();
|
||||
|
||||
// add tabs
|
||||
tabbedPane.addTab( "All", createPreviewTab( new FlatThemePreviewAll( this ) ) );
|
||||
tabbedPane.addTab( "Buttons", createPreviewTab( new FlatThemePreviewButtons() ) );
|
||||
tabbedPane.addTab( "Switches", createPreviewTab( new FlatThemePreviewSwitches() ) );
|
||||
allTab = new FlatThemePreviewAll( this );
|
||||
buttonsTab = new FlatThemePreviewButtons( this );
|
||||
switchesTab = new FlatThemePreviewSwitches();
|
||||
tabbedPane.addTab( "All", createPreviewTab( allTab ) );
|
||||
tabbedPane.addTab( "Buttons", createPreviewTab( buttonsTab ) );
|
||||
tabbedPane.addTab( "Switches", createPreviewTab( switchesTab ) );
|
||||
selectRecentTab();
|
||||
tabbedPane.addChangeListener( e -> selectedTabChanged() );
|
||||
|
||||
@@ -85,8 +92,14 @@ class FlatThemePreview
|
||||
|
||||
private void selectRecentTab() {
|
||||
int selectedTab = state.getInt( KEY_SELECTED_TAB, -1 );
|
||||
if( selectedTab >= 0 && selectedTab < tabbedPane.getTabCount() )
|
||||
if( selectedTab >= 0 && selectedTab < tabbedPane.getTabCount() ) {
|
||||
tabbedPane.setSelectedIndex( selectedTab );
|
||||
|
||||
switch( selectedTab ) {
|
||||
case 0: allTab.activated(); break;
|
||||
case 1: buttonsTab.activated(); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void selectedTabChanged() {
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.formdev.flatlaf.themeeditor;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.beans.Beans;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
@@ -39,6 +40,11 @@ import net.miginfocom.swing.*;
|
||||
class FlatThemePreviewAll
|
||||
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;
|
||||
|
||||
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() {
|
||||
boolean enabled = enabledCheckBox.isSelected();
|
||||
|
||||
@@ -89,10 +122,12 @@ class FlatThemePreviewAll
|
||||
preview.runWithUIDefaultsGetter( () -> {
|
||||
enableDisable( this, enabled );
|
||||
} );
|
||||
|
||||
FlatThemeFileEditor.putPrefsBoolean( preview.state, KEY_ENABLED, enabled, true );
|
||||
}
|
||||
|
||||
private void enableDisable( Component comp, boolean enabled ) {
|
||||
if( comp != enabledCheckBox && comp != focusedCheckBox && comp != menu2 )
|
||||
if( !isControlComponent( comp ) )
|
||||
comp.setEnabled( enabled );
|
||||
|
||||
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() {
|
||||
Predicate<JComponent> value = focusedCheckBox.isSelected() && enabledCheckBox.isSelected()
|
||||
boolean focused = focusedCheckBox.isSelected();
|
||||
|
||||
Predicate<JComponent> value = focused && enabledCheckBox.isSelected()
|
||||
? value = c -> true
|
||||
: null;
|
||||
focusComponent( this, value );
|
||||
repaint();
|
||||
|
||||
FlatThemeFileEditor.putPrefsBoolean( preview.state, KEY_FOCUSED, focused,false );
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
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() {
|
||||
int value = slider3.getValue();
|
||||
progressBar1.setValue( value );
|
||||
@@ -165,7 +237,9 @@ class FlatThemePreviewAll
|
||||
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||
JPanel hSpacer1 = new JPanel(null);
|
||||
enabledCheckBox = new JCheckBox();
|
||||
editableCheckBox = new JCheckBox();
|
||||
focusedCheckBox = new JCheckBox();
|
||||
JLabel labelLabel = new JLabel();
|
||||
JLabel label1 = new JLabel();
|
||||
@@ -173,20 +247,15 @@ class FlatThemePreviewAll
|
||||
JLabel buttonLabel = new JLabel();
|
||||
JButton button1 = new JButton();
|
||||
FlatThemePreviewAll.PreviewDefaultButton testDefaultButton1 = new FlatThemePreviewAll.PreviewDefaultButton();
|
||||
FlatButton helpButton = new FlatButton();
|
||||
JPanel hSpacer2 = new JPanel(null);
|
||||
JLabel toggleButtonLabel = new JLabel();
|
||||
JToggleButton toggleButton1 = new JToggleButton();
|
||||
JToggleButton toggleButton3 = new JToggleButton();
|
||||
JPanel hSpacer1 = new JPanel(null);
|
||||
JLabel checkBoxLabel = new JLabel();
|
||||
JCheckBox checkBox1 = new JCheckBox();
|
||||
JCheckBox checkBox3 = new JCheckBox();
|
||||
JPanel hSpacer3 = new JPanel(null);
|
||||
JLabel radioButtonLabel = new JLabel();
|
||||
JRadioButton radioButton1 = new JRadioButton();
|
||||
JRadioButton radioButton3 = new JRadioButton();
|
||||
JPanel hSpacer4 = new JPanel(null);
|
||||
JLabel comboBoxLabel = new JLabel();
|
||||
FlatComboBox<String> comboBox1 = new FlatComboBox<>();
|
||||
JComboBox<String> comboBox3 = new JComboBox<>();
|
||||
@@ -194,16 +263,17 @@ class FlatThemePreviewAll
|
||||
JSpinner spinner1 = new JSpinner();
|
||||
JLabel textFieldLabel = new JLabel();
|
||||
textField1 = new FlatTextField();
|
||||
FlatFormattedTextField formattedTextField1 = new FlatFormattedTextField();
|
||||
FlatPasswordField passwordField1 = new FlatPasswordField();
|
||||
formattedTextField1 = new FlatFormattedTextField();
|
||||
passwordField1 = new FlatPasswordField();
|
||||
JLabel textAreaLabel = new JLabel();
|
||||
JScrollPane scrollPane1 = new JScrollPane();
|
||||
JTextArea textArea1 = new JTextArea();
|
||||
textArea1 = new JTextArea();
|
||||
JScrollPane scrollPane5 = new JScrollPane();
|
||||
JEditorPane editorPane1 = new JEditorPane();
|
||||
editorPane1 = new JEditorPane();
|
||||
JScrollPane scrollPane9 = new JScrollPane();
|
||||
JTextPane textPane1 = new JTextPane();
|
||||
textPane1 = new JTextPane();
|
||||
JLabel menuBarLabel = new JLabel();
|
||||
menuUnderlineSelectionButton = new FlatToggleButton();
|
||||
JMenuBar menuBar1 = new JMenuBar();
|
||||
menu2 = new JMenu();
|
||||
JMenuItem menuItem3 = new JMenuItem();
|
||||
@@ -239,6 +309,7 @@ class FlatThemePreviewAll
|
||||
JButton button6 = new JButton();
|
||||
JToggleButton button7 = new JToggleButton();
|
||||
JToggleButton button8 = new JToggleButton();
|
||||
JToggleButton button9 = new JToggleButton();
|
||||
JLabel tabbedPaneLabel = new JLabel();
|
||||
tabbedPane1 = new FlatThemePreviewAll.PreviewTabbedPane();
|
||||
JLabel listTreeLabel = new JLabel();
|
||||
@@ -260,15 +331,10 @@ class FlatThemePreviewAll
|
||||
"insets dialog,hidemode 3",
|
||||
// columns
|
||||
"[fill]" +
|
||||
"[130,fill]",
|
||||
"[60,sizegroup 1,fill]" +
|
||||
"[60,sizegroup 1,fill]",
|
||||
// rows
|
||||
"[]unrel" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]para" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
@@ -278,9 +344,14 @@ class FlatThemePreviewAll
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[fill]" +
|
||||
"[]" +
|
||||
"[]4" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]0" +
|
||||
"[]" +
|
||||
"[]0" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
@@ -289,17 +360,24 @@ class FlatThemePreviewAll
|
||||
"[]" +
|
||||
"[100,fill]" +
|
||||
"[grow]"));
|
||||
add(hSpacer1, "cell 0 0 3 1,growx");
|
||||
|
||||
//---- enabledCheckBox ----
|
||||
enabledCheckBox.setText("Enabled");
|
||||
enabledCheckBox.setSelected(true);
|
||||
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.setText("Focused");
|
||||
focusedCheckBox.addActionListener(e -> focusedChanged());
|
||||
add(focusedCheckBox, "cell 0 0 2 1");
|
||||
add(focusedCheckBox, "cell 0 0 3 1");
|
||||
|
||||
//---- labelLabel ----
|
||||
labelLabel.setText("JLabel:");
|
||||
@@ -307,7 +385,7 @@ class FlatThemePreviewAll
|
||||
|
||||
//---- label1 ----
|
||||
label1.setText("Some Text");
|
||||
add(label1, "cell 1 1");
|
||||
add(label1, "cell 1 1 2 1");
|
||||
|
||||
//---- flatButton1 ----
|
||||
flatButton1.setText("Help");
|
||||
@@ -321,16 +399,11 @@ class FlatThemePreviewAll
|
||||
|
||||
//---- button1 ----
|
||||
button1.setText("OK");
|
||||
add(button1, "cell 1 2,alignx left,growx 0");
|
||||
add(button1, "cell 1 2");
|
||||
|
||||
//---- testDefaultButton1 ----
|
||||
testDefaultButton1.setText("Default");
|
||||
add(testDefaultButton1, "cell 1 2");
|
||||
|
||||
//---- helpButton ----
|
||||
helpButton.setButtonType(FlatButton.ButtonType.help);
|
||||
add(helpButton, "cell 1 2");
|
||||
add(hSpacer2, "cell 1 2");
|
||||
add(testDefaultButton1, "cell 2 2");
|
||||
|
||||
//---- toggleButtonLabel ----
|
||||
toggleButtonLabel.setText("JToggleButton:");
|
||||
@@ -338,13 +411,12 @@ class FlatThemePreviewAll
|
||||
|
||||
//---- toggleButton1 ----
|
||||
toggleButton1.setText("Unselected");
|
||||
add(toggleButton1, "cell 1 3,alignx left,growx 0");
|
||||
add(toggleButton1, "cell 1 3");
|
||||
|
||||
//---- toggleButton3 ----
|
||||
toggleButton3.setText("Selected");
|
||||
toggleButton3.setSelected(true);
|
||||
add(toggleButton3, "cell 1 3");
|
||||
add(hSpacer1, "cell 1 3");
|
||||
add(toggleButton3, "cell 2 3");
|
||||
|
||||
//---- checkBoxLabel ----
|
||||
checkBoxLabel.setText("JCheckBox");
|
||||
@@ -357,8 +429,7 @@ class FlatThemePreviewAll
|
||||
//---- checkBox3 ----
|
||||
checkBox3.setText("Selected");
|
||||
checkBox3.setSelected(true);
|
||||
add(checkBox3, "cell 1 4,alignx left,growx 0");
|
||||
add(hSpacer3, "cell 1 4");
|
||||
add(checkBox3, "cell 2 4,alignx left,growx 0");
|
||||
|
||||
//---- radioButtonLabel ----
|
||||
radioButtonLabel.setText("JRadioButton:");
|
||||
@@ -371,8 +442,7 @@ class FlatThemePreviewAll
|
||||
//---- radioButton3 ----
|
||||
radioButton3.setText("Selected");
|
||||
radioButton3.setSelected(true);
|
||||
add(radioButton3, "cell 1 5,alignx left,growx 0");
|
||||
add(hSpacer4, "cell 1 5");
|
||||
add(radioButton3, "cell 2 5,alignx left,growx 0");
|
||||
|
||||
//---- comboBoxLabel ----
|
||||
comboBoxLabel.setText("JComboBox:");
|
||||
@@ -396,7 +466,7 @@ class FlatThemePreviewAll
|
||||
}));
|
||||
comboBox1.setMaximumRowCount(6);
|
||||
comboBox1.setPlaceholderText("placeholder text");
|
||||
add(comboBox1, "cell 1 6,width 50");
|
||||
add(comboBox1, "cell 1 6");
|
||||
|
||||
//---- comboBox3 ----
|
||||
comboBox3.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
@@ -414,12 +484,12 @@ class FlatThemePreviewAll
|
||||
"kkk"
|
||||
}));
|
||||
comboBox3.setMaximumRowCount(6);
|
||||
add(comboBox3, "cell 1 6,width 50");
|
||||
add(comboBox3, "cell 2 6");
|
||||
|
||||
//---- spinnerLabel ----
|
||||
spinnerLabel.setText("JSpinner:");
|
||||
add(spinnerLabel, "cell 0 7");
|
||||
add(spinner1, "cell 1 7");
|
||||
add(spinner1, "cell 1 7 2 1");
|
||||
|
||||
//---- textFieldLabel ----
|
||||
textFieldLabel.setText("<html>JTextField:<br>JFormattedTextF.:<br>JPasswordField:</html>");
|
||||
@@ -428,21 +498,21 @@ class FlatThemePreviewAll
|
||||
//---- textField1 ----
|
||||
textField1.setText("Some Text");
|
||||
textField1.setPlaceholderText("placeholder text");
|
||||
add(textField1, "cell 1 8");
|
||||
add(textField1, "cell 1 8 2 1");
|
||||
|
||||
//---- formattedTextField1 ----
|
||||
formattedTextField1.setText("Some Text");
|
||||
formattedTextField1.setPlaceholderText("placeholder text");
|
||||
add(formattedTextField1, "cell 1 9,width 50");
|
||||
add(formattedTextField1, "cell 1 9");
|
||||
|
||||
//---- passwordField1 ----
|
||||
passwordField1.setText("Some Text");
|
||||
passwordField1.setPlaceholderText("placeholder text");
|
||||
add(passwordField1, "cell 1 9,width 50");
|
||||
add(passwordField1, "cell 2 9");
|
||||
|
||||
//---- textAreaLabel ----
|
||||
textAreaLabel.setText("<html>JTextArea:<br><br>JEditorPane:<br>JTextPane:</html>");
|
||||
add(textAreaLabel, "cell 0 10 1 2");
|
||||
textAreaLabel.setText("<html>JTextArea:<br>JEditorPane:<br>JTextPane:</html>");
|
||||
add(textAreaLabel, "cell 0 10");
|
||||
|
||||
//======== scrollPane1 ========
|
||||
{
|
||||
@@ -450,11 +520,11 @@ class FlatThemePreviewAll
|
||||
scrollPane1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
|
||||
//---- textArea1 ----
|
||||
textArea1.setText("Some Text");
|
||||
textArea1.setText("Text");
|
||||
textArea1.setRows(2);
|
||||
scrollPane1.setViewportView(textArea1);
|
||||
}
|
||||
add(scrollPane1, "cell 1 10");
|
||||
add(scrollPane1, "cell 1 10 2 1,width 40");
|
||||
|
||||
//======== scrollPane5 ========
|
||||
{
|
||||
@@ -462,10 +532,10 @@ class FlatThemePreviewAll
|
||||
scrollPane5.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
|
||||
//---- editorPane1 ----
|
||||
editorPane1.setText("Some Text");
|
||||
editorPane1.setText("Text");
|
||||
scrollPane5.setViewportView(editorPane1);
|
||||
}
|
||||
add(scrollPane5, "cell 1 11,width 50");
|
||||
add(scrollPane5, "cell 1 10 2 1,width 40");
|
||||
|
||||
//======== scrollPane9 ========
|
||||
{
|
||||
@@ -473,14 +543,23 @@ class FlatThemePreviewAll
|
||||
scrollPane9.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
|
||||
//---- textPane1 ----
|
||||
textPane1.setText("Some Text");
|
||||
textPane1.setText("Text");
|
||||
scrollPane9.setViewportView(textPane1);
|
||||
}
|
||||
add(scrollPane9, "cell 1 11,width 50");
|
||||
add(scrollPane9, "cell 1 10 2 1,width 40");
|
||||
|
||||
//---- menuBarLabel ----
|
||||
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 ========
|
||||
{
|
||||
@@ -558,33 +637,33 @@ class FlatThemePreviewAll
|
||||
}
|
||||
menuBar1.add(menu3);
|
||||
}
|
||||
add(menuBar1, "cell 1 12");
|
||||
add(menuBar1, "cell 1 11 2 1");
|
||||
|
||||
//---- scrollBarLabel ----
|
||||
scrollBarLabel.setText("JScrollBar:");
|
||||
add(scrollBarLabel, "cell 0 13");
|
||||
add(scrollBarLabel, "cell 0 12 1 2,aligny top,growy 0");
|
||||
|
||||
//---- scrollBar1 ----
|
||||
scrollBar1.setOrientation(Adjustable.HORIZONTAL);
|
||||
add(scrollBar1, "cell 1 13");
|
||||
add(scrollBar1, "cell 1 12 2 1");
|
||||
|
||||
//---- scrollBar5 ----
|
||||
scrollBar5.setOrientation(Adjustable.HORIZONTAL);
|
||||
scrollBar5.setShowButtons(true);
|
||||
add(scrollBar5, "cell 1 14");
|
||||
add(scrollBar5, "cell 1 13 2 1");
|
||||
|
||||
//---- separatorLabel ----
|
||||
separatorLabel.setText("JSeparator:");
|
||||
add(separatorLabel, "cell 0 15");
|
||||
add(separator1, "cell 1 15");
|
||||
add(separatorLabel, "cell 0 14");
|
||||
add(separator1, "cell 1 14 2 1");
|
||||
|
||||
//---- sliderLabel ----
|
||||
sliderLabel.setText("JSlider:");
|
||||
add(sliderLabel, "cell 0 16");
|
||||
add(sliderLabel, "cell 0 15");
|
||||
|
||||
//---- slider1 ----
|
||||
slider1.setValue(30);
|
||||
add(slider1, "cell 1 16");
|
||||
add(slider1, "cell 1 15 2 1,width 100");
|
||||
|
||||
//---- slider3 ----
|
||||
slider3.setMinorTickSpacing(10);
|
||||
@@ -593,32 +672,32 @@ class FlatThemePreviewAll
|
||||
slider3.setPaintLabels(true);
|
||||
slider3.setValue(30);
|
||||
slider3.addChangeListener(e -> changeProgress());
|
||||
add(slider3, "cell 1 17");
|
||||
add(slider3, "cell 1 16 2 1,width 100");
|
||||
|
||||
//---- progressBarLabel ----
|
||||
progressBarLabel.setText("JProgressBar:");
|
||||
add(progressBarLabel, "cell 0 18");
|
||||
add(progressBarLabel, "cell 0 17");
|
||||
|
||||
//---- progressBar1 ----
|
||||
progressBar1.setValue(60);
|
||||
add(progressBar1, "cell 1 18");
|
||||
add(progressBar1, "cell 1 17 2 1");
|
||||
|
||||
//---- progressBar2 ----
|
||||
progressBar2.setValue(50);
|
||||
progressBar2.setStringPainted(true);
|
||||
add(progressBar2, "cell 1 19");
|
||||
add(progressBar2, "cell 1 18 2 1");
|
||||
|
||||
//---- toolTipLabel ----
|
||||
toolTipLabel.setText("JToolTip:");
|
||||
add(toolTipLabel, "cell 0 20");
|
||||
add(toolTipLabel, "cell 0 19");
|
||||
|
||||
//---- toolTip1 ----
|
||||
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.setText("JToolBar:");
|
||||
add(toolBarLabel, "cell 0 21");
|
||||
add(toolBarLabel, "cell 0 20");
|
||||
|
||||
//======== toolBar1 ========
|
||||
{
|
||||
@@ -640,17 +719,22 @@ class FlatThemePreviewAll
|
||||
button8.setIcon(UIManager.getIcon("Tree.leafIcon"));
|
||||
button8.setSelected(true);
|
||||
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.setText("JTabbedPane:");
|
||||
add(tabbedPaneLabel, "cell 0 22");
|
||||
add(tabbedPane1, "cell 1 22");
|
||||
add(tabbedPaneLabel, "cell 0 21");
|
||||
add(tabbedPane1, "cell 1 21 2 1");
|
||||
|
||||
//---- listTreeLabel ----
|
||||
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 ========
|
||||
{
|
||||
@@ -693,11 +777,11 @@ class FlatThemePreviewAll
|
||||
}
|
||||
splitPane1.setRightComponent(scrollPane3);
|
||||
}
|
||||
add(splitPane1, "cell 1 23,height 50");
|
||||
add(splitPane1, "cell 1 22 2 1,height 50");
|
||||
|
||||
//---- tableLabel ----
|
||||
tableLabel.setText("JTable:");
|
||||
add(tableLabel, "cell 0 24");
|
||||
add(tableLabel, "cell 0 23");
|
||||
|
||||
//======== scrollPane4 ========
|
||||
{
|
||||
@@ -714,11 +798,11 @@ class FlatThemePreviewAll
|
||||
));
|
||||
scrollPane4.setViewportView(table1);
|
||||
}
|
||||
add(scrollPane4, "cell 1 24,height 70");
|
||||
add(scrollPane4, "cell 1 23 2 1,width 100,height 70");
|
||||
|
||||
//---- internalFrameLabel ----
|
||||
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 ========
|
||||
{
|
||||
@@ -751,7 +835,7 @@ class FlatThemePreviewAll
|
||||
desktopPane1.add(internalFrame2, JLayeredPane.DEFAULT_LAYER);
|
||||
internalFrame2.setBounds(new Rectangle(new Point(5, 50), internalFrame2.getPreferredSize()));
|
||||
}
|
||||
add(desktopPane1, "cell 1 25");
|
||||
add(desktopPane1, "cell 1 24 2 1");
|
||||
|
||||
//---- buttonGroup1 ----
|
||||
ButtonGroup buttonGroup1 = new ButtonGroup();
|
||||
@@ -767,8 +851,15 @@ class FlatThemePreviewAll
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
private JCheckBox enabledCheckBox;
|
||||
private JCheckBox editableCheckBox;
|
||||
private JCheckBox focusedCheckBox;
|
||||
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 JSlider slider1;
|
||||
private JSlider slider3;
|
||||
@@ -804,7 +895,10 @@ class FlatThemePreviewAll
|
||||
|
||||
@Override
|
||||
public void updateUI() {
|
||||
setUI( new PreviewFlatTabbedPaneUI( uiDefaultsGetter ) );
|
||||
if( !Beans.isDesignTime() )
|
||||
setUI( new PreviewFlatTabbedPaneUI( uiDefaultsGetter ) );
|
||||
else
|
||||
super.updateUI();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -848,10 +942,13 @@ class FlatThemePreviewAll
|
||||
|
||||
@Override
|
||||
public void paint( Graphics g ) {
|
||||
// needed for DefaultTableCellRenderer
|
||||
FlatLaf.runWithUIDefaultsGetter( uiDefaultsGetter, () -> {
|
||||
if( !Beans.isDesignTime() ) {
|
||||
// needed for DefaultTableCellRenderer
|
||||
FlatLaf.runWithUIDefaultsGetter( uiDefaultsGetter, () -> {
|
||||
super.paint( g );
|
||||
} );
|
||||
} else
|
||||
super.paint( g );
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
contentType: "form/swing"
|
||||
@@ -8,10 +8,15 @@ new FormModel {
|
||||
}
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets dialog,hidemode 3"
|
||||
"$columnConstraints": "[fill][130,fill]"
|
||||
"$rowConstraints": "[]unrel[][][][][][][][][][][][][][][][][][][][][][][][][100,fill][grow]"
|
||||
"$columnConstraints": "[fill][60,sizegroup 1,fill][60,sizegroup 1,fill]"
|
||||
"$rowConstraints": "[]para[][][][][][][][][][fill][][]4[][][]0[][]0[][][][][][][100,fill][grow]"
|
||||
} ) {
|
||||
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" ) {
|
||||
name: "enabledCheckBox"
|
||||
"text": "Enabled"
|
||||
@@ -21,7 +26,18 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "enabledChanged", false ) )
|
||||
}, 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" ) {
|
||||
name: "focusedCheckBox"
|
||||
@@ -31,7 +47,7 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "focusedChanged", false ) )
|
||||
}, 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" ) {
|
||||
name: "labelLabel"
|
||||
@@ -43,7 +59,7 @@ new FormModel {
|
||||
name: "label1"
|
||||
"text": "Some Text"
|
||||
}, 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" ) {
|
||||
name: "flatButton1"
|
||||
@@ -63,24 +79,13 @@ new FormModel {
|
||||
name: "button1"
|
||||
"text": "OK"
|
||||
}, 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" ) {
|
||||
name: "testDefaultButton1"
|
||||
"text": "Default"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 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"
|
||||
"value": "cell 2 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "toggleButtonLabel"
|
||||
@@ -92,19 +97,14 @@ new FormModel {
|
||||
name: "toggleButton1"
|
||||
"text": "Unselected"
|
||||
}, 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" ) {
|
||||
name: "toggleButton3"
|
||||
"text": "Selected"
|
||||
"selected": true
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3"
|
||||
} )
|
||||
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
|
||||
name: "hSpacer1"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3"
|
||||
"value": "cell 2 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "checkBoxLabel"
|
||||
@@ -123,12 +123,7 @@ new FormModel {
|
||||
"text": "Selected"
|
||||
"selected": true
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 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"
|
||||
"value": "cell 2 4,alignx left,growx 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "radioButtonLabel"
|
||||
@@ -149,12 +144,7 @@ new FormModel {
|
||||
"selected": true
|
||||
"$buttonGroup": new FormReference( "buttonGroup1" )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 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"
|
||||
"value": "cell 2 5,alignx left,growx 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "comboBoxLabel"
|
||||
@@ -186,7 +176,7 @@ new FormModel {
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 6,width 50"
|
||||
"value": "cell 1 6"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
name: "comboBox3"
|
||||
@@ -207,7 +197,7 @@ new FormModel {
|
||||
}
|
||||
"maximumRowCount": 6
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 6,width 50"
|
||||
"value": "cell 2 6"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "spinnerLabel"
|
||||
@@ -218,7 +208,7 @@ new FormModel {
|
||||
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||
name: "spinner1"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 7"
|
||||
"value": "cell 1 7 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "textFieldLabel"
|
||||
@@ -234,27 +224,33 @@ new FormModel {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, 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" ) {
|
||||
name: "formattedTextField1"
|
||||
"text": "Some Text"
|
||||
"placeholderText": "placeholder text"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, 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" ) {
|
||||
name: "passwordField1"
|
||||
"text": "Some Text"
|
||||
"placeholderText": "placeholder text"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 9,width 50"
|
||||
"value": "cell 2 9"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
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 ) {
|
||||
"value": "cell 0 10 1 2"
|
||||
"value": "cell 0 10"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane1"
|
||||
@@ -262,11 +258,14 @@ new FormModel {
|
||||
"horizontalScrollBarPolicy": 31
|
||||
add( new FormComponent( "javax.swing.JTextArea" ) {
|
||||
name: "textArea1"
|
||||
"text": "Some Text"
|
||||
"text": "Text"
|
||||
"rows": 2
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
}, 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 ) ) {
|
||||
name: "scrollPane5"
|
||||
@@ -274,10 +273,13 @@ new FormModel {
|
||||
"horizontalScrollBarPolicy": 31
|
||||
add( new FormComponent( "javax.swing.JEditorPane" ) {
|
||||
name: "editorPane1"
|
||||
"text": "Some Text"
|
||||
"text": "Text"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
}, 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 ) ) {
|
||||
name: "scrollPane9"
|
||||
@@ -285,16 +287,33 @@ new FormModel {
|
||||
"horizontalScrollBarPolicy": 31
|
||||
add( new FormComponent( "javax.swing.JTextPane" ) {
|
||||
name: "textPane1"
|
||||
"text": "Some Text"
|
||||
"text": "Text"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
}, 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" ) {
|
||||
name: "menuBarLabel"
|
||||
"text": "JMenuBar:"
|
||||
}, 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 ) ) {
|
||||
name: "menuBar1"
|
||||
@@ -375,43 +394,43 @@ new FormModel {
|
||||
} )
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 12"
|
||||
"value": "cell 1 11 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "scrollBarLabel"
|
||||
"text": "JScrollBar:"
|
||||
}, 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" ) {
|
||||
name: "scrollBar1"
|
||||
"orientation": 0
|
||||
}, 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" ) {
|
||||
name: "scrollBar5"
|
||||
"orientation": 0
|
||||
"showButtons": true
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 14"
|
||||
"value": "cell 1 13 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "separatorLabel"
|
||||
"text": "JSeparator:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 15"
|
||||
"value": "cell 0 14"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSeparator" ) {
|
||||
name: "separator1"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 15"
|
||||
"value": "cell 1 14 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "sliderLabel"
|
||||
"text": "JSlider:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 16"
|
||||
"value": "cell 0 15"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSlider" ) {
|
||||
name: "slider1"
|
||||
@@ -420,7 +439,7 @@ new FormModel {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, 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" ) {
|
||||
name: "slider3"
|
||||
@@ -434,13 +453,13 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "changeProgress", false ) )
|
||||
}, 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" ) {
|
||||
name: "progressBarLabel"
|
||||
"text": "JProgressBar:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 18"
|
||||
"value": "cell 0 17"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) {
|
||||
name: "progressBar1"
|
||||
@@ -449,7 +468,7 @@ new FormModel {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, 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" ) {
|
||||
name: "progressBar2"
|
||||
@@ -459,25 +478,25 @@ new FormModel {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 19"
|
||||
"value": "cell 1 18 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "toolTipLabel"
|
||||
"text": "JToolTip:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 20"
|
||||
"value": "cell 0 19"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToolTip" ) {
|
||||
name: "toolTip1"
|
||||
"tipText": "Some text in tool tip."
|
||||
}, 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" ) {
|
||||
name: "toolBarLabel"
|
||||
"text": "JToolBar:"
|
||||
}, 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 ) ) {
|
||||
name: "toolBar1"
|
||||
@@ -504,14 +523,19 @@ new FormModel {
|
||||
"icon": #SwingIcon0
|
||||
"selected": true
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
name: "button9"
|
||||
"icon": #SwingIcon0
|
||||
"selected": true
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 21"
|
||||
"value": "cell 1 20 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "tabbedPaneLabel"
|
||||
"text": "JTabbedPane:"
|
||||
}, 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 ) ) {
|
||||
name: "tabbedPane1"
|
||||
@@ -519,13 +543,13 @@ new FormModel {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 22"
|
||||
"value": "cell 1 21 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "listTreeLabel"
|
||||
"text": "<html>JList / JTree:<br>JSplitPane:</html>"
|
||||
}, 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 ) ) {
|
||||
name: "splitPane1"
|
||||
@@ -570,13 +594,13 @@ new FormModel {
|
||||
"value": "right"
|
||||
} )
|
||||
}, 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" ) {
|
||||
name: "tableLabel"
|
||||
"text": "JTable:"
|
||||
}, 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 ) ) {
|
||||
name: "scrollPane4"
|
||||
@@ -609,13 +633,13 @@ new FormModel {
|
||||
}
|
||||
} )
|
||||
}, 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" ) {
|
||||
name: "internalFrameLabel"
|
||||
"text": "<html>JDesktopPane:<br>JInternalFrame:</html>"
|
||||
}, 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 ) ) {
|
||||
name: "desktopPane1"
|
||||
@@ -653,7 +677,7 @@ new FormModel {
|
||||
"y": 50
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 25"
|
||||
"value": "cell 1 24 2 1"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
package com.formdev.flatlaf.themeeditor;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import java.awt.Component;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Predicate;
|
||||
import javax.swing.*;
|
||||
import com.formdev.flatlaf.FlatClientProperties;
|
||||
import net.miginfocom.swing.*;
|
||||
|
||||
/**
|
||||
@@ -29,31 +29,64 @@ import net.miginfocom.swing.*;
|
||||
class FlatThemePreviewButtons
|
||||
extends JPanel
|
||||
{
|
||||
FlatThemePreviewButtons() {
|
||||
private static final String KEY_BUTTON_TYPE = "preview.buttonType";
|
||||
|
||||
private final FlatThemePreview preview;
|
||||
|
||||
FlatThemePreviewButtons( FlatThemePreview preview ) {
|
||||
this.preview = preview;
|
||||
|
||||
initComponents();
|
||||
}
|
||||
|
||||
private void buttonTypeChanged() {
|
||||
Object buttonType = null;
|
||||
void activated() {
|
||||
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() )
|
||||
buttonType = FlatClientProperties.BUTTON_TYPE_SQUARE;
|
||||
buttonType = BUTTON_TYPE_SQUARE;
|
||||
else if( roundRectButton.isSelected() )
|
||||
buttonType = FlatClientProperties.BUTTON_TYPE_ROUND_RECT;
|
||||
buttonType = BUTTON_TYPE_ROUND_RECT;
|
||||
else if( tabButton.isSelected() )
|
||||
buttonType = FlatClientProperties.BUTTON_TYPE_TAB;
|
||||
buttonType = BUTTON_TYPE_TAB;
|
||||
else if( toolBarButtonButton.isSelected() )
|
||||
buttonType = FlatClientProperties.BUTTON_TYPE_TOOLBAR_BUTTON;
|
||||
buttonType = BUTTON_TYPE_TOOLBAR_BUTTON;
|
||||
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() ) {
|
||||
if( !(c instanceof AbstractButton) )
|
||||
continue;
|
||||
|
||||
AbstractButton b = (AbstractButton) c;
|
||||
if( !Objects.equals( b.getClientProperty( FlatClientProperties.BUTTON_TYPE ), FlatClientProperties.BUTTON_TYPE_HELP ) )
|
||||
b.putClientProperty( FlatClientProperties.BUTTON_TYPE, buttonType );
|
||||
if( !Objects.equals( b.getClientProperty( BUTTON_TYPE ), BUTTON_TYPE_HELP ) )
|
||||
b.putClientProperty( BUTTON_TYPE, buttonType );
|
||||
}
|
||||
|
||||
FlatThemeFileEditor.putPrefsString( preview.state, KEY_BUTTON_TYPE, buttonType );
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
@@ -664,7 +697,7 @@ class FlatThemePreviewButtons
|
||||
}
|
||||
} );
|
||||
|
||||
putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER,
|
||||
putClientProperty( COMPONENT_FOCUS_OWNER,
|
||||
(Predicate<JComponent>) c -> {
|
||||
return ((TestStateButton)c).isStateFocused();
|
||||
} );
|
||||
@@ -734,7 +767,7 @@ class FlatThemePreviewButtons
|
||||
}
|
||||
} );
|
||||
|
||||
putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER,
|
||||
putClientProperty( COMPONENT_FOCUS_OWNER,
|
||||
(Predicate<JComponent>) c -> {
|
||||
return ((TestStateToggleButton)c).isStateFocused();
|
||||
} );
|
||||
|
||||
@@ -830,7 +830,7 @@ Table.selectionForeground
|
||||
Table.selectionInactiveBackground
|
||||
Table.selectionInactiveForeground
|
||||
Table.showHorizontalLines
|
||||
Table.showLastVerticalLine
|
||||
Table.showTrailingVerticalLine
|
||||
Table.showVerticalLines
|
||||
Table.sortIconColor
|
||||
TableHeader.ancestorInputMap
|
||||
@@ -843,7 +843,7 @@ TableHeader.font
|
||||
TableHeader.foreground
|
||||
TableHeader.height
|
||||
TableHeader.separatorColor
|
||||
TableHeader.showLastVerticalLine
|
||||
TableHeader.showTrailingVerticalLine
|
||||
TableHeaderUI
|
||||
TableUI
|
||||
TaskPane.background
|
||||
|
||||
Reference in New Issue
Block a user