mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 22:47:13 -06:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
073a25f381 | ||
|
|
40592ab876 | ||
|
|
bbfe624b51 | ||
|
|
a2af9e4c65 | ||
|
|
0123a8895f | ||
|
|
53854a4d13 | ||
|
|
4fdd44858f | ||
|
|
3c58879ce5 | ||
|
|
a7c6a881b3 | ||
|
|
ef065d31a0 | ||
|
|
d059d6b448 | ||
|
|
2d0a6f1bec | ||
|
|
a3cc5a1938 | ||
|
|
435068515a | ||
|
|
956001dbd7 | ||
|
|
460f0d9dee | ||
|
|
5155ec93c9 | ||
|
|
8bb8883e22 | ||
|
|
ffb7a6dfbb | ||
|
|
176de6f245 | ||
|
|
11f9740dbf | ||
|
|
42a91ba26c | ||
|
|
234003e2b1 | ||
|
|
534384438b | ||
|
|
ab51f35d5d | ||
|
|
511a4044d7 | ||
|
|
821efaff40 | ||
|
|
91bc994532 | ||
|
|
1323b46ac7 | ||
|
|
3a8b30ca8e | ||
|
|
923d58519f | ||
|
|
eabb1f84f6 | ||
|
|
cfbe44b946 | ||
|
|
81c35eab46 | ||
|
|
a1c7c29113 | ||
|
|
1293e2a074 |
42
CHANGELOG.md
42
CHANGELOG.md
@@ -1,6 +1,48 @@
|
||||
FlatLaf Change Log
|
||||
==================
|
||||
|
||||
## 0.46
|
||||
|
||||
#### New features and improvements
|
||||
|
||||
- Slider and JIDE RangeSlider: Clicking on track now immediately moves the thumb
|
||||
to mouse location and starts dragging the thumb. Use `UIManager.put(
|
||||
"Slider.scrollOnTrackClick", true )` to enable old behavior that scrolls the
|
||||
thumb when clicking on track.
|
||||
- Slider: Snap to ticks is now done while dragging the thumb. Use
|
||||
`UIManager.put( "Slider.snapToTicksOnReleased", true )` to enable old behavior
|
||||
that snaps to ticks on mouse released.
|
||||
- Extras: Added standard component extension classes that provides easy access
|
||||
to FlatLaf specific client properties (see package
|
||||
`com.formdev.flatlaf.extras.components`).
|
||||
- Extras: Renamed tri-state check box class from
|
||||
`com.formdev.flatlaf.extras.TriStateCheckBox` to
|
||||
`com.formdev.flatlaf.extras.components.FlatTriStateCheckBox`. Also
|
||||
changed/improved API and added javadoc.
|
||||
- Extras: Renamed SVG utility class from `com.formdev.flatlaf.extras.SVGUtils`
|
||||
to `com.formdev.flatlaf.extras.FlatSVGUtils`.
|
||||
- IntelliJ Themes: Added flag whether a theme is dark to
|
||||
`FlatAllIJThemes.INFOS`. (issue #221)
|
||||
- JIDE Common Layer: Support `TristateCheckBox`.
|
||||
|
||||
|
||||
#### Fixed bugs
|
||||
|
||||
- Slider: Fixed painting of colored track if `JSlider.inverted` is `true`.
|
||||
- Table and TableHeader: Fixed missing right vertical grid line if using table
|
||||
as row header in scroll pane. (issues #152 and #46)
|
||||
- TableHeader: Fixed position of column separators in right-to-left component
|
||||
orientation.
|
||||
- ToolTip: Fixed drop shadow for wide tooltips on Windows and Java 9+. (issue
|
||||
#224)
|
||||
- SwingX: Fixed striping background highlighting color (e.g. alternating table
|
||||
rows) in dark themes.
|
||||
- Fixed: If text antialiasing is disabled (in OS system settings or via
|
||||
`-Dawt.useSystemAAFontSettings=off`), then some components still did use
|
||||
antialiasing to render text (not-editable ComboBox, ProgressBar, Slider,
|
||||
TabbedPane and multiline ToolTip). (issue #227)
|
||||
|
||||
|
||||
## 0.45
|
||||
|
||||
#### New features and improvements
|
||||
|
||||
74
README.md
74
README.md
@@ -76,36 +76,76 @@ Addons
|
||||
Projects using FlatLaf
|
||||
----------------------
|
||||
|
||||
- [NetBeans](https://netbeans.apache.org/) 11.3
|
||||
- [Apache NetBeans](https://netbeans.apache.org/) 11.3 - IDE for Java, PHP, HTML
|
||||
and much more
|
||||
- [jclasslib bytecode viewer](https://github.com/ingokegel/jclasslib) 5.5
|
||||
- [KeyStore Explorer](https://keystore-explorer.org/) 5.4.3
|
||||
- [OWASP Zed Attack Proxy (ZAP)](https://www.zaproxy.org/) (in weekly releases)
|
||||
-  [jAlbum](https://jalbum.net/) 21 (commercial)
|
||||
-  [OWASP ZAP](https://www.zaproxy.org/) 2.10 - the worlds
|
||||
most widely used web app scanner
|
||||
-  [JOSM](https://josm.openstreetmap.de/) - an extensible
|
||||
editor for [OpenStreetMap](https://www.openstreetmap.org/) (requires FlatLaf
|
||||
JOSM plugin)
|
||||
- [jAlbum](https://jalbum.net/) 21 (commercial) - creates photo album websites
|
||||
- [XMLmind XML Editor](https://www.xmlmind.com/xmleditor/) 9.3 (commercial)
|
||||
- [Total Validator](https://www.totalvalidator.com/) 15 (commercial)
|
||||
- [j-lawyer](https://github.com/jlawyerorg/j-lawyer-org)
|
||||
- [Total Validator](https://www.totalvalidator.com/) 15 (commercial) - checks
|
||||
your website
|
||||
- [j-lawyer](https://github.com/jlawyerorg/j-lawyer-org) - Kanzleisoftware
|
||||
- [MegaMek](https://github.com/MegaMek/megamek) v0.47.4 and
|
||||
[MekHQ](https://github.com/MegaMek/mekhq) v0.47.5
|
||||
[MekHQ](https://github.com/MegaMek/mekhq) v0.47.5 - a turn-based sci-fi board
|
||||
game
|
||||
- [GUIslice Builder](https://github.com/ImpulseAdventure/GUIslice-Builder)
|
||||
0.13.b024
|
||||
- [Rest Suite](https://github.com/supanadit/restsuite)
|
||||
- [ControllerBuddy](https://github.com/bwRavencl/ControllerBuddy)
|
||||
- [SpringRemote](https://github.com/HaleyWang/SpringRemote)
|
||||
0.13.b024 - GUI builder for
|
||||
[GUIslice](https://github.com/ImpulseAdventure/GUIslice), a lightweight GUI
|
||||
framework for embedded displays
|
||||
- [Rest Suite](https://github.com/supanadit/restsuite) - Rest API testing
|
||||
- [ControllerBuddy](https://github.com/bwRavencl/ControllerBuddy) - advanced
|
||||
gamepad mapping software
|
||||
- [SpringRemote](https://github.com/HaleyWang/SpringRemote) - remote Linux SSH
|
||||
connections manager
|
||||
-  [jEnTunnel](https://github.com/ggrandes/jentunnel) -
|
||||
manage SSH Tunnels made easy
|
||||
- [mendelson AS2](https://sourceforge.net/projects/mec-as2/),
|
||||
[AS4](https://sourceforge.net/projects/mendelson-as4/) and
|
||||
[OFTP2](https://sourceforge.net/projects/mendelson-oftp2/) (open-source) and
|
||||
[mendelson AS2](https://mendelson-e-c.com/as2/),
|
||||
[AS4](https://mendelson-e-c.com/as4/) and
|
||||
[OFTP2](https://mendelson-e-c.com/oftp2) (commercial)
|
||||
- [MeteoInfo](https://github.com/meteoinfo/MeteoInfo) 2.2
|
||||
- [lsfusion platform](https://github.com/lsfusion/platform)
|
||||
- [MeteoInfo](https://github.com/meteoinfo/MeteoInfo) 2.2 - GIS and scientific
|
||||
computation environment for meteorological community
|
||||
- [lsfusion platform](https://github.com/lsfusion/platform) - information
|
||||
systems development platform
|
||||
-  [JPass](https://github.com/gaborbata/jpass) - password
|
||||
manager with strong encryption
|
||||
- [Jes - Die Java-EÜR](https://www.jes-eur.de)
|
||||
- [Mapton](https://mapton.org/) 2.0
|
||||
([source code](https://github.com/trixon/mapton)) based on NetBeans platform
|
||||
- [Pseudo Assembler IDE](https://github.com/tomasz-herman/PseudoAssemblerIDE)
|
||||
- [Sound Analysis](https://github.com/tomasz-herman/SoundAnalysis)
|
||||
- [RemoteLight](https://github.com/Drumber/RemoteLight) - Multifunctional LED
|
||||
Control Software
|
||||
([source code](https://github.com/trixon/mapton)) based on NetBeans platform -
|
||||
some kind of map application
|
||||
- [Pseudo Assembler IDE](https://github.com/tomasz-herman/PseudoAssemblerIDE) -
|
||||
IDE for Pseudo-Assembler
|
||||
-  [Linotte](https://github.com/cpc6128/LangageLinotte)
|
||||
3.1 - French programming language created to learn programming
|
||||
-  [MEKA](https://github.com/Waikato/meka) 1.9.3 -
|
||||
multi-label classifiers and evaluation procedures using the Weka machine
|
||||
learning framework
|
||||
-  [Shutter Encoder](https://www.shutterencoder.com/) 14.2
|
||||
([source code](https://github.com/paulpacifico/shutter-encoder)) -
|
||||
professional video converter and compression tool (screenshots show **old**
|
||||
look)
|
||||
- [Sound Analysis](https://github.com/tomasz-herman/SoundAnalysis) - analyze
|
||||
sound files in time or frequency domain
|
||||
- [RemoteLight](https://github.com/Drumber/RemoteLight) - multifunctional LED
|
||||
control software
|
||||
- 
|
||||
[ThunderFocus](https://github.com/marcocipriani01/ThunderFocus) -
|
||||
Arduino-based telescope focuser
|
||||
- 
|
||||
[Novel-Grabber](https://github.com/Flameish/Novel-Grabber) - download novels
|
||||
from any webnovel and lightnovel site
|
||||
-  [lectureStudio](https://www.lecturestudio.org/)
|
||||
4.3.1060 - digitize your lectures with ease
|
||||
- 
|
||||
[Android Tool](https://github.com/fast-geek/Android-Tool) - makes popular adb
|
||||
and fastboot commands easier to use
|
||||
- and more...
|
||||
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
val releaseVersion = "0.45"
|
||||
val developmentVersion = "0.46-SNAPSHOT"
|
||||
val releaseVersion = "0.46"
|
||||
val developmentVersion = "0.47-SNAPSHOT"
|
||||
|
||||
version = if( java.lang.Boolean.getBoolean( "release" ) ) releaseVersion else developmentVersion
|
||||
|
||||
|
||||
@@ -130,6 +130,15 @@ public interface FlatClientProperties
|
||||
*/
|
||||
String MINIMUM_HEIGHT = "JComponent.minimumHeight";
|
||||
|
||||
/**
|
||||
* Paint the component with round edges.
|
||||
* <p>
|
||||
* <strong>Components</strong> {@link javax.swing.JComboBox}, {@link javax.swing.JSpinner},
|
||||
* {@link javax.swing.JTextField}, {@link javax.swing.JFormattedTextField} and {@link javax.swing.JPasswordField}<br>
|
||||
* <strong>Value type</strong> {@link java.lang.Boolean}
|
||||
*/
|
||||
String COMPONENT_ROUND_RECT = "JComponent.roundRect";
|
||||
|
||||
/**
|
||||
* Specifies the outline color of the component border.
|
||||
* <p>
|
||||
@@ -161,15 +170,6 @@ public interface FlatClientProperties
|
||||
*/
|
||||
String OUTLINE_WARNING = "warning";
|
||||
|
||||
/**
|
||||
* Paint the component with round edges.
|
||||
* <p>
|
||||
* <strong>Components</strong> {@link javax.swing.JComboBox}, {@link javax.swing.JSpinner},
|
||||
* {@link javax.swing.JTextField}, {@link javax.swing.JFormattedTextField} and {@link javax.swing.JPasswordField}<br>
|
||||
* <strong>Value type</strong> {@link java.lang.Boolean}
|
||||
*/
|
||||
String COMPONENT_ROUND_RECT = "JComponent.roundRect";
|
||||
|
||||
//---- Popup --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -264,7 +264,7 @@ public interface FlatClientProperties
|
||||
String TABBED_PANE_HAS_FULL_BORDER = "JTabbedPane.hasFullBorder";
|
||||
|
||||
/**
|
||||
* Specifies whether the tab area should be hidded if it contains only one tab.
|
||||
* Specifies whether the tab area should be hidden if it contains only one tab.
|
||||
* <p>
|
||||
* <strong>Component</strong> {@link javax.swing.JTabbedPane}<br>
|
||||
* <strong>Value type</strong> {@link java.lang.Boolean}
|
||||
@@ -349,7 +349,7 @@ public interface FlatClientProperties
|
||||
* Specifies the callback that is invoked when a tab close button is clicked.
|
||||
* The callback is responsible for closing the tab.
|
||||
* <p>
|
||||
* Either use a {@link java.util.function.IntConsumer} that received the tab index as parameter:
|
||||
* Either use a {@link java.util.function.IntConsumer} that receives the tab index as parameter:
|
||||
* <pre>{@code
|
||||
* myTabbedPane.putClientProperty( "JTabbedPane.tabCloseCallback",
|
||||
* (IntConsumer) tabIndex -> {
|
||||
@@ -357,7 +357,7 @@ public interface FlatClientProperties
|
||||
* } );
|
||||
* }</pre>
|
||||
* Or use a {@link java.util.function.BiConsumer}<javax.swing.JTabbedPane, Integer>
|
||||
* that received the tabbed pane and the tab index as parameters:
|
||||
* that receives the tabbed pane and the tab index as parameters:
|
||||
* <pre>{@code
|
||||
* myTabbedPane.putClientProperty( "JTabbedPane.tabCloseCallback",
|
||||
* (BiConsumer<JTabbedPane, Integer>) (tabbedPane, tabIndex) -> {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.icons;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import com.formdev.flatlaf.util.AnimatedIcon;
|
||||
|
||||
/**
|
||||
* Base class for animated icons that scales width and height, creates and initializes
|
||||
* a scaled graphics context for icon painting.
|
||||
* <p>
|
||||
* Subclasses do not need to scale icon painting.
|
||||
* <p>
|
||||
* This class does not store any state information (needed for animation) in its instance.
|
||||
* Instead a client property is set on the painted component.
|
||||
* This makes it possible to use a share icon instance for multiple components.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public abstract class FlatAnimatedIcon
|
||||
extends FlatAbstractIcon
|
||||
implements AnimatedIcon
|
||||
{
|
||||
public FlatAnimatedIcon( int width, int height, Color color ) {
|
||||
super( width, height, color );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon( Component c, Graphics g, int x, int y ) {
|
||||
super.paintIcon( c, g, x, y );
|
||||
AnimatedIcon.AnimationSupport.saveIconLocation( this, c, x, y );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintIcon( Component c, Graphics2D g ) {
|
||||
AnimatedIcon.AnimationSupport.paintIcon( this, c, g, 0, 0 );
|
||||
}
|
||||
}
|
||||
@@ -166,8 +166,7 @@ public class FlatArrowButton
|
||||
|
||||
@Override
|
||||
public void paint( Graphics g ) {
|
||||
Graphics2D g2 = (Graphics2D)g;
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
||||
|
||||
// paint hover or pressed background
|
||||
if( isEnabled() ) {
|
||||
@@ -179,7 +178,7 @@ public class FlatArrowButton
|
||||
|
||||
if( background != null ) {
|
||||
g.setColor( deriveBackground( background ) );
|
||||
paintBackground( g2 );
|
||||
paintBackground( (Graphics2D) g );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +190,9 @@ public class FlatArrowButton
|
||||
? hoverForeground
|
||||
: foreground))
|
||||
: disabledForeground ) );
|
||||
paintArrow( g2 );
|
||||
paintArrow( (Graphics2D) g );
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||
}
|
||||
|
||||
protected void paintBackground( Graphics2D g ) {
|
||||
|
||||
@@ -352,7 +352,7 @@ public class FlatComboBoxUI
|
||||
FlatUIUtils.paintParentBackground( g, c );
|
||||
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g2 );
|
||||
|
||||
int width = c.getWidth();
|
||||
int height = c.getHeight();
|
||||
@@ -386,6 +386,9 @@ public class FlatComboBoxUI
|
||||
g2.fill( new Rectangle2D.Float( lx, focusWidth, lw, height - 1 - (focusWidth * 2)) );
|
||||
}
|
||||
|
||||
// avoid that the "current value" renderer is invoked with enabled antialiasing
|
||||
FlatUIUtils.resetRenderingHints( g2, oldRenderingHints );
|
||||
|
||||
paint( g, c );
|
||||
}
|
||||
|
||||
|
||||
@@ -271,16 +271,17 @@ public class FlatPopupFactory
|
||||
|
||||
// increase tooltip size if necessary because it may be too small on HiDPI screens
|
||||
// https://bugs.openjdk.java.net/browse/JDK-8213535
|
||||
if( contents instanceof JToolTip ) {
|
||||
if( contents instanceof JToolTip && popupWindow == null ) {
|
||||
Container parent = contents.getParent();
|
||||
if( parent instanceof JPanel ) {
|
||||
Dimension prefSize = parent.getPreferredSize();
|
||||
if( !prefSize.equals( parent.getSize() ) ) {
|
||||
Container panel = SwingUtilities.getAncestorOfClass( Panel.class, parent );
|
||||
if( panel != null )
|
||||
panel.setSize( prefSize ); // for medium weight popup
|
||||
else
|
||||
parent.setSize( prefSize ); // for light weight popup
|
||||
Container mediumWeightPanel = SwingUtilities.getAncestorOfClass( Panel.class, parent );
|
||||
Container c = (mediumWeightPanel != null)
|
||||
? mediumWeightPanel // medium weight popup
|
||||
: parent; // light weight popup
|
||||
c.setSize( prefSize );
|
||||
c.validate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class FlatProgressBarUI
|
||||
? 0
|
||||
: Math.min( UIScale.scale( this.arc ), horizontal ? height : width );
|
||||
|
||||
FlatUIUtils.setRenderingHints( (Graphics2D) g );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
||||
|
||||
// paint track
|
||||
RoundRectangle2D.Float trackShape = new RoundRectangle2D.Float( x, y, width, height, arc, arc );
|
||||
@@ -163,6 +163,7 @@ public class FlatProgressBarUI
|
||||
((Graphics2D)g).fill( trackShape );
|
||||
|
||||
// paint progress
|
||||
int amountFull = 0;
|
||||
if( progressBar.isIndeterminate() ) {
|
||||
boxRect = getBox( boxRect );
|
||||
if( boxRect != null ) {
|
||||
@@ -170,11 +171,8 @@ public class FlatProgressBarUI
|
||||
((Graphics2D)g).fill( new RoundRectangle2D.Float( boxRect.x, boxRect.y,
|
||||
boxRect.width, boxRect.height, arc, arc ) );
|
||||
}
|
||||
|
||||
if( progressBar.isStringPainted() )
|
||||
paintString( g, x, y, width, height, 0, insets );
|
||||
} else {
|
||||
int amountFull = getAmountFull( insets, width, height );
|
||||
amountFull = getAmountFull( insets, width, height );
|
||||
|
||||
RoundRectangle2D.Float progressShape = horizontal
|
||||
? new RoundRectangle2D.Float( c.getComponentOrientation().isLeftToRight() ? x : x + (width - amountFull),
|
||||
@@ -189,10 +187,12 @@ public class FlatProgressBarUI
|
||||
((Graphics2D)g).fill( area );
|
||||
} else
|
||||
((Graphics2D)g).fill( progressShape );
|
||||
|
||||
if( progressBar.isStringPainted() )
|
||||
paintString( g, x, y, width, height, amountFull, insets );
|
||||
}
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||
|
||||
if( progressBar.isStringPainted() )
|
||||
paintString( g, x, y, width, height, amountFull, insets );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.formdev.flatlaf.ui;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.MouseAdapter;
|
||||
@@ -221,8 +220,9 @@ public class FlatScrollBarUI
|
||||
|
||||
@Override
|
||||
public void paint( Graphics g, JComponent c ) {
|
||||
FlatUIUtils.setRenderingHints( (Graphics2D) g );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
||||
super.paint( g, c );
|
||||
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -94,6 +94,8 @@ public class FlatSliderUI
|
||||
protected boolean thumbHover;
|
||||
protected boolean thumbPressed;
|
||||
|
||||
private Object[] oldRenderingHints;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
return new FlatSliderUI();
|
||||
}
|
||||
@@ -211,7 +213,7 @@ public class FlatSliderUI
|
||||
|
||||
@Override
|
||||
public void paint( Graphics g, JComponent c ) {
|
||||
FlatUIUtils.setRenderingHints( (Graphics2D) g );
|
||||
oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
||||
|
||||
/*debug
|
||||
g.setColor( Color.gray );
|
||||
@@ -224,9 +226,23 @@ public class FlatSliderUI
|
||||
g.drawRect( trackRect.x, trackRect.y, trackRect.width - 1, trackRect.height - 1 );
|
||||
g.setColor( Color.red );
|
||||
g.drawRect( thumbRect.x, thumbRect.y, thumbRect.width - 1, thumbRect.height - 1 );
|
||||
g.setColor( Color.green );
|
||||
g.drawRect( tickRect.x, tickRect.y, tickRect.width - 1, tickRect.height - 1 );
|
||||
g.setColor( Color.red );
|
||||
g.drawRect( labelRect.x, labelRect.y, labelRect.width - 1, labelRect.height - 1 );
|
||||
debug*/
|
||||
|
||||
super.paint( g, c );
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||
oldRenderingHints = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintLabels( Graphics g ) {
|
||||
FlatUIUtils.runWithoutRenderingHints( g, oldRenderingHints, () -> {
|
||||
super.paintLabels( g );
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -267,6 +283,12 @@ debug*/
|
||||
}
|
||||
|
||||
if( coloredTrack != null ) {
|
||||
if( slider.getInverted() ) {
|
||||
RoundRectangle2D temp = track;
|
||||
track = coloredTrack;
|
||||
coloredTrack = temp;
|
||||
}
|
||||
|
||||
g.setColor( trackValueColor );
|
||||
((Graphics2D)g).fill( coloredTrack );
|
||||
}
|
||||
@@ -484,7 +506,47 @@ debug*/
|
||||
@Override
|
||||
public void mousePressed( MouseEvent e ) {
|
||||
setThumbPressed( isOverThumb( e ) );
|
||||
|
||||
if( !slider.isEnabled() )
|
||||
return;
|
||||
|
||||
// use "old" behavior when clicking on track
|
||||
if( UIManager.getBoolean( "Slider.scrollOnTrackClick" ) ) {
|
||||
super.mousePressed( e );
|
||||
return;
|
||||
}
|
||||
|
||||
// "new" behavior set thumb to mouse location when clicking on track
|
||||
|
||||
int x = e.getX();
|
||||
int y = e.getY();
|
||||
|
||||
// clicked on thumb --> let super class do the work
|
||||
calculateGeometry();
|
||||
if( thumbRect.contains( x, y ) ) {
|
||||
super.mousePressed( e );
|
||||
return;
|
||||
}
|
||||
|
||||
if( UIManager.getBoolean( "Slider.onlyLeftMouseButtonDrag" ) &&
|
||||
!SwingUtilities.isLeftMouseButton( e ) )
|
||||
return;
|
||||
|
||||
// move the mouse event coordinates to the center of the thumb
|
||||
int tx = thumbRect.x + (thumbRect.width / 2) - x;
|
||||
int ty = thumbRect.y + (thumbRect.height / 2) - y;
|
||||
e.translatePoint( tx, ty );
|
||||
|
||||
// invoke super mousePressed() to start dragging thumb
|
||||
super.mousePressed( e );
|
||||
|
||||
// move the mouse event coordinates back to current mouse location
|
||||
e.translatePoint( -tx, -ty );
|
||||
|
||||
// invoke mouseDragged() to update thumb location
|
||||
mouseDragged( e );
|
||||
|
||||
setThumbPressed( true );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -493,6 +555,20 @@ debug*/
|
||||
super.mouseReleased( e );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged( MouseEvent e ) {
|
||||
super.mouseDragged( e );
|
||||
|
||||
if( isDragging() &&
|
||||
slider.getSnapToTicks() &&
|
||||
slider.isEnabled() &&
|
||||
!UIManager.getBoolean( "Slider.snapToTicksOnReleased" ) )
|
||||
{
|
||||
calculateThumbLocation();
|
||||
slider.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
protected void setThumbHover( boolean hover ) {
|
||||
if( hover != thumbHover ) {
|
||||
thumbHover = hover;
|
||||
|
||||
@@ -264,7 +264,7 @@ public class FlatSpinnerUI
|
||||
FlatUIUtils.paintParentBackground( g, c );
|
||||
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g2 );
|
||||
|
||||
int width = c.getWidth();
|
||||
int height = c.getHeight();
|
||||
@@ -303,6 +303,8 @@ public class FlatSpinnerUI
|
||||
}
|
||||
|
||||
paint( g, c );
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||
}
|
||||
|
||||
//---- class Handler ------------------------------------------------------
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
@@ -148,10 +147,12 @@ public class FlatSplitPaneUI
|
||||
if( "plain".equals( style ) )
|
||||
return;
|
||||
|
||||
FlatUIUtils.setRenderingHints( (Graphics2D) g );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
||||
|
||||
g.setColor( gripColor );
|
||||
paintGrip( g, 0, 0, getWidth(), getHeight() );
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||
}
|
||||
|
||||
protected void paintGrip( Graphics g, int x, int y, int width, int height ) {
|
||||
|
||||
@@ -226,6 +226,8 @@ public class FlatTabbedPaneUI
|
||||
private boolean rolloverTabClose;
|
||||
private boolean pressedTabClose;
|
||||
|
||||
private Object[] oldRenderingHints;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
return new FlatTabbedPaneUI();
|
||||
}
|
||||
@@ -791,9 +793,12 @@ public class FlatTabbedPaneUI
|
||||
|
||||
@Override
|
||||
public void update( Graphics g, JComponent c ) {
|
||||
FlatUIUtils.setRenderingHints( (Graphics2D) g );
|
||||
oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
||||
|
||||
super.update( g, c );
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||
oldRenderingHints = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -874,27 +879,29 @@ public class FlatTabbedPaneUI
|
||||
{
|
||||
g.setFont( font );
|
||||
|
||||
// html
|
||||
View view = getTextViewForTab( tabIndex );
|
||||
if( view != null ) {
|
||||
view.paint( g, textRect );
|
||||
return;
|
||||
}
|
||||
FlatUIUtils.runWithoutRenderingHints( g, oldRenderingHints, () -> {
|
||||
// html
|
||||
View view = getTextViewForTab( tabIndex );
|
||||
if( view != null ) {
|
||||
view.paint( g, textRect );
|
||||
return;
|
||||
}
|
||||
|
||||
// plain text
|
||||
Color color;
|
||||
if( tabPane.isEnabled() && tabPane.isEnabledAt( tabIndex ) ) {
|
||||
color = tabPane.getForegroundAt( tabIndex );
|
||||
if( isSelected && (color instanceof UIResource) && selectedForeground != null )
|
||||
color = selectedForeground;
|
||||
} else
|
||||
color = disabledForeground;
|
||||
// plain text
|
||||
Color color;
|
||||
if( tabPane.isEnabled() && tabPane.isEnabledAt( tabIndex ) ) {
|
||||
color = tabPane.getForegroundAt( tabIndex );
|
||||
if( isSelected && (color instanceof UIResource) && selectedForeground != null )
|
||||
color = selectedForeground;
|
||||
} else
|
||||
color = disabledForeground;
|
||||
|
||||
int mnemIndex = FlatLaf.isShowMnemonics() ? tabPane.getDisplayedMnemonicIndexAt( tabIndex ) : -1;
|
||||
int mnemIndex = FlatLaf.isShowMnemonics() ? tabPane.getDisplayedMnemonicIndexAt( tabIndex ) : -1;
|
||||
|
||||
g.setColor( color );
|
||||
FlatUIUtils.drawStringUnderlineCharAt( tabPane, g, title, mnemIndex,
|
||||
textRect.x, textRect.y + metrics.getAscent() );
|
||||
g.setColor( color );
|
||||
FlatUIUtils.drawStringUnderlineCharAt( tabPane, g, title, mnemIndex,
|
||||
textRect.x, textRect.y + metrics.getAscent() );
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,6 +31,7 @@ import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.Border;
|
||||
@@ -98,10 +99,13 @@ public class FlatTableHeaderUI
|
||||
|
||||
@Override
|
||||
public void paint( Graphics g, JComponent c ) {
|
||||
if( header.getColumnModel().getColumnCount() <= 0 )
|
||||
return;
|
||||
|
||||
// do not paint borders if JTableHeader.setDefaultRenderer() was used
|
||||
TableCellRenderer defaultRenderer = header.getDefaultRenderer();
|
||||
boolean paintBorders = isSystemDefaultRenderer( defaultRenderer );
|
||||
if( !paintBorders && header.getColumnModel().getColumnCount() > 0 ) {
|
||||
if( !paintBorders ) {
|
||||
// check whether the renderer delegates to the system default renderer
|
||||
Component rendererComponent = defaultRenderer.getTableCellRendererComponent(
|
||||
header.getTable(), "", false, false, -1, 0 );
|
||||
@@ -145,6 +149,9 @@ public class FlatTableHeaderUI
|
||||
float bottomLineIndent = lineWidth * 3;
|
||||
TableColumnModel columnModel = header.getColumnModel();
|
||||
int columnCount = columnModel.getColumnCount();
|
||||
int sepCount = columnCount;
|
||||
if( hideLastVerticalLine() )
|
||||
sepCount--;
|
||||
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
try {
|
||||
@@ -157,23 +164,30 @@ public class FlatTableHeaderUI
|
||||
// paint column separator lines
|
||||
g2.setColor( separatorColor );
|
||||
|
||||
int sepCount = columnCount;
|
||||
if( header.getTable() != null && header.getTable().getAutoResizeMode() != JTable.AUTO_RESIZE_OFF && !isVerticalScrollBarVisible() )
|
||||
sepCount--;
|
||||
float y = topLineIndent;
|
||||
float h = height - bottomLineIndent;
|
||||
|
||||
if( header.getComponentOrientation().isLeftToRight() ) {
|
||||
int x = 0;
|
||||
for( int i = 0; i < sepCount; i++ ) {
|
||||
x += columnModel.getColumn( i ).getWidth();
|
||||
g2.fill( new Rectangle2D.Float( x - lineWidth, topLineIndent, lineWidth, height - bottomLineIndent ) );
|
||||
g2.fill( new Rectangle2D.Float( x - lineWidth, y, lineWidth, h ) );
|
||||
}
|
||||
|
||||
// paint trailing separator (on right side)
|
||||
if( !hideTrailingVerticalLine() )
|
||||
g2.fill( new Rectangle2D.Float( header.getWidth() - lineWidth, y, lineWidth, h ) );
|
||||
} else {
|
||||
int x = width;
|
||||
Rectangle cellRect = header.getHeaderRect( 0 );
|
||||
int x = cellRect.x + cellRect.width;
|
||||
for( int i = 0; i < sepCount; i++ ) {
|
||||
x -= columnModel.getColumn( i ).getWidth();
|
||||
g2.fill( new Rectangle2D.Float( x - (i < sepCount - 1 ? lineWidth : 0),
|
||||
topLineIndent, lineWidth, height - bottomLineIndent ) );
|
||||
g2.fill( new Rectangle2D.Float( x - (i < sepCount - 1 ? lineWidth : 0), y, lineWidth, h ) );
|
||||
}
|
||||
|
||||
// paint trailing separator (on left side)
|
||||
if( !hideTrailingVerticalLine() )
|
||||
g2.fill( new Rectangle2D.Float( 0, y, lineWidth, h ) );
|
||||
}
|
||||
} finally {
|
||||
g2.dispose();
|
||||
@@ -230,20 +244,30 @@ public class FlatTableHeaderUI
|
||||
return size;
|
||||
}
|
||||
|
||||
private boolean isVerticalScrollBarVisible() {
|
||||
JScrollPane scrollPane = getScrollPane();
|
||||
return (scrollPane != null && scrollPane.getVerticalScrollBar() != null)
|
||||
? scrollPane.getVerticalScrollBar().isVisible()
|
||||
: false;
|
||||
protected boolean hideLastVerticalLine() {
|
||||
Container viewport = header.getParent();
|
||||
Container viewportParent = (viewport != null) ? viewport.getParent() : null;
|
||||
if( !(viewportParent instanceof JScrollPane) )
|
||||
return false;
|
||||
|
||||
Rectangle cellRect = header.getHeaderRect( header.getColumnModel().getColumnCount() - 1 );
|
||||
|
||||
// using component orientation of scroll pane here because it is also used in FlatTableUI
|
||||
JScrollPane scrollPane = (JScrollPane) viewportParent;
|
||||
return scrollPane.getComponentOrientation().isLeftToRight()
|
||||
? cellRect.x + cellRect.width >= viewport.getWidth()
|
||||
: cellRect.x <= 0;
|
||||
}
|
||||
|
||||
private JScrollPane getScrollPane() {
|
||||
Container parent = header.getParent();
|
||||
if( parent == null )
|
||||
return null;
|
||||
protected boolean hideTrailingVerticalLine() {
|
||||
Container viewport = header.getParent();
|
||||
Container viewportParent = (viewport != null) ? viewport.getParent() : null;
|
||||
if( !(viewportParent instanceof JScrollPane) )
|
||||
return false;
|
||||
|
||||
parent = parent.getParent();
|
||||
return (parent instanceof JScrollPane) ? (JScrollPane) parent : null;
|
||||
JScrollPane scrollPane = (JScrollPane) viewportParent;
|
||||
return viewport == scrollPane.getColumnHeader() &&
|
||||
scrollPane.getCorner( ScrollPaneConstants.UPPER_TRAILING_CORNER ) == null;
|
||||
}
|
||||
|
||||
//---- class FlatTableCellHeaderRenderer ----------------------------------
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.formdev.flatlaf.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.Graphics;
|
||||
@@ -26,8 +27,10 @@ import java.awt.event.FocusListener;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JViewport;
|
||||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicTableUI;
|
||||
@@ -215,16 +218,11 @@ public class FlatTableUI
|
||||
boolean verticalLines = table.getShowVerticalLines();
|
||||
if( horizontalLines || verticalLines ) {
|
||||
// fix grid painting issues in BasicTableUI
|
||||
// - do not paint last vertical grid line if auto-resize mode is not off
|
||||
// - in right-to-left component orientation, do not paint last vertical grid line
|
||||
// in any auto-resize mode; can not paint on left side of table because
|
||||
// cells are painted over left line
|
||||
// - do not paint last vertical grid line if line is on right edge of scroll pane
|
||||
// - fix unstable grid line thickness when scaled at 125%, 150%, 175%, 225%, ...
|
||||
// which paints either 1px or 2px lines depending on location
|
||||
|
||||
boolean hideLastVerticalLine =
|
||||
table.getAutoResizeMode() != JTable.AUTO_RESIZE_OFF ||
|
||||
!table.getComponentOrientation().isLeftToRight();
|
||||
boolean hideLastVerticalLine = hideLastVerticalLine();
|
||||
int tableWidth = table.getWidth();
|
||||
|
||||
double systemScaleFactor = UIScale.getSystemScaleFactor( (Graphics2D) g );
|
||||
@@ -281,4 +279,26 @@ public class FlatTableUI
|
||||
|
||||
super.paint( g, c );
|
||||
}
|
||||
|
||||
protected boolean hideLastVerticalLine() {
|
||||
Container viewport = SwingUtilities.getUnwrappedParent( table );
|
||||
Container viewportParent = (viewport != null) ? viewport.getParent() : null;
|
||||
if( !(viewportParent instanceof JScrollPane) )
|
||||
return false;
|
||||
|
||||
// do not hide last vertical line if table is smaller than viewport
|
||||
if( table.getX() + table.getWidth() < viewport.getWidth() )
|
||||
return false;
|
||||
|
||||
// in left-to-right:
|
||||
// - do not hide last vertical line if table used as row header in scroll pane
|
||||
// in right-to-left:
|
||||
// - hide last vertical line if table used as row header in scroll pane
|
||||
// - do not hide last vertical line if table is in center and scroll pane has row header
|
||||
JScrollPane scrollPane = (JScrollPane) viewportParent;
|
||||
JViewport rowHeader = scrollPane.getRowHeader();
|
||||
return scrollPane.getComponentOrientation().isLeftToRight()
|
||||
? (viewport != rowHeader)
|
||||
: (viewport == rowHeader || rowHeader == null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,13 +106,15 @@ public class FlatToolBarSeparatorUI
|
||||
float lineWidth = scale( 1f );
|
||||
float offset = scale( 2f );
|
||||
|
||||
FlatUIUtils.setRenderingHints( (Graphics2D) g );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
||||
g.setColor( separatorColor );
|
||||
|
||||
if( isVertical( c ) )
|
||||
((Graphics2D)g).fill( new Rectangle2D.Float( Math.round( (width - lineWidth) / 2f ), offset, lineWidth, height - (offset * 2) ) );
|
||||
else
|
||||
((Graphics2D)g).fill( new Rectangle2D.Float( offset, Math.round( (height - lineWidth) / 2f ), width - (offset * 2), lineWidth ) );
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||
}
|
||||
|
||||
private boolean isVertical( JComponent c ) {
|
||||
|
||||
@@ -116,7 +116,6 @@ public class FlatToolTipUI
|
||||
FontMetrics fm = c.getFontMetrics( c.getFont() );
|
||||
Insets insets = c.getInsets();
|
||||
|
||||
FlatUIUtils.setRenderingHints( (Graphics2D) g );
|
||||
g.setColor( c.getForeground() );
|
||||
|
||||
List<String> lines = StringUtils.split( ((JToolTip)c).getTipText(), '\n' );
|
||||
|
||||
@@ -240,10 +240,57 @@ public class FlatUIUtils
|
||||
/**
|
||||
* Sets rendering hints used for painting.
|
||||
*/
|
||||
public static void setRenderingHints( Graphics2D g ) {
|
||||
g.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
|
||||
g.setRenderingHint( RenderingHints.KEY_STROKE_CONTROL,
|
||||
public static Object[] setRenderingHints( Graphics g ) {
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
Object[] oldRenderingHints = new Object[] {
|
||||
g2.getRenderingHint( RenderingHints.KEY_ANTIALIASING ),
|
||||
g2.getRenderingHint( RenderingHints.KEY_STROKE_CONTROL ),
|
||||
};
|
||||
|
||||
g2.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
|
||||
g2.setRenderingHint( RenderingHints.KEY_STROKE_CONTROL,
|
||||
MAC_USE_QUARTZ ? RenderingHints.VALUE_STROKE_PURE : RenderingHints.VALUE_STROKE_NORMALIZE );
|
||||
|
||||
return oldRenderingHints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets rendering hints previously set with {@link #setRenderingHints}.
|
||||
*/
|
||||
public static void resetRenderingHints( Graphics g, Object[] oldRenderingHints ) {
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
g2.setRenderingHint( RenderingHints.KEY_ANTIALIASING, oldRenderingHints[0] );
|
||||
g2.setRenderingHint( RenderingHints.KEY_STROKE_CONTROL, oldRenderingHints[1] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporary resets rendering hints set with {@link #setRenderingHints}
|
||||
* and runs the given runnable.
|
||||
* <p>
|
||||
* This is intended for painting text while rendering hints are set.
|
||||
* <p>
|
||||
* If text antialiasing is disabled (in OS system settings or via
|
||||
* {@code -Dawt.useSystemAAFontSettings=off}), but general antialiasing is enabled,
|
||||
* then text is still painted using some kind of "grayscale" antialiasing,
|
||||
* which may make the text look bold (depends on font and font size).
|
||||
* To avoid this, temporary disable general antialiasing.
|
||||
* This does not affect text rendering if text antialiasing is enabled (usually the default).
|
||||
*/
|
||||
public static void runWithoutRenderingHints( Graphics g, Object[] oldRenderingHints, Runnable runnable ) {
|
||||
if( oldRenderingHints == null ) {
|
||||
runnable.run();
|
||||
return;
|
||||
}
|
||||
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
Object[] oldRenderingHints2 = new Object[] {
|
||||
g2.getRenderingHint( RenderingHints.KEY_ANTIALIASING ),
|
||||
g2.getRenderingHint( RenderingHints.KEY_STROKE_CONTROL ),
|
||||
};
|
||||
|
||||
resetRenderingHints( g2, oldRenderingHints );
|
||||
runnable.run();
|
||||
resetRenderingHints( g2, oldRenderingHints2 );
|
||||
}
|
||||
|
||||
public static Color deriveColor( Color color, Color baseColor ) {
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.util;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import com.formdev.flatlaf.util.Animator.Interpolator;
|
||||
|
||||
/**
|
||||
* Icon that automatically animates painting on component value changes.
|
||||
* <p>
|
||||
* {@link #getValue(Component)} returns the value of the component.
|
||||
* If the value changes, then {@link #paintIconAnimated(Component, Graphics, int, int, float)}
|
||||
* is invoked multiple times with animated value (from old value to new value).
|
||||
* <p>
|
||||
* Example for an animated icon:
|
||||
* <pre>
|
||||
* private class AnimatedMinimalTestIcon
|
||||
* implements AnimatedIcon
|
||||
* {
|
||||
* @Override public int getIconWidth() { return 100; }
|
||||
* @Override public int getIconHeight() { return 20; }
|
||||
*
|
||||
* @Override
|
||||
* public void paintIconAnimated( Component c, Graphics g, int x, int y, float animatedValue ) {
|
||||
* int w = getIconWidth();
|
||||
* int h = getIconHeight();
|
||||
*
|
||||
* g.setColor( Color.red );
|
||||
* g.drawRect( x, y, w - 1, h - 1 );
|
||||
* g.fillRect( x, y, Math.round( w * animatedValue ), h );
|
||||
* }
|
||||
*
|
||||
* @Override
|
||||
* public float getValue( Component c ) {
|
||||
* return ((AbstractButton)c).isSelected() ? 1 : 0;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* // sample usage
|
||||
* JCheckBox checkBox = new JCheckBox( "test" );
|
||||
* checkBox.setIcon( new AnimatedMinimalTestIcon() );
|
||||
* </pre>
|
||||
*
|
||||
* Animation works only if the component passed to {@link #paintIcon(Component, Graphics, int, int)}
|
||||
* is a instance of {@link JComponent}.
|
||||
* A client property is set on the component to store the animation state.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public interface AnimatedIcon
|
||||
extends Icon
|
||||
{
|
||||
@Override
|
||||
public default void paintIcon( Component c, Graphics g, int x, int y ) {
|
||||
AnimationSupport.paintIcon( this, c, g, x, y );
|
||||
}
|
||||
|
||||
/**
|
||||
* Paints the icon for the given animated value.
|
||||
*
|
||||
* @param c the component that this icon belongs to
|
||||
* @param g the graphics context
|
||||
* @param x the x coordinate of the icon
|
||||
* @param y the y coordinate of the icon
|
||||
* @param animatedValue the animated value, which is either equal to what {@link #getValue(Component)}
|
||||
* returned, or somewhere between the previous value and the latest value
|
||||
* that {@link #getValue(Component)} returned
|
||||
*/
|
||||
void paintIconAnimated( Component c, Graphics g, int x, int y, float animatedValue );
|
||||
|
||||
/**
|
||||
* Gets the value of the component.
|
||||
* <p>
|
||||
* This can be any value and depends on the component.
|
||||
* If the value changes, then this class animates from the old value to the new one.
|
||||
* <p>
|
||||
* For a toggle button this could be {@code 0} for off and {@code 1} for on.
|
||||
*/
|
||||
float getValue( Component c );
|
||||
|
||||
/**
|
||||
* Returns whether animation is enabled for this icon (default is {@code true}).
|
||||
*/
|
||||
default boolean isAnimationEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the duration of the animation in milliseconds (default is 150).
|
||||
*/
|
||||
default int getAnimationDuration() {
|
||||
return 150;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the resolution of the animation in milliseconds (default is 10).
|
||||
* Resolution is the amount of time between timing events.
|
||||
*/
|
||||
default int getAnimationResolution() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the interpolator for the animation.
|
||||
* Default is {@link CubicBezierEasing#STANDARD_EASING}.
|
||||
*/
|
||||
default Interpolator getAnimationInterpolator() {
|
||||
return CubicBezierEasing.STANDARD_EASING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the client property key used to store the animation support.
|
||||
*/
|
||||
default Object getClientPropertyKey() {
|
||||
return getClass();
|
||||
}
|
||||
|
||||
//---- class AnimationSupport ---------------------------------------------
|
||||
|
||||
/**
|
||||
* Animation support class that stores the animation state and implements the animation.
|
||||
*/
|
||||
class AnimationSupport
|
||||
{
|
||||
private float startValue;
|
||||
private float targetValue;
|
||||
private float animatedValue;
|
||||
private float fraction;
|
||||
|
||||
private Animator animator;
|
||||
|
||||
// last x,y coordinates of the icon needed to repaint while animating
|
||||
private int x;
|
||||
private int y;
|
||||
|
||||
public static void paintIcon( AnimatedIcon icon, Component c, Graphics g, int x, int y ) {
|
||||
if( !isAnimationEnabled( icon, c ) ) {
|
||||
// paint without animation if animation is disabled or
|
||||
// component is not a JComponent and therefore does not support
|
||||
// client properties, which are required to keep animation state
|
||||
paintIconImpl( icon, c, g, x, y, null );
|
||||
return;
|
||||
}
|
||||
|
||||
JComponent jc = (JComponent) c;
|
||||
Object key = icon.getClientPropertyKey();
|
||||
AnimationSupport as = (AnimationSupport) jc.getClientProperty( key );
|
||||
if( as == null ) {
|
||||
// painted first time --> do not animate, but remember current component value
|
||||
as = new AnimationSupport();
|
||||
as.startValue = as.targetValue = as.animatedValue = icon.getValue( c );
|
||||
as.x = x;
|
||||
as.y = y;
|
||||
jc.putClientProperty( key, as );
|
||||
} else {
|
||||
// get component value
|
||||
float value = icon.getValue( c );
|
||||
|
||||
if( value != as.targetValue ) {
|
||||
// value changed --> (re)start animation
|
||||
|
||||
if( as.animator == null ) {
|
||||
// create animator
|
||||
AnimationSupport as2 = as;
|
||||
as.animator = new Animator( icon.getAnimationDuration(), fraction -> {
|
||||
// check whether component was removed while animation is running
|
||||
if( !c.isDisplayable() ) {
|
||||
as2.animator.stop();
|
||||
return;
|
||||
}
|
||||
|
||||
// compute animated value
|
||||
as2.animatedValue = as2.startValue + ((as2.targetValue - as2.startValue) * fraction);
|
||||
as2.fraction = fraction;
|
||||
|
||||
// repaint icon
|
||||
c.repaint( as2.x, as2.y, icon.getIconWidth(), icon.getIconHeight() );
|
||||
}, () -> {
|
||||
as2.startValue = as2.animatedValue = as2.targetValue;
|
||||
as2.animator = null;
|
||||
} );
|
||||
}
|
||||
|
||||
if( as.animator.isRunning() ) {
|
||||
// if animation is still running, restart it from the current
|
||||
// animated value to the new target value with reduced duration
|
||||
as.animator.cancel();
|
||||
int duration2 = (int) (icon.getAnimationDuration() * as.fraction);
|
||||
if( duration2 > 0 )
|
||||
as.animator.setDuration( duration2 );
|
||||
as.startValue = as.animatedValue;
|
||||
} else {
|
||||
// new animation
|
||||
as.animator.setDuration( icon.getAnimationDuration() );
|
||||
as.animator.setResolution( icon.getAnimationResolution() );
|
||||
as.animator.setInterpolator( icon.getAnimationInterpolator() );
|
||||
|
||||
as.animatedValue = as.startValue;
|
||||
}
|
||||
|
||||
as.targetValue = value;
|
||||
as.animator.start();
|
||||
}
|
||||
|
||||
as.x = x;
|
||||
as.y = y;
|
||||
}
|
||||
|
||||
paintIconImpl( icon, c, g, x, y, as );
|
||||
}
|
||||
|
||||
private static void paintIconImpl( AnimatedIcon icon, Component c, Graphics g, int x, int y, AnimationSupport as ) {
|
||||
float value = (as != null) ? as.animatedValue : icon.getValue( c );
|
||||
icon.paintIconAnimated( c, g, x, y, value );
|
||||
}
|
||||
|
||||
private static boolean isAnimationEnabled( AnimatedIcon icon, Component c ) {
|
||||
return Animator.useAnimation() && icon.isAnimationEnabled() && c instanceof JComponent;
|
||||
}
|
||||
|
||||
public static void saveIconLocation( AnimatedIcon icon, Component c, int x, int y ) {
|
||||
if( !isAnimationEnabled( icon, c ) )
|
||||
return;
|
||||
|
||||
AnimationSupport as = (AnimationSupport) ((JComponent)c).getClientProperty( icon.getClientPropertyKey() );
|
||||
if( as != null ) {
|
||||
as.x = x;
|
||||
as.y = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,38 @@ public class ColorFunctions
|
||||
: value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a color that is a mixture of two colors.
|
||||
*
|
||||
* @param color1 first color
|
||||
* @param color2 second color
|
||||
* @param weight the weight (in range 0-1) to mix the two colors.
|
||||
* Larger weight uses more of first color, smaller weight more of second color.
|
||||
* @return mixture of colors
|
||||
*/
|
||||
public static Color mix( Color color1, Color color2, float weight ) {
|
||||
if( weight >= 1 )
|
||||
return color1;
|
||||
if( weight <= 0 )
|
||||
return color2;
|
||||
|
||||
int r1 = color1.getRed();
|
||||
int g1 = color1.getGreen();
|
||||
int b1 = color1.getBlue();
|
||||
int a1 = color1.getAlpha();
|
||||
|
||||
int r2 = color2.getRed();
|
||||
int g2 = color2.getGreen();
|
||||
int b2 = color2.getBlue();
|
||||
int a2 = color2.getAlpha();
|
||||
|
||||
return new Color(
|
||||
Math.round( r2 + ((r1 - r2) * weight) ),
|
||||
Math.round( g2 + ((g1 - g2) * weight) ),
|
||||
Math.round( b2 + ((b1 - b2) * weight) ),
|
||||
Math.round( a2 + ((a1 - a2) * weight) ) );
|
||||
}
|
||||
|
||||
//---- interface ColorFunction --------------------------------------------
|
||||
|
||||
public interface ColorFunction {
|
||||
|
||||
@@ -24,6 +24,13 @@ package com.formdev.flatlaf.util;
|
||||
public class CubicBezierEasing
|
||||
implements Animator.Interpolator
|
||||
{
|
||||
/**
|
||||
* Standard easing as specified in Material design (0.4, 0, 0.2, 1).
|
||||
*
|
||||
* @see <a href="https://material.io/design/motion/speed.html#easing">https://material.io/design/motion/speed.html#easing</a>
|
||||
*/
|
||||
public static final CubicBezierEasing STANDARD_EASING = new CubicBezierEasing( 0.4f, 0f, 0.2f, 1f );
|
||||
|
||||
// common cubic-bezier easing functions (same as in CSS)
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function
|
||||
public static final CubicBezierEasing EASE = new CubicBezierEasing( 0.25f, 0.1f, 0.25f, 1f );
|
||||
|
||||
@@ -113,7 +113,7 @@ public class UIScale
|
||||
}
|
||||
|
||||
public static double getSystemScaleFactor( Graphics2D g ) {
|
||||
return isSystemScalingEnabled() ? g.getDeviceConfiguration().getDefaultTransform().getScaleX() : 1;
|
||||
return isSystemScalingEnabled() ? getSystemScaleFactor( g.getDeviceConfiguration() ) : 1;
|
||||
}
|
||||
|
||||
public static double getSystemScaleFactor( GraphicsConfiguration gc ) {
|
||||
|
||||
@@ -275,7 +275,7 @@ TabbedPane.closePressedForeground=$TabbedPane.closeHoverForeground
|
||||
|
||||
#---- Table ----
|
||||
|
||||
Table.gridColor=lighten($Table.background,3%)
|
||||
Table.gridColor=lighten($Table.background,5%)
|
||||
|
||||
|
||||
#---- TableHeader ----
|
||||
|
||||
@@ -287,7 +287,7 @@ TabbedPane.closePressedForeground=$TabbedPane.closeHoverForeground
|
||||
|
||||
#---- Table ----
|
||||
|
||||
Table.gridColor=darken($Table.background,3%)
|
||||
Table.gridColor=darken($Table.background,5%)
|
||||
|
||||
|
||||
#---- TableHeader ----
|
||||
|
||||
@@ -2,3 +2,12 @@ FlatLaf Demo
|
||||
============
|
||||
|
||||
This sub-project contains the FlatLaf Demo source code.
|
||||
|
||||
|
||||
Download
|
||||
--------
|
||||
|
||||
[](https://download.formdev.com/flatlaf/flatlaf-demo-latest.jar)
|
||||
|
||||
Run demo with `java -jar flatlaf-demo-<version>.jar` (or double-click it).
|
||||
Requires Java 8 or newer.
|
||||
|
||||
@@ -32,7 +32,7 @@ import com.formdev.flatlaf.demo.intellijthemes.*;
|
||||
import com.formdev.flatlaf.extras.FlatAnimatedLafChange;
|
||||
import com.formdev.flatlaf.extras.FlatSVGIcon;
|
||||
import com.formdev.flatlaf.extras.FlatUIDefaultsInspector;
|
||||
import com.formdev.flatlaf.extras.SVGUtils;
|
||||
import com.formdev.flatlaf.extras.FlatSVGUtils;
|
||||
import com.formdev.flatlaf.ui.JBRCustomDecorations;
|
||||
import net.miginfocom.layout.ConstraintParser;
|
||||
import net.miginfocom.layout.LC;
|
||||
@@ -59,7 +59,7 @@ class DemoFrame
|
||||
updateFontMenuItems();
|
||||
controlBar.initialize( this, tabbedPane );
|
||||
|
||||
setIconImages( SVGUtils.createWindowIconImages( "/com/formdev/flatlaf/demo/FlatLaf.svg" ) );
|
||||
setIconImages( FlatSVGUtils.createWindowIconImages( "/com/formdev/flatlaf/demo/FlatLaf.svg" ) );
|
||||
|
||||
if( tabIndex >= 0 && tabIndex < tabbedPane.getTabCount() && tabIndex != tabbedPane.getSelectedIndex() )
|
||||
tabbedPane.setSelectedIndex( tabIndex );
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.formdev.flatlaf.demo.extras;
|
||||
|
||||
import javax.swing.*;
|
||||
import com.formdev.flatlaf.extras.*;
|
||||
import com.formdev.flatlaf.extras.components.FlatTriStateCheckBox;
|
||||
import net.miginfocom.swing.*;
|
||||
|
||||
/**
|
||||
@@ -63,7 +64,7 @@ public class ExtrasPanel
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||
label4 = new JLabel();
|
||||
label1 = new JLabel();
|
||||
triStateCheckBox1 = new TriStateCheckBox();
|
||||
triStateCheckBox1 = new FlatTriStateCheckBox();
|
||||
triStateLabel1 = new JLabel();
|
||||
label2 = new JLabel();
|
||||
svgIconsPanel = new JPanel();
|
||||
@@ -124,7 +125,7 @@ public class ExtrasPanel
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
private JLabel label4;
|
||||
private JLabel label1;
|
||||
private TriStateCheckBox triStateCheckBox1;
|
||||
private FlatTriStateCheckBox triStateCheckBox1;
|
||||
private JLabel triStateLabel1;
|
||||
private JLabel label2;
|
||||
private JPanel svgIconsPanel;
|
||||
|
||||
@@ -21,7 +21,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) {
|
||||
name: "triStateCheckBox1"
|
||||
"text": "Three States"
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "triStateCheckBox1Changed", false ) )
|
||||
|
||||
@@ -108,7 +108,8 @@ public class IJThemesClassGenerator
|
||||
allInfos.append( THEME_TEMPLATE
|
||||
.replace( "${subPackage}", subPackage )
|
||||
.replace( "${themeClass}", themeClass )
|
||||
.replace( "${themeName}", themeName ) );
|
||||
.replace( "${themeName}", themeName )
|
||||
.replace( "${dark}", Boolean.toString( ti.dark ) ) );
|
||||
|
||||
markdownTable.append( String.format( "[%s](%s) | `com.formdev.flatlaf.intellijthemes%s.%s`\n",
|
||||
themeName, ti.sourceCodeUrl, subPackage, themeClass ) );
|
||||
@@ -189,11 +190,28 @@ public class IJThemesClassGenerator
|
||||
" */\n" +
|
||||
"public class FlatAllIJThemes\n" +
|
||||
"{\n" +
|
||||
" public static final LookAndFeelInfo[] INFOS = {\n" +
|
||||
" public static final FlatIJLookAndFeelInfo[] INFOS = {\n" +
|
||||
"${allInfos}\n" +
|
||||
" };\n" +
|
||||
"\n" +
|
||||
" //---- class FlatIJLookAndFeelInfo ----------------------------------------\n" +
|
||||
"\n" +
|
||||
" public static class FlatIJLookAndFeelInfo\n" +
|
||||
" extends LookAndFeelInfo\n" +
|
||||
" {\n" +
|
||||
" private final boolean dark;\n" +
|
||||
"\n" +
|
||||
" public FlatIJLookAndFeelInfo( String name, String className, boolean dark ) {\n" +
|
||||
" super( name, className );\n" +
|
||||
" this.dark = dark;\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" public boolean isDark() {\n" +
|
||||
" return dark;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"}\n";
|
||||
|
||||
private static final String THEME_TEMPLATE =
|
||||
" new LookAndFeelInfo( \"${themeName}\", \"com.formdev.flatlaf.intellijthemes${subPackage}.${themeClass}\" ),";
|
||||
" new FlatIJLookAndFeelInfo( \"${themeName}\", \"com.formdev.flatlaf.intellijthemes${subPackage}.${themeClass}\", ${dark} ),";
|
||||
}
|
||||
|
||||
@@ -7,9 +7,12 @@ This sub-project provides some additional components and classes:
|
||||
An icon that displays SVG using
|
||||
[svgSalamander](https://github.com/JFormDesigner/svgSalamander).\
|
||||

|
||||
- [TriStateCheckBox](https://www.javadoc.io/doc/com.formdev/flatlaf-extras/latest/com/formdev/flatlaf/extras/TriStateCheckBox.html):
|
||||
- [FlatTriStateCheckBox](https://www.javadoc.io/doc/com.formdev/flatlaf-extras/latest/com/formdev/flatlaf/extras/components/FlatTriStateCheckBox.html):
|
||||
A tri-state check box.\
|
||||

|
||||
- Extension classes of standard Swing components that provide easy access to
|
||||
FlatLaf specific client properties (see package
|
||||
[com.formdev.flatlaf.extras.components](https://www.javadoc.io/doc/com.formdev/flatlaf-extras/latest/com/formdev/flatlaf/extras/components/package-summary.html)).
|
||||
- [FlatAnimatedLafChange](https://www.javadoc.io/doc/com.formdev/flatlaf-extras/latest/com/formdev/flatlaf/extras/FlatAnimatedLafChange.html):
|
||||
Animated Laf (theme) changing.
|
||||
- [FlatInspector](#ui-inspector): A simple UI inspector that shows information
|
||||
@@ -35,10 +38,8 @@ Otherwise download `flatlaf-extras-<version>.jar` here:
|
||||
|
||||
[](https://bintray.com/jformdesigner/flatlaf/flatlaf-extras/_latestVersion)
|
||||
|
||||
You also need `flatlaf-<version>.jar` and `svgSalamander-<version>.jar`, which
|
||||
you can download here:
|
||||
If SVG classes are used, `svgSalamander-<version>.jar` is also required:
|
||||
|
||||
[](https://bintray.com/jformdesigner/flatlaf/flatlaf/_latestVersion)
|
||||
[](https://bintray.com/jformdesigner/svgSalamander/svgSalamander/_latestVersion)
|
||||
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ tasks {
|
||||
this as StandardJavadocDocletOptions
|
||||
use( true )
|
||||
tags = listOf( "uiDefault", "clientProperty" )
|
||||
addStringOption( "Xdoclint:all,-missing", "-Xdoclint:all,-missing" )
|
||||
}
|
||||
isFailOnError = false
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.awt.Dimension;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Insets;
|
||||
import java.awt.KeyboardFocusManager;
|
||||
import java.awt.LayoutManager;
|
||||
@@ -348,8 +347,9 @@ public class FlatInspector
|
||||
|
||||
@Override
|
||||
protected void paintBorder( Graphics g ) {
|
||||
FlatUIUtils.setRenderingHints( (Graphics2D) g );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
||||
super.paintBorder( g );
|
||||
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||
}
|
||||
};
|
||||
c.setBackground( new Color( 255, 0, 0, 32 ) );
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.kitfox.svg.SVGException;
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class SVGUtils
|
||||
public class FlatSVGUtils
|
||||
{
|
||||
/**
|
||||
* Creates from the given SVG a list of icon images with different sizes that
|
||||
@@ -131,7 +131,7 @@ public class SVGUtils
|
||||
*/
|
||||
private static SVGDiagram loadSVG( String svgName ) {
|
||||
try {
|
||||
URL url = SVGUtils.class.getResource( svgName );
|
||||
URL url = FlatSVGUtils.class.getResource( svgName );
|
||||
return SVGCache.getSVGUniverse().getDiagram( url.toURI() );
|
||||
} catch( URISyntaxException ex ) {
|
||||
throw new RuntimeException( ex );
|
||||
@@ -1,141 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.ItemEvent;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.UIManager;
|
||||
import com.formdev.flatlaf.FlatLaf;
|
||||
|
||||
/**
|
||||
* A tri-state check box.
|
||||
* <p>
|
||||
* To display the third state, this component requires an LaF that supports painting
|
||||
* the indeterminate state if client property {@code "JButton.selectedState"} has the
|
||||
* value {@code "indeterminate"}.
|
||||
* <p>
|
||||
* FlatLaf and Mac Aqua LaF support the third state.
|
||||
* For other LaFs a magenta rectangle is painted around the component for the third state.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class TriStateCheckBox
|
||||
extends JCheckBox
|
||||
{
|
||||
public enum State { INDETERMINATE, SELECTED, UNSELECTED }
|
||||
|
||||
private State state;
|
||||
private boolean thirdStateEnabled = true;
|
||||
|
||||
public TriStateCheckBox() {
|
||||
this( null );
|
||||
}
|
||||
|
||||
public TriStateCheckBox( String text ) {
|
||||
this( text, State.INDETERMINATE );
|
||||
}
|
||||
|
||||
public TriStateCheckBox( String text, State initialState ) {
|
||||
super( text );
|
||||
|
||||
setModel( new ToggleButtonModel() {
|
||||
@Override
|
||||
public boolean isSelected() {
|
||||
return state != State.UNSELECTED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected( boolean b ) {
|
||||
switch( state ) {
|
||||
case INDETERMINATE: setState( State.SELECTED ); break;
|
||||
case SELECTED: setState( State.UNSELECTED ); break;
|
||||
case UNSELECTED: setState( thirdStateEnabled ? State.INDETERMINATE : State.SELECTED ); break;
|
||||
}
|
||||
|
||||
fireStateChanged();
|
||||
fireItemStateChanged( new ItemEvent( this, ItemEvent.ITEM_STATE_CHANGED, this,
|
||||
isSelected() ? ItemEvent.SELECTED : ItemEvent.DESELECTED ) );
|
||||
}
|
||||
} );
|
||||
|
||||
setState( initialState );
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState( State state ) {
|
||||
if( this.state == state )
|
||||
return;
|
||||
|
||||
State oldState = this.state;
|
||||
this.state = state;
|
||||
|
||||
putClientProperty( "JButton.selectedState", state == State.INDETERMINATE ? "indeterminate" : null );
|
||||
|
||||
firePropertyChange( "state", oldState, state );
|
||||
repaint();
|
||||
}
|
||||
|
||||
public Boolean getValue() {
|
||||
switch( state ) {
|
||||
default:
|
||||
case INDETERMINATE: return null;
|
||||
case SELECTED: return true;
|
||||
case UNSELECTED: return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setValue( Boolean value ) {
|
||||
setState( value == null ? State.INDETERMINATE : (value ? State.SELECTED : State.UNSELECTED) );
|
||||
}
|
||||
|
||||
public boolean isThirdStateEnabled() {
|
||||
return thirdStateEnabled;
|
||||
}
|
||||
|
||||
public void setThirdStateEnabled( boolean thirdStateEnabled ) {
|
||||
this.thirdStateEnabled = thirdStateEnabled;
|
||||
|
||||
if( state == State.INDETERMINATE )
|
||||
setState( State.UNSELECTED );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected( boolean b ) {
|
||||
setState( b ? State.SELECTED : State.UNSELECTED );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent( Graphics g ) {
|
||||
super.paintComponent( g );
|
||||
|
||||
if( state == State.INDETERMINATE && !isThirdStateSupported() ) {
|
||||
g.setColor( Color.magenta );
|
||||
g.drawRect( 0, 0, getWidth() - 1, getHeight() - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isThirdStateSupported() {
|
||||
LookAndFeel laf = UIManager.getLookAndFeel();
|
||||
return laf instanceof FlatLaf || laf.getClass().getName().equals( "com.apple.laf.AquaLookAndFeel" );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import java.awt.Color;
|
||||
import javax.swing.JButton;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JButton} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatButton
|
||||
extends JButton
|
||||
implements FlatComponentExtension
|
||||
{
|
||||
// NOTE: enum names must be equal to allowed strings
|
||||
public enum ButtonType { none, square, roundRect, tab, help, toolBarButton };
|
||||
|
||||
/**
|
||||
* Returns type of a button.
|
||||
*/
|
||||
public ButtonType getButtonType() {
|
||||
return getClientPropertyEnumString( BUTTON_TYPE, ButtonType.class, null, ButtonType.none );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies type of a button.
|
||||
*/
|
||||
public void setButtonType( ButtonType buttonType ) {
|
||||
if( buttonType == ButtonType.none )
|
||||
buttonType = null;
|
||||
putClientPropertyEnumString( BUTTON_TYPE, buttonType );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the button preferred size will be made square (quadratically).
|
||||
*/
|
||||
public boolean isSquareSize() {
|
||||
return getClientPropertyBoolean( SQUARE_SIZE, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the button preferred size will be made square (quadratically).
|
||||
*/
|
||||
public void setSquareSize( boolean squareSize ) {
|
||||
putClientPropertyBoolean( SQUARE_SIZE, squareSize, false );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns minimum width of a component.
|
||||
*/
|
||||
public int getMinimumWidth() {
|
||||
return getClientPropertyInt( MINIMUM_WIDTH, "Button.minimumWidth" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies minimum width of a component.
|
||||
*/
|
||||
public void setMinimumWidth( int minimumWidth ) {
|
||||
putClientProperty( MINIMUM_WIDTH, (minimumWidth >= 0) ? minimumWidth : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns minimum height of a component.
|
||||
*/
|
||||
public int getMinimumHeight() {
|
||||
return getClientPropertyInt( MINIMUM_HEIGHT, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies minimum height of a component.
|
||||
*/
|
||||
public void setMinimumHeight( int minimumHeight ) {
|
||||
putClientProperty( MINIMUM_HEIGHT, (minimumHeight >= 0) ? minimumHeight : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the outline color of the component border.
|
||||
*/
|
||||
public Object getOutline() {
|
||||
return getClientProperty( OUTLINE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the outline color of the component border.
|
||||
* <p>
|
||||
* Allowed Values are:
|
||||
* <ul>
|
||||
* <li>{@code null}
|
||||
* <li>string {@code "error"}
|
||||
* <li>string {@code "warning"}
|
||||
* <li>any color (type {@link Color})
|
||||
* <li>an array of two colors (type {@link Color}[2]) where the first color
|
||||
* is for focused state and the second for unfocused state
|
||||
* </ul>
|
||||
*/
|
||||
public void setOutline( Object outline ) {
|
||||
putClientProperty( OUTLINE, outline );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import java.awt.Color;
|
||||
import javax.swing.JComboBox;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JComboBox} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatComboBox<E>
|
||||
extends JComboBox<E>
|
||||
implements FlatComponentExtension
|
||||
{
|
||||
/**
|
||||
* Returns the placeholder text that is only painted if the editable combo box is empty.
|
||||
*/
|
||||
public String getPlaceholderText() {
|
||||
return (String) getClientProperty( PLACEHOLDER_TEXT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the placeholder text that is only painted if the editable combo box is empty.
|
||||
*/
|
||||
public void setPlaceholderText( String placeholderText ) {
|
||||
putClientProperty( PLACEHOLDER_TEXT, placeholderText );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns minimum width of a component.
|
||||
*/
|
||||
public int getMinimumWidth() {
|
||||
return getClientPropertyInt( MINIMUM_WIDTH, "ComboBox.minimumWidth" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies minimum width of a component.
|
||||
*/
|
||||
public void setMinimumWidth( int minimumWidth ) {
|
||||
putClientProperty( MINIMUM_WIDTH, (minimumWidth >= 0) ? minimumWidth : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the component is painted with round edges.
|
||||
*/
|
||||
public boolean isRoundRect() {
|
||||
return getClientPropertyBoolean( COMPONENT_ROUND_RECT, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the component is painted with round edges.
|
||||
*/
|
||||
public void setRoundRect( boolean roundRect ) {
|
||||
putClientPropertyBoolean( COMPONENT_ROUND_RECT, roundRect, false );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the outline color of the component border.
|
||||
*/
|
||||
public Object getOutline() {
|
||||
return getClientProperty( OUTLINE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the outline color of the component border.
|
||||
* <p>
|
||||
* Allowed Values are:
|
||||
* <ul>
|
||||
* <li>{@code null}
|
||||
* <li>string {@code "error"}
|
||||
* <li>string {@code "warning"}
|
||||
* <li>any color (type {@link Color})
|
||||
* <li>an array of two colors (type {@link Color}[2]) where the first color
|
||||
* is for focused state and the second for unfocused state
|
||||
* </ul>
|
||||
*/
|
||||
public void setOutline( Object outline ) {
|
||||
putClientProperty( OUTLINE, outline );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
/**
|
||||
* Base interface for all FlatLaf component extensions.
|
||||
* Extensions use client properties to store property values in components.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public interface FlatComponentExtension
|
||||
{
|
||||
/**
|
||||
* Overrides {@link JComponent#getClientProperty(Object)}.
|
||||
*/
|
||||
Object getClientProperty( Object key );
|
||||
|
||||
/**
|
||||
* Overrides {@link JComponent#putClientProperty(Object, Object)}.
|
||||
*/
|
||||
void putClientProperty( Object key, Object value );
|
||||
|
||||
|
||||
default boolean getClientPropertyBoolean( Object key, String defaultValueKey ) {
|
||||
Object value = getClientProperty( key );
|
||||
return (value instanceof Boolean) ? (boolean) value : UIManager.getBoolean( defaultValueKey );
|
||||
}
|
||||
|
||||
default boolean getClientPropertyBoolean( Object key, boolean defaultValue ) {
|
||||
Object value = getClientProperty( key );
|
||||
return (value instanceof Boolean) ? (boolean) value : defaultValue;
|
||||
}
|
||||
|
||||
default void putClientPropertyBoolean( Object key, boolean value, boolean defaultValue ) {
|
||||
putClientProperty( key, (value != defaultValue) ? value : null );
|
||||
}
|
||||
|
||||
|
||||
default int getClientPropertyInt( Object key, String defaultValueKey ) {
|
||||
Object value = getClientProperty( key );
|
||||
return (value instanceof Integer) ? (int) value : UIManager.getInt( defaultValueKey );
|
||||
}
|
||||
|
||||
default int getClientPropertyInt( Object key, int defaultValue ) {
|
||||
Object value = getClientProperty( key );
|
||||
return (value instanceof Integer) ? (int) value : defaultValue;
|
||||
}
|
||||
|
||||
|
||||
default Color getClientPropertyColor( Object key, String defaultValueKey ) {
|
||||
Object value = getClientProperty( key );
|
||||
return (value instanceof Color) ? (Color) value : UIManager.getColor( defaultValueKey );
|
||||
}
|
||||
|
||||
default Insets getClientPropertyInsets( Object key, String defaultValueKey ) {
|
||||
Object value = getClientProperty( key );
|
||||
return (value instanceof Insets) ? (Insets) value : UIManager.getInsets( defaultValueKey );
|
||||
}
|
||||
|
||||
|
||||
default <T extends Enum<T>> T getClientPropertyEnumString( Object key, Class<T> enumType,
|
||||
String defaultValueKey, T defaultValue )
|
||||
{
|
||||
Object value = getClientProperty( key );
|
||||
if( !(value instanceof String) && defaultValueKey != null )
|
||||
value = UIManager.getString( defaultValueKey );
|
||||
if( value instanceof String ) {
|
||||
try {
|
||||
return Enum.valueOf( enumType, (String) value );
|
||||
} catch( IllegalArgumentException ex ) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
default <T extends Enum<T>> void putClientPropertyEnumString( Object key, Enum<T> value ) {
|
||||
putClientProperty( key, (value != null) ? value.toString() : null );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import javax.swing.JEditorPane;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JEditorPane} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatEditorPane
|
||||
extends JEditorPane
|
||||
implements FlatComponentExtension
|
||||
{
|
||||
/**
|
||||
* Returns minimum width of a component.
|
||||
*/
|
||||
public int getMinimumWidth() {
|
||||
return getClientPropertyInt( MINIMUM_WIDTH, "Component.minimumWidth" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies minimum width of a component.
|
||||
*/
|
||||
public void setMinimumWidth( int minimumWidth ) {
|
||||
putClientProperty( MINIMUM_WIDTH, (minimumWidth >= 0) ? minimumWidth : null );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import java.awt.Color;
|
||||
import javax.swing.JFormattedTextField;
|
||||
import com.formdev.flatlaf.extras.components.FlatTextField.SelectAllOnFocusPolicy;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JFormattedTextField} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatFormattedTextField
|
||||
extends JFormattedTextField
|
||||
implements FlatComponentExtension
|
||||
{
|
||||
/**
|
||||
* Returns the placeholder text that is only painted if the text field is empty.
|
||||
*/
|
||||
public String getPlaceholderText() {
|
||||
return (String) getClientProperty( PLACEHOLDER_TEXT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the placeholder text that is only painted if the text field is empty.
|
||||
*/
|
||||
public void setPlaceholderText( String placeholderText ) {
|
||||
putClientProperty( PLACEHOLDER_TEXT, placeholderText );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether all text is selected when the text component gains focus.
|
||||
*/
|
||||
public SelectAllOnFocusPolicy getSelectAllOnFocusPolicy() {
|
||||
return getClientPropertyEnumString( SELECT_ALL_ON_FOCUS_POLICY, SelectAllOnFocusPolicy.class,
|
||||
"TextComponent.selectAllOnFocusPolicy", SelectAllOnFocusPolicy.once );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether all text is selected when the text component gains focus.
|
||||
*/
|
||||
public void setSelectAllOnFocusPolicy( SelectAllOnFocusPolicy selectAllOnFocusPolicy ) {
|
||||
putClientPropertyEnumString( SELECT_ALL_ON_FOCUS_POLICY, selectAllOnFocusPolicy );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns minimum width of a component.
|
||||
*/
|
||||
public int getMinimumWidth() {
|
||||
return getClientPropertyInt( MINIMUM_WIDTH, "Component.minimumWidth" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies minimum width of a component.
|
||||
*/
|
||||
public void setMinimumWidth( int minimumWidth ) {
|
||||
putClientProperty( MINIMUM_WIDTH, (minimumWidth >= 0) ? minimumWidth : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the component is painted with round edges.
|
||||
*/
|
||||
public boolean isRoundRect() {
|
||||
return getClientPropertyBoolean( COMPONENT_ROUND_RECT, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the component is painted with round edges.
|
||||
*/
|
||||
public void setRoundRect( boolean roundRect ) {
|
||||
putClientPropertyBoolean( COMPONENT_ROUND_RECT, roundRect, false );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the outline color of the component border.
|
||||
*/
|
||||
public Object getOutline() {
|
||||
return getClientProperty( OUTLINE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the outline color of the component border.
|
||||
* <p>
|
||||
* Allowed Values are:
|
||||
* <ul>
|
||||
* <li>{@code null}
|
||||
* <li>string {@code "error"}
|
||||
* <li>string {@code "warning"}
|
||||
* <li>any color (type {@link Color})
|
||||
* <li>an array of two colors (type {@link Color}[2]) where the first color
|
||||
* is for focused state and the second for unfocused state
|
||||
* </ul>
|
||||
*/
|
||||
public void setOutline( Object outline ) {
|
||||
putClientProperty( OUTLINE, outline );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import java.awt.Color;
|
||||
import javax.swing.JPasswordField;
|
||||
import com.formdev.flatlaf.extras.components.FlatTextField.SelectAllOnFocusPolicy;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JPasswordField} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatPasswordField
|
||||
extends JPasswordField
|
||||
implements FlatComponentExtension
|
||||
{
|
||||
/**
|
||||
* Returns the placeholder text that is only painted if the text field is empty.
|
||||
*/
|
||||
public String getPlaceholderText() {
|
||||
return (String) getClientProperty( PLACEHOLDER_TEXT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the placeholder text that is only painted if the text field is empty.
|
||||
*/
|
||||
public void setPlaceholderText( String placeholderText ) {
|
||||
putClientProperty( PLACEHOLDER_TEXT, placeholderText );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether all text is selected when the text component gains focus.
|
||||
*/
|
||||
public SelectAllOnFocusPolicy getSelectAllOnFocusPolicy() {
|
||||
return getClientPropertyEnumString( SELECT_ALL_ON_FOCUS_POLICY, SelectAllOnFocusPolicy.class,
|
||||
"TextComponent.selectAllOnFocusPolicy", SelectAllOnFocusPolicy.once );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether all text is selected when the text component gains focus.
|
||||
*/
|
||||
public void setSelectAllOnFocusPolicy( SelectAllOnFocusPolicy selectAllOnFocusPolicy ) {
|
||||
putClientPropertyEnumString( SELECT_ALL_ON_FOCUS_POLICY, selectAllOnFocusPolicy );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns minimum width of a component.
|
||||
*/
|
||||
public int getMinimumWidth() {
|
||||
return getClientPropertyInt( MINIMUM_WIDTH, "Component.minimumWidth" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies minimum width of a component.
|
||||
*/
|
||||
public void setMinimumWidth( int minimumWidth ) {
|
||||
putClientProperty( MINIMUM_WIDTH, (minimumWidth >= 0) ? minimumWidth : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the component is painted with round edges.
|
||||
*/
|
||||
public boolean isRoundRect() {
|
||||
return getClientPropertyBoolean( COMPONENT_ROUND_RECT, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the component is painted with round edges.
|
||||
*/
|
||||
public void setRoundRect( boolean roundRect ) {
|
||||
putClientPropertyBoolean( COMPONENT_ROUND_RECT, roundRect, false );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the outline color of the component border.
|
||||
*/
|
||||
public Object getOutline() {
|
||||
return getClientProperty( OUTLINE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the outline color of the component border.
|
||||
* <p>
|
||||
* Allowed Values are:
|
||||
* <ul>
|
||||
* <li>{@code null}
|
||||
* <li>string {@code "error"}
|
||||
* <li>string {@code "warning"}
|
||||
* <li>any color (type {@link Color})
|
||||
* <li>an array of two colors (type {@link Color}[2]) where the first color
|
||||
* is for focused state and the second for unfocused state
|
||||
* </ul>
|
||||
*/
|
||||
public void setOutline( Object outline ) {
|
||||
putClientProperty( OUTLINE, outline );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import javax.swing.JProgressBar;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JProgressBar} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatProgressBar
|
||||
extends JProgressBar
|
||||
implements FlatComponentExtension
|
||||
{
|
||||
/**
|
||||
* Returns whether the progress bar has always the larger height even if no string is painted.
|
||||
*/
|
||||
public boolean isLargeHeight() {
|
||||
return getClientPropertyBoolean( PROGRESS_BAR_LARGE_HEIGHT, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the progress bar has always the larger height even if no string is painted.
|
||||
*/
|
||||
public void setLargeHeight( boolean largeHeight ) {
|
||||
putClientPropertyBoolean( PROGRESS_BAR_LARGE_HEIGHT, largeHeight, false );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the progress bar is paint with square edges.
|
||||
*/
|
||||
public boolean isSquare() {
|
||||
return getClientPropertyBoolean( PROGRESS_BAR_SQUARE, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the progress bar is paint with square edges.
|
||||
*/
|
||||
public void setSquare( boolean square ) {
|
||||
putClientPropertyBoolean( PROGRESS_BAR_SQUARE, square, false );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import javax.swing.JScrollBar;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JScrollBar} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatScrollBar
|
||||
extends JScrollBar
|
||||
implements FlatComponentExtension
|
||||
{
|
||||
/**
|
||||
* Returns whether the decrease/increase arrow buttons of a scrollbar are shown.
|
||||
*/
|
||||
public boolean isShowButtons() {
|
||||
return getClientPropertyBoolean( SCROLL_BAR_SHOW_BUTTONS, "ScrollBar.showButtons" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the decrease/increase arrow buttons of a scrollbar are shown.
|
||||
*/
|
||||
public void setShowButtons( boolean showButtons ) {
|
||||
putClientProperty( SCROLL_BAR_SHOW_BUTTONS, showButtons );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import java.awt.Color;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JScrollPane} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatScrollPane
|
||||
extends JScrollPane
|
||||
implements FlatComponentExtension
|
||||
{
|
||||
/**
|
||||
* Returns whether the decrease/increase arrow buttons of a scrollbar are shown.
|
||||
*/
|
||||
public boolean isShowButtons() {
|
||||
return getClientPropertyBoolean( SCROLL_BAR_SHOW_BUTTONS, "ScrollBar.showButtons" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the decrease/increase arrow buttons of a scrollbar are shown.
|
||||
*/
|
||||
public void setShowButtons( boolean showButtons ) {
|
||||
putClientProperty( SCROLL_BAR_SHOW_BUTTONS, showButtons );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the scroll pane uses smooth scrolling.
|
||||
*/
|
||||
public boolean isSmoothScrolling() {
|
||||
return getClientPropertyBoolean( SCROLL_PANE_SMOOTH_SCROLLING, "ScrollPane.smoothScrolling" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the scroll pane uses smooth scrolling.
|
||||
*/
|
||||
public void setSmoothScrolling( boolean smoothScrolling ) {
|
||||
putClientProperty( SCROLL_PANE_SMOOTH_SCROLLING, smoothScrolling );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the outline color of the component border.
|
||||
*/
|
||||
public Object getOutline() {
|
||||
return getClientProperty( OUTLINE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the outline color of the component border.
|
||||
* <p>
|
||||
* Allowed Values are:
|
||||
* <ul>
|
||||
* <li>{@code null}
|
||||
* <li>string {@code "error"}
|
||||
* <li>string {@code "warning"}
|
||||
* <li>any color (type {@link Color})
|
||||
* <li>an array of two colors (type {@link Color}[2]) where the first color
|
||||
* is for focused state and the second for unfocused state
|
||||
* </ul>
|
||||
*/
|
||||
public void setOutline( Object outline ) {
|
||||
putClientProperty( OUTLINE, outline );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import java.awt.Color;
|
||||
import javax.swing.JSpinner;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JSpinner} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatSpinner
|
||||
extends JSpinner
|
||||
implements FlatComponentExtension
|
||||
{
|
||||
/**
|
||||
* Returns minimum width of a component.
|
||||
*/
|
||||
public int getMinimumWidth() {
|
||||
return getClientPropertyInt( MINIMUM_WIDTH, "Component.minimumWidth" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies minimum width of a component.
|
||||
*/
|
||||
public void setMinimumWidth( int minimumWidth ) {
|
||||
putClientProperty( MINIMUM_WIDTH, (minimumWidth >= 0) ? minimumWidth : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the component is painted with round edges.
|
||||
*/
|
||||
public boolean isRoundRect() {
|
||||
return getClientPropertyBoolean( COMPONENT_ROUND_RECT, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the component is painted with round edges.
|
||||
*/
|
||||
public void setRoundRect( boolean roundRect ) {
|
||||
putClientPropertyBoolean( COMPONENT_ROUND_RECT, roundRect, false );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the outline color of the component border.
|
||||
*/
|
||||
public Object getOutline() {
|
||||
return getClientProperty( OUTLINE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the outline color of the component border.
|
||||
* <p>
|
||||
* Allowed Values are:
|
||||
* <ul>
|
||||
* <li>{@code null}
|
||||
* <li>string {@code "error"}
|
||||
* <li>string {@code "warning"}
|
||||
* <li>any color (type {@link Color})
|
||||
* <li>an array of two colors (type {@link Color}[2]) where the first color
|
||||
* is for focused state and the second for unfocused state
|
||||
* </ul>
|
||||
*/
|
||||
public void setOutline( Object outline ) {
|
||||
putClientProperty( OUTLINE, outline );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,537 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import java.awt.Component;
|
||||
import java.awt.Insets;
|
||||
import java.util.function.BiConsumer;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JTabbedPane} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatTabbedPane
|
||||
extends JTabbedPane
|
||||
implements FlatComponentExtension
|
||||
{
|
||||
/**
|
||||
* Returns whether separators are shown between tabs.
|
||||
*/
|
||||
public boolean isShowTabSeparators() {
|
||||
return getClientPropertyBoolean( TABBED_PANE_SHOW_TAB_SEPARATORS, "TabbedPane.showTabSeparators" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether separators are shown between tabs.
|
||||
*/
|
||||
public void setShowTabSeparators( boolean showTabSeparators ) {
|
||||
putClientProperty( TABBED_PANE_SHOW_TAB_SEPARATORS, showTabSeparators );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the separator between tabs area and content area should be shown.
|
||||
*/
|
||||
public boolean isShowContentSeparators() {
|
||||
return getClientPropertyBoolean( TABBED_PANE_SHOW_CONTENT_SEPARATOR, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the separator between tabs area and content area should be shown.
|
||||
*/
|
||||
public void setShowContentSeparators( boolean showContentSeparators ) {
|
||||
putClientPropertyBoolean( TABBED_PANE_SHOW_CONTENT_SEPARATOR, showContentSeparators, true );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether a full border is painted around a tabbed pane.
|
||||
*/
|
||||
public boolean isHasFullBorder() {
|
||||
return getClientPropertyBoolean( TABBED_PANE_HAS_FULL_BORDER, "TabbedPane.hasFullBorder" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether a full border is painted around a tabbed pane.
|
||||
*/
|
||||
public void setHasFullBorder( boolean hasFullBorder ) {
|
||||
putClientProperty( TABBED_PANE_HAS_FULL_BORDER, hasFullBorder );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the tab area should be hidden if it contains only one tab.
|
||||
*/
|
||||
public boolean isHideTabAreaWithOneTab() {
|
||||
return getClientPropertyBoolean( TABBED_PANE_HIDE_TAB_AREA_WITH_ONE_TAB, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the tab area should be hidden if it contains only one tab.
|
||||
*/
|
||||
public void setHideTabAreaWithOneTab( boolean hideTabAreaWithOneTab ) {
|
||||
putClientPropertyBoolean( TABBED_PANE_HIDE_TAB_AREA_WITH_ONE_TAB, hideTabAreaWithOneTab, false );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the minimum width of a tab.
|
||||
*/
|
||||
public int getMinimumTabWidth() {
|
||||
return getClientPropertyInt( TABBED_PANE_MINIMUM_TAB_WIDTH, "TabbedPane.minimumTabWidth" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the minimum width of a tab.
|
||||
*/
|
||||
public void setMinimumTabWidth( int minimumTabWidth ) {
|
||||
putClientProperty( TABBED_PANE_MINIMUM_TAB_WIDTH, (minimumTabWidth >= 0) ? minimumTabWidth : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the minimum width of the tab at the given tab index.
|
||||
*/
|
||||
public int getMinimumTabWidth( int tabIndex ) {
|
||||
JComponent c = (JComponent) getComponentAt( tabIndex );
|
||||
return clientPropertyInt( c, TABBED_PANE_MINIMUM_TAB_WIDTH, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the minimum width of the tab at the given tab index.
|
||||
*/
|
||||
public void setMinimumTabWidth( int tabIndex, int minimumTabWidth ) {
|
||||
JComponent c = (JComponent) getComponentAt( tabIndex );
|
||||
c.putClientProperty( TABBED_PANE_MINIMUM_TAB_WIDTH, (minimumTabWidth >= 0) ? minimumTabWidth : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the maximum width of a tab.
|
||||
*/
|
||||
public int getMaximumTabWidth() {
|
||||
return getClientPropertyInt( TABBED_PANE_MAXIMUM_TAB_WIDTH, "TabbedPane.maximumTabWidth" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the maximum width of a tab.
|
||||
* <p>
|
||||
* Applied only if tab does not have a custom tab component
|
||||
* (see {@link javax.swing.JTabbedPane#setTabComponentAt(int, java.awt.Component)}).
|
||||
*/
|
||||
public void setMaximumTabWidth( int maximumTabWidth ) {
|
||||
putClientProperty( TABBED_PANE_MAXIMUM_TAB_WIDTH, (maximumTabWidth >= 0) ? maximumTabWidth : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the maximum width of the tab at the given tab index.
|
||||
*/
|
||||
public int getMaximumTabWidth( int tabIndex ) {
|
||||
JComponent c = (JComponent) getComponentAt( tabIndex );
|
||||
return clientPropertyInt( c, TABBED_PANE_MAXIMUM_TAB_WIDTH, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the maximum width of the tab at the given tab index.
|
||||
* <p>
|
||||
* Applied only if tab does not have a custom tab component
|
||||
* (see {@link javax.swing.JTabbedPane#setTabComponentAt(int, java.awt.Component)}).
|
||||
*/
|
||||
public void setMaximumTabWidth( int tabIndex, int maximumTabWidth ) {
|
||||
JComponent c = (JComponent) getComponentAt( tabIndex );
|
||||
c.putClientProperty( TABBED_PANE_MAXIMUM_TAB_WIDTH, (maximumTabWidth >= 0) ? maximumTabWidth : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the height of a tab.
|
||||
*/
|
||||
public int getTabHeight() {
|
||||
return getClientPropertyInt( TABBED_PANE_TAB_HEIGHT, "TabbedPane.tabHeight" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the height of a tab.
|
||||
*/
|
||||
public void setTabHeight( int tabHeight ) {
|
||||
putClientProperty( TABBED_PANE_TAB_HEIGHT, (tabHeight >= 0) ? tabHeight : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the insets of a tab.
|
||||
*/
|
||||
public Insets getTabInsets() {
|
||||
return getClientPropertyInsets( TABBED_PANE_TAB_INSETS, "TabbedPane.tabInsets" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the insets of a tab.
|
||||
*/
|
||||
public void setTabInsets( Insets tabInsets ) {
|
||||
putClientProperty( TABBED_PANE_TAB_INSETS, tabInsets );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the insets of the tab at the given tab index.
|
||||
*/
|
||||
public Insets getTabInsets( int tabIndex ) {
|
||||
JComponent c = (JComponent) getComponentAt( tabIndex );
|
||||
return (Insets) c.getClientProperty( TABBED_PANE_TAB_INSETS );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the insets of the tab at the given tab index.
|
||||
*/
|
||||
public void setTabInsets( int tabIndex, Insets tabInsets ) {
|
||||
JComponent c = (JComponent) getComponentAt( tabIndex );
|
||||
c.putClientProperty( TABBED_PANE_TAB_INSETS, tabInsets );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the insets of the tab area.
|
||||
*/
|
||||
public Insets getTabAreaInsets() {
|
||||
return getClientPropertyInsets( TABBED_PANE_TAB_AREA_INSETS, "TabbedPane.tabAreaInsets" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the insets of the tab area.
|
||||
*/
|
||||
public void setTabAreaInsets( Insets tabAreaInsets ) {
|
||||
putClientProperty( TABBED_PANE_TAB_AREA_INSETS, tabAreaInsets );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether all tabs are closable.
|
||||
*/
|
||||
public boolean isTabsClosable() {
|
||||
return getClientPropertyBoolean( TABBED_PANE_TAB_CLOSABLE, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether all tabs are closable.
|
||||
* If set to {@code true}, all tabs in that tabbed pane are closable.
|
||||
* To make individual tabs closable, use {@link #setTabClosable(int, boolean)}.
|
||||
* <p>
|
||||
* Note that you have to specify a callback (see {@link #setTabCloseCallback(BiConsumer)})
|
||||
* that is invoked when the user clicks a tab close button.
|
||||
* The callback is responsible for closing the tab.
|
||||
*/
|
||||
public void setTabsClosable( boolean tabClosable ) {
|
||||
putClientPropertyBoolean( TABBED_PANE_TAB_CLOSABLE, tabClosable, false );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the tab at the given tab index is closable.
|
||||
*/
|
||||
public Boolean isTabClosable( int tabIndex ) {
|
||||
JComponent c = (JComponent) getComponentAt( tabIndex );
|
||||
Object value = c.getClientProperty( TABBED_PANE_TAB_CLOSABLE );
|
||||
return (value instanceof Boolean) ? (boolean) value : isTabsClosable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the tab at the given tab index is closable.
|
||||
* To make all tabs closable, use {@link #setTabsClosable(boolean)}.
|
||||
* <p>
|
||||
* Note that you have to specify a callback (see {@link #setTabCloseCallback(BiConsumer)})
|
||||
* that is invoked when the user clicks a tab close button.
|
||||
* The callback is responsible for closing the tab.
|
||||
*/
|
||||
public void setTabClosable( int tabIndex, boolean tabClosable ) {
|
||||
JComponent c = (JComponent) getComponentAt( tabIndex );
|
||||
c.putClientProperty( TABBED_PANE_TAB_CLOSABLE, tabClosable );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the tooltip text used for tab close buttons.
|
||||
*/
|
||||
public String getTabCloseToolTipText() {
|
||||
return (String) getClientProperty( TABBED_PANE_TAB_CLOSE_TOOLTIPTEXT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the tooltip text used for tab close buttons.
|
||||
*/
|
||||
public void setTabCloseToolTipText( String tabCloseToolTipText ) {
|
||||
putClientProperty( TABBED_PANE_TAB_CLOSE_TOOLTIPTEXT, tabCloseToolTipText );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the tooltip text used for tab close button at the given tab index.
|
||||
*/
|
||||
public String getTabCloseToolTipText( int tabIndex ) {
|
||||
JComponent c = (JComponent) getComponentAt( tabIndex );
|
||||
return (String) c.getClientProperty( TABBED_PANE_TAB_CLOSE_TOOLTIPTEXT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the tooltip text used for tab close button at the given tab index.
|
||||
*/
|
||||
public void setTabCloseToolTipText( int tabIndex, String tabCloseToolTipText ) {
|
||||
JComponent c = (JComponent) getComponentAt( tabIndex );
|
||||
c.putClientProperty( TABBED_PANE_TAB_CLOSE_TOOLTIPTEXT, tabCloseToolTipText );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the callback that is invoked when a tab close button is clicked.
|
||||
* The callback is responsible for closing the tab.
|
||||
*/
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public BiConsumer<JTabbedPane, Integer> getTabCloseCallback() {
|
||||
return (BiConsumer<JTabbedPane, Integer>) getClientProperty( TABBED_PANE_TAB_CLOSE_CALLBACK );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the callback that is invoked when a tab close button is clicked.
|
||||
* The callback is responsible for closing the tab.
|
||||
* <p>
|
||||
* Use a {@link java.util.function.BiConsumer}<javax.swing.JTabbedPane, Integer>
|
||||
* that receives the tabbed pane and the tab index as parameters:
|
||||
* <pre>{@code
|
||||
* myTabbedPane.setTabCloseCallback( (tabbedPane, tabIndex) -> {
|
||||
* // close tab here
|
||||
* } );
|
||||
* }</pre>
|
||||
* If you need to check whether a modifier key (e.g. Alt or Shift) was pressed
|
||||
* while the user clicked the tab close button, use {@link java.awt.EventQueue#getCurrentEvent}
|
||||
* to get current event, check whether it is a {@link java.awt.event.MouseEvent}
|
||||
* and invoke its methods. E.g.
|
||||
* <pre>{@code
|
||||
* AWTEvent e = EventQueue.getCurrentEvent();
|
||||
* boolean shift = (e instanceof MouseEvent) ? ((MouseEvent)e).isShiftDown() : false;
|
||||
* }</pre>
|
||||
*/
|
||||
public void setTabCloseCallback( BiConsumer<JTabbedPane, Integer> tabCloseCallback ) {
|
||||
putClientProperty( TABBED_PANE_TAB_CLOSE_CALLBACK, tabCloseCallback );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the callback that is invoked when the tab close button at the given tab index is clicked.
|
||||
* The callback is responsible for closing the tab.
|
||||
*/
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public BiConsumer<JTabbedPane, Integer> getTabCloseCallback( int tabIndex ) {
|
||||
JComponent c = (JComponent) getComponentAt( tabIndex );
|
||||
return (BiConsumer<JTabbedPane, Integer>) c.getClientProperty( TABBED_PANE_TAB_CLOSE_CALLBACK );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the callback that is invoked when the tab close button at the given tab index is clicked.
|
||||
* The callback is responsible for closing the tab.
|
||||
*
|
||||
* @see #setTabCloseCallback(BiConsumer)
|
||||
*/
|
||||
public void setTabCloseCallback( int tabIndex, BiConsumer<JTabbedPane, Integer> tabCloseCallback ) {
|
||||
JComponent c = (JComponent) getComponentAt( tabIndex );
|
||||
c.putClientProperty( TABBED_PANE_TAB_CLOSE_CALLBACK, tabCloseCallback );
|
||||
}
|
||||
|
||||
|
||||
// NOTE: enum names must be equal to allowed strings
|
||||
public enum TabsPopupPolicy { never, asNeeded };
|
||||
|
||||
/**
|
||||
* Returns the display policy for the "more tabs" button,
|
||||
* which shows a popup menu with the (partly) hidden tabs.
|
||||
*/
|
||||
public TabsPopupPolicy getTabsPopupPolicy() {
|
||||
return getClientPropertyEnumString( TABBED_PANE_TABS_POPUP_POLICY, TabsPopupPolicy.class,
|
||||
"TabbedPane.tabsPopupPolicy", TabsPopupPolicy.asNeeded );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the display policy for the "more tabs" button,
|
||||
* which shows a popup menu with the (partly) hidden tabs.
|
||||
*/
|
||||
public void setTabsPopupPolicy( TabsPopupPolicy tabsPopupPolicy ) {
|
||||
putClientPropertyEnumString( TABBED_PANE_TABS_POPUP_POLICY, tabsPopupPolicy );
|
||||
}
|
||||
|
||||
|
||||
// NOTE: enum names must be equal to allowed strings
|
||||
public enum ScrollButtonsPolicy { never, asNeeded, asNeededSingle };
|
||||
|
||||
/**
|
||||
* Returns the display policy for the forward/backward scroll arrow buttons.
|
||||
*/
|
||||
public ScrollButtonsPolicy getScrollButtonsPolicy() {
|
||||
return getClientPropertyEnumString( TABBED_PANE_SCROLL_BUTTONS_POLICY, ScrollButtonsPolicy.class,
|
||||
"TabbedPane.scrollButtonsPolicy", ScrollButtonsPolicy.asNeededSingle );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the display policy for the forward/backward scroll arrow buttons.
|
||||
*/
|
||||
public void setScrollButtonsPolicy( ScrollButtonsPolicy scrollButtonsPolicy ) {
|
||||
putClientPropertyEnumString( TABBED_PANE_SCROLL_BUTTONS_POLICY, scrollButtonsPolicy );
|
||||
}
|
||||
|
||||
|
||||
// NOTE: enum names must be equal to allowed strings
|
||||
public enum ScrollButtonsPlacement { both, trailing };
|
||||
|
||||
/**
|
||||
* Returns the placement of the forward/backward scroll arrow buttons.
|
||||
*/
|
||||
public ScrollButtonsPlacement getScrollButtonsPlacement() {
|
||||
return getClientPropertyEnumString( TABBED_PANE_SCROLL_BUTTONS_PLACEMENT, ScrollButtonsPlacement.class,
|
||||
"TabbedPane.scrollButtonsPlacement", ScrollButtonsPlacement.both );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the placement of the forward/backward scroll arrow buttons.
|
||||
*/
|
||||
public void setScrollButtonsPlacement( ScrollButtonsPlacement scrollButtonsPlacement ) {
|
||||
putClientPropertyEnumString( TABBED_PANE_SCROLL_BUTTONS_PLACEMENT, scrollButtonsPlacement );
|
||||
}
|
||||
|
||||
|
||||
// NOTE: enum names must be equal to allowed strings
|
||||
public enum TabAreaAlignment { leading, trailing, center, fill };
|
||||
|
||||
/**
|
||||
* Returns the alignment of the tab area.
|
||||
*/
|
||||
public TabAreaAlignment getTabAreaAlignment() {
|
||||
return getClientPropertyEnumString( TABBED_PANE_TAB_AREA_ALIGNMENT, TabAreaAlignment.class,
|
||||
"TabbedPane.tabAreaAlignment", TabAreaAlignment.leading );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the alignment of the tab area.
|
||||
*/
|
||||
public void setTabAreaAlignment( TabAreaAlignment tabAreaAlignment ) {
|
||||
putClientPropertyEnumString( TABBED_PANE_TAB_AREA_ALIGNMENT, tabAreaAlignment );
|
||||
}
|
||||
|
||||
|
||||
// NOTE: enum names must be equal to allowed strings
|
||||
public enum TabAlignment { leading, trailing, center };
|
||||
|
||||
/**
|
||||
* Returns the horizontal alignment of the tab title and icon.
|
||||
*/
|
||||
public TabAlignment getTabAlignment() {
|
||||
return getClientPropertyEnumString( TABBED_PANE_TAB_ALIGNMENT, TabAlignment.class,
|
||||
"TabbedPane.tabAlignment", TabAlignment.center );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the horizontal alignment of the tab title and icon.
|
||||
*/
|
||||
public void setTabAlignment( TabAlignment tabAlignment ) {
|
||||
putClientPropertyEnumString( TABBED_PANE_TAB_ALIGNMENT, tabAlignment );
|
||||
}
|
||||
|
||||
|
||||
// NOTE: enum names must be equal to allowed strings
|
||||
public enum TabWidthMode { preferred, equal, compact };
|
||||
|
||||
/**
|
||||
* Returns how the tabs should be sized.
|
||||
*/
|
||||
public TabWidthMode getTabWidthMode() {
|
||||
return getClientPropertyEnumString( TABBED_PANE_TAB_WIDTH_MODE, TabWidthMode.class,
|
||||
"TabbedPane.tabWidthMode", TabWidthMode.preferred );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies how the tabs should be sized.
|
||||
*/
|
||||
public void setTabWidthMode( TabWidthMode tabWidthMode ) {
|
||||
putClientPropertyEnumString( TABBED_PANE_TAB_WIDTH_MODE, tabWidthMode );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the tab icon placement (relative to tab title).
|
||||
*/
|
||||
public int getTabIconPlacement() {
|
||||
return getClientPropertyInt( TABBED_PANE_TAB_ICON_PLACEMENT, SwingConstants.LEADING );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the tab icon placement (relative to tab title).
|
||||
* <p>
|
||||
* Allowed Values are:
|
||||
* <ul>
|
||||
* <li>{@link SwingConstants#LEADING} (default)
|
||||
* <li>{@link SwingConstants#TRAILING}
|
||||
* <li>{@link SwingConstants#TOP}
|
||||
* <li>{@link SwingConstants#BOTTOM}
|
||||
* </ul>
|
||||
*/
|
||||
public void setTabIconPlacement( int tabIconPlacement ) {
|
||||
putClientProperty( TABBED_PANE_TAB_ICON_PLACEMENT, (tabIconPlacement >= 0) ? tabIconPlacement : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a component that will be placed at the leading edge of the tabs area.
|
||||
*/
|
||||
public Component getLeadingComponent() {
|
||||
return (Component) getClientProperty( TABBED_PANE_LEADING_COMPONENT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a component that will be placed at the leading edge of the tabs area.
|
||||
* <p>
|
||||
* For top and bottom tab placement, the layed out component size will be
|
||||
* the preferred component width and the tab area height.<br>
|
||||
* For left and right tab placement, the layed out component size will be
|
||||
* the tab area width and the preferred component height.
|
||||
*/
|
||||
public void setLeadingComponent( Component leadingComponent ) {
|
||||
putClientProperty( TABBED_PANE_LEADING_COMPONENT, leadingComponent );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a component that will be placed at the trailing edge of the tabs area.
|
||||
*/
|
||||
public Component getTrailingComponent() {
|
||||
return (Component) getClientProperty( TABBED_PANE_TRAILING_COMPONENT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a component that will be placed at the trailing edge of the tabs area.
|
||||
* <p>
|
||||
* For top and bottom tab placement, the layed out component size will be
|
||||
* the available horizontal space (minimum is preferred component width) and the tab area height.<br>
|
||||
* For left and right tab placement, the layed out component size will be
|
||||
* the tab area width and the available vertical space (minimum is preferred component height).
|
||||
*/
|
||||
public void setTrailingComponent( Component trailingComponent ) {
|
||||
putClientProperty( TABBED_PANE_TRAILING_COMPONENT, trailingComponent );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JTextArea} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatTextArea
|
||||
extends JTextArea
|
||||
implements FlatComponentExtension
|
||||
{
|
||||
/**
|
||||
* Returns minimum width of a component.
|
||||
*/
|
||||
public int getMinimumWidth() {
|
||||
return getClientPropertyInt( MINIMUM_WIDTH, "Component.minimumWidth" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies minimum width of a component.
|
||||
*/
|
||||
public void setMinimumWidth( int minimumWidth ) {
|
||||
putClientProperty( MINIMUM_WIDTH, (minimumWidth >= 0) ? minimumWidth : null );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import java.awt.Color;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JTextField} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatTextField
|
||||
extends JTextField
|
||||
implements FlatComponentExtension
|
||||
{
|
||||
/**
|
||||
* Returns the placeholder text that is only painted if the text field is empty.
|
||||
*/
|
||||
public String getPlaceholderText() {
|
||||
return (String) getClientProperty( PLACEHOLDER_TEXT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the placeholder text that is only painted if the text field is empty.
|
||||
*/
|
||||
public void setPlaceholderText( String placeholderText ) {
|
||||
putClientProperty( PLACEHOLDER_TEXT, placeholderText );
|
||||
}
|
||||
|
||||
|
||||
// NOTE: enum names must be equal to allowed strings
|
||||
public enum SelectAllOnFocusPolicy { never, once, always };
|
||||
|
||||
/**
|
||||
* Returns whether all text is selected when the text component gains focus.
|
||||
*/
|
||||
public SelectAllOnFocusPolicy getSelectAllOnFocusPolicy() {
|
||||
return getClientPropertyEnumString( SELECT_ALL_ON_FOCUS_POLICY, SelectAllOnFocusPolicy.class,
|
||||
"TextComponent.selectAllOnFocusPolicy", SelectAllOnFocusPolicy.once );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether all text is selected when the text component gains focus.
|
||||
*/
|
||||
public void setSelectAllOnFocusPolicy( SelectAllOnFocusPolicy selectAllOnFocusPolicy ) {
|
||||
putClientPropertyEnumString( SELECT_ALL_ON_FOCUS_POLICY, selectAllOnFocusPolicy );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns minimum width of a component.
|
||||
*/
|
||||
public int getMinimumWidth() {
|
||||
return getClientPropertyInt( MINIMUM_WIDTH, "Component.minimumWidth" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies minimum width of a component.
|
||||
*/
|
||||
public void setMinimumWidth( int minimumWidth ) {
|
||||
putClientProperty( MINIMUM_WIDTH, (minimumWidth >= 0) ? minimumWidth : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the component is painted with round edges.
|
||||
*/
|
||||
public boolean isRoundRect() {
|
||||
return getClientPropertyBoolean( COMPONENT_ROUND_RECT, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the component is painted with round edges.
|
||||
*/
|
||||
public void setRoundRect( boolean roundRect ) {
|
||||
putClientPropertyBoolean( COMPONENT_ROUND_RECT, roundRect, false );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the outline color of the component border.
|
||||
*/
|
||||
public Object getOutline() {
|
||||
return getClientProperty( OUTLINE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the outline color of the component border.
|
||||
* <p>
|
||||
* Allowed Values are:
|
||||
* <ul>
|
||||
* <li>{@code null}
|
||||
* <li>string {@code "error"}
|
||||
* <li>string {@code "warning"}
|
||||
* <li>any color (type {@link Color})
|
||||
* <li>an array of two colors (type {@link Color}[2]) where the first color
|
||||
* is for focused state and the second for unfocused state
|
||||
* </ul>
|
||||
*/
|
||||
public void setOutline( Object outline ) {
|
||||
putClientProperty( OUTLINE, outline );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import javax.swing.JTextPane;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JTextPane} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatTextPane
|
||||
extends JTextPane
|
||||
implements FlatComponentExtension
|
||||
{
|
||||
/**
|
||||
* Returns minimum width of a component.
|
||||
*/
|
||||
public int getMinimumWidth() {
|
||||
return getClientPropertyInt( MINIMUM_WIDTH, "Component.minimumWidth" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies minimum width of a component.
|
||||
*/
|
||||
public void setMinimumWidth( int minimumWidth ) {
|
||||
putClientProperty( MINIMUM_WIDTH, (minimumWidth >= 0) ? minimumWidth : null );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import java.awt.Color;
|
||||
import javax.swing.JToggleButton;
|
||||
import com.formdev.flatlaf.extras.components.FlatButton.ButtonType;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JToggleButton} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatToggleButton
|
||||
extends JToggleButton
|
||||
implements FlatComponentExtension
|
||||
{
|
||||
/**
|
||||
* Returns type of a button.
|
||||
*/
|
||||
public ButtonType getButtonType() {
|
||||
return getClientPropertyEnumString( BUTTON_TYPE, ButtonType.class, null, ButtonType.none );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies type of a button.
|
||||
*/
|
||||
public void setButtonType( ButtonType buttonType ) {
|
||||
if( buttonType == ButtonType.none )
|
||||
buttonType = null;
|
||||
putClientPropertyEnumString( BUTTON_TYPE, buttonType );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the button preferred size will be made square (quadratically).
|
||||
*/
|
||||
public boolean isSquareSize() {
|
||||
return getClientPropertyBoolean( SQUARE_SIZE, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the button preferred size will be made square (quadratically).
|
||||
*/
|
||||
public void setSquareSize( boolean squareSize ) {
|
||||
putClientPropertyBoolean( SQUARE_SIZE, squareSize, false );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns minimum width of a component.
|
||||
*/
|
||||
public int getMinimumWidth() {
|
||||
return getClientPropertyInt( MINIMUM_WIDTH, "ToggleButton.minimumWidth" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies minimum width of a component.
|
||||
*/
|
||||
public void setMinimumWidth( int minimumWidth ) {
|
||||
putClientProperty( MINIMUM_WIDTH, (minimumWidth >= 0) ? minimumWidth : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns minimum height of a component.
|
||||
*/
|
||||
public int getMinimumHeight() {
|
||||
return getClientPropertyInt( MINIMUM_HEIGHT, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies minimum height of a component.
|
||||
*/
|
||||
public void setMinimumHeight( int minimumHeight ) {
|
||||
putClientProperty( MINIMUM_HEIGHT, (minimumHeight >= 0) ? minimumHeight : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the outline color of the component border.
|
||||
*/
|
||||
public Object getOutline() {
|
||||
return getClientProperty( OUTLINE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the outline color of the component border.
|
||||
* <p>
|
||||
* Allowed Values are:
|
||||
* <ul>
|
||||
* <li>{@code null}
|
||||
* <li>string {@code "error"}
|
||||
* <li>string {@code "warning"}
|
||||
* <li>any color (type {@link Color})
|
||||
* <li>an array of two colors (type {@link Color}[2]) where the first color
|
||||
* is for focused state and the second for unfocused state
|
||||
* </ul>
|
||||
*/
|
||||
public void setOutline( Object outline ) {
|
||||
putClientProperty( OUTLINE, outline );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns height of underline if toggle button type is {@link ButtonType#tab}.
|
||||
*/
|
||||
public int getTabUnderlineHeight() {
|
||||
return getClientPropertyInt( TAB_BUTTON_UNDERLINE_HEIGHT, "ToggleButton.tab.underlineHeight" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies height of underline if toggle button type is {@link ButtonType#tab}.
|
||||
*/
|
||||
public void setTabUnderlineHeight( int tabUnderlineHeight ) {
|
||||
putClientProperty( TAB_BUTTON_UNDERLINE_HEIGHT, (tabUnderlineHeight >= 0) ? tabUnderlineHeight : null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns color of underline if toggle button type is {@link ButtonType#tab}.
|
||||
*/
|
||||
public Color getTabUnderlineColor() {
|
||||
return getClientPropertyColor( TAB_BUTTON_UNDERLINE_COLOR, "ToggleButton.tab.underlineColor" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies color of underline if toggle button type is {@link ButtonType#tab}.
|
||||
*/
|
||||
public void setTabUnderlineColor( Color tabUnderlineColor ) {
|
||||
putClientProperty( TAB_BUTTON_UNDERLINE_COLOR, tabUnderlineColor );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns background color if selected and toggle button type is {@link ButtonType#tab}.
|
||||
*/
|
||||
public Color getTabSelectedBackground() {
|
||||
return getClientPropertyColor( TAB_BUTTON_SELECTED_BACKGROUND, "ToggleButton.tab.selectedBackground" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies background color if selected and toggle button type is {@link ButtonType#tab}.
|
||||
*/
|
||||
public void setTabSelectedBackground( Color tabSelectedBackground ) {
|
||||
putClientProperty( TAB_BUTTON_SELECTED_BACKGROUND, tabSelectedBackground );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
/*
|
||||
* Copyright 2019 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.extras.components;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.ItemEvent;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.UIManager;
|
||||
import com.formdev.flatlaf.FlatLaf;
|
||||
|
||||
/**
|
||||
* A tri-state check box.
|
||||
* <p>
|
||||
* The initial state is {@link State#INDETERMINATE}.
|
||||
* <p>
|
||||
* By default the third state is allowed and clicking on the checkbox cycles thru all
|
||||
* three states. If you want that the user can cycle only thru two states, disallow
|
||||
* intermediate state using {@link #setAllowIndeterminate(boolean)}. Then you can still
|
||||
* set the indeterminate state via API if necessary, but the user can not.
|
||||
* <p>
|
||||
* The default state cycle order is {@link State#UNSELECTED} to {@link State#INDETERMINATE}
|
||||
* to {@link State#SELECTED}.
|
||||
* This is the same order as used by macOS, win32, IntelliJ IDEA and on the web as recommended by W3C in
|
||||
* <a href="https://www.w3.org/TR/wai-aria-practices-1.1/examples/checkbox/checkbox-2/checkbox-2.html">Tri-State Checkbox Example</a>).
|
||||
* <p>
|
||||
* If {@link #isAltStateCycleOrder()} returns {@code true},
|
||||
* the state cycle order is {@link State#UNSELECTED} to {@link State#SELECTED}
|
||||
* to {@link State#INDETERMINATE}. This order is used by Windows 10 UWP apps.
|
||||
* <p>
|
||||
* If you prefer the alternative state cycle order for all tri-state check boxes, enable it using:
|
||||
* <pre>
|
||||
* UIManager.put( "FlatTriStateCheckBox.altStateCycleOrder", true );
|
||||
* </pre>
|
||||
* <p>
|
||||
* To display the third state, this component requires an LaF that supports painting
|
||||
* the indeterminate state if client property {@code "JButton.selectedState"} has the
|
||||
* value {@code "indeterminate"}.
|
||||
* FlatLaf and macOS Aqua LaF support the third state.
|
||||
* For other LaFs a magenta rectangle is painted around the component for the third state.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatTriStateCheckBox
|
||||
extends JCheckBox
|
||||
{
|
||||
public enum State { UNSELECTED, INDETERMINATE, SELECTED }
|
||||
|
||||
private State state;
|
||||
private boolean allowIndeterminate = true;
|
||||
private boolean altStateCycleOrder = UIManager.getBoolean( "FlatTriStateCheckBox.altStateCycleOrder" );
|
||||
|
||||
public FlatTriStateCheckBox() {
|
||||
this( null );
|
||||
}
|
||||
|
||||
public FlatTriStateCheckBox( String text ) {
|
||||
this( text, State.INDETERMINATE );
|
||||
}
|
||||
|
||||
public FlatTriStateCheckBox( String text, State initialState ) {
|
||||
super( text );
|
||||
|
||||
setModel( new ToggleButtonModel() {
|
||||
@Override
|
||||
public boolean isSelected() {
|
||||
return state != State.UNSELECTED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected( boolean b ) {
|
||||
setState( nextState( state ) );
|
||||
|
||||
fireStateChanged();
|
||||
fireItemStateChanged( new ItemEvent( this, ItemEvent.ITEM_STATE_CHANGED, this,
|
||||
isSelected() ? ItemEvent.SELECTED : ItemEvent.DESELECTED ) );
|
||||
}
|
||||
} );
|
||||
|
||||
setState( initialState );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the state as {@link State} enum.
|
||||
* <p>
|
||||
* Alternatively you can use {@link #getChecked()} to get all three states as {@link Boolean}
|
||||
* or {@link #isIndeterminate()} to check only for indeterminate state.
|
||||
*/
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the state as {@link State} enum.
|
||||
*/
|
||||
public void setState( State state ) {
|
||||
if( this.state == state )
|
||||
return;
|
||||
|
||||
State oldState = this.state;
|
||||
this.state = state;
|
||||
|
||||
putClientProperty( SELECTED_STATE, (state == State.INDETERMINATE) ? SELECTED_STATE_INDETERMINATE : null );
|
||||
|
||||
firePropertyChange( "state", oldState, state );
|
||||
repaint();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next state that follows the given state, depending on
|
||||
* {@link #isAllowIndeterminate()} and {@link #isAltStateCycleOrder()}.
|
||||
*/
|
||||
protected State nextState( State state ) {
|
||||
if( !altStateCycleOrder ) {
|
||||
// default cycle order: UNSELECTED --> INDETERMINATE --> SELECTED
|
||||
switch( state ) {
|
||||
default:
|
||||
case UNSELECTED: return allowIndeterminate ? State.INDETERMINATE : State.SELECTED;
|
||||
case INDETERMINATE: return State.SELECTED;
|
||||
case SELECTED: return State.UNSELECTED;
|
||||
}
|
||||
} else {
|
||||
// alternative cycle order: INDETERMINATE --> UNSELECTED --> SELECTED
|
||||
switch( state ) {
|
||||
default:
|
||||
case UNSELECTED: return State.SELECTED;
|
||||
case INDETERMINATE: return State.UNSELECTED;
|
||||
case SELECTED: return allowIndeterminate ? State.INDETERMINATE : State.UNSELECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the state as {@link Boolean}.
|
||||
* Returns {@code null} if the state is {@link State#INDETERMINATE}.
|
||||
* <p>
|
||||
* Alternatively you can use {@link #getState()} to get state as {@link State} enum
|
||||
* or {@link #isIndeterminate()} to check only for indeterminate state.
|
||||
*/
|
||||
public Boolean getChecked() {
|
||||
switch( state ) {
|
||||
default:
|
||||
case UNSELECTED: return false;
|
||||
case INDETERMINATE: return null;
|
||||
case SELECTED: return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the state as {@link Boolean}.
|
||||
* Passing {@code null} sets state to {@link State#INDETERMINATE}.
|
||||
*/
|
||||
public void setChecked( Boolean value ) {
|
||||
setState( (value == null) ? State.INDETERMINATE : (value ? State.SELECTED : State.UNSELECTED) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected( boolean b ) {
|
||||
setState( b ? State.SELECTED : State.UNSELECTED );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether state is indeterminate.
|
||||
*/
|
||||
public boolean isIndeterminate() {
|
||||
return state == State.INDETERMINATE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets indeterminate state.
|
||||
*/
|
||||
public void setIndeterminate( boolean indeterminate ) {
|
||||
if( indeterminate )
|
||||
setState( State.INDETERMINATE );
|
||||
else if( state == State.INDETERMINATE )
|
||||
setState( State.UNSELECTED );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether indeterminate state is allowed.
|
||||
* <p>
|
||||
* This affects only the user when clicking on the checkbox.
|
||||
* Setting state to indeterminate via API is always allowed.
|
||||
*/
|
||||
public boolean isAllowIndeterminate() {
|
||||
return allowIndeterminate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether indeterminate state is allowed.
|
||||
* <p>
|
||||
* This affects only the user when clicking on the checkbox.
|
||||
* Setting state to indeterminate via API is always allowed.
|
||||
*/
|
||||
public void setAllowIndeterminate( boolean allowIndeterminate ) {
|
||||
this.allowIndeterminate = allowIndeterminate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether alternative state cycle order should be used.
|
||||
*/
|
||||
public boolean isAltStateCycleOrder() {
|
||||
return altStateCycleOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether alternative state cycle order should be used.
|
||||
*/
|
||||
public void setAltStateCycleOrder( boolean altStateCycleOrder ) {
|
||||
this.altStateCycleOrder = altStateCycleOrder;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent( Graphics g ) {
|
||||
super.paintComponent( g );
|
||||
|
||||
if( state == State.INDETERMINATE && !isIndeterminateStateSupported() )
|
||||
paintIndeterminateState( g );
|
||||
}
|
||||
|
||||
/**
|
||||
* Paints the indeterminate state if the current LaF does not support displaying
|
||||
* the indeterminate state.
|
||||
* The default implementation draws a magenta rectangle around the component.
|
||||
*/
|
||||
protected void paintIndeterminateState( Graphics g ) {
|
||||
g.setColor( Color.magenta );
|
||||
g.drawRect( 0, 0, getWidth() - 1, getHeight() - 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the current LaF supports displaying the indeterminate state.
|
||||
* Returns {@code true} for FlatLaf and macOS Aqua.
|
||||
*/
|
||||
protected boolean isIndeterminateStateSupported() {
|
||||
LookAndFeel laf = UIManager.getLookAndFeel();
|
||||
return laf instanceof FlatLaf || laf.getClass().getName().equals( "com.apple.laf.AquaLookAndFeel" );
|
||||
}
|
||||
}
|
||||
@@ -25,10 +25,6 @@ Otherwise download `flatlaf-intellij-themes-<version>.jar` here:
|
||||
|
||||
[](https://bintray.com/jformdesigner/flatlaf/flatlaf-intellij-themes/_latestVersion)
|
||||
|
||||
You also need `flatlaf-<version>.jar`, which you can download here:
|
||||
|
||||
[](https://bintray.com/jformdesigner/flatlaf/flatlaf/_latestVersion)
|
||||
|
||||
|
||||
How to use?
|
||||
-----------
|
||||
|
||||
@@ -28,65 +28,82 @@ import javax.swing.UIManager.LookAndFeelInfo;
|
||||
*/
|
||||
public class FlatAllIJThemes
|
||||
{
|
||||
public static final LookAndFeelInfo[] INFOS = {
|
||||
new LookAndFeelInfo( "Arc", "com.formdev.flatlaf.intellijthemes.FlatArcIJTheme" ),
|
||||
new LookAndFeelInfo( "Arc - Orange", "com.formdev.flatlaf.intellijthemes.FlatArcOrangeIJTheme" ),
|
||||
new LookAndFeelInfo( "Arc Dark", "com.formdev.flatlaf.intellijthemes.FlatArcDarkIJTheme" ),
|
||||
new LookAndFeelInfo( "Arc Dark - Orange", "com.formdev.flatlaf.intellijthemes.FlatArcDarkOrangeIJTheme" ),
|
||||
new LookAndFeelInfo( "Carbon", "com.formdev.flatlaf.intellijthemes.FlatCarbonIJTheme" ),
|
||||
new LookAndFeelInfo( "Cobalt 2", "com.formdev.flatlaf.intellijthemes.FlatCobalt2IJTheme" ),
|
||||
new LookAndFeelInfo( "Cyan light", "com.formdev.flatlaf.intellijthemes.FlatCyanLightIJTheme" ),
|
||||
new LookAndFeelInfo( "Dark Flat", "com.formdev.flatlaf.intellijthemes.FlatDarkFlatIJTheme" ),
|
||||
new LookAndFeelInfo( "Dark purple", "com.formdev.flatlaf.intellijthemes.FlatDarkPurpleIJTheme" ),
|
||||
new LookAndFeelInfo( "Dracula", "com.formdev.flatlaf.intellijthemes.FlatDraculaIJTheme" ),
|
||||
new LookAndFeelInfo( "Gradianto Dark Fuchsia", "com.formdev.flatlaf.intellijthemes.FlatGradiantoDarkFuchsiaIJTheme" ),
|
||||
new LookAndFeelInfo( "Gradianto Deep Ocean", "com.formdev.flatlaf.intellijthemes.FlatGradiantoDeepOceanIJTheme" ),
|
||||
new LookAndFeelInfo( "Gradianto Midnight Blue", "com.formdev.flatlaf.intellijthemes.FlatGradiantoMidnightBlueIJTheme" ),
|
||||
new LookAndFeelInfo( "Gradianto Nature Green", "com.formdev.flatlaf.intellijthemes.FlatGradiantoNatureGreenIJTheme" ),
|
||||
new LookAndFeelInfo( "Gray", "com.formdev.flatlaf.intellijthemes.FlatGrayIJTheme" ),
|
||||
new LookAndFeelInfo( "Gruvbox Dark Hard", "com.formdev.flatlaf.intellijthemes.FlatGruvboxDarkHardIJTheme" ),
|
||||
new LookAndFeelInfo( "Gruvbox Dark Medium", "com.formdev.flatlaf.intellijthemes.FlatGruvboxDarkMediumIJTheme" ),
|
||||
new LookAndFeelInfo( "Gruvbox Dark Soft", "com.formdev.flatlaf.intellijthemes.FlatGruvboxDarkSoftIJTheme" ),
|
||||
new LookAndFeelInfo( "Hiberbee Dark", "com.formdev.flatlaf.intellijthemes.FlatHiberbeeDarkIJTheme" ),
|
||||
new LookAndFeelInfo( "High contrast", "com.formdev.flatlaf.intellijthemes.FlatHighContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "Light Flat", "com.formdev.flatlaf.intellijthemes.FlatLightFlatIJTheme" ),
|
||||
new LookAndFeelInfo( "Material Design Dark", "com.formdev.flatlaf.intellijthemes.FlatMaterialDesignDarkIJTheme" ),
|
||||
new LookAndFeelInfo( "Monocai", "com.formdev.flatlaf.intellijthemes.FlatMonocaiIJTheme" ),
|
||||
new LookAndFeelInfo( "Nord", "com.formdev.flatlaf.intellijthemes.FlatNordIJTheme" ),
|
||||
new LookAndFeelInfo( "One Dark", "com.formdev.flatlaf.intellijthemes.FlatOneDarkIJTheme" ),
|
||||
new LookAndFeelInfo( "Solarized Dark", "com.formdev.flatlaf.intellijthemes.FlatSolarizedDarkIJTheme" ),
|
||||
new LookAndFeelInfo( "Solarized Light", "com.formdev.flatlaf.intellijthemes.FlatSolarizedLightIJTheme" ),
|
||||
new LookAndFeelInfo( "Spacegray", "com.formdev.flatlaf.intellijthemes.FlatSpacegrayIJTheme" ),
|
||||
new LookAndFeelInfo( "Vuesion", "com.formdev.flatlaf.intellijthemes.FlatVuesionIJTheme" ),
|
||||
new LookAndFeelInfo( "Arc Dark (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatArcDarkIJTheme" ),
|
||||
new LookAndFeelInfo( "Arc Dark Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatArcDarkContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "Atom One Dark (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatAtomOneDarkIJTheme" ),
|
||||
new LookAndFeelInfo( "Atom One Dark Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatAtomOneDarkContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "Atom One Light (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatAtomOneLightIJTheme" ),
|
||||
new LookAndFeelInfo( "Atom One Light Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatAtomOneLightContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "Dracula (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatDraculaIJTheme" ),
|
||||
new LookAndFeelInfo( "Dracula Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatDraculaContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "GitHub (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatGitHubIJTheme" ),
|
||||
new LookAndFeelInfo( "GitHub Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatGitHubContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "Light Owl (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatLightOwlIJTheme" ),
|
||||
new LookAndFeelInfo( "Light Owl Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatLightOwlContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "Material Darker (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialDarkerIJTheme" ),
|
||||
new LookAndFeelInfo( "Material Darker Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialDarkerContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "Material Deep Ocean (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialDeepOceanIJTheme" ),
|
||||
new LookAndFeelInfo( "Material Deep Ocean Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialDeepOceanContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "Material Lighter (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialLighterIJTheme" ),
|
||||
new LookAndFeelInfo( "Material Lighter Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialLighterContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "Material Oceanic (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialOceanicIJTheme" ),
|
||||
new LookAndFeelInfo( "Material Oceanic Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialOceanicContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "Material Palenight (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialPalenightIJTheme" ),
|
||||
new LookAndFeelInfo( "Material Palenight Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialPalenightContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "Monokai Pro (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMonokaiProIJTheme" ),
|
||||
new LookAndFeelInfo( "Monokai Pro Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMonokaiProContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "Night Owl (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatNightOwlIJTheme" ),
|
||||
new LookAndFeelInfo( "Night Owl Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatNightOwlContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "Solarized Dark (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatSolarizedDarkIJTheme" ),
|
||||
new LookAndFeelInfo( "Solarized Dark Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatSolarizedDarkContrastIJTheme" ),
|
||||
new LookAndFeelInfo( "Solarized Light (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatSolarizedLightIJTheme" ),
|
||||
new LookAndFeelInfo( "Solarized Light Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatSolarizedLightContrastIJTheme" ),
|
||||
public static final FlatIJLookAndFeelInfo[] INFOS = {
|
||||
new FlatIJLookAndFeelInfo( "Arc", "com.formdev.flatlaf.intellijthemes.FlatArcIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "Arc - Orange", "com.formdev.flatlaf.intellijthemes.FlatArcOrangeIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "Arc Dark", "com.formdev.flatlaf.intellijthemes.FlatArcDarkIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Arc Dark - Orange", "com.formdev.flatlaf.intellijthemes.FlatArcDarkOrangeIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Carbon", "com.formdev.flatlaf.intellijthemes.FlatCarbonIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Cobalt 2", "com.formdev.flatlaf.intellijthemes.FlatCobalt2IJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Cyan light", "com.formdev.flatlaf.intellijthemes.FlatCyanLightIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "Dark Flat", "com.formdev.flatlaf.intellijthemes.FlatDarkFlatIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Dark purple", "com.formdev.flatlaf.intellijthemes.FlatDarkPurpleIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Dracula", "com.formdev.flatlaf.intellijthemes.FlatDraculaIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Gradianto Dark Fuchsia", "com.formdev.flatlaf.intellijthemes.FlatGradiantoDarkFuchsiaIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Gradianto Deep Ocean", "com.formdev.flatlaf.intellijthemes.FlatGradiantoDeepOceanIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Gradianto Midnight Blue", "com.formdev.flatlaf.intellijthemes.FlatGradiantoMidnightBlueIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Gradianto Nature Green", "com.formdev.flatlaf.intellijthemes.FlatGradiantoNatureGreenIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Gray", "com.formdev.flatlaf.intellijthemes.FlatGrayIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "Gruvbox Dark Hard", "com.formdev.flatlaf.intellijthemes.FlatGruvboxDarkHardIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Gruvbox Dark Medium", "com.formdev.flatlaf.intellijthemes.FlatGruvboxDarkMediumIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Gruvbox Dark Soft", "com.formdev.flatlaf.intellijthemes.FlatGruvboxDarkSoftIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Hiberbee Dark", "com.formdev.flatlaf.intellijthemes.FlatHiberbeeDarkIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "High contrast", "com.formdev.flatlaf.intellijthemes.FlatHighContrastIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Light Flat", "com.formdev.flatlaf.intellijthemes.FlatLightFlatIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "Material Design Dark", "com.formdev.flatlaf.intellijthemes.FlatMaterialDesignDarkIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Monocai", "com.formdev.flatlaf.intellijthemes.FlatMonocaiIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Nord", "com.formdev.flatlaf.intellijthemes.FlatNordIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "One Dark", "com.formdev.flatlaf.intellijthemes.FlatOneDarkIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Solarized Dark", "com.formdev.flatlaf.intellijthemes.FlatSolarizedDarkIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Solarized Light", "com.formdev.flatlaf.intellijthemes.FlatSolarizedLightIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "Spacegray", "com.formdev.flatlaf.intellijthemes.FlatSpacegrayIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Vuesion", "com.formdev.flatlaf.intellijthemes.FlatVuesionIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Arc Dark (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatArcDarkIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Arc Dark Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatArcDarkContrastIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Atom One Dark (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatAtomOneDarkIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Atom One Dark Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatAtomOneDarkContrastIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Atom One Light (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatAtomOneLightIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "Atom One Light Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatAtomOneLightContrastIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "Dracula (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatDraculaIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Dracula Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatDraculaContrastIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "GitHub (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatGitHubIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "GitHub Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatGitHubContrastIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "Light Owl (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatLightOwlIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "Light Owl Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatLightOwlContrastIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "Material Darker (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialDarkerIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Material Darker Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialDarkerContrastIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Material Deep Ocean (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialDeepOceanIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Material Deep Ocean Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialDeepOceanContrastIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Material Lighter (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialLighterIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "Material Lighter Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialLighterContrastIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "Material Oceanic (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialOceanicIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Material Oceanic Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialOceanicContrastIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Material Palenight (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialPalenightIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Material Palenight Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialPalenightContrastIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Monokai Pro (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMonokaiProIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Monokai Pro Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMonokaiProContrastIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Night Owl (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatNightOwlIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Night Owl Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatNightOwlContrastIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Solarized Dark (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatSolarizedDarkIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Solarized Dark Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatSolarizedDarkContrastIJTheme", true ),
|
||||
new FlatIJLookAndFeelInfo( "Solarized Light (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatSolarizedLightIJTheme", false ),
|
||||
new FlatIJLookAndFeelInfo( "Solarized Light Contrast (Material)", "com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatSolarizedLightContrastIJTheme", false ),
|
||||
};
|
||||
|
||||
//---- class FlatIJLookAndFeelInfo ----------------------------------------
|
||||
|
||||
public static class FlatIJLookAndFeelInfo
|
||||
extends LookAndFeelInfo
|
||||
{
|
||||
private final boolean dark;
|
||||
|
||||
public FlatIJLookAndFeelInfo( String name, String className, boolean dark ) {
|
||||
super( name, className );
|
||||
this.dark = dark;
|
||||
}
|
||||
|
||||
public boolean isDark() {
|
||||
return dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ Following JIDE Common Layer components are currently supported by this addon:
|
||||
|
||||
- `JideTabbedPane`
|
||||
- `RangeSlider`
|
||||
- `TristateCheckBox`
|
||||
|
||||
|
||||
**Note**: We have currently no plans to support additional components. If you're
|
||||
@@ -32,7 +33,3 @@ build script:
|
||||
Otherwise download `flatlaf-jide-oss-<version>.jar` here:
|
||||
|
||||
[](https://bintray.com/jformdesigner/flatlaf/flatlaf-jide-oss/_latestVersion)
|
||||
|
||||
You also need `flatlaf-<version>.jar`, which you can download here:
|
||||
|
||||
[](https://bintray.com/jformdesigner/flatlaf/flatlaf/_latestVersion)
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.formdev.flatlaf.jideoss;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.UIDefaults;
|
||||
import com.formdev.flatlaf.FlatDefaultsAddon;
|
||||
import com.formdev.flatlaf.FlatLaf;
|
||||
@@ -46,6 +47,14 @@ public class FlatJideOssDefaultsAddon
|
||||
return super.getDefaults( lafClass );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterDefaultsLoading( LookAndFeel laf, UIDefaults defaults ) {
|
||||
// TristateCheckBox
|
||||
defaults.put( "TristateCheckBox.icon", null );
|
||||
defaults.put( "TristateCheckBox.setMixed.clientProperty", new Object[] { "JButton.selectedState", "indeterminate" } );
|
||||
defaults.put( "TristateCheckBox.clearMixed.clientProperty", new Object[] { "JButton.selectedState", null } );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return 11;
|
||||
@@ -71,6 +80,7 @@ public class FlatJideOssDefaultsAddon
|
||||
Object key = e.getKey();
|
||||
if( key instanceof String &&
|
||||
(((String)key).startsWith( "Jide" ) ||
|
||||
((String)key).startsWith( "TristateCheckBox." ) ||
|
||||
key.equals( "RangeSliderUI" ) ||
|
||||
key.equals( "Resizable.resizeBorder" )) )
|
||||
{
|
||||
@@ -85,6 +95,9 @@ public class FlatJideOssDefaultsAddon
|
||||
defaults.putAll( jideDefaults );
|
||||
jideDefaults = null;
|
||||
}
|
||||
|
||||
// TristateCheckBox
|
||||
defaults.put( "TristateCheckBox.icon", null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import static com.formdev.flatlaf.FlatClientProperties.clientPropertyBoolean;
|
||||
import static com.formdev.flatlaf.util.UIScale.scale;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
@@ -62,6 +63,8 @@ public class FlatJideTabbedPaneUI
|
||||
protected boolean hasFullBorder;
|
||||
protected boolean tabsOverlapBorder;
|
||||
|
||||
private Object[] oldRenderingHints;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
return new FlatJideTabbedPaneUI();
|
||||
}
|
||||
@@ -193,9 +196,12 @@ public class FlatJideTabbedPaneUI
|
||||
|
||||
@Override
|
||||
public void update( Graphics g, JComponent c ) {
|
||||
FlatUIUtils.setRenderingHints( (Graphics2D) g );
|
||||
oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
||||
|
||||
super.update( g, c );
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||
oldRenderingHints = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -222,6 +228,15 @@ public class FlatJideTabbedPaneUI
|
||||
g.fillRect( x, y, w, h );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintText( Graphics g, int tabPlacement, Font font, FontMetrics metrics,
|
||||
int tabIndex, String title, Rectangle textRect, boolean isSelected )
|
||||
{
|
||||
FlatUIUtils.runWithoutRenderingHints( g, oldRenderingHints, () -> {
|
||||
super.paintText( g, tabPlacement, font, metrics, tabIndex, title, textRect, isSelected );
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintTabBorder( Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h,
|
||||
boolean isSelected )
|
||||
|
||||
@@ -23,12 +23,14 @@ import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
import java.util.Dictionary;
|
||||
import java.util.Enumeration;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JSlider;
|
||||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import com.formdev.flatlaf.ui.FlatSliderUI;
|
||||
@@ -60,6 +62,8 @@ public class FlatRangeSliderUI
|
||||
protected Color disabledThumbColor;
|
||||
protected Color disabledThumbBorderColor;
|
||||
|
||||
private Object[] oldRenderingHints;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
return new FlatRangeSliderUI();
|
||||
}
|
||||
@@ -142,6 +146,11 @@ public class FlatRangeSliderUI
|
||||
disabledThumbBorderColor = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TrackListener createTrackListener( JSlider slider ) {
|
||||
return new FlatRangeTrackListener( super.createTrackListener( slider ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBaseline( JComponent c, int width, int height ) {
|
||||
if( c == null )
|
||||
@@ -190,7 +199,7 @@ public class FlatRangeSliderUI
|
||||
|
||||
@Override
|
||||
public void paint( Graphics g, JComponent c ) {
|
||||
FlatUIUtils.setRenderingHints( (Graphics2D) g );
|
||||
oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
||||
|
||||
/*debug
|
||||
g.setColor( Color.gray );
|
||||
@@ -209,6 +218,16 @@ public class FlatRangeSliderUI
|
||||
debug*/
|
||||
|
||||
super.paint( g, c );
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||
oldRenderingHints = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintLabels( Graphics g ) {
|
||||
FlatUIUtils.runWithoutRenderingHints( g, oldRenderingHints, () -> {
|
||||
super.paintLabels( g );
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -288,4 +307,64 @@ debug*/
|
||||
protected boolean isRoundThumb() {
|
||||
return !slider.getPaintTicks() && !slider.getPaintLabels();
|
||||
}
|
||||
|
||||
//---- class FlatRangeTrackListener ---------------------------------------
|
||||
|
||||
protected class FlatRangeTrackListener
|
||||
extends RangeTrackListener
|
||||
{
|
||||
public FlatRangeTrackListener( TrackListener listener ) {
|
||||
super( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed( MouseEvent e ) {
|
||||
if( !slider.isEnabled() )
|
||||
return;
|
||||
|
||||
// use "old" behavior when clicking on track
|
||||
if( UIManager.getBoolean( "Slider.scrollOnTrackClick" ) ) {
|
||||
super.mousePressed( e );
|
||||
return;
|
||||
}
|
||||
|
||||
// "new" behavior set thumb to mouse location when clicking on track
|
||||
|
||||
int x = e.getX();
|
||||
int y = e.getY();
|
||||
int handle = getMouseHandle( x, y );
|
||||
|
||||
// clicked on thumb --> let super class do the work
|
||||
if( handle != MOUSE_HANDLE_LOWER && handle != MOUSE_HANDLE_UPPER ) {
|
||||
super.mousePressed( e );
|
||||
return;
|
||||
}
|
||||
|
||||
if( UIManager.getBoolean( "Slider.onlyLeftMouseButtonDrag" ) &&
|
||||
!SwingUtilities.isLeftMouseButton( e ) )
|
||||
return;
|
||||
|
||||
// get low or high thumb rectangle
|
||||
Rectangle thumbRect = FlatRangeSliderUI.this.thumbRect;
|
||||
if( handle == MOUSE_HANDLE_UPPER ) {
|
||||
Point p = adjustThumbForHighValue();
|
||||
thumbRect = new Rectangle( FlatRangeSliderUI.this.thumbRect );
|
||||
restoreThumbForLowValue( p );
|
||||
}
|
||||
|
||||
// move the mouse event coordinates to the center of the thumb
|
||||
int tx = thumbRect.x + (thumbRect.width / 2) - x;
|
||||
int ty = thumbRect.y + (thumbRect.height / 2) - y;
|
||||
e.translatePoint( tx, ty );
|
||||
|
||||
// invoke super mousePressed() to start dragging thumb
|
||||
super.mousePressed( e );
|
||||
|
||||
// move the mouse event coordinates back to current mouse location
|
||||
e.translatePoint( -tx, -ty );
|
||||
|
||||
// invoke mouseDragged() to update thumb location
|
||||
mouseDragged( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,3 @@ build script:
|
||||
Otherwise download `flatlaf-swingx-<version>.jar` here:
|
||||
|
||||
[](https://bintray.com/jformdesigner/flatlaf/flatlaf-swingx/_latestVersion)
|
||||
|
||||
You also need `flatlaf-<version>.jar`, which you can download here:
|
||||
|
||||
[](https://bintray.com/jformdesigner/flatlaf/flatlaf/_latestVersion)
|
||||
|
||||
@@ -218,7 +218,7 @@ public class FlatDatePickerUI
|
||||
FlatUIUtils.paintParentBackground( g, c );
|
||||
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g2 );
|
||||
|
||||
int width = c.getWidth();
|
||||
int height = c.getHeight();
|
||||
@@ -252,6 +252,8 @@ public class FlatDatePickerUI
|
||||
g2.fill( new Rectangle2D.Float( lx, focusWidth, lw, height - 1 - (focusWidth * 2) ) );
|
||||
|
||||
paint( g, c );
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g2, oldRenderingHints );
|
||||
}
|
||||
|
||||
//---- class DefaultEditor ------------------------------------------------
|
||||
|
||||
@@ -60,13 +60,6 @@ public class FlatHyperlinkUI
|
||||
disabledText = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint( Graphics g, JComponent c ) {
|
||||
FlatUIUtils.setRenderingHints( (Graphics2D) g );
|
||||
|
||||
super.paint( g, c );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintText( Graphics g, AbstractButton b, Rectangle textRect, String text ) {
|
||||
FlatButtonUI.paintText( g, b, textRect, text, b.isEnabled() ? b.getForeground() : disabledText );
|
||||
@@ -78,8 +71,12 @@ public class FlatHyperlinkUI
|
||||
private void paintUnderline( Graphics g, Rectangle rect ) {
|
||||
int descent = g.getFontMetrics().getDescent();
|
||||
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
||||
|
||||
((Graphics2D)g).fill( new Rectangle2D.Float(
|
||||
rect.x, (rect.y + rect.height) - descent + UIScale.scale( 1f ),
|
||||
rect.width, UIScale.scale( 1f ) ) );
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ public class FlatTaskPaneUI
|
||||
if( color == null )
|
||||
return;
|
||||
|
||||
FlatUIUtils.setRenderingHints( (Graphics2D) g );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
||||
|
||||
g.setColor( color );
|
||||
|
||||
@@ -155,6 +155,8 @@ public class FlatTaskPaneUI
|
||||
path.append( new Rectangle2D.Float( x, y, width, height ), false );
|
||||
path.append( new Rectangle2D.Float( x + lineWidth, y, width - (lineWidth * 2), height - lineWidth ), false );
|
||||
((Graphics2D)g).fill( path );
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -179,9 +181,11 @@ public class FlatTaskPaneUI
|
||||
{
|
||||
@Override
|
||||
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
|
||||
FlatUIUtils.setRenderingHints( (Graphics2D) g );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
||||
|
||||
super.paintBorder( c, g, x, y, width, height );
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,11 @@ JXHeader.background=@background
|
||||
JXHeader.startBackground=#4c5052
|
||||
|
||||
|
||||
#---- HighlighterFactory ----
|
||||
|
||||
UIColorHighlighter.stripingBackground=lighten(@textComponentBackground,5%)
|
||||
|
||||
|
||||
#---- Hyperlink ----
|
||||
|
||||
Hyperlink.linkColor=#589df6
|
||||
|
||||
@@ -26,6 +26,11 @@ JXHeader.background=@background
|
||||
JXHeader.startBackground=#fff
|
||||
|
||||
|
||||
#---- HighlighterFactory ----
|
||||
|
||||
UIColorHighlighter.stripingBackground=darken(@textComponentBackground,5%)
|
||||
|
||||
|
||||
#---- Hyperlink ----
|
||||
|
||||
Hyperlink.linkColor=$Component.linkColor
|
||||
|
||||
@@ -995,7 +995,7 @@ Table.focusCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.F
|
||||
Table.focusSelectedCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Selected [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
|
||||
Table.font [active] $defaultFont [UI]
|
||||
Table.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
|
||||
Table.gridColor #4c5152 javax.swing.plaf.ColorUIResource [UI]
|
||||
Table.gridColor #515657 javax.swing.plaf.ColorUIResource [UI]
|
||||
Table.intercellSpacing 0,0 javax.swing.plaf.DimensionUIResource [UI]
|
||||
Table.rowHeight 20
|
||||
Table.scrollPaneBorder [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatBorder [UI]
|
||||
@@ -1273,6 +1273,21 @@ Tree.wideSelection true
|
||||
TreeUI com.formdev.flatlaf.ui.FlatTreeUI
|
||||
|
||||
|
||||
#---- TristateCheckBox ----
|
||||
|
||||
TristateCheckBox.clearMixed.clientProperty length=2 [Ljava.lang.Object;
|
||||
[0] JButton.selectedState
|
||||
[1] null
|
||||
TristateCheckBox.setMixed.clientProperty length=2 [Ljava.lang.Object;
|
||||
[0] JButton.selectedState
|
||||
[1] indeterminate
|
||||
|
||||
|
||||
#---- UIColorHighlighter ----
|
||||
|
||||
UIColorHighlighter.stripingBackground #515657 javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
|
||||
#---- Viewport ----
|
||||
|
||||
Viewport.background #3c3f41 javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
@@ -1000,7 +1000,7 @@ Table.focusCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.F
|
||||
Table.focusSelectedCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Selected [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
|
||||
Table.font [active] $defaultFont [UI]
|
||||
Table.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
|
||||
Table.gridColor #f7f7f7 javax.swing.plaf.ColorUIResource [UI]
|
||||
Table.gridColor #f2f2f2 javax.swing.plaf.ColorUIResource [UI]
|
||||
Table.intercellSpacing 0,0 javax.swing.plaf.DimensionUIResource [UI]
|
||||
Table.rowHeight 20
|
||||
Table.scrollPaneBorder [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatBorder [UI]
|
||||
@@ -1278,6 +1278,21 @@ Tree.wideSelection true
|
||||
TreeUI com.formdev.flatlaf.ui.FlatTreeUI
|
||||
|
||||
|
||||
#---- TristateCheckBox ----
|
||||
|
||||
TristateCheckBox.clearMixed.clientProperty length=2 [Ljava.lang.Object;
|
||||
[0] JButton.selectedState
|
||||
[1] null
|
||||
TristateCheckBox.setMixed.clientProperty length=2 [Ljava.lang.Object;
|
||||
[0] JButton.selectedState
|
||||
[1] indeterminate
|
||||
|
||||
|
||||
#---- UIColorHighlighter ----
|
||||
|
||||
UIColorHighlighter.stripingBackground #f2f2f2 javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
|
||||
#---- Viewport ----
|
||||
|
||||
Viewport.background #f2f2f2 javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
@@ -1274,6 +1274,16 @@ Tree.wideSelection true
|
||||
TreeUI com.formdev.flatlaf.ui.FlatTreeUI
|
||||
|
||||
|
||||
#---- TristateCheckBox ----
|
||||
|
||||
TristateCheckBox.clearMixed.clientProperty length=2 [Ljava.lang.Object;
|
||||
[0] JButton.selectedState
|
||||
[1] null
|
||||
TristateCheckBox.setMixed.clientProperty length=2 [Ljava.lang.Object;
|
||||
[0] JButton.selectedState
|
||||
[1] indeterminate
|
||||
|
||||
|
||||
#---- Viewport ----
|
||||
|
||||
Viewport.background #ccffcc javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.testing;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import javax.swing.*;
|
||||
import com.formdev.flatlaf.icons.FlatAnimatedIcon;
|
||||
import com.formdev.flatlaf.util.AnimatedIcon;
|
||||
import com.formdev.flatlaf.util.ColorFunctions;
|
||||
import net.miginfocom.swing.*;
|
||||
|
||||
/**
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatAnimatedIconTest
|
||||
extends FlatTestPanel
|
||||
{
|
||||
public static void main( String[] args ) {
|
||||
SwingUtilities.invokeLater( () -> {
|
||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatAnimatedIconTest" );
|
||||
frame.showFrame( FlatAnimatedIconTest::new );
|
||||
} );
|
||||
}
|
||||
|
||||
FlatAnimatedIconTest() {
|
||||
initComponents();
|
||||
|
||||
AnimatedRadioButtonIcon radioIcon = new AnimatedRadioButtonIcon();
|
||||
radioButton1.setIcon( radioIcon );
|
||||
radioButton2.setIcon( radioIcon );
|
||||
radioButton3.setIcon( radioIcon );
|
||||
|
||||
checkBox1.setIcon( new AnimatedSwitchIcon() );
|
||||
checkBox2.setIcon( new AnimatedMinimalTestIcon() );
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||
radioButton1 = new JRadioButton();
|
||||
radioButton2 = new JRadioButton();
|
||||
radioButton3 = new JRadioButton();
|
||||
checkBox1 = new JCheckBox();
|
||||
checkBox2 = new JCheckBox();
|
||||
durationLabel = new JLabel();
|
||||
durationField = new JSpinner();
|
||||
|
||||
//======== this ========
|
||||
setLayout(new MigLayout(
|
||||
"insets dialog,hidemode 3",
|
||||
// columns
|
||||
"[]para" +
|
||||
"[fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]para" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[grow]" +
|
||||
"[]"));
|
||||
|
||||
//---- radioButton1 ----
|
||||
radioButton1.setText("radio 1");
|
||||
radioButton1.setSelected(true);
|
||||
add(radioButton1, "cell 0 0");
|
||||
|
||||
//---- radioButton2 ----
|
||||
radioButton2.setText("radio 2");
|
||||
add(radioButton2, "cell 0 1");
|
||||
|
||||
//---- radioButton3 ----
|
||||
radioButton3.setText("radio 3");
|
||||
add(radioButton3, "cell 0 2");
|
||||
|
||||
//---- checkBox1 ----
|
||||
checkBox1.setText("switch");
|
||||
add(checkBox1, "cell 0 3");
|
||||
|
||||
//---- checkBox2 ----
|
||||
checkBox2.setText("minimal");
|
||||
add(checkBox2, "cell 0 4");
|
||||
|
||||
//---- durationLabel ----
|
||||
durationLabel.setText("Duration:");
|
||||
add(durationLabel, "cell 0 6 2 1");
|
||||
|
||||
//---- durationField ----
|
||||
durationField.setModel(new SpinnerNumberModel(200, 100, null, 50));
|
||||
add(durationField, "cell 0 6 2 1");
|
||||
|
||||
//---- buttonGroup1 ----
|
||||
ButtonGroup buttonGroup1 = new ButtonGroup();
|
||||
buttonGroup1.add(radioButton1);
|
||||
buttonGroup1.add(radioButton2);
|
||||
buttonGroup1.add(radioButton3);
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
}
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
private JRadioButton radioButton1;
|
||||
private JRadioButton radioButton2;
|
||||
private JRadioButton radioButton3;
|
||||
private JCheckBox checkBox1;
|
||||
private JCheckBox checkBox2;
|
||||
private JLabel durationLabel;
|
||||
private JSpinner durationField;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
|
||||
//---- class AnimatedRadioButtonIcon --------------------------------------
|
||||
|
||||
/**
|
||||
* Experimental radio button icon that:
|
||||
* - fades icon color from off to on color
|
||||
* - animates size of center dot from zero to full size
|
||||
*/
|
||||
private class AnimatedRadioButtonIcon
|
||||
extends FlatAnimatedIcon
|
||||
{
|
||||
private static final int SIZE = 16;
|
||||
private static final int BORDER_SIZE = 2;
|
||||
private static final int DOT_SIZE = 8;
|
||||
|
||||
private final Color offColor = Color.lightGray;
|
||||
private final Color onColor = Color.red;
|
||||
|
||||
public AnimatedRadioButtonIcon() {
|
||||
super( SIZE, SIZE, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIconAnimated( Component c, Graphics g, int x, int y, float animatedValue ) {
|
||||
Color color = ColorFunctions.mix( onColor, offColor, animatedValue );;
|
||||
|
||||
// border
|
||||
g.setColor( color );
|
||||
g.fillOval( 0, 0, SIZE, SIZE );
|
||||
|
||||
// background
|
||||
g.setColor( c.getBackground() );
|
||||
int bwh = SIZE - (BORDER_SIZE * 2);
|
||||
g.fillOval( BORDER_SIZE, BORDER_SIZE, bwh, bwh );
|
||||
|
||||
// dot
|
||||
float dotDiameter = DOT_SIZE * animatedValue;
|
||||
float xy = (SIZE - dotDiameter) / 2f;
|
||||
g.setColor( color );
|
||||
((Graphics2D)g).fill( new Ellipse2D.Float( xy, xy, dotDiameter, dotDiameter ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getValue( Component c ) {
|
||||
return ((JRadioButton)c).isSelected() ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnimationDuration() {
|
||||
return (Integer) durationField.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
//---- class AnimatedSwitchIcon -------------------------------------------
|
||||
|
||||
public class AnimatedSwitchIcon
|
||||
extends FlatAnimatedIcon
|
||||
{
|
||||
private final Color offColor = Color.lightGray;
|
||||
private final Color onColor = Color.red;
|
||||
|
||||
public AnimatedSwitchIcon() {
|
||||
super( 28, 16, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIconAnimated( Component c, Graphics g, int x, int y, float animatedValue ) {
|
||||
Color color = ColorFunctions.mix( onColor, offColor, animatedValue );;
|
||||
|
||||
g.setColor( color );
|
||||
g.fillRoundRect( x, y, width, height, height, height );
|
||||
|
||||
int thumbSize = height - 4;
|
||||
int thumbX = x + 2 + Math.round( (width - 4 - thumbSize) * animatedValue );
|
||||
int thumbY = y + 2;
|
||||
g.setColor( Color.white );
|
||||
g.fillOval( thumbX, thumbY, thumbSize, thumbSize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getValue( Component c ) {
|
||||
return ((AbstractButton)c).isSelected() ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnimationDuration() {
|
||||
return (Integer) durationField.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
//---- class AnimatedMinimalTestIcon --------------------------------------
|
||||
|
||||
/**
|
||||
* Minimal example for an animated icon.
|
||||
*/
|
||||
private class AnimatedMinimalTestIcon
|
||||
implements AnimatedIcon
|
||||
{
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIconAnimated( Component c, Graphics g, int x, int y, float animatedValue ) {
|
||||
int w = getIconWidth();
|
||||
int h = getIconHeight();
|
||||
|
||||
g.setColor( Color.red );
|
||||
g.drawRect( x, y, w - 1, h - 1 );
|
||||
g.fillRect( x, y, Math.round( w * animatedValue ), h );
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getValue( Component c ) {
|
||||
return ((AbstractButton)c).isSelected() ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnimationDuration() {
|
||||
return (Integer) durationField.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
JFDML JFormDesigner: "7.0.2.0.298" Java: "15" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
root: new FormRoot {
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets dialog,hidemode 3"
|
||||
"$columnConstraints": "[]para[fill]"
|
||||
"$rowConstraints": "[][][]para[][][grow][]"
|
||||
} ) {
|
||||
name: "this"
|
||||
add( new FormComponent( "javax.swing.JRadioButton" ) {
|
||||
name: "radioButton1"
|
||||
"text": "radio 1"
|
||||
"$buttonGroup": new FormReference( "buttonGroup1" )
|
||||
"selected": true
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JRadioButton" ) {
|
||||
name: "radioButton2"
|
||||
"text": "radio 2"
|
||||
"$buttonGroup": new FormReference( "buttonGroup1" )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JRadioButton" ) {
|
||||
name: "radioButton3"
|
||||
"text": "radio 3"
|
||||
"$buttonGroup": new FormReference( "buttonGroup1" )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "checkBox1"
|
||||
"text": "switch"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "checkBox2"
|
||||
"text": "minimal"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "durationLabel"
|
||||
"text": "Duration:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 6 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||
name: "durationField"
|
||||
"model": new javax.swing.SpinnerNumberModel {
|
||||
minimum: 100
|
||||
stepSize: 50
|
||||
value: 200
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 6 2 1"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 415, 350 )
|
||||
} )
|
||||
add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
|
||||
name: "buttonGroup1"
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 360 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
@@ -17,22 +17,37 @@
|
||||
package com.formdev.flatlaf.testing;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.ComponentOrientation;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.TableModelEvent;
|
||||
import javax.swing.event.TableModelListener;
|
||||
import javax.swing.table.*;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
import com.formdev.flatlaf.icons.FlatMenuArrowIcon;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
import net.miginfocom.swing.*;
|
||||
import org.jdesktop.swingx.JXTable;
|
||||
import org.jdesktop.swingx.JXTreeTable;
|
||||
import org.jdesktop.swingx.decorator.ColorHighlighter;
|
||||
import org.jdesktop.swingx.decorator.HighlightPredicate;
|
||||
import org.jdesktop.swingx.decorator.Highlighter;
|
||||
import org.jdesktop.swingx.decorator.HighlighterFactory;
|
||||
import org.jdesktop.swingx.decorator.PatternPredicate;
|
||||
import org.jdesktop.swingx.decorator.ShadingColorHighlighter;
|
||||
import org.jdesktop.swingx.treetable.FileSystemModel;
|
||||
|
||||
/**
|
||||
* @author Karl Tauber
|
||||
@@ -43,6 +58,7 @@ public class FlatComponents2Test
|
||||
public static void main( String[] args ) {
|
||||
SwingUtilities.invokeLater( () -> {
|
||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatComponents2Test" );
|
||||
frame.useApplyComponentOrientation = true;
|
||||
frame.showFrame( FlatComponents2Test::new );
|
||||
} );
|
||||
}
|
||||
@@ -50,6 +66,9 @@ public class FlatComponents2Test
|
||||
private final TestListModel listModel;
|
||||
private final TestTreeModel treeModel;
|
||||
private final TestTableModel tableModel;
|
||||
private final List<JTable> allTables = new ArrayList<>();
|
||||
private final List<JTable> allTablesInclRowHeader = new ArrayList<>();
|
||||
private JTable rowHeaderTable1;
|
||||
|
||||
FlatComponents2Test() {
|
||||
initComponents();
|
||||
@@ -67,9 +86,35 @@ public class FlatComponents2Test
|
||||
// table model
|
||||
tableModel = new TestTableModel( (Integer) tableRowCountSpinner.getValue() );
|
||||
table1.setModel( tableModel );
|
||||
xTable1.setModel( tableModel );
|
||||
|
||||
// table column editors
|
||||
TableColumnModel cm = table1.getColumnModel();
|
||||
initTableEditors( table1 );
|
||||
initTableEditors( xTable1 );
|
||||
|
||||
// JXTable
|
||||
Highlighter simpleStriping = HighlighterFactory.createSimpleStriping();
|
||||
PatternPredicate patternPredicate = new PatternPredicate( "^J", 2 );
|
||||
ColorHighlighter magenta = new ColorHighlighter( patternPredicate, null, Color.MAGENTA, null, Color.MAGENTA );
|
||||
ColorHighlighter rollover = new ColorHighlighter( HighlightPredicate.ROLLOVER_ROW, Color.cyan, null );
|
||||
Highlighter shading = new ShadingColorHighlighter( new HighlightPredicate.ColumnHighlightPredicate( 1 ) );
|
||||
xTable1.setHighlighters( simpleStriping, magenta, rollover, shading );
|
||||
|
||||
// JXTreeTable
|
||||
xTreeTable1.setTreeTableModel( new FileSystemModel( new File( "." ) ) );
|
||||
xTreeTable1.setHighlighters( simpleStriping, magenta, rollover, shading );
|
||||
|
||||
allTables.add( table1 );
|
||||
allTables.add( xTable1 );
|
||||
allTables.add( xTreeTable1 );
|
||||
allTablesInclRowHeader.addAll( allTables );
|
||||
|
||||
expandTree( tree1 );
|
||||
expandTree( tree2 );
|
||||
}
|
||||
|
||||
private void initTableEditors( JTable table ) {
|
||||
TableColumnModel cm = table.getColumnModel();
|
||||
String[] months = new String[] {
|
||||
"January", "February", "March", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November", "December"
|
||||
@@ -78,9 +123,6 @@ public class FlatComponents2Test
|
||||
JComboBox<String> editableComboBox = new JComboBox<>( months );
|
||||
editableComboBox.setEditable( true );
|
||||
cm.getColumn(3).setCellEditor( new DefaultCellEditor( editableComboBox ) );
|
||||
|
||||
expandTree( tree1 );
|
||||
expandTree( tree2 );
|
||||
}
|
||||
|
||||
private void expandTree( JTree tree ) {
|
||||
@@ -133,7 +175,8 @@ public class FlatComponents2Test
|
||||
case "allColumns": autoResizeMode = JTable.AUTO_RESIZE_ALL_COLUMNS; break;
|
||||
}
|
||||
}
|
||||
table1.setAutoResizeMode( autoResizeMode );
|
||||
for( JTable table : allTables )
|
||||
table.setAutoResizeMode( autoResizeMode );
|
||||
}
|
||||
|
||||
private void dndChanged() {
|
||||
@@ -143,11 +186,15 @@ public class FlatComponents2Test
|
||||
tree1.setDragEnabled( dnd );
|
||||
tree2.setDragEnabled( dnd );
|
||||
table1.setDragEnabled( dnd );
|
||||
xTable1.setDragEnabled( dnd );
|
||||
xTreeTable1.setDragEnabled( dnd );
|
||||
|
||||
DropMode dropMode = dnd ? DropMode.ON_OR_INSERT : DropMode.USE_SELECTION;
|
||||
list1.setDropMode( dropMode );
|
||||
tree1.setDropMode( dropMode );
|
||||
table1.setDropMode( dropMode );
|
||||
xTable1.setDropMode( dropMode );
|
||||
xTreeTable1.setDropMode( dropMode );
|
||||
|
||||
String key = "FlatLaf.oldTransferHandler";
|
||||
if( dnd ) {
|
||||
@@ -158,48 +205,114 @@ public class FlatComponents2Test
|
||||
tree1.setTransferHandler( new DummyTransferHandler() );
|
||||
|
||||
table1.putClientProperty( key, table1.getTransferHandler() );
|
||||
xTable1.putClientProperty( key, xTable1.getTransferHandler() );
|
||||
xTreeTable1.putClientProperty( key, xTreeTable1.getTransferHandler() );
|
||||
table1.setTransferHandler( new DummyTransferHandler() );
|
||||
xTable1.setTransferHandler( new DummyTransferHandler() );
|
||||
xTreeTable1.setTransferHandler( new DummyTransferHandler() );
|
||||
} else {
|
||||
list1.setTransferHandler( (TransferHandler) list1.getClientProperty( key ) );
|
||||
tree1.setTransferHandler( (TransferHandler) tree1.getClientProperty( key ) );
|
||||
table1.setTransferHandler( (TransferHandler) table1.getClientProperty( key ) );
|
||||
xTable1.setTransferHandler( (TransferHandler) xTable1.getClientProperty( key ) );
|
||||
xTreeTable1.setTransferHandler( (TransferHandler) xTreeTable1.getClientProperty( key ) );
|
||||
}
|
||||
}
|
||||
|
||||
private void tableHeaderButtonChanged() {
|
||||
tableHeaderButtonChanged( table1ScrollPane );
|
||||
tableHeaderButtonChanged( xTable1ScrollPane );
|
||||
tableHeaderButtonChanged( xTreeTable1ScrollPane );
|
||||
}
|
||||
|
||||
private void tableHeaderButtonChanged( JScrollPane scrollPane ) {
|
||||
boolean show = tableHeaderButtonCheckBox.isSelected();
|
||||
JButton button = null;
|
||||
if( show ) {
|
||||
button = new JButton( new FlatMenuArrowIcon() );
|
||||
button.applyComponentOrientation( getComponentOrientation() );
|
||||
button.addActionListener( e -> {
|
||||
JOptionPane.showMessageDialog( this, "hello" );
|
||||
} );
|
||||
}
|
||||
scrollPane5.setCorner( JScrollPane.UPPER_TRAILING_CORNER, button );
|
||||
scrollPane.setCorner( JScrollPane.UPPER_TRAILING_CORNER, button );
|
||||
}
|
||||
|
||||
private void rowSelectionChanged() {
|
||||
table1.setRowSelectionAllowed( rowSelectionCheckBox.isSelected() );
|
||||
for( JTable table : allTables )
|
||||
table.setRowSelectionAllowed( rowSelectionCheckBox.isSelected() );
|
||||
}
|
||||
|
||||
private void columnSelectionChanged() {
|
||||
table1.setColumnSelectionAllowed( columnSelectionCheckBox.isSelected() );
|
||||
for( JTable table : allTables )
|
||||
table.setColumnSelectionAllowed( columnSelectionCheckBox.isSelected() );
|
||||
}
|
||||
|
||||
private void showHorizontalLinesChanged() {
|
||||
table1.setShowHorizontalLines( showHorizontalLinesCheckBox.isSelected() );
|
||||
for( JTable table : allTablesInclRowHeader )
|
||||
table.setShowHorizontalLines( showHorizontalLinesCheckBox.isSelected() );
|
||||
}
|
||||
|
||||
private void showVerticalLinesChanged() {
|
||||
table1.setShowVerticalLines( showVerticalLinesCheckBox.isSelected() );
|
||||
for( JTable table : allTablesInclRowHeader )
|
||||
table.setShowVerticalLines( showVerticalLinesCheckBox.isSelected() );
|
||||
}
|
||||
|
||||
private void intercellSpacingChanged() {
|
||||
table1.setIntercellSpacing( intercellSpacingCheckBox.isSelected() ? new Dimension( 1, 1 ) : new Dimension() );
|
||||
for( JTable table : allTablesInclRowHeader )
|
||||
table.setIntercellSpacing( intercellSpacingCheckBox.isSelected() ? new Dimension( 1, 1 ) : new Dimension() );
|
||||
}
|
||||
|
||||
private void redGridColorChanged() {
|
||||
table1.setGridColor( redGridColorCheckBox.isSelected() ? Color.red : UIManager.getColor( "Table.gridColor" ) );
|
||||
for( JTable table : allTablesInclRowHeader )
|
||||
table.setGridColor( redGridColorCheckBox.isSelected() ? Color.red : UIManager.getColor( "Table.gridColor" ) );
|
||||
}
|
||||
|
||||
private void rowHeaderChanged() {
|
||||
if( rowHeaderCheckBox.isSelected() ) {
|
||||
TestTableRowHeaderModel rowHeaderModel = new TestTableRowHeaderModel( tableModel );
|
||||
rowHeaderTable1 = new JTable( rowHeaderModel );
|
||||
rowHeaderTable1.setPreferredScrollableViewportSize( UIScale.scale( new Dimension( 50, 50 ) ) );
|
||||
rowHeaderTable1.setSelectionModel( table1.getSelectionModel() );
|
||||
|
||||
DefaultTableCellRenderer rowHeaderRenderer = new DefaultTableCellRenderer();
|
||||
rowHeaderRenderer.setHorizontalAlignment( JLabel.CENTER );
|
||||
rowHeaderTable1.setDefaultRenderer( Object.class, rowHeaderRenderer );
|
||||
table1ScrollPane.setRowHeaderView( rowHeaderTable1 );
|
||||
|
||||
JViewport headerViewport = new JViewport();
|
||||
headerViewport.setView( rowHeaderTable1.getTableHeader() );
|
||||
table1ScrollPane.setCorner( ScrollPaneConstants.UPPER_LEADING_CORNER, headerViewport );
|
||||
|
||||
table1ScrollPane.applyComponentOrientation( getComponentOrientation() );
|
||||
|
||||
allTablesInclRowHeader.add( rowHeaderTable1 );
|
||||
|
||||
showHorizontalLinesChanged();
|
||||
showVerticalLinesChanged();
|
||||
intercellSpacingChanged();
|
||||
redGridColorChanged();
|
||||
} else {
|
||||
table1ScrollPane.setRowHeader( null );
|
||||
table1ScrollPane.setCorner( ScrollPaneConstants.UPPER_LEADING_CORNER, null );
|
||||
allTablesInclRowHeader.remove( rowHeaderTable1 );
|
||||
|
||||
((TestTableRowHeaderModel)rowHeaderTable1.getModel()).dispose();
|
||||
rowHeaderTable1 = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyComponentOrientation( ComponentOrientation o ) {
|
||||
super.applyComponentOrientation( o );
|
||||
|
||||
// swap upper right and left corners (other corners are not used in this app)
|
||||
Component leftCorner = table1ScrollPane.getCorner( ScrollPaneConstants.UPPER_LEFT_CORNER );
|
||||
Component rightCorner = table1ScrollPane.getCorner( ScrollPaneConstants.UPPER_RIGHT_CORNER );
|
||||
table1ScrollPane.setCorner( ScrollPaneConstants.UPPER_LEFT_CORNER, null );
|
||||
table1ScrollPane.setCorner( ScrollPaneConstants.UPPER_RIGHT_CORNER, null );
|
||||
table1ScrollPane.setCorner( ScrollPaneConstants.UPPER_LEFT_CORNER, rightCorner );
|
||||
table1ScrollPane.setCorner( ScrollPaneConstants.UPPER_RIGHT_CORNER, leftCorner );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -218,31 +331,35 @@ public class FlatComponents2Test
|
||||
JLabel textFieldLabel = new JLabel();
|
||||
JTextField textField1 = new JTextField();
|
||||
JTextField textField2 = new JTextField();
|
||||
JTextField textField3 = new JTextField();
|
||||
JTextField textField4 = new JTextField();
|
||||
JPanel panel1 = new JPanel();
|
||||
JLabel listLabel = new JLabel();
|
||||
JLabel listRowCountLabel = new JLabel();
|
||||
listRowCountSpinner = new JSpinner();
|
||||
JScrollPane scrollPane1 = new JScrollPane();
|
||||
list1 = new JList<>();
|
||||
JScrollPane scrollPane2 = new JScrollPane();
|
||||
list2 = new JList<>();
|
||||
JPanel listOptionsPanel = new JPanel();
|
||||
JLabel listRowCountLabel = new JLabel();
|
||||
listRowCountSpinner = new JSpinner();
|
||||
JPanel panel2 = new JPanel();
|
||||
JLabel treeLabel = new JLabel();
|
||||
JLabel treeRowCountLabel = new JLabel();
|
||||
treeRowCountSpinner = new JSpinner();
|
||||
JScrollPane scrollPane3 = new JScrollPane();
|
||||
tree1 = new JTree();
|
||||
JScrollPane scrollPane4 = new JScrollPane();
|
||||
tree2 = new JTree();
|
||||
JPanel treeOptionsPanel = new JPanel();
|
||||
JLabel treeRowCountLabel = new JLabel();
|
||||
treeRowCountSpinner = new JSpinner();
|
||||
JPanel panel3 = new JPanel();
|
||||
JLabel tableLabel = new JLabel();
|
||||
scrollPane5 = new JScrollPane();
|
||||
table1 = new JTable();
|
||||
JPanel tableOptionsPanel = new JPanel();
|
||||
JLabel tableRowCountLabel = new JLabel();
|
||||
tableRowCountSpinner = new JSpinner();
|
||||
table1ScrollPane = new JScrollPane();
|
||||
table1 = new JTable();
|
||||
JPanel tableOptionsPanel = new JPanel();
|
||||
JLabel autoResizeModeLabel = new JLabel();
|
||||
autoResizeModeField = new JComboBox<>();
|
||||
showHorizontalLinesCheckBox = new JCheckBox();
|
||||
rowHeaderCheckBox = new JCheckBox();
|
||||
showVerticalLinesCheckBox = new JCheckBox();
|
||||
intercellSpacingCheckBox = new JCheckBox();
|
||||
redGridColorCheckBox = new JCheckBox();
|
||||
@@ -250,15 +367,23 @@ public class FlatComponents2Test
|
||||
columnSelectionCheckBox = new JCheckBox();
|
||||
dndCheckBox = new JCheckBox();
|
||||
tableHeaderButtonCheckBox = new JCheckBox();
|
||||
JLabel label1 = new JLabel();
|
||||
xTable1ScrollPane = new JScrollPane();
|
||||
xTable1 = new JXTable();
|
||||
JLabel label2 = new JLabel();
|
||||
xTreeTable1ScrollPane = new JScrollPane();
|
||||
xTreeTable1 = new JXTreeTable();
|
||||
|
||||
//======== this ========
|
||||
setLayout(new MigLayout(
|
||||
"ltr,insets dialog,hidemode 3",
|
||||
// columns
|
||||
"[]" +
|
||||
"[200,fill]" +
|
||||
"[200,fill]" +
|
||||
"[fill]",
|
||||
"[200,grow,sizegroup 1,fill]" +
|
||||
"[200,grow,sizegroup 1,fill]" +
|
||||
"[fill]" +
|
||||
"[200,grow,sizegroup 1,fill]" +
|
||||
"[200,grow,sizegroup 1,fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[150,grow,sizegroup 1,fill]" +
|
||||
@@ -278,9 +403,41 @@ public class FlatComponents2Test
|
||||
textField2.setEnabled(false);
|
||||
add(textField2, "cell 2 0,growx");
|
||||
|
||||
//---- listLabel ----
|
||||
listLabel.setText("JList:");
|
||||
add(listLabel, "cell 0 1,aligny top,growy 0");
|
||||
//---- textField3 ----
|
||||
textField3.setText("editable");
|
||||
add(textField3, "cell 4 0,growx");
|
||||
|
||||
//---- textField4 ----
|
||||
textField4.setText("disabled");
|
||||
textField4.setEnabled(false);
|
||||
add(textField4, "cell 5 0,growx");
|
||||
|
||||
//======== panel1 ========
|
||||
{
|
||||
panel1.setLayout(new MigLayout(
|
||||
"ltr,insets 0,hidemode 3",
|
||||
// columns
|
||||
"[fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[grow]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- listLabel ----
|
||||
listLabel.setText("JList:");
|
||||
panel1.add(listLabel, "cell 0 0,aligny top,growy 0");
|
||||
|
||||
//---- listRowCountLabel ----
|
||||
listRowCountLabel.setText("Row count:");
|
||||
panel1.add(listRowCountLabel, "cell 0 2");
|
||||
|
||||
//---- listRowCountSpinner ----
|
||||
listRowCountSpinner.setModel(new SpinnerNumberModel(20, 0, null, 10));
|
||||
listRowCountSpinner.addChangeListener(e -> listRowCountChanged());
|
||||
panel1.add(listRowCountSpinner, "cell 0 3");
|
||||
}
|
||||
add(panel1, "cell 0 1");
|
||||
|
||||
//======== scrollPane1 ========
|
||||
{
|
||||
@@ -297,30 +454,32 @@ public class FlatComponents2Test
|
||||
}
|
||||
add(scrollPane2, "cell 2 1");
|
||||
|
||||
//======== listOptionsPanel ========
|
||||
//======== panel2 ========
|
||||
{
|
||||
listOptionsPanel.setLayout(new MigLayout(
|
||||
"hidemode 3",
|
||||
panel2.setLayout(new MigLayout(
|
||||
"insets 0,hidemode 3",
|
||||
// columns
|
||||
"[fill]" +
|
||||
"[90,fill]",
|
||||
"[fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[grow]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- listRowCountLabel ----
|
||||
listRowCountLabel.setText("Row count:");
|
||||
listOptionsPanel.add(listRowCountLabel, "cell 0 0");
|
||||
//---- treeLabel ----
|
||||
treeLabel.setText("JTree:");
|
||||
panel2.add(treeLabel, "cell 0 0,aligny top,growy 0");
|
||||
|
||||
//---- listRowCountSpinner ----
|
||||
listRowCountSpinner.setModel(new SpinnerNumberModel(20, 0, null, 10));
|
||||
listRowCountSpinner.addChangeListener(e -> listRowCountChanged());
|
||||
listOptionsPanel.add(listRowCountSpinner, "cell 1 0");
|
||||
//---- treeRowCountLabel ----
|
||||
treeRowCountLabel.setText("Row count:");
|
||||
panel2.add(treeRowCountLabel, "cell 0 2");
|
||||
|
||||
//---- treeRowCountSpinner ----
|
||||
treeRowCountSpinner.setModel(new SpinnerNumberModel(20, 20, null, 20));
|
||||
treeRowCountSpinner.addChangeListener(e -> treeRowCountChanged());
|
||||
panel2.add(treeRowCountSpinner, "cell 0 3");
|
||||
}
|
||||
add(listOptionsPanel, "cell 3 1");
|
||||
|
||||
//---- treeLabel ----
|
||||
treeLabel.setText("JTree:");
|
||||
add(treeLabel, "cell 0 2,aligny top,growy 0");
|
||||
add(panel2, "cell 3 1");
|
||||
|
||||
//======== scrollPane3 ========
|
||||
{
|
||||
@@ -330,7 +489,7 @@ public class FlatComponents2Test
|
||||
tree1.setEditable(true);
|
||||
scrollPane3.setViewportView(tree1);
|
||||
}
|
||||
add(scrollPane3, "cell 1 2");
|
||||
add(scrollPane3, "cell 4 1");
|
||||
|
||||
//======== scrollPane4 ========
|
||||
{
|
||||
@@ -339,41 +498,43 @@ public class FlatComponents2Test
|
||||
tree2.setEnabled(false);
|
||||
scrollPane4.setViewportView(tree2);
|
||||
}
|
||||
add(scrollPane4, "cell 2 2");
|
||||
add(scrollPane4, "cell 5 1");
|
||||
|
||||
//======== treeOptionsPanel ========
|
||||
//======== panel3 ========
|
||||
{
|
||||
treeOptionsPanel.setLayout(new MigLayout(
|
||||
"hidemode 3",
|
||||
panel3.setLayout(new MigLayout(
|
||||
"insets 0,hidemode 3",
|
||||
// columns
|
||||
"[fill]" +
|
||||
"[90,fill]",
|
||||
"[fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[grow]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- treeRowCountLabel ----
|
||||
treeRowCountLabel.setText("Row count:");
|
||||
treeOptionsPanel.add(treeRowCountLabel, "cell 0 0");
|
||||
//---- tableLabel ----
|
||||
tableLabel.setText("JTable:");
|
||||
panel3.add(tableLabel, "cell 0 0");
|
||||
|
||||
//---- treeRowCountSpinner ----
|
||||
treeRowCountSpinner.setModel(new SpinnerNumberModel(20, 20, null, 20));
|
||||
treeRowCountSpinner.addChangeListener(e -> treeRowCountChanged());
|
||||
treeOptionsPanel.add(treeRowCountSpinner, "cell 1 0");
|
||||
//---- tableRowCountLabel ----
|
||||
tableRowCountLabel.setText("Row count:");
|
||||
panel3.add(tableRowCountLabel, "cell 0 2");
|
||||
|
||||
//---- tableRowCountSpinner ----
|
||||
tableRowCountSpinner.setModel(new SpinnerNumberModel(20, 0, null, 5));
|
||||
tableRowCountSpinner.addChangeListener(e -> tableRowCountChanged());
|
||||
panel3.add(tableRowCountSpinner, "cell 0 3");
|
||||
}
|
||||
add(treeOptionsPanel, "cell 3 2");
|
||||
add(panel3, "cell 0 2");
|
||||
|
||||
//---- tableLabel ----
|
||||
tableLabel.setText("JTable:");
|
||||
add(tableLabel, "cell 0 3,aligny top,growy 0");
|
||||
|
||||
//======== scrollPane5 ========
|
||||
//======== table1ScrollPane ========
|
||||
{
|
||||
|
||||
//---- table1 ----
|
||||
table1.setAutoCreateRowSorter(true);
|
||||
scrollPane5.setViewportView(table1);
|
||||
table1ScrollPane.setViewportView(table1);
|
||||
}
|
||||
add(scrollPane5, "cell 1 3 2 1,width 300");
|
||||
add(table1ScrollPane, "cell 1 2 2 1,width 300");
|
||||
|
||||
//======== tableOptionsPanel ========
|
||||
{
|
||||
@@ -381,10 +542,9 @@ public class FlatComponents2Test
|
||||
"hidemode 3",
|
||||
// columns
|
||||
"[]" +
|
||||
"[90,fill]",
|
||||
"[]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]0" +
|
||||
"[]0" +
|
||||
"[]0" +
|
||||
@@ -394,18 +554,9 @@ public class FlatComponents2Test
|
||||
"[]0" +
|
||||
"[]"));
|
||||
|
||||
//---- tableRowCountLabel ----
|
||||
tableRowCountLabel.setText("Row count:");
|
||||
tableOptionsPanel.add(tableRowCountLabel, "cell 0 0");
|
||||
|
||||
//---- tableRowCountSpinner ----
|
||||
tableRowCountSpinner.setModel(new SpinnerNumberModel(20, 0, null, 10));
|
||||
tableRowCountSpinner.addChangeListener(e -> tableRowCountChanged());
|
||||
tableOptionsPanel.add(tableRowCountSpinner, "cell 1 0");
|
||||
|
||||
//---- autoResizeModeLabel ----
|
||||
autoResizeModeLabel.setText("Auto resize mode:");
|
||||
tableOptionsPanel.add(autoResizeModeLabel, "cell 0 1");
|
||||
tableOptionsPanel.add(autoResizeModeLabel, "cell 0 0");
|
||||
|
||||
//---- autoResizeModeField ----
|
||||
autoResizeModeField.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
@@ -417,66 +568,92 @@ public class FlatComponents2Test
|
||||
}));
|
||||
autoResizeModeField.setSelectedIndex(2);
|
||||
autoResizeModeField.addActionListener(e -> autoResizeModeChanged());
|
||||
tableOptionsPanel.add(autoResizeModeField, "cell 1 1");
|
||||
tableOptionsPanel.add(autoResizeModeField, "cell 1 0");
|
||||
|
||||
//---- showHorizontalLinesCheckBox ----
|
||||
showHorizontalLinesCheckBox.setText("show horizontal lines");
|
||||
showHorizontalLinesCheckBox.addActionListener(e -> showHorizontalLinesChanged());
|
||||
tableOptionsPanel.add(showHorizontalLinesCheckBox, "cell 0 2 2 1");
|
||||
tableOptionsPanel.add(showHorizontalLinesCheckBox, "cell 0 1");
|
||||
|
||||
//---- rowHeaderCheckBox ----
|
||||
rowHeaderCheckBox.setText("row header");
|
||||
rowHeaderCheckBox.addActionListener(e -> rowHeaderChanged());
|
||||
tableOptionsPanel.add(rowHeaderCheckBox, "cell 1 1");
|
||||
|
||||
//---- showVerticalLinesCheckBox ----
|
||||
showVerticalLinesCheckBox.setText("show vertical lines");
|
||||
showVerticalLinesCheckBox.addActionListener(e -> showVerticalLinesChanged());
|
||||
tableOptionsPanel.add(showVerticalLinesCheckBox, "cell 0 3 2 1");
|
||||
tableOptionsPanel.add(showVerticalLinesCheckBox, "cell 0 2");
|
||||
|
||||
//---- intercellSpacingCheckBox ----
|
||||
intercellSpacingCheckBox.setText("intercell spacing");
|
||||
intercellSpacingCheckBox.addActionListener(e -> intercellSpacingChanged());
|
||||
tableOptionsPanel.add(intercellSpacingCheckBox, "cell 0 4 2 1");
|
||||
tableOptionsPanel.add(intercellSpacingCheckBox, "cell 0 3");
|
||||
|
||||
//---- redGridColorCheckBox ----
|
||||
redGridColorCheckBox.setText("red grid color");
|
||||
redGridColorCheckBox.addActionListener(e -> redGridColorChanged());
|
||||
tableOptionsPanel.add(redGridColorCheckBox, "cell 0 5 2 1");
|
||||
tableOptionsPanel.add(redGridColorCheckBox, "cell 0 4");
|
||||
|
||||
//---- rowSelectionCheckBox ----
|
||||
rowSelectionCheckBox.setText("row selection");
|
||||
rowSelectionCheckBox.setSelected(true);
|
||||
rowSelectionCheckBox.addActionListener(e -> rowSelectionChanged());
|
||||
tableOptionsPanel.add(rowSelectionCheckBox, "cell 0 6 2 1");
|
||||
tableOptionsPanel.add(rowSelectionCheckBox, "cell 0 5");
|
||||
|
||||
//---- columnSelectionCheckBox ----
|
||||
columnSelectionCheckBox.setText("column selection");
|
||||
columnSelectionCheckBox.addActionListener(e -> columnSelectionChanged());
|
||||
tableOptionsPanel.add(columnSelectionCheckBox, "cell 0 7 2 1");
|
||||
tableOptionsPanel.add(columnSelectionCheckBox, "cell 0 6");
|
||||
|
||||
//---- dndCheckBox ----
|
||||
dndCheckBox.setText("enable drag and drop");
|
||||
dndCheckBox.setMnemonic('D');
|
||||
dndCheckBox.addActionListener(e -> dndChanged());
|
||||
tableOptionsPanel.add(dndCheckBox, "cell 0 8 2 1");
|
||||
tableOptionsPanel.add(dndCheckBox, "cell 0 7");
|
||||
|
||||
//---- tableHeaderButtonCheckBox ----
|
||||
tableHeaderButtonCheckBox.setText("show button in table header");
|
||||
tableHeaderButtonCheckBox.addActionListener(e -> tableHeaderButtonChanged());
|
||||
tableOptionsPanel.add(tableHeaderButtonCheckBox, "cell 0 9 2 1");
|
||||
tableOptionsPanel.add(tableHeaderButtonCheckBox, "cell 0 8 2 1");
|
||||
}
|
||||
add(tableOptionsPanel, "cell 3 3");
|
||||
add(tableOptionsPanel, "cell 4 2 2 1");
|
||||
|
||||
//---- label1 ----
|
||||
label1.setText("JXTable:");
|
||||
add(label1, "cell 0 3,aligny top,growy 0");
|
||||
|
||||
//======== xTable1ScrollPane ========
|
||||
{
|
||||
xTable1ScrollPane.setViewportView(xTable1);
|
||||
}
|
||||
add(xTable1ScrollPane, "cell 1 3 2 1");
|
||||
|
||||
//---- label2 ----
|
||||
label2.setText("JXTreeTable:");
|
||||
add(label2, "cell 3 3,aligny top,growy 0");
|
||||
|
||||
//======== xTreeTable1ScrollPane ========
|
||||
{
|
||||
xTreeTable1ScrollPane.setViewportView(xTreeTable1);
|
||||
}
|
||||
add(xTreeTable1ScrollPane, "cell 4 3 2 1");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
}
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
private JSpinner listRowCountSpinner;
|
||||
private JList<String> list1;
|
||||
private JList<String> list2;
|
||||
private JSpinner listRowCountSpinner;
|
||||
private JSpinner treeRowCountSpinner;
|
||||
private JTree tree1;
|
||||
private JTree tree2;
|
||||
private JSpinner treeRowCountSpinner;
|
||||
private JScrollPane scrollPane5;
|
||||
private JTable table1;
|
||||
private JSpinner tableRowCountSpinner;
|
||||
private JScrollPane table1ScrollPane;
|
||||
private JTable table1;
|
||||
private JComboBox<String> autoResizeModeField;
|
||||
private JCheckBox showHorizontalLinesCheckBox;
|
||||
private JCheckBox rowHeaderCheckBox;
|
||||
private JCheckBox showVerticalLinesCheckBox;
|
||||
private JCheckBox intercellSpacingCheckBox;
|
||||
private JCheckBox redGridColorCheckBox;
|
||||
@@ -484,6 +661,10 @@ public class FlatComponents2Test
|
||||
private JCheckBox columnSelectionCheckBox;
|
||||
private JCheckBox dndCheckBox;
|
||||
private JCheckBox tableHeaderButtonCheckBox;
|
||||
private JScrollPane xTable1ScrollPane;
|
||||
private JXTable xTable1;
|
||||
private JScrollPane xTreeTable1ScrollPane;
|
||||
private JXTreeTable xTreeTable1;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
|
||||
private final String[] randomRowStrings = new String[1000];
|
||||
@@ -770,4 +951,56 @@ public class FlatComponents2Test
|
||||
fireTableCellUpdated( rowIndex, columnIndex );
|
||||
}
|
||||
}
|
||||
|
||||
//---- TestTableRowHeaderModel --------------------------------------------
|
||||
|
||||
private class TestTableRowHeaderModel
|
||||
extends AbstractTableModel
|
||||
implements TableModelListener
|
||||
{
|
||||
private final TableModel model;
|
||||
|
||||
TestTableRowHeaderModel( TableModel model ) {
|
||||
this.model = model;
|
||||
|
||||
model.addTableModelListener( this );
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
model.removeTableModelListener( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return model.getRowCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName( int columnIndex ) {
|
||||
return "Row #";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt( int rowIndex, int columnIndex ) {
|
||||
return rowIndex + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tableChanged( TableModelEvent e ) {
|
||||
switch( e.getType() ) {
|
||||
case TableModelEvent.INSERT:
|
||||
fireTableRowsInserted( e.getFirstRow(), e.getLastRow() );
|
||||
break;
|
||||
|
||||
case TableModelEvent.DELETE:
|
||||
fireTableRowsDeleted( e.getFirstRow(), e.getLastRow() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.2.0.298" Java: "15" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.3.0.337" Java: "15" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -8,7 +8,7 @@ new FormModel {
|
||||
}
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
|
||||
"$columnConstraints": "[][200,fill][200,fill][fill]"
|
||||
"$columnConstraints": "[][200,grow,sizegroup 1,fill][200,grow,sizegroup 1,fill][fill][200,grow,sizegroup 1,fill][200,grow,sizegroup 1,fill]"
|
||||
"$rowConstraints": "[][150,grow,sizegroup 1,fill][150,grow,sizegroup 1,fill][150,grow,sizegroup 1,fill]"
|
||||
} ) {
|
||||
name: "this"
|
||||
@@ -31,11 +31,53 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 0,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "listLabel"
|
||||
"text": "JList:"
|
||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||
name: "textField3"
|
||||
"text": "editable"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1,aligny top,growy 0"
|
||||
"value": "cell 4 0,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||
name: "textField4"
|
||||
"text": "disabled"
|
||||
"enabled": false
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 0,growx"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$columnConstraints": "[fill]"
|
||||
"$rowConstraints": "[][grow][][]"
|
||||
"$layoutConstraints": "ltr,insets 0,hidemode 3"
|
||||
} ) {
|
||||
name: "panel1"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "listLabel"
|
||||
"text": "JList:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0,aligny top,growy 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "listRowCountLabel"
|
||||
"text": "Row count:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||
name: "listRowCountSpinner"
|
||||
"model": new javax.swing.SpinnerNumberModel {
|
||||
minimum: 0
|
||||
stepSize: 10
|
||||
value: 20
|
||||
}
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "listRowCountChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane1"
|
||||
@@ -63,76 +105,22 @@ new FormModel {
|
||||
"value": "cell 2 1"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "hidemode 3"
|
||||
"$columnConstraints": "[fill][90,fill]"
|
||||
"$rowConstraints": "[]"
|
||||
"$layoutConstraints": "insets 0,hidemode 3"
|
||||
"$columnConstraints": "[fill]"
|
||||
"$rowConstraints": "[][grow][][]"
|
||||
} ) {
|
||||
name: "listOptionsPanel"
|
||||
name: "panel2"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "listRowCountLabel"
|
||||
"text": "Row count:"
|
||||
name: "treeLabel"
|
||||
"text": "JTree:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
"value": "cell 0 0,aligny top,growy 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||
name: "listRowCountSpinner"
|
||||
"model": &SpinnerNumberModel0 new javax.swing.SpinnerNumberModel {
|
||||
minimum: 0
|
||||
stepSize: 10
|
||||
value: 20
|
||||
}
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "listRowCountChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "treeLabel"
|
||||
"text": "JTree:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2,aligny top,growy 0"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane3"
|
||||
add( new FormComponent( "javax.swing.JTree" ) {
|
||||
name: "tree1"
|
||||
"showsRootHandles": true
|
||||
"editable": true
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane4"
|
||||
add( new FormComponent( "javax.swing.JTree" ) {
|
||||
name: "tree2"
|
||||
"enabled": false
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 2"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "hidemode 3"
|
||||
"$columnConstraints": "[fill][90,fill]"
|
||||
"$rowConstraints": "[]"
|
||||
} ) {
|
||||
name: "treeOptionsPanel"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "treeRowCountLabel"
|
||||
"text": "Row count:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||
name: "treeRowCountSpinner"
|
||||
@@ -146,19 +134,73 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "treeRowCountChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0"
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "tableLabel"
|
||||
"text": "JTable:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3,aligny top,growy 0"
|
||||
"value": "cell 3 1"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane5"
|
||||
name: "scrollPane3"
|
||||
add( new FormComponent( "javax.swing.JTree" ) {
|
||||
name: "tree1"
|
||||
"showsRootHandles": true
|
||||
"editable": true
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 1"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane4"
|
||||
add( new FormComponent( "javax.swing.JTree" ) {
|
||||
name: "tree2"
|
||||
"enabled": false
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 1"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3"
|
||||
"$columnConstraints": "[fill]"
|
||||
"$rowConstraints": "[][grow][][]"
|
||||
} ) {
|
||||
name: "panel3"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "tableLabel"
|
||||
"text": "JTable:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "tableRowCountLabel"
|
||||
"text": "Row count:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||
name: "tableRowCountSpinner"
|
||||
"model": new javax.swing.SpinnerNumberModel {
|
||||
minimum: 0
|
||||
stepSize: 5
|
||||
value: 20
|
||||
}
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "tableRowCountChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "table1ScrollPane"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
@@ -170,35 +212,19 @@ new FormModel {
|
||||
}
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3 2 1,width 300"
|
||||
"value": "cell 1 2 2 1,width 300"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "hidemode 3"
|
||||
"$columnConstraints": "[][90,fill]"
|
||||
"$rowConstraints": "[][][]0[]0[]0[]0[]0[]0[]0[]"
|
||||
"$columnConstraints": "[][]"
|
||||
"$rowConstraints": "[][]0[]0[]0[]0[]0[]0[]0[]"
|
||||
} ) {
|
||||
name: "tableOptionsPanel"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "tableRowCountLabel"
|
||||
"text": "Row count:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||
name: "tableRowCountSpinner"
|
||||
"model": #SpinnerNumberModel0
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "tableRowCountChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "autoResizeModeLabel"
|
||||
"text": "Auto resize mode:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
name: "autoResizeModeField"
|
||||
@@ -217,7 +243,7 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "autoResizeModeChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1"
|
||||
"value": "cell 1 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "showHorizontalLinesCheckBox"
|
||||
@@ -227,7 +253,17 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showHorizontalLinesChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2 2 1"
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "rowHeaderCheckBox"
|
||||
"text": "row header"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "rowHeaderChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "showVerticalLinesCheckBox"
|
||||
@@ -237,7 +273,7 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showVerticalLinesChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3 2 1"
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "intercellSpacingCheckBox"
|
||||
@@ -247,7 +283,7 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "intercellSpacingChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4 2 1"
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "redGridColorCheckBox"
|
||||
@@ -257,7 +293,7 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "redGridColorChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 5 2 1"
|
||||
"value": "cell 0 4"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "rowSelectionCheckBox"
|
||||
@@ -268,7 +304,7 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "rowSelectionChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 6 2 1"
|
||||
"value": "cell 0 5"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "columnSelectionCheckBox"
|
||||
@@ -278,7 +314,7 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "columnSelectionChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 7 2 1"
|
||||
"value": "cell 0 6"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "dndCheckBox"
|
||||
@@ -289,7 +325,7 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "dndChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 8 2 1"
|
||||
"value": "cell 0 7"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "tableHeaderButtonCheckBox"
|
||||
@@ -299,10 +335,50 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tableHeaderButtonChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 9 2 1"
|
||||
"value": "cell 0 8 2 1"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 3"
|
||||
"value": "cell 4 2 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label1"
|
||||
"text": "JXTable:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3,aligny top,growy 0"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "xTable1ScrollPane"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
add( new FormComponent( "org.jdesktop.swingx.JXTable" ) {
|
||||
name: "xTable1"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label2"
|
||||
"text": "JXTreeTable:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 3,aligny top,growy 0"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "xTreeTable1ScrollPane"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
add( new FormComponent( "org.jdesktop.swingx.JXTreeTable" ) {
|
||||
name: "xTreeTable1"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 3 2 1"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
|
||||
@@ -19,7 +19,10 @@ package com.formdev.flatlaf.testing;
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import com.formdev.flatlaf.FlatClientProperties;
|
||||
import com.formdev.flatlaf.extras.components.*;
|
||||
import com.formdev.flatlaf.extras.components.FlatButton.ButtonType;
|
||||
import net.miginfocom.swing.*;
|
||||
|
||||
/**
|
||||
@@ -35,8 +38,27 @@ public class FlatComponentsTest
|
||||
} );
|
||||
}
|
||||
|
||||
private final JSlider[] allSliders;
|
||||
private final JSlider[] roundSliders;
|
||||
private final JSlider[] directionalSliders;
|
||||
|
||||
FlatComponentsTest() {
|
||||
initComponents();
|
||||
|
||||
buttonTypeComboBox.init( ButtonType.class, true );
|
||||
|
||||
allSliders = new JSlider[] { slider1, slider2, slider3, slider4, slider5, slider6 };
|
||||
roundSliders = new JSlider[] { slider1, slider2, slider6 };
|
||||
directionalSliders = new JSlider[] { slider3, slider4, slider5 };
|
||||
|
||||
ChangeListener sliderChanged = e -> {
|
||||
JSlider slider = (JSlider) e.getSource();
|
||||
String text = slider.getValue() + " " + slider.getValueIsAdjusting();
|
||||
sliderValueLabel.setText( text );
|
||||
// System.out.println( text );
|
||||
};
|
||||
for( JSlider slider : allSliders )
|
||||
slider.addChangeListener( sliderChanged );
|
||||
}
|
||||
|
||||
private void changeProgress() {
|
||||
@@ -55,6 +77,22 @@ public class FlatComponentsTest
|
||||
progressBar4.setIndeterminate( indeterminate );
|
||||
}
|
||||
|
||||
private void squareChanged() {
|
||||
boolean square = squareCheckBox.isSelected();
|
||||
progressBar1.setSquare( square );
|
||||
progressBar2.setSquare( square );
|
||||
progressBar3.setSquare( square );
|
||||
progressBar4.setSquare( square );
|
||||
}
|
||||
|
||||
private void largeHeightChanged() {
|
||||
boolean largeHeight = largeHeightCheckBox.isSelected();
|
||||
progressBar1.setLargeHeight( largeHeight );
|
||||
progressBar2.setLargeHeight( largeHeight );
|
||||
progressBar3.setLargeHeight( largeHeight );
|
||||
progressBar4.setLargeHeight( largeHeight );
|
||||
}
|
||||
|
||||
private void borderPaintedChanged() {
|
||||
boolean borderPainted = borderPaintedCheckBox.isSelected();
|
||||
|
||||
@@ -99,13 +137,16 @@ public class FlatComponentsTest
|
||||
}
|
||||
|
||||
private void buttonTypeChanged() {
|
||||
String buttonType = (String) buttonTypeComboBox.getSelectedItem();
|
||||
if( "-".equals( buttonType ) )
|
||||
buttonType = null;
|
||||
ButtonType buttonType = buttonTypeComboBox.getSelectedValue();
|
||||
String buttonTypeStr = (buttonType != null && buttonType != ButtonType.none) ? buttonType.toString() : null;
|
||||
|
||||
for( Component c : getComponents() ) {
|
||||
if( c instanceof AbstractButton )
|
||||
((AbstractButton)c).putClientProperty( FlatClientProperties.BUTTON_TYPE, buttonType );
|
||||
if( c instanceof FlatButton )
|
||||
((FlatButton)c).setButtonType( buttonType );
|
||||
else if( c instanceof FlatToggleButton )
|
||||
((FlatToggleButton)c).setButtonType( buttonType );
|
||||
else if( c instanceof AbstractButton )
|
||||
((AbstractButton)c).putClientProperty( FlatClientProperties.BUTTON_TYPE, buttonTypeStr );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +170,64 @@ public class FlatComponentsTest
|
||||
textField1.requestFocusInWindow();
|
||||
}
|
||||
|
||||
private void sliderPaintTrackChanged() {
|
||||
boolean paintTrack = sliderPaintTrackCheckBox.isSelected();
|
||||
for( JSlider slider : allSliders )
|
||||
slider.setPaintTrack( paintTrack );
|
||||
}
|
||||
|
||||
private void sliderPaintTicksChanged() {
|
||||
Boolean paintTicks = sliderPaintTicksCheckBox.getChecked();
|
||||
if( paintTicks != null ) {
|
||||
for( JSlider slider : allSliders )
|
||||
slider.setPaintTicks( paintTicks );
|
||||
} else {
|
||||
for( JSlider slider : roundSliders )
|
||||
slider.setPaintTicks( false );
|
||||
for( JSlider slider : directionalSliders )
|
||||
slider.setPaintTicks( true );
|
||||
}
|
||||
}
|
||||
|
||||
private void sliderPaintLabelsChanged() {
|
||||
Boolean paintLabels = sliderPaintLabelsCheckBox.getChecked();
|
||||
if( paintLabels != null ) {
|
||||
for( JSlider slider : allSliders )
|
||||
slider.setPaintLabels( paintLabels );
|
||||
} else {
|
||||
for( JSlider slider : roundSliders )
|
||||
slider.setPaintLabels( false );
|
||||
for( JSlider slider : directionalSliders )
|
||||
slider.setPaintLabels( true );
|
||||
}
|
||||
}
|
||||
|
||||
private void sliderInvertedChanged() {
|
||||
boolean inverted = sliderInvertedCheckBox.isSelected();
|
||||
for( JSlider slider : allSliders )
|
||||
slider.setInverted( inverted );
|
||||
}
|
||||
|
||||
private void sliderSnapToTicksChanged() {
|
||||
boolean snapToTicks = sliderSnapToTicksCheckBox.isSelected();
|
||||
for( JSlider slider : allSliders )
|
||||
slider.setSnapToTicks( snapToTicks );
|
||||
}
|
||||
|
||||
private void majorThickSpacingChanged() {
|
||||
int majorTickSpacing = (Integer) majorTickSpacingSpinner.getValue();
|
||||
for( JSlider slider : directionalSliders ) {
|
||||
slider.setLabelTable( null );
|
||||
slider.setMajorTickSpacing( majorTickSpacing );
|
||||
}
|
||||
}
|
||||
|
||||
private void minorThickSpacingChanged() {
|
||||
int minorTickSpacing = (Integer) minorTickSpacingSpinner.getValue();
|
||||
for( JSlider slider : directionalSliders )
|
||||
slider.setMinorTickSpacing( minorTickSpacing );
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||
JLabel labelLabel = new JLabel();
|
||||
@@ -137,14 +236,14 @@ public class FlatComponentsTest
|
||||
FlatComponentsTest.TestMultiLineLabel testMultiLineLabel1 = new FlatComponentsTest.TestMultiLineLabel();
|
||||
JLabel buttonLabel = new JLabel();
|
||||
JButton button1 = new JButton();
|
||||
JButton button17 = new JButton();
|
||||
JButton button22 = new JButton();
|
||||
FlatButton button17 = new FlatButton();
|
||||
FlatButton button22 = new FlatButton();
|
||||
JButton button2 = new JButton();
|
||||
JButton button18 = new JButton();
|
||||
JButton button23 = new JButton();
|
||||
FlatButton button18 = new FlatButton();
|
||||
FlatButton button23 = new FlatButton();
|
||||
FlatComponentsTest.TestDefaultButton button5 = new FlatComponentsTest.TestDefaultButton();
|
||||
JButton button3 = new JButton();
|
||||
JButton button12 = new JButton();
|
||||
FlatButton button3 = new FlatButton();
|
||||
FlatButton button12 = new FlatButton();
|
||||
JButton button13 = new JButton();
|
||||
JButton button14 = new JButton();
|
||||
JButton button15 = new JButton();
|
||||
@@ -152,11 +251,11 @@ public class FlatComponentsTest
|
||||
JButton button20 = new JButton();
|
||||
JLabel toggleButtonLabel = new JLabel();
|
||||
JToggleButton toggleButton1 = new JToggleButton();
|
||||
JToggleButton toggleButton9 = new JToggleButton();
|
||||
JToggleButton toggleButton19 = new JToggleButton();
|
||||
FlatToggleButton toggleButton9 = new FlatToggleButton();
|
||||
FlatToggleButton toggleButton19 = new FlatToggleButton();
|
||||
JToggleButton toggleButton2 = new JToggleButton();
|
||||
JToggleButton toggleButton10 = new JToggleButton();
|
||||
JToggleButton toggleButton20 = new JToggleButton();
|
||||
FlatToggleButton toggleButton10 = new FlatToggleButton();
|
||||
FlatToggleButton toggleButton20 = new FlatToggleButton();
|
||||
JToggleButton toggleButton3 = new JToggleButton();
|
||||
JToggleButton toggleButton4 = new JToggleButton();
|
||||
JToggleButton toggleButton11 = new JToggleButton();
|
||||
@@ -169,8 +268,8 @@ public class FlatComponentsTest
|
||||
JCheckBox checkBox2 = new JCheckBox();
|
||||
JCheckBox checkBox3 = new JCheckBox();
|
||||
JCheckBox checkBox4 = new JCheckBox();
|
||||
JToggleButton toggleButton5 = new JToggleButton();
|
||||
JToggleButton toggleButton8 = new JToggleButton();
|
||||
FlatToggleButton toggleButton5 = new FlatToggleButton();
|
||||
FlatToggleButton toggleButton8 = new FlatToggleButton();
|
||||
JLabel radioButtonLabel = new JLabel();
|
||||
JRadioButton radioButton1 = new JRadioButton();
|
||||
JRadioButton radioButton2 = new JRadioButton();
|
||||
@@ -188,28 +287,28 @@ public class FlatComponentsTest
|
||||
JSpinner spinner2 = new JSpinner();
|
||||
FlatComponentsTest.ButtonlessSpinner buttonlessSpinner1 = new FlatComponentsTest.ButtonlessSpinner();
|
||||
FlatComponentsTest.ButtonlessSpinner buttonlessSpinner2 = new FlatComponentsTest.ButtonlessSpinner();
|
||||
JComboBox<String> comboBox7 = new JComboBox<>();
|
||||
FlatComboBox<String> comboBox7 = new FlatComboBox<>();
|
||||
JSpinner spinner3 = new JSpinner();
|
||||
JLabel textFieldLabel = new JLabel();
|
||||
textField1 = new JTextField();
|
||||
JTextField textField2 = new JTextField();
|
||||
JTextField textField3 = new JTextField();
|
||||
JTextField textField4 = new JTextField();
|
||||
JTextField textField6 = new JTextField();
|
||||
FlatTextField textField6 = new FlatTextField();
|
||||
JTextField textField5 = new JTextField();
|
||||
JLabel formattedTextFieldLabel = new JLabel();
|
||||
JFormattedTextField formattedTextField1 = new JFormattedTextField();
|
||||
JFormattedTextField formattedTextField2 = new JFormattedTextField();
|
||||
JFormattedTextField formattedTextField3 = new JFormattedTextField();
|
||||
JFormattedTextField formattedTextField4 = new JFormattedTextField();
|
||||
JFormattedTextField formattedTextField5 = new JFormattedTextField();
|
||||
FlatFormattedTextField formattedTextField5 = new FlatFormattedTextField();
|
||||
JFormattedTextField formattedTextField6 = new JFormattedTextField();
|
||||
JLabel passwordFieldLabel = new JLabel();
|
||||
JPasswordField passwordField1 = new JPasswordField();
|
||||
JPasswordField passwordField2 = new JPasswordField();
|
||||
JPasswordField passwordField3 = new JPasswordField();
|
||||
JPasswordField passwordField4 = new JPasswordField();
|
||||
JPasswordField passwordField5 = new JPasswordField();
|
||||
FlatPasswordField passwordField5 = new FlatPasswordField();
|
||||
JPasswordField passwordField6 = new JPasswordField();
|
||||
JLabel textAreaLabel = new JLabel();
|
||||
JScrollPane scrollPane1 = new JScrollPane();
|
||||
@@ -247,14 +346,14 @@ public class FlatComponentsTest
|
||||
JButton button19 = new JButton();
|
||||
JScrollBar scrollBar2 = new JScrollBar();
|
||||
JScrollBar scrollBar3 = new JScrollBar();
|
||||
JScrollBar scrollBar7 = new JScrollBar();
|
||||
JScrollBar scrollBar8 = new JScrollBar();
|
||||
FlatScrollBar scrollBar7 = new FlatScrollBar();
|
||||
FlatScrollBar scrollBar8 = new FlatScrollBar();
|
||||
JSeparator separator2 = new JSeparator();
|
||||
JSlider slider2 = new JSlider();
|
||||
JSlider slider4 = new JSlider();
|
||||
slider2 = new JSlider();
|
||||
slider4 = new JSlider();
|
||||
JScrollPane scrollPane14 = new JScrollPane();
|
||||
progressBar3 = new JProgressBar();
|
||||
progressBar4 = new JProgressBar();
|
||||
progressBar3 = new FlatProgressBar();
|
||||
progressBar4 = new FlatProgressBar();
|
||||
JToolBar toolBar2 = new JToolBar();
|
||||
JButton button9 = new JButton();
|
||||
JButton button10 = new JButton();
|
||||
@@ -264,7 +363,7 @@ public class FlatComponentsTest
|
||||
JPanel panel3 = new JPanel();
|
||||
JButton button21 = new JButton();
|
||||
JPanel panel5 = new JPanel();
|
||||
buttonTypeComboBox = new JComboBox<>();
|
||||
buttonTypeComboBox = new FlatTestEnumComboBox<>();
|
||||
borderPaintedCheckBox = new JCheckBox();
|
||||
roundRectCheckBox = new JCheckBox();
|
||||
contentAreaFilledCheckBox = new JCheckBox();
|
||||
@@ -278,21 +377,34 @@ public class FlatComponentsTest
|
||||
JLabel scrollBarLabel = new JLabel();
|
||||
JScrollBar scrollBar1 = new JScrollBar();
|
||||
JScrollBar scrollBar4 = new JScrollBar();
|
||||
JScrollBar scrollBar5 = new JScrollBar();
|
||||
JScrollBar scrollBar6 = new JScrollBar();
|
||||
FlatScrollBar scrollBar5 = new FlatScrollBar();
|
||||
FlatScrollBar scrollBar6 = new FlatScrollBar();
|
||||
JLabel separatorLabel = new JLabel();
|
||||
JSeparator separator1 = new JSeparator();
|
||||
JPanel panel2 = new JPanel();
|
||||
JLabel sliderLabel = new JLabel();
|
||||
JSlider slider1 = new JSlider();
|
||||
JSlider slider6 = new JSlider();
|
||||
slider1 = new JSlider();
|
||||
slider6 = new JSlider();
|
||||
JPanel panel8 = new JPanel();
|
||||
JPanel panel6 = new JPanel();
|
||||
sliderPaintTrackCheckBox = new JCheckBox();
|
||||
sliderPaintTicksCheckBox = new FlatTriStateCheckBox();
|
||||
sliderPaintLabelsCheckBox = new FlatTriStateCheckBox();
|
||||
sliderInvertedCheckBox = new JCheckBox();
|
||||
sliderSnapToTicksCheckBox = new JCheckBox();
|
||||
majorTickSpacingSpinner = new JSpinner();
|
||||
minorTickSpacingSpinner = new JSpinner();
|
||||
sliderValueLabel = new JLabel();
|
||||
JPanel panel7 = new JPanel();
|
||||
indeterminateCheckBox = new JCheckBox();
|
||||
squareCheckBox = new JCheckBox();
|
||||
largeHeightCheckBox = new JCheckBox();
|
||||
JLabel sliderLabel2 = new JLabel();
|
||||
slider3 = new JSlider();
|
||||
JSlider slider5 = new JSlider();
|
||||
slider5 = new JSlider();
|
||||
JLabel progressBarLabel = new JLabel();
|
||||
progressBar1 = new JProgressBar();
|
||||
progressBar2 = new JProgressBar();
|
||||
indeterminateCheckBox = new JCheckBox();
|
||||
progressBar1 = new FlatProgressBar();
|
||||
progressBar2 = new FlatProgressBar();
|
||||
JLabel toolTipLabel = new JLabel();
|
||||
JToolTip toolTip1 = new JToolTip();
|
||||
JToolTip toolTip2 = new JToolTip();
|
||||
@@ -308,16 +420,16 @@ public class FlatComponentsTest
|
||||
JToggleButton toggleButton17 = new JToggleButton();
|
||||
JLabel label3 = new JLabel();
|
||||
JToolBar toolBar3 = new JToolBar();
|
||||
JButton button26 = new JButton();
|
||||
JButton button27 = new JButton();
|
||||
JToggleButton toggleButton23 = new JToggleButton();
|
||||
JToggleButton toggleButton24 = new JToggleButton();
|
||||
FlatButton button26 = new FlatButton();
|
||||
FlatButton button27 = new FlatButton();
|
||||
FlatToggleButton toggleButton23 = new FlatToggleButton();
|
||||
FlatToggleButton toggleButton24 = new FlatToggleButton();
|
||||
JLabel label4 = new JLabel();
|
||||
JToolBar toolBar4 = new JToolBar();
|
||||
JButton button28 = new JButton();
|
||||
JButton button29 = new JButton();
|
||||
JToggleButton toggleButton25 = new JToggleButton();
|
||||
JToggleButton toggleButton26 = new JToggleButton();
|
||||
FlatButton button28 = new FlatButton();
|
||||
FlatButton button29 = new FlatButton();
|
||||
FlatToggleButton toggleButton25 = new FlatToggleButton();
|
||||
FlatToggleButton toggleButton26 = new FlatToggleButton();
|
||||
|
||||
//======== this ========
|
||||
setLayout(new MigLayout(
|
||||
@@ -387,14 +499,14 @@ public class FlatComponentsTest
|
||||
|
||||
//---- button17 ----
|
||||
button17.setText("Sq");
|
||||
button17.putClientProperty("JButton.buttonType", "square");
|
||||
button17.putClientProperty("JComponent.minimumWidth", 0);
|
||||
button17.setButtonType(FlatButton.ButtonType.square);
|
||||
button17.setMinimumWidth(0);
|
||||
add(button17, "cell 1 1");
|
||||
|
||||
//---- button22 ----
|
||||
button22.setText("Rd");
|
||||
button22.putClientProperty("JButton.buttonType", "roundRect");
|
||||
button22.putClientProperty("JComponent.minimumWidth", 0);
|
||||
button22.setButtonType(FlatButton.ButtonType.roundRect);
|
||||
button22.setMinimumWidth(0);
|
||||
add(button22, "cell 1 1");
|
||||
|
||||
//---- button2 ----
|
||||
@@ -406,16 +518,16 @@ public class FlatComponentsTest
|
||||
|
||||
//---- button18 ----
|
||||
button18.setText("Sq");
|
||||
button18.putClientProperty("JButton.buttonType", "square");
|
||||
button18.setButtonType(FlatButton.ButtonType.square);
|
||||
button18.setEnabled(false);
|
||||
button18.putClientProperty("JComponent.minimumWidth", 0);
|
||||
button18.setMinimumWidth(0);
|
||||
add(button18, "cell 2 1");
|
||||
|
||||
//---- button23 ----
|
||||
button23.setText("Rd");
|
||||
button23.putClientProperty("JButton.buttonType", "roundRect");
|
||||
button23.setButtonType(FlatButton.ButtonType.roundRect);
|
||||
button23.setEnabled(false);
|
||||
button23.putClientProperty("JComponent.minimumWidth", 0);
|
||||
button23.setMinimumWidth(0);
|
||||
add(button23, "cell 2 1");
|
||||
|
||||
//---- button5 ----
|
||||
@@ -426,12 +538,12 @@ public class FlatComponentsTest
|
||||
|
||||
//---- button3 ----
|
||||
button3.setText("Help");
|
||||
button3.putClientProperty("JButton.buttonType", "help");
|
||||
button3.setButtonType(FlatButton.ButtonType.help);
|
||||
add(button3, "cell 4 1");
|
||||
|
||||
//---- button12 ----
|
||||
button12.setText("Help");
|
||||
button12.putClientProperty("JButton.buttonType", "help");
|
||||
button12.setButtonType(FlatButton.ButtonType.help);
|
||||
button12.setEnabled(false);
|
||||
add(button12, "cell 4 1");
|
||||
|
||||
@@ -462,16 +574,17 @@ public class FlatComponentsTest
|
||||
|
||||
//---- toggleButton1 ----
|
||||
toggleButton1.setText("Enabled");
|
||||
toggleButton1.setToolTipText("LOOOOOOOOOOOOOONG TEXT");
|
||||
add(toggleButton1, "cell 1 2");
|
||||
|
||||
//---- toggleButton9 ----
|
||||
toggleButton9.setText("Sq");
|
||||
toggleButton9.putClientProperty("JButton.buttonType", "square");
|
||||
toggleButton9.setButtonType(FlatButton.ButtonType.square);
|
||||
add(toggleButton9, "cell 1 2");
|
||||
|
||||
//---- toggleButton19 ----
|
||||
toggleButton19.setText("Rd");
|
||||
toggleButton19.putClientProperty("JButton.buttonType", "roundRect");
|
||||
toggleButton19.setButtonType(FlatButton.ButtonType.roundRect);
|
||||
add(toggleButton19, "cell 1 2");
|
||||
|
||||
//---- toggleButton2 ----
|
||||
@@ -481,13 +594,13 @@ public class FlatComponentsTest
|
||||
|
||||
//---- toggleButton10 ----
|
||||
toggleButton10.setText("Sq");
|
||||
toggleButton10.putClientProperty("JButton.buttonType", "square");
|
||||
toggleButton10.setButtonType(FlatButton.ButtonType.square);
|
||||
toggleButton10.setEnabled(false);
|
||||
add(toggleButton10, "cell 2 2");
|
||||
|
||||
//---- toggleButton20 ----
|
||||
toggleButton20.setText("Rd");
|
||||
toggleButton20.putClientProperty("JButton.buttonType", "roundRect");
|
||||
toggleButton20.setButtonType(FlatButton.ButtonType.roundRect);
|
||||
toggleButton20.setEnabled(false);
|
||||
add(toggleButton20, "cell 2 2");
|
||||
|
||||
@@ -555,13 +668,13 @@ public class FlatComponentsTest
|
||||
|
||||
//---- toggleButton5 ----
|
||||
toggleButton5.setText("Tab");
|
||||
toggleButton5.putClientProperty("JButton.buttonType", "tab");
|
||||
toggleButton5.setButtonType(FlatButton.ButtonType.tab);
|
||||
toggleButton5.setSelected(true);
|
||||
add(toggleButton5, "cell 5 3");
|
||||
|
||||
//---- toggleButton8 ----
|
||||
toggleButton8.setText("Tab");
|
||||
toggleButton8.putClientProperty("JButton.buttonType", "tab");
|
||||
toggleButton8.setButtonType(FlatButton.ButtonType.tab);
|
||||
toggleButton8.setEnabled(false);
|
||||
toggleButton8.setSelected(true);
|
||||
add(toggleButton8, "cell 5 3");
|
||||
@@ -686,7 +799,7 @@ public class FlatComponentsTest
|
||||
|
||||
//---- comboBox7 ----
|
||||
comboBox7.setEditable(true);
|
||||
comboBox7.putClientProperty("JTextField.placeholderText", "Placeholder");
|
||||
comboBox7.setPlaceholderText("Placeholder");
|
||||
add(comboBox7, "cell 5 6,growx");
|
||||
|
||||
//---- spinner3 ----
|
||||
@@ -719,7 +832,7 @@ public class FlatComponentsTest
|
||||
add(textField4, "cell 4 7,growx");
|
||||
|
||||
//---- textField6 ----
|
||||
textField6.putClientProperty("JTextField.placeholderText", "Placeholder");
|
||||
textField6.setPlaceholderText("Placeholder");
|
||||
add(textField6, "cell 5 7,growx");
|
||||
|
||||
//---- textField5 ----
|
||||
@@ -752,7 +865,7 @@ public class FlatComponentsTest
|
||||
add(formattedTextField4, "cell 4 8,growx");
|
||||
|
||||
//---- formattedTextField5 ----
|
||||
formattedTextField5.putClientProperty("JTextField.placeholderText", "Placeholder");
|
||||
formattedTextField5.setPlaceholderText("Placeholder");
|
||||
add(formattedTextField5, "cell 5 8,growx");
|
||||
|
||||
//---- formattedTextField6 ----
|
||||
@@ -785,7 +898,7 @@ public class FlatComponentsTest
|
||||
add(passwordField4, "cell 4 9,growx");
|
||||
|
||||
//---- passwordField5 ----
|
||||
passwordField5.putClientProperty("JTextField.placeholderText", "Placeholder");
|
||||
passwordField5.setPlaceholderText("Placeholder");
|
||||
add(passwordField5, "cell 5 9,growx");
|
||||
|
||||
//---- passwordField6 ----
|
||||
@@ -996,12 +1109,12 @@ public class FlatComponentsTest
|
||||
add(scrollBar3, "cell 2 13 1 6,growy");
|
||||
|
||||
//---- scrollBar7 ----
|
||||
scrollBar7.putClientProperty("JScrollBar.showButtons", true);
|
||||
scrollBar7.setShowButtons(true);
|
||||
add(scrollBar7, "cell 2 13 1 6,growy");
|
||||
|
||||
//---- scrollBar8 ----
|
||||
scrollBar8.setEnabled(false);
|
||||
scrollBar8.putClientProperty("JScrollBar.showButtons", true);
|
||||
scrollBar8.setShowButtons(true);
|
||||
add(scrollBar8, "cell 2 13 1 6,growy");
|
||||
|
||||
//---- separator2 ----
|
||||
@@ -1091,13 +1204,6 @@ public class FlatComponentsTest
|
||||
"[]"));
|
||||
|
||||
//---- buttonTypeComboBox ----
|
||||
buttonTypeComboBox.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"-",
|
||||
"square",
|
||||
"roundRect",
|
||||
"tab",
|
||||
"help"
|
||||
}));
|
||||
buttonTypeComboBox.addActionListener(e -> buttonTypeChanged());
|
||||
panel5.add(buttonTypeComboBox, "cell 0 0");
|
||||
|
||||
@@ -1173,13 +1279,13 @@ public class FlatComponentsTest
|
||||
|
||||
//---- scrollBar5 ----
|
||||
scrollBar5.setOrientation(Adjustable.HORIZONTAL);
|
||||
scrollBar5.putClientProperty("JScrollBar.showButtons", true);
|
||||
scrollBar5.setShowButtons(true);
|
||||
add(scrollBar5, "cell 1 16,growx");
|
||||
|
||||
//---- scrollBar6 ----
|
||||
scrollBar6.setOrientation(Adjustable.HORIZONTAL);
|
||||
scrollBar6.setEnabled(false);
|
||||
scrollBar6.putClientProperty("JScrollBar.showButtons", true);
|
||||
scrollBar6.setShowButtons(true);
|
||||
add(scrollBar6, "cell 1 17,growx");
|
||||
|
||||
//---- separatorLabel ----
|
||||
@@ -1208,6 +1314,104 @@ public class FlatComponentsTest
|
||||
slider6.setValue(30);
|
||||
add(slider6, "cell 1 19 3 1");
|
||||
|
||||
//======== panel8 ========
|
||||
{
|
||||
panel8.setLayout(new MigLayout(
|
||||
"ltr,insets 0,hidemode 3",
|
||||
// columns
|
||||
"[]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//======== panel6 ========
|
||||
{
|
||||
panel6.setBorder(new TitledBorder("JSlider Control"));
|
||||
panel6.setLayout(new MigLayout(
|
||||
"ltr,insets 0,hidemode 3",
|
||||
// columns
|
||||
"[]",
|
||||
// rows
|
||||
"[]0" +
|
||||
"[]0" +
|
||||
"[]0" +
|
||||
"[]"));
|
||||
|
||||
//---- sliderPaintTrackCheckBox ----
|
||||
sliderPaintTrackCheckBox.setText("track");
|
||||
sliderPaintTrackCheckBox.setSelected(true);
|
||||
sliderPaintTrackCheckBox.addActionListener(e -> sliderPaintTrackChanged());
|
||||
panel6.add(sliderPaintTrackCheckBox, "cell 0 0");
|
||||
|
||||
//---- sliderPaintTicksCheckBox ----
|
||||
sliderPaintTicksCheckBox.setText("ticks");
|
||||
sliderPaintTicksCheckBox.addActionListener(e -> sliderPaintTicksChanged());
|
||||
panel6.add(sliderPaintTicksCheckBox, "cell 0 0");
|
||||
|
||||
//---- sliderPaintLabelsCheckBox ----
|
||||
sliderPaintLabelsCheckBox.setText("labels");
|
||||
sliderPaintLabelsCheckBox.addActionListener(e -> sliderPaintLabelsChanged());
|
||||
panel6.add(sliderPaintLabelsCheckBox, "cell 0 0");
|
||||
|
||||
//---- sliderInvertedCheckBox ----
|
||||
sliderInvertedCheckBox.setText("inverted");
|
||||
sliderInvertedCheckBox.addActionListener(e -> sliderInvertedChanged());
|
||||
panel6.add(sliderInvertedCheckBox, "cell 0 1");
|
||||
|
||||
//---- sliderSnapToTicksCheckBox ----
|
||||
sliderSnapToTicksCheckBox.setText("snap to ticks");
|
||||
sliderSnapToTicksCheckBox.addActionListener(e -> sliderSnapToTicksChanged());
|
||||
panel6.add(sliderSnapToTicksCheckBox, "cell 0 1");
|
||||
|
||||
//---- majorTickSpacingSpinner ----
|
||||
majorTickSpacingSpinner.setModel(new SpinnerNumberModel(50, 0, 100, 5));
|
||||
majorTickSpacingSpinner.addChangeListener(e -> majorThickSpacingChanged());
|
||||
panel6.add(majorTickSpacingSpinner, "cell 0 2");
|
||||
|
||||
//---- minorTickSpacingSpinner ----
|
||||
minorTickSpacingSpinner.setModel(new SpinnerNumberModel(10, 0, 100, 5));
|
||||
minorTickSpacingSpinner.addChangeListener(e -> minorThickSpacingChanged());
|
||||
panel6.add(minorTickSpacingSpinner, "cell 0 2");
|
||||
|
||||
//---- sliderValueLabel ----
|
||||
sliderValueLabel.setText("slider value");
|
||||
panel6.add(sliderValueLabel, "cell 0 3");
|
||||
}
|
||||
panel8.add(panel6, "cell 0 0 1 2,grow");
|
||||
|
||||
//======== panel7 ========
|
||||
{
|
||||
panel7.setBorder(new TitledBorder("JProgressBar Control"));
|
||||
panel7.setLayout(new MigLayout(
|
||||
"ltr,insets 0,hidemode 3",
|
||||
// columns
|
||||
"[]" +
|
||||
"[fill]",
|
||||
// rows
|
||||
"[]0" +
|
||||
"[]"));
|
||||
|
||||
//---- indeterminateCheckBox ----
|
||||
indeterminateCheckBox.setText("indeterminate");
|
||||
indeterminateCheckBox.addActionListener(e -> indeterminateProgress());
|
||||
panel7.add(indeterminateCheckBox, "cell 0 0");
|
||||
|
||||
//---- squareCheckBox ----
|
||||
squareCheckBox.setText("square");
|
||||
squareCheckBox.addActionListener(e -> squareChanged());
|
||||
panel7.add(squareCheckBox, "cell 1 0");
|
||||
|
||||
//---- largeHeightCheckBox ----
|
||||
largeHeightCheckBox.setText("large height");
|
||||
largeHeightCheckBox.addActionListener(e -> largeHeightChanged());
|
||||
panel7.add(largeHeightCheckBox, "cell 0 1,aligny top,growy 0");
|
||||
}
|
||||
panel8.add(panel7, "cell 0 2 1 2,grow");
|
||||
}
|
||||
add(panel8, "cell 4 19 1 4");
|
||||
|
||||
//---- sliderLabel2 ----
|
||||
sliderLabel2.setText("baseline");
|
||||
add(sliderLabel2, "cell 0 20,alignx right,growx 0");
|
||||
@@ -1243,11 +1447,6 @@ public class FlatComponentsTest
|
||||
progressBar2.setValue(60);
|
||||
add(progressBar2, "cell 1 21 3 1,growx");
|
||||
|
||||
//---- indeterminateCheckBox ----
|
||||
indeterminateCheckBox.setText("indeterminate");
|
||||
indeterminateCheckBox.addActionListener(e -> indeterminateProgress());
|
||||
add(indeterminateCheckBox, "cell 4 21");
|
||||
|
||||
//---- toolTipLabel ----
|
||||
toolTipLabel.setText("JToolTip:");
|
||||
add(toolTipLabel, "cell 0 22");
|
||||
@@ -1318,24 +1517,24 @@ public class FlatComponentsTest
|
||||
|
||||
//---- button26 ----
|
||||
button26.setIcon(UIManager.getIcon("Tree.closedIcon"));
|
||||
button26.putClientProperty("JButton.buttonType", "square");
|
||||
button26.setButtonType(FlatButton.ButtonType.square);
|
||||
toolBar3.add(button26);
|
||||
|
||||
//---- button27 ----
|
||||
button27.setIcon(UIManager.getIcon("Tree.openIcon"));
|
||||
button27.putClientProperty("JButton.buttonType", "square");
|
||||
button27.setButtonType(FlatButton.ButtonType.square);
|
||||
toolBar3.add(button27);
|
||||
|
||||
//---- toggleButton23 ----
|
||||
toggleButton23.setIcon(UIManager.getIcon("FileView.computerIcon"));
|
||||
toggleButton23.setSelected(true);
|
||||
toggleButton23.putClientProperty("JButton.buttonType", "square");
|
||||
toggleButton23.setButtonType(FlatButton.ButtonType.square);
|
||||
toolBar3.add(toggleButton23);
|
||||
|
||||
//---- toggleButton24 ----
|
||||
toggleButton24.setIcon(UIManager.getIcon("FileView.floppyDriveIcon"));
|
||||
toggleButton24.setSelected(true);
|
||||
toggleButton24.putClientProperty("JButton.buttonType", "square");
|
||||
toggleButton24.setButtonType(FlatButton.ButtonType.square);
|
||||
toolBar3.add(toggleButton24);
|
||||
}
|
||||
add(toolBar3, "cell 1 23 5 1");
|
||||
@@ -1349,24 +1548,24 @@ public class FlatComponentsTest
|
||||
|
||||
//---- button28 ----
|
||||
button28.setIcon(UIManager.getIcon("Tree.closedIcon"));
|
||||
button28.putClientProperty("JButton.buttonType", "roundRect");
|
||||
button28.setButtonType(FlatButton.ButtonType.roundRect);
|
||||
toolBar4.add(button28);
|
||||
|
||||
//---- button29 ----
|
||||
button29.setIcon(UIManager.getIcon("Tree.openIcon"));
|
||||
button29.putClientProperty("JButton.buttonType", "roundRect");
|
||||
button29.setButtonType(FlatButton.ButtonType.roundRect);
|
||||
toolBar4.add(button29);
|
||||
|
||||
//---- toggleButton25 ----
|
||||
toggleButton25.setIcon(UIManager.getIcon("FileView.computerIcon"));
|
||||
toggleButton25.setSelected(true);
|
||||
toggleButton25.putClientProperty("JButton.buttonType", "roundRect");
|
||||
toggleButton25.setButtonType(FlatButton.ButtonType.roundRect);
|
||||
toolBar4.add(toggleButton25);
|
||||
|
||||
//---- toggleButton26 ----
|
||||
toggleButton26.setIcon(UIManager.getIcon("FileView.floppyDriveIcon"));
|
||||
toggleButton26.setSelected(true);
|
||||
toggleButton26.putClientProperty("JButton.buttonType", "roundRect");
|
||||
toggleButton26.setButtonType(FlatButton.ButtonType.roundRect);
|
||||
toolBar4.add(toggleButton26);
|
||||
}
|
||||
add(toolBar4, "cell 1 23 5 1");
|
||||
@@ -1388,9 +1587,11 @@ public class FlatComponentsTest
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
private JTextField textField1;
|
||||
private JProgressBar progressBar3;
|
||||
private JProgressBar progressBar4;
|
||||
private JComboBox<String> buttonTypeComboBox;
|
||||
private JSlider slider2;
|
||||
private JSlider slider4;
|
||||
private FlatProgressBar progressBar3;
|
||||
private FlatProgressBar progressBar4;
|
||||
private FlatTestEnumComboBox<ButtonType> buttonTypeComboBox;
|
||||
private JCheckBox borderPaintedCheckBox;
|
||||
private JCheckBox roundRectCheckBox;
|
||||
private JCheckBox contentAreaFilledCheckBox;
|
||||
@@ -1400,10 +1601,23 @@ public class FlatComponentsTest
|
||||
private JRadioButton magentaOutlineRadioButton;
|
||||
private JRadioButton magentaCyanOutlineRadioButton;
|
||||
private JCheckBox focusPaintedCheckBox;
|
||||
private JSlider slider3;
|
||||
private JProgressBar progressBar1;
|
||||
private JProgressBar progressBar2;
|
||||
private JSlider slider1;
|
||||
private JSlider slider6;
|
||||
private JCheckBox sliderPaintTrackCheckBox;
|
||||
private FlatTriStateCheckBox sliderPaintTicksCheckBox;
|
||||
private FlatTriStateCheckBox sliderPaintLabelsCheckBox;
|
||||
private JCheckBox sliderInvertedCheckBox;
|
||||
private JCheckBox sliderSnapToTicksCheckBox;
|
||||
private JSpinner majorTickSpacingSpinner;
|
||||
private JSpinner minorTickSpacingSpinner;
|
||||
private JLabel sliderValueLabel;
|
||||
private JCheckBox indeterminateCheckBox;
|
||||
private JCheckBox squareCheckBox;
|
||||
private JCheckBox largeHeightCheckBox;
|
||||
private JSlider slider3;
|
||||
private JSlider slider5;
|
||||
private FlatProgressBar progressBar1;
|
||||
private FlatProgressBar progressBar2;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
|
||||
//---- class TestDefaultButton --------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.2.0.298" Java: "15" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -53,19 +53,19 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
|
||||
name: "button17"
|
||||
"text": "Sq"
|
||||
"$client.JButton.buttonType": "square"
|
||||
"$client.JComponent.minimumWidth": 0
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType square
|
||||
"minimumWidth": 0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
|
||||
name: "button22"
|
||||
"text": "Rd"
|
||||
"$client.JButton.buttonType": "roundRect"
|
||||
"$client.JComponent.minimumWidth": 0
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType roundRect
|
||||
"minimumWidth": 0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1"
|
||||
} )
|
||||
@@ -78,21 +78,21 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
|
||||
name: "button18"
|
||||
"text": "Sq"
|
||||
"$client.JButton.buttonType": "square"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType square
|
||||
"enabled": false
|
||||
"$client.JComponent.minimumWidth": 0
|
||||
"minimumWidth": 0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
|
||||
name: "button23"
|
||||
"text": "Rd"
|
||||
"$client.JButton.buttonType": "roundRect"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType roundRect
|
||||
"enabled": false
|
||||
"$client.JComponent.minimumWidth": 0
|
||||
"minimumWidth": 0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 1"
|
||||
} )
|
||||
@@ -104,17 +104,17 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
|
||||
name: "button3"
|
||||
"text": "Help"
|
||||
"$client.JButton.buttonType": "help"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType help
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
|
||||
name: "button12"
|
||||
"text": "Help"
|
||||
"$client.JButton.buttonType": "help"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType help
|
||||
"enabled": false
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 1"
|
||||
@@ -159,20 +159,21 @@ new FormModel {
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
name: "toggleButton1"
|
||||
"text": "Enabled"
|
||||
"toolTipText": "LOOOOOOOOOOOOOONG TEXT"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatToggleButton" ) {
|
||||
name: "toggleButton9"
|
||||
"text": "Sq"
|
||||
"$client.JButton.buttonType": "square"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType square
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatToggleButton" ) {
|
||||
name: "toggleButton19"
|
||||
"text": "Rd"
|
||||
"$client.JButton.buttonType": "roundRect"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType roundRect
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2"
|
||||
} )
|
||||
@@ -183,18 +184,18 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatToggleButton" ) {
|
||||
name: "toggleButton10"
|
||||
"text": "Sq"
|
||||
"$client.JButton.buttonType": "square"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType square
|
||||
"enabled": false
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatToggleButton" ) {
|
||||
name: "toggleButton20"
|
||||
"text": "Rd"
|
||||
"$client.JButton.buttonType": "roundRect"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType roundRect
|
||||
"enabled": false
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 2"
|
||||
@@ -285,18 +286,18 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatToggleButton" ) {
|
||||
name: "toggleButton5"
|
||||
"text": "Tab"
|
||||
"$client.JButton.buttonType": "tab"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType tab
|
||||
"selected": true
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatToggleButton" ) {
|
||||
name: "toggleButton8"
|
||||
"text": "Tab"
|
||||
"$client.JButton.buttonType": "tab"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType tab
|
||||
"enabled": false
|
||||
"selected": true
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
@@ -466,10 +467,10 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 6,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatComboBox" ) {
|
||||
name: "comboBox7"
|
||||
"editable": true
|
||||
"$client.JTextField.placeholderText": "Placeholder"
|
||||
"placeholderText": "Placeholder"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
}
|
||||
@@ -522,9 +523,9 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 7,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTextField" ) {
|
||||
name: "textField6"
|
||||
"$client.JTextField.placeholderText": "Placeholder"
|
||||
"placeholderText": "Placeholder"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 7,growx"
|
||||
} )
|
||||
@@ -569,9 +570,9 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 8,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JFormattedTextField" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatFormattedTextField" ) {
|
||||
name: "formattedTextField5"
|
||||
"$client.JTextField.placeholderText": "Placeholder"
|
||||
"placeholderText": "Placeholder"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 8,growx"
|
||||
} )
|
||||
@@ -616,9 +617,9 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 9,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JPasswordField" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatPasswordField" ) {
|
||||
name: "passwordField5"
|
||||
"$client.JTextField.placeholderText": "Placeholder"
|
||||
"placeholderText": "Placeholder"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 9,growx"
|
||||
} )
|
||||
@@ -850,16 +851,16 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 13 1 6,growy"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JScrollBar" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatScrollBar" ) {
|
||||
name: "scrollBar7"
|
||||
"$client.JScrollBar.showButtons": true
|
||||
"showButtons": true
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 13 1 6,growy"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JScrollBar" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatScrollBar" ) {
|
||||
name: "scrollBar8"
|
||||
"enabled": false
|
||||
"$client.JScrollBar.showButtons": true
|
||||
"showButtons": true
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 13 1 6,growy"
|
||||
} )
|
||||
@@ -873,6 +874,9 @@ new FormModel {
|
||||
name: "slider2"
|
||||
"orientation": 1
|
||||
"value": 30
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 13 1 6,growy"
|
||||
} )
|
||||
@@ -884,6 +888,9 @@ new FormModel {
|
||||
"paintLabels": true
|
||||
"orientation": 1
|
||||
"value": 30
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 13 1 6,growy"
|
||||
} )
|
||||
@@ -892,7 +899,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 13,grow"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JProgressBar" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) {
|
||||
name: "progressBar3"
|
||||
"orientation": 1
|
||||
"value": 60
|
||||
@@ -902,7 +909,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 13 1 6,growy"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JProgressBar" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) {
|
||||
name: "progressBar4"
|
||||
"orientation": 1
|
||||
"value": 60
|
||||
@@ -963,18 +970,11 @@ new FormModel {
|
||||
} ) {
|
||||
name: "panel5"
|
||||
"border": new javax.swing.border.TitledBorder( "Control" )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatTestEnumComboBox" ) {
|
||||
name: "buttonTypeComboBox"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "-"
|
||||
addElement( "-" )
|
||||
addElement( "square" )
|
||||
addElement( "roundRect" )
|
||||
addElement( "tab" )
|
||||
addElement( "help" )
|
||||
}
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
"JavaCodeGenerator.typeParameters": "ButtonType"
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "buttonTypeChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
@@ -1098,18 +1098,18 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 15,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JScrollBar" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatScrollBar" ) {
|
||||
name: "scrollBar5"
|
||||
"orientation": 0
|
||||
"$client.JScrollBar.showButtons": true
|
||||
"showButtons": true
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 16,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JScrollBar" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatScrollBar" ) {
|
||||
name: "scrollBar6"
|
||||
"orientation": 0
|
||||
"enabled": false
|
||||
"$client.JScrollBar.showButtons": true
|
||||
"showButtons": true
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 17,growx"
|
||||
} )
|
||||
@@ -1140,6 +1140,9 @@ new FormModel {
|
||||
add( new FormComponent( "javax.swing.JSlider" ) {
|
||||
name: "slider1"
|
||||
"value": 30
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 19 3 1,growx"
|
||||
} )
|
||||
@@ -1147,9 +1150,151 @@ new FormModel {
|
||||
name: "slider6"
|
||||
"enabled": false
|
||||
"value": 30
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 19 3 1"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$columnConstraints": "[]"
|
||||
"$rowConstraints": "[][][][]"
|
||||
"$layoutConstraints": "ltr,insets 0,hidemode 3"
|
||||
} ) {
|
||||
name: "panel8"
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$columnConstraints": "[]"
|
||||
"$rowConstraints": "[]0[]0[]0[]"
|
||||
"$layoutConstraints": "ltr,insets 0,hidemode 3"
|
||||
} ) {
|
||||
name: "panel6"
|
||||
"border": new javax.swing.border.TitledBorder( "JSlider Control" )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "sliderPaintTrackCheckBox"
|
||||
"text": "track"
|
||||
"selected": true
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "sliderPaintTrackChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) {
|
||||
name: "sliderPaintTicksCheckBox"
|
||||
"text": "ticks"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "sliderPaintTicksChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) {
|
||||
name: "sliderPaintLabelsCheckBox"
|
||||
"text": "labels"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "sliderPaintLabelsChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "sliderInvertedCheckBox"
|
||||
"text": "inverted"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "sliderInvertedChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "sliderSnapToTicksCheckBox"
|
||||
"text": "snap to ticks"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "sliderSnapToTicksChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||
name: "majorTickSpacingSpinner"
|
||||
"model": new javax.swing.SpinnerNumberModel( 50, 0, 100, 5 )
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "majorThickSpacingChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||
name: "minorTickSpacingSpinner"
|
||||
"model": new javax.swing.SpinnerNumberModel( 10, 0, 100, 5 )
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "minorThickSpacingChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "sliderValueLabel"
|
||||
"text": "slider value"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0 1 2,grow"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$columnConstraints": "[][fill]"
|
||||
"$rowConstraints": "[]0[]"
|
||||
"$layoutConstraints": "ltr,insets 0,hidemode 3"
|
||||
} ) {
|
||||
name: "panel7"
|
||||
"border": new javax.swing.border.TitledBorder( "JProgressBar Control" )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "indeterminateCheckBox"
|
||||
"text": "indeterminate"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "indeterminateProgress", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "squareCheckBox"
|
||||
"text": "square"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "squareChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "largeHeightCheckBox"
|
||||
"text": "large height"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "largeHeightChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1,aligny top,growy 0"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2 1 2,grow"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 19 1 4"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "sliderLabel2"
|
||||
"text": "baseline"
|
||||
@@ -1178,6 +1323,9 @@ new FormModel {
|
||||
"paintLabels": true
|
||||
"enabled": false
|
||||
"value": 30
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 20 3 1"
|
||||
} )
|
||||
@@ -1187,7 +1335,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 21"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JProgressBar" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) {
|
||||
name: "progressBar1"
|
||||
"value": 60
|
||||
auxiliary() {
|
||||
@@ -1196,7 +1344,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 21 3 1,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JProgressBar" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) {
|
||||
name: "progressBar2"
|
||||
"stringPainted": true
|
||||
"value": 60
|
||||
@@ -1206,16 +1354,6 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 21 3 1,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "indeterminateCheckBox"
|
||||
"text": "indeterminate"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "indeterminateProgress", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 21"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "toolTipLabel"
|
||||
"text": "JToolTip:"
|
||||
@@ -1297,27 +1435,27 @@ new FormModel {
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
|
||||
name: "toolBar3"
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
|
||||
name: "button26"
|
||||
"icon": #SwingIcon1
|
||||
"$client.JButton.buttonType": "square"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType square
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
|
||||
name: "button27"
|
||||
"icon": #SwingIcon2
|
||||
"$client.JButton.buttonType": "square"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType square
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatToggleButton" ) {
|
||||
name: "toggleButton23"
|
||||
"icon": #SwingIcon4
|
||||
"selected": true
|
||||
"$client.JButton.buttonType": "square"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType square
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatToggleButton" ) {
|
||||
name: "toggleButton24"
|
||||
"icon": #SwingIcon5
|
||||
"selected": true
|
||||
"$client.JButton.buttonType": "square"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType square
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 23 5 1"
|
||||
@@ -1330,27 +1468,27 @@ new FormModel {
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
|
||||
name: "toolBar4"
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
|
||||
name: "button28"
|
||||
"icon": #SwingIcon1
|
||||
"$client.JButton.buttonType": "roundRect"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType roundRect
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
|
||||
name: "button29"
|
||||
"icon": #SwingIcon2
|
||||
"$client.JButton.buttonType": "roundRect"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType roundRect
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatToggleButton" ) {
|
||||
name: "toggleButton25"
|
||||
"icon": #SwingIcon4
|
||||
"selected": true
|
||||
"$client.JButton.buttonType": "roundRect"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType roundRect
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatToggleButton" ) {
|
||||
name: "toggleButton26"
|
||||
"icon": #SwingIcon5
|
||||
"selected": true
|
||||
"$client.JButton.buttonType": "roundRect"
|
||||
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType roundRect
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 23 5 1"
|
||||
|
||||
@@ -19,11 +19,12 @@ package com.formdev.flatlaf.testing;
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.function.BiConsumer;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
import com.formdev.flatlaf.FlatLaf;
|
||||
import com.formdev.flatlaf.extras.TriStateCheckBox;
|
||||
import com.formdev.flatlaf.extras.components.FlatTabbedPane;
|
||||
import com.formdev.flatlaf.extras.components.FlatTabbedPane.*;
|
||||
import com.formdev.flatlaf.extras.components.FlatTriStateCheckBox;
|
||||
import com.formdev.flatlaf.icons.FlatInternalFrameCloseIcon;
|
||||
import com.formdev.flatlaf.util.ScaledImageIcon;
|
||||
import com.jgoodies.forms.layout.*;
|
||||
@@ -46,11 +47,21 @@ public class FlatContainerTest
|
||||
public FlatContainerTest() {
|
||||
initComponents();
|
||||
|
||||
tabPlacementField.init( TabPlacement.class, true );
|
||||
iconPlacementField.init( TabIconPlacement.class, true );
|
||||
tabsPopupPolicyField.init( TabsPopupPolicy.class, true );
|
||||
scrollButtonsPolicyField.init( ScrollButtonsPolicy.class, true );
|
||||
scrollButtonsPlacementField.init( ScrollButtonsPlacement.class, true );
|
||||
tabAreaAlignmentField.init( TabAreaAlignment.class, true );
|
||||
tabAlignmentField.init( TabAlignment.class, true );
|
||||
tabWidthModeField.init( TabWidthMode.class, true );
|
||||
|
||||
tabCountChanged();
|
||||
|
||||
tabsClosableCheckBox.setSelected( true );
|
||||
tabsClosableChanged();
|
||||
putTabbedPanesClientProperty( TABBED_PANE_TAB_CLOSE_TOOLTIPTEXT, "Close" );
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setTabCloseToolTipText( "Close" );
|
||||
|
||||
tabScrollCheckBox.setSelected( true );
|
||||
tabScrollChanged();
|
||||
@@ -79,7 +90,7 @@ public class FlatContainerTest
|
||||
}
|
||||
|
||||
private void hideTabAreaWithOneTabChanged() {
|
||||
boolean hideTabAreaWithOneTab = hideTabAreaWithOneTabCheckBox.isSelected();
|
||||
Boolean hideTabAreaWithOneTab = hideTabAreaWithOneTabCheckBox.isSelected() ? true : null;
|
||||
putTabbedPanesClientProperty( TABBED_PANE_HIDE_TAB_AREA_WITH_ONE_TAB, hideTabAreaWithOneTab );
|
||||
}
|
||||
|
||||
@@ -158,6 +169,7 @@ public class FlatContainerTest
|
||||
setTabIcons( tabbedPane );
|
||||
|
||||
tabIconSizeSpinner.setEnabled( tabIconsCheckBox.isSelected() );
|
||||
iconPlacementField.setEnabled( tabIconsCheckBox.isSelected() );
|
||||
}
|
||||
|
||||
private void setTabIcons( JTabbedPane tabbedPane ) {
|
||||
@@ -182,14 +194,10 @@ public class FlatContainerTest
|
||||
}
|
||||
|
||||
private void iconPlacementChanged() {
|
||||
Object iconPlacement = null;
|
||||
switch( (String) iconPlacementField.getSelectedItem() ) {
|
||||
case "leading": iconPlacement = SwingConstants.LEADING; break;
|
||||
case "trailing": iconPlacement = SwingConstants.TRAILING; break;
|
||||
case "top": iconPlacement = SwingConstants.TOP; break;
|
||||
case "bottom": iconPlacement = SwingConstants.BOTTOM; break;
|
||||
}
|
||||
putTabbedPanesClientProperty( TABBED_PANE_TAB_ICON_PLACEMENT, iconPlacement );
|
||||
TabIconPlacement value = iconPlacementField.getSelectedValue();
|
||||
int iconPlacement = (value != null) ? value.value : -1;
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setTabIconPlacement( iconPlacement );
|
||||
}
|
||||
|
||||
private void customBorderChanged() {
|
||||
@@ -252,13 +260,8 @@ public class FlatContainerTest
|
||||
}
|
||||
|
||||
private void tabPlacementChanged() {
|
||||
int tabPlacement = -1;
|
||||
switch( (String) tabPlacementField.getSelectedItem() ) {
|
||||
case "top": tabPlacement = SwingConstants.TOP; break;
|
||||
case "bottom": tabPlacement = SwingConstants.BOTTOM; break;
|
||||
case "left": tabPlacement = SwingConstants.LEFT; break;
|
||||
case "right": tabPlacement = SwingConstants.RIGHT; break;
|
||||
}
|
||||
TabPlacement value = tabPlacementField.getSelectedValue();
|
||||
int tabPlacement = (value != null) ? value.value : -1;
|
||||
|
||||
tabbedPane1.setTabPlacement( (tabPlacement >= 0) ? tabPlacement : SwingConstants.TOP );
|
||||
tabbedPane2.setTabPlacement( (tabPlacement >= 0) ? tabPlacement : SwingConstants.BOTTOM );
|
||||
@@ -267,49 +270,39 @@ public class FlatContainerTest
|
||||
}
|
||||
|
||||
private void tabsPopupPolicyChanged() {
|
||||
String value = (String) tabsPopupPolicyField.getSelectedItem();
|
||||
if( "default".equals( value ) )
|
||||
value = null;
|
||||
putTabbedPanesClientProperty( TABBED_PANE_TABS_POPUP_POLICY, value );
|
||||
TabsPopupPolicy value = tabsPopupPolicyField.getSelectedValue();
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setTabsPopupPolicy( value );
|
||||
}
|
||||
|
||||
private void scrollButtonsPolicyChanged() {
|
||||
String value = (String) scrollButtonsPolicyField.getSelectedItem();
|
||||
if( "default".equals( value ) )
|
||||
value = null;
|
||||
putTabbedPanesClientProperty( TABBED_PANE_SCROLL_BUTTONS_POLICY, value );
|
||||
ScrollButtonsPolicy value = scrollButtonsPolicyField.getSelectedValue();
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setScrollButtonsPolicy( value );
|
||||
}
|
||||
|
||||
private void scrollButtonsPlacementChanged() {
|
||||
String value = (String) scrollButtonsPlacementField.getSelectedItem();
|
||||
if( "default".equals( value ) )
|
||||
value = null;
|
||||
putTabbedPanesClientProperty( TABBED_PANE_SCROLL_BUTTONS_PLACEMENT, value );
|
||||
ScrollButtonsPlacement value = scrollButtonsPlacementField.getSelectedValue();
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setScrollButtonsPlacement( value );
|
||||
}
|
||||
|
||||
private void tabAreaAlignmentChanged() {
|
||||
String value = (String) tabAreaAlignmentField.getSelectedItem();
|
||||
if( "default".equals( value ) )
|
||||
value = null;
|
||||
putTabbedPanesClientProperty( TABBED_PANE_TAB_AREA_ALIGNMENT, value );
|
||||
TabAreaAlignment value = tabAreaAlignmentField.getSelectedValue();
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setTabAreaAlignment( value );
|
||||
}
|
||||
|
||||
private void tabAlignmentChanged() {
|
||||
String value = (String) tabAlignmentField.getSelectedItem();
|
||||
Integer tabAlignment = null;
|
||||
switch( value ) {
|
||||
case "center": tabAlignment = SwingConstants.CENTER; break;
|
||||
case "leading": tabAlignment = SwingConstants.LEADING; break;
|
||||
case "trailing": tabAlignment = SwingConstants.TRAILING; break;
|
||||
}
|
||||
putTabbedPanesClientProperty( TABBED_PANE_TAB_ALIGNMENT, tabAlignment );
|
||||
TabAlignment value = tabAlignmentField.getSelectedValue();
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setTabAlignment( value );
|
||||
}
|
||||
|
||||
private void tabWidthModeChanged() {
|
||||
String value = (String) tabWidthModeField.getSelectedItem();
|
||||
if( "default".equals( value ) )
|
||||
value = null;
|
||||
putTabbedPanesClientProperty( TABBED_PANE_TAB_WIDTH_MODE, value );
|
||||
TabWidthMode value = tabWidthModeField.getSelectedValue();
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setTabWidthMode( value );
|
||||
}
|
||||
|
||||
private void tabBackForegroundChanged() {
|
||||
@@ -349,65 +342,74 @@ public class FlatContainerTest
|
||||
|
||||
private void tabsClosableChanged() {
|
||||
boolean closable = tabsClosableCheckBox.isSelected();
|
||||
putTabbedPanesClientProperty( TABBED_PANE_TAB_CLOSABLE, closable ? true : null );
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setTabsClosable( closable );
|
||||
|
||||
if( closable ) {
|
||||
putTabbedPanesClientProperty( TABBED_PANE_TAB_CLOSE_CALLBACK,
|
||||
(BiConsumer<JTabbedPane, Integer>) (tabbedPane, tabIndex) -> {
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes ) {
|
||||
tabbedPane.setTabCloseCallback( (tabbedPane2, tabIndex) -> {
|
||||
AWTEvent e = EventQueue.getCurrentEvent();
|
||||
int modifiers = (e instanceof MouseEvent) ? ((MouseEvent)e).getModifiers() : 0;
|
||||
JOptionPane.showMessageDialog( this, "Closed tab '" + tabbedPane.getTitleAt( tabIndex ) + "'."
|
||||
JOptionPane.showMessageDialog( this, "Closed tab '" + tabbedPane2.getTitleAt( tabIndex ) + "'."
|
||||
+ "\n\n(modifiers: " + MouseEvent.getMouseModifiersText( modifiers ) + ")",
|
||||
"Tab Closed", JOptionPane.PLAIN_MESSAGE );
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void secondTabClosableChanged() {
|
||||
Boolean value = secondTabClosableCheckBox.getValue();
|
||||
Boolean closable = secondTabClosableCheckBox.getChecked();
|
||||
|
||||
for( JTabbedPane tabbedPane : allTabbedPanes ) {
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes ) {
|
||||
if( tabbedPane.getTabCount() > 1 ) {
|
||||
Component c = tabbedPane.getComponentAt( 1 );
|
||||
((JComponent)c).putClientProperty( TABBED_PANE_TAB_CLOSABLE, value );
|
||||
if( closable != null )
|
||||
tabbedPane.setTabClosable( 1, closable );
|
||||
else {
|
||||
JComponent c = (JComponent) tabbedPane.getComponentAt( 1 );
|
||||
c.putClientProperty( TABBED_PANE_TAB_CLOSABLE, null );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void tabAreaInsetsChanged() {
|
||||
Insets insets = tabAreaInsetsCheckBox.isSelected() ? new Insets( 5, 5, 10, 10 ) : null;
|
||||
putTabbedPanesClientProperty( TABBED_PANE_TAB_AREA_INSETS, insets );
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setTabAreaInsets( insets );
|
||||
}
|
||||
|
||||
private void smallerTabHeightChanged() {
|
||||
Integer tabHeight = smallerTabHeightCheckBox.isSelected() ? 26 : null;
|
||||
putTabbedPanesClientProperty( TABBED_PANE_TAB_HEIGHT, tabHeight );
|
||||
int tabHeight = smallerTabHeightCheckBox.isSelected() ? 26 : -1;
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setTabHeight( tabHeight );
|
||||
}
|
||||
|
||||
private void smallerInsetsChanged() {
|
||||
Insets insets = smallerInsetsCheckBox.isSelected() ? new Insets( 2, 2, 2, 2 ) : null;
|
||||
putTabbedPanesClientProperty( TABBED_PANE_TAB_INSETS, insets );
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setTabInsets( insets );
|
||||
}
|
||||
|
||||
private void secondTabWiderChanged() {
|
||||
Insets insets = secondTabWiderCheckBox.isSelected() ? new Insets( 4, 20, 4, 20 ) : null;
|
||||
|
||||
for( JTabbedPane tabbedPane : allTabbedPanes ) {
|
||||
if( tabbedPane.getTabCount() > 1 ) {
|
||||
Component c = tabbedPane.getComponentAt( 1 );
|
||||
((JComponent)c).putClientProperty( TABBED_PANE_TAB_INSETS, insets );
|
||||
}
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes ) {
|
||||
if( tabbedPane.getTabCount() > 1 )
|
||||
tabbedPane.setTabInsets( 1, insets );
|
||||
}
|
||||
}
|
||||
|
||||
private void minimumTabWidthChanged() {
|
||||
Integer minimumTabWidth = minimumTabWidthCheckBox.isSelected() ? 100 : null;
|
||||
putTabbedPanesClientProperty( TABBED_PANE_MINIMUM_TAB_WIDTH, minimumTabWidth );
|
||||
int minimumTabWidth = minimumTabWidthCheckBox.isSelected() ? 100 : -1;
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setMinimumTabWidth( minimumTabWidth );
|
||||
}
|
||||
|
||||
private void maximumTabWidthChanged() {
|
||||
Integer maximumTabWidth = maximumTabWidthCheckBox.isSelected() ? 60 : null;
|
||||
putTabbedPanesClientProperty( TABBED_PANE_MAXIMUM_TAB_WIDTH, maximumTabWidth );
|
||||
int maximumTabWidth = maximumTabWidthCheckBox.isSelected() ? 60 : -1;
|
||||
for( FlatTabbedPane tabbedPane : allTabbedPanes )
|
||||
tabbedPane.setMaximumTabWidth( maximumTabWidth );
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
@@ -424,10 +426,10 @@ public class FlatContainerTest
|
||||
JPanel panel13 = new JPanel();
|
||||
JLabel label4 = new JLabel();
|
||||
JLabel tabbedPaneLabel = new JLabel();
|
||||
tabbedPane1 = new JTabbedPane();
|
||||
tabbedPane3 = new JTabbedPane();
|
||||
tabbedPane2 = new JTabbedPane();
|
||||
tabbedPane4 = new JTabbedPane();
|
||||
tabbedPane1 = new FlatTabbedPane();
|
||||
tabbedPane3 = new FlatTabbedPane();
|
||||
tabbedPane2 = new FlatTabbedPane();
|
||||
tabbedPane4 = new FlatTabbedPane();
|
||||
FlatTestFrame.NoRightToLeftPanel tabbedPaneControlPanel = new FlatTestFrame.NoRightToLeftPanel();
|
||||
tabScrollCheckBox = new JCheckBox();
|
||||
JLabel tabCountLabel = new JLabel();
|
||||
@@ -436,24 +438,24 @@ public class FlatContainerTest
|
||||
htmlTabsCheckBox = new JCheckBox();
|
||||
multiLineTabsCheckBox = new JCheckBox();
|
||||
JLabel tabsPopupPolicyLabel = new JLabel();
|
||||
tabsPopupPolicyField = new JComboBox<>();
|
||||
tabsPopupPolicyField = new FlatTestEnumComboBox<>();
|
||||
tabBackForegroundCheckBox = new JCheckBox();
|
||||
JLabel scrollButtonsPolicyLabel = new JLabel();
|
||||
scrollButtonsPolicyField = new JComboBox<>();
|
||||
scrollButtonsPolicyField = new FlatTestEnumComboBox<>();
|
||||
tabIconsCheckBox = new JCheckBox();
|
||||
tabIconSizeSpinner = new JSpinner();
|
||||
iconPlacementField = new JComboBox<>();
|
||||
iconPlacementField = new FlatTestEnumComboBox<>();
|
||||
JLabel scrollButtonsPlacementLabel = new JLabel();
|
||||
scrollButtonsPlacementField = new JComboBox<>();
|
||||
scrollButtonsPlacementField = new FlatTestEnumComboBox<>();
|
||||
tabsClosableCheckBox = new JCheckBox();
|
||||
JLabel tabPlacementLabel = new JLabel();
|
||||
tabPlacementField = new JComboBox<>();
|
||||
secondTabClosableCheckBox = new TriStateCheckBox();
|
||||
tabPlacementField = new FlatTestEnumComboBox<>();
|
||||
secondTabClosableCheckBox = new FlatTriStateCheckBox();
|
||||
JLabel tabAreaAlignmentLabel = new JLabel();
|
||||
tabAreaAlignmentField = new JComboBox<>();
|
||||
tabAlignmentField = new JComboBox<>();
|
||||
tabAreaAlignmentField = new FlatTestEnumComboBox<>();
|
||||
tabAlignmentField = new FlatTestEnumComboBox<>();
|
||||
JLabel tabWidthModeLabel = new JLabel();
|
||||
tabWidthModeField = new JComboBox<>();
|
||||
tabWidthModeField = new FlatTestEnumComboBox<>();
|
||||
leadingComponentCheckBox = new JCheckBox();
|
||||
customBorderCheckBox = new JCheckBox();
|
||||
tabAreaInsetsCheckBox = new JCheckBox();
|
||||
@@ -623,11 +625,6 @@ public class FlatContainerTest
|
||||
tabbedPaneControlPanel.add(tabsPopupPolicyLabel, "cell 0 1");
|
||||
|
||||
//---- tabsPopupPolicyField ----
|
||||
tabsPopupPolicyField.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"default",
|
||||
"asNeeded",
|
||||
"never"
|
||||
}));
|
||||
tabsPopupPolicyField.addActionListener(e -> tabsPopupPolicyChanged());
|
||||
tabbedPaneControlPanel.add(tabsPopupPolicyField, "cell 1 1");
|
||||
|
||||
@@ -641,12 +638,6 @@ public class FlatContainerTest
|
||||
tabbedPaneControlPanel.add(scrollButtonsPolicyLabel, "cell 0 2");
|
||||
|
||||
//---- scrollButtonsPolicyField ----
|
||||
scrollButtonsPolicyField.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"default",
|
||||
"asNeededSingle",
|
||||
"asNeeded",
|
||||
"never"
|
||||
}));
|
||||
scrollButtonsPolicyField.addActionListener(e -> scrollButtonsPolicyChanged());
|
||||
tabbedPaneControlPanel.add(scrollButtonsPolicyField, "cell 1 2");
|
||||
|
||||
@@ -662,12 +653,7 @@ public class FlatContainerTest
|
||||
tabbedPaneControlPanel.add(tabIconSizeSpinner, "cell 2 2");
|
||||
|
||||
//---- iconPlacementField ----
|
||||
iconPlacementField.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"leading",
|
||||
"trailing",
|
||||
"top",
|
||||
"bottom"
|
||||
}));
|
||||
iconPlacementField.setEnabled(false);
|
||||
iconPlacementField.addActionListener(e -> iconPlacementChanged());
|
||||
tabbedPaneControlPanel.add(iconPlacementField, "cell 2 2");
|
||||
|
||||
@@ -676,11 +662,6 @@ public class FlatContainerTest
|
||||
tabbedPaneControlPanel.add(scrollButtonsPlacementLabel, "cell 0 3");
|
||||
|
||||
//---- scrollButtonsPlacementField ----
|
||||
scrollButtonsPlacementField.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"default",
|
||||
"both",
|
||||
"trailing"
|
||||
}));
|
||||
scrollButtonsPlacementField.addActionListener(e -> scrollButtonsPlacementChanged());
|
||||
tabbedPaneControlPanel.add(scrollButtonsPlacementField, "cell 1 3");
|
||||
|
||||
@@ -694,13 +675,6 @@ public class FlatContainerTest
|
||||
tabbedPaneControlPanel.add(tabPlacementLabel, "cell 0 4");
|
||||
|
||||
//---- tabPlacementField ----
|
||||
tabPlacementField.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"default",
|
||||
"top",
|
||||
"bottom",
|
||||
"left",
|
||||
"right"
|
||||
}));
|
||||
tabPlacementField.addActionListener(e -> tabPlacementChanged());
|
||||
tabbedPaneControlPanel.add(tabPlacementField, "cell 1 4");
|
||||
|
||||
@@ -714,23 +688,10 @@ public class FlatContainerTest
|
||||
tabbedPaneControlPanel.add(tabAreaAlignmentLabel, "cell 0 5");
|
||||
|
||||
//---- tabAreaAlignmentField ----
|
||||
tabAreaAlignmentField.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"default",
|
||||
"leading",
|
||||
"trailing",
|
||||
"center",
|
||||
"fill"
|
||||
}));
|
||||
tabAreaAlignmentField.addActionListener(e -> tabAreaAlignmentChanged());
|
||||
tabbedPaneControlPanel.add(tabAreaAlignmentField, "cell 1 5");
|
||||
|
||||
//---- tabAlignmentField ----
|
||||
tabAlignmentField.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"default",
|
||||
"leading",
|
||||
"trailing",
|
||||
"center"
|
||||
}));
|
||||
tabAlignmentField.addActionListener(e -> tabAlignmentChanged());
|
||||
tabbedPaneControlPanel.add(tabAlignmentField, "cell 1 5");
|
||||
|
||||
@@ -739,12 +700,6 @@ public class FlatContainerTest
|
||||
tabbedPaneControlPanel.add(tabWidthModeLabel, "cell 2 5");
|
||||
|
||||
//---- tabWidthModeField ----
|
||||
tabWidthModeField.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"default",
|
||||
"preferred",
|
||||
"equal",
|
||||
"compact"
|
||||
}));
|
||||
tabWidthModeField.addActionListener(e -> tabWidthModeChanged());
|
||||
tabbedPaneControlPanel.add(tabWidthModeField, "cell 2 5");
|
||||
|
||||
@@ -818,32 +773,32 @@ public class FlatContainerTest
|
||||
add(panel9, "cell 0 0");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
|
||||
allTabbedPanes = new JTabbedPane[] { tabbedPane1, tabbedPane2, tabbedPane3, tabbedPane4 };
|
||||
allTabbedPanes = new FlatTabbedPane[] { tabbedPane1, tabbedPane2, tabbedPane3, tabbedPane4 };
|
||||
}
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
private JTabbedPane tabbedPane1;
|
||||
private JTabbedPane tabbedPane3;
|
||||
private JTabbedPane tabbedPane2;
|
||||
private JTabbedPane tabbedPane4;
|
||||
private FlatTabbedPane tabbedPane1;
|
||||
private FlatTabbedPane tabbedPane3;
|
||||
private FlatTabbedPane tabbedPane2;
|
||||
private FlatTabbedPane tabbedPane4;
|
||||
private JCheckBox tabScrollCheckBox;
|
||||
private JSpinner tabCountSpinner;
|
||||
private JCheckBox customTabsCheckBox;
|
||||
private JCheckBox htmlTabsCheckBox;
|
||||
private JCheckBox multiLineTabsCheckBox;
|
||||
private JComboBox<String> tabsPopupPolicyField;
|
||||
private FlatTestEnumComboBox<TabsPopupPolicy> tabsPopupPolicyField;
|
||||
private JCheckBox tabBackForegroundCheckBox;
|
||||
private JComboBox<String> scrollButtonsPolicyField;
|
||||
private FlatTestEnumComboBox<ScrollButtonsPolicy> scrollButtonsPolicyField;
|
||||
private JCheckBox tabIconsCheckBox;
|
||||
private JSpinner tabIconSizeSpinner;
|
||||
private JComboBox<String> iconPlacementField;
|
||||
private JComboBox<String> scrollButtonsPlacementField;
|
||||
private FlatTestEnumComboBox<TabIconPlacement> iconPlacementField;
|
||||
private FlatTestEnumComboBox<ScrollButtonsPlacement> scrollButtonsPlacementField;
|
||||
private JCheckBox tabsClosableCheckBox;
|
||||
private JComboBox<String> tabPlacementField;
|
||||
private TriStateCheckBox secondTabClosableCheckBox;
|
||||
private JComboBox<String> tabAreaAlignmentField;
|
||||
private JComboBox<String> tabAlignmentField;
|
||||
private JComboBox<String> tabWidthModeField;
|
||||
private FlatTestEnumComboBox<TabPlacement> tabPlacementField;
|
||||
private FlatTriStateCheckBox secondTabClosableCheckBox;
|
||||
private FlatTestEnumComboBox<TabAreaAlignment> tabAreaAlignmentField;
|
||||
private FlatTestEnumComboBox<TabAlignment> tabAlignmentField;
|
||||
private FlatTestEnumComboBox<TabWidthMode> tabWidthModeField;
|
||||
private JCheckBox leadingComponentCheckBox;
|
||||
private JCheckBox customBorderCheckBox;
|
||||
private JCheckBox tabAreaInsetsCheckBox;
|
||||
@@ -859,7 +814,37 @@ public class FlatContainerTest
|
||||
private JCheckBox hideTabAreaWithOneTabCheckBox;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
|
||||
private JTabbedPane[] allTabbedPanes;
|
||||
private FlatTabbedPane[] allTabbedPanes;
|
||||
|
||||
//---- enum TabPlacement --------------------------------------------------
|
||||
|
||||
enum TabPlacement {
|
||||
top( SwingConstants.TOP ),
|
||||
bottom( SwingConstants.BOTTOM ),
|
||||
left( SwingConstants.LEFT ),
|
||||
right( SwingConstants.RIGHT );
|
||||
|
||||
public final int value;
|
||||
|
||||
TabPlacement( int value ) {
|
||||
this.value = value;
|
||||
}
|
||||
};
|
||||
|
||||
//---- enum TabIconPlacement ----------------------------------------------
|
||||
|
||||
enum TabIconPlacement {
|
||||
leading( SwingConstants.LEADING ),
|
||||
trailing( SwingConstants.TRAILING ),
|
||||
top( SwingConstants.TOP ),
|
||||
bottom( SwingConstants.BOTTOM );
|
||||
|
||||
public final int value;
|
||||
|
||||
TabIconPlacement( int value ) {
|
||||
this.value = value;
|
||||
}
|
||||
};
|
||||
|
||||
//---- class Tab1Panel ----------------------------------------------------
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ new FormModel {
|
||||
"gridX": 1
|
||||
"gridY": 5
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
|
||||
add( new FormContainer( "com.formdev.flatlaf.extras.components.FlatTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
|
||||
name: "tabbedPane1"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
@@ -100,7 +100,7 @@ new FormModel {
|
||||
"gridX": 1
|
||||
"gridY": 7
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
|
||||
add( new FormContainer( "com.formdev.flatlaf.extras.components.FlatTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
|
||||
name: "tabbedPane3"
|
||||
"tabPlacement": 2
|
||||
auxiliary() {
|
||||
@@ -110,7 +110,7 @@ new FormModel {
|
||||
"gridX": 3
|
||||
"gridY": 7
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
|
||||
add( new FormContainer( "com.formdev.flatlaf.extras.components.FlatTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
|
||||
name: "tabbedPane2"
|
||||
"tabPlacement": 3
|
||||
auxiliary() {
|
||||
@@ -119,7 +119,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
|
||||
"gridY": 9
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
|
||||
add( new FormContainer( "com.formdev.flatlaf.extras.components.FlatTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
|
||||
name: "tabbedPane4"
|
||||
"tabPlacement": 4
|
||||
auxiliary() {
|
||||
@@ -202,17 +202,11 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatTestEnumComboBox" ) {
|
||||
name: "tabsPopupPolicyField"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "default"
|
||||
addElement( "default" )
|
||||
addElement( "asNeeded" )
|
||||
addElement( "never" )
|
||||
}
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
"JavaCodeGenerator.typeParameters": "TabsPopupPolicy"
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabsPopupPolicyChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
@@ -234,18 +228,11 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatTestEnumComboBox" ) {
|
||||
name: "scrollButtonsPolicyField"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "default"
|
||||
addElement( "default" )
|
||||
addElement( "asNeededSingle" )
|
||||
addElement( "asNeeded" )
|
||||
addElement( "never" )
|
||||
}
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
"JavaCodeGenerator.typeParameters": "ScrollButtonsPolicy"
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "scrollButtonsPolicyChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
@@ -280,18 +267,12 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatTestEnumComboBox" ) {
|
||||
name: "iconPlacementField"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "leading"
|
||||
addElement( "leading" )
|
||||
addElement( "trailing" )
|
||||
addElement( "top" )
|
||||
addElement( "bottom" )
|
||||
}
|
||||
"enabled": false
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
"JavaCodeGenerator.typeParameters": "TabIconPlacement"
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "iconPlacementChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
@@ -303,17 +284,11 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatTestEnumComboBox" ) {
|
||||
name: "scrollButtonsPlacementField"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "default"
|
||||
addElement( "default" )
|
||||
addElement( "both" )
|
||||
addElement( "trailing" )
|
||||
}
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
"JavaCodeGenerator.typeParameters": "ScrollButtonsPlacement"
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "scrollButtonsPlacementChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
@@ -335,25 +310,17 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatTestEnumComboBox" ) {
|
||||
name: "tabPlacementField"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "default"
|
||||
addElement( "default" )
|
||||
addElement( "top" )
|
||||
addElement( "bottom" )
|
||||
addElement( "left" )
|
||||
addElement( "right" )
|
||||
}
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
"JavaCodeGenerator.typeParameters": "TabPlacement"
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabPlacementChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 4"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) {
|
||||
name: "secondTabClosableCheckBox"
|
||||
"text": "Second Tab closable"
|
||||
auxiliary() {
|
||||
@@ -369,36 +336,21 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 5"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatTestEnumComboBox" ) {
|
||||
name: "tabAreaAlignmentField"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "default"
|
||||
addElement( "default" )
|
||||
addElement( "leading" )
|
||||
addElement( "trailing" )
|
||||
addElement( "center" )
|
||||
addElement( "fill" )
|
||||
}
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
"JavaCodeGenerator.typeParameters": "TabAreaAlignment"
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabAreaAlignmentChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 5"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatTestEnumComboBox" ) {
|
||||
name: "tabAlignmentField"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "default"
|
||||
addElement( "default" )
|
||||
addElement( "leading" )
|
||||
addElement( "trailing" )
|
||||
addElement( "center" )
|
||||
}
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
"JavaCodeGenerator.typeParameters": "TabAlignment"
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabAlignmentChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
@@ -410,18 +362,11 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 5"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatTestEnumComboBox" ) {
|
||||
name: "tabWidthModeField"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "default"
|
||||
addElement( "default" )
|
||||
addElement( "preferred" )
|
||||
addElement( "equal" )
|
||||
addElement( "compact" )
|
||||
}
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
"JavaCodeGenerator.typeParameters": "TabWidthMode"
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabWidthModeChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import javax.swing.*;
|
||||
import com.formdev.flatlaf.util.StringUtils;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
import net.miginfocom.swing.*;
|
||||
import org.jdesktop.swingx.*;
|
||||
|
||||
/**
|
||||
* @author Karl Tauber
|
||||
@@ -89,6 +90,12 @@ public class FlatHtmlTest
|
||||
label14 = new JLabel();
|
||||
label15 = new JLabel();
|
||||
label16 = new JLabel();
|
||||
label17 = new JLabel();
|
||||
comboBox1 = new JComboBox<>();
|
||||
comboBox2 = new JComboBox<>();
|
||||
label18 = new JLabel();
|
||||
xHyperlink1 = new JXHyperlink();
|
||||
xHyperlink2 = new JXHyperlink();
|
||||
label1 = new JLabel();
|
||||
scrollPane15 = new JScrollPane();
|
||||
editorPane1 = new JEditorPane();
|
||||
@@ -150,6 +157,8 @@ public class FlatHtmlTest
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- label5 ----
|
||||
@@ -283,6 +292,38 @@ public class FlatHtmlTest
|
||||
label16.setText("(move mouse here)");
|
||||
label16.setToolTipText("Some text");
|
||||
panel1.add(label16, "cell 2 9");
|
||||
|
||||
//---- label17 ----
|
||||
label17.setText("JComboBox:");
|
||||
panel1.add(label17, "cell 0 10");
|
||||
|
||||
//---- comboBox1 ----
|
||||
comboBox1.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"<html>Some <b>Bold</b> Text",
|
||||
"abc",
|
||||
"def"
|
||||
}));
|
||||
panel1.add(comboBox1, "cell 1 10");
|
||||
|
||||
//---- comboBox2 ----
|
||||
comboBox2.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"Some Text",
|
||||
"abc",
|
||||
"def"
|
||||
}));
|
||||
panel1.add(comboBox2, "cell 2 10");
|
||||
|
||||
//---- label18 ----
|
||||
label18.setText("JXHyperlink:");
|
||||
panel1.add(label18, "cell 0 11");
|
||||
|
||||
//---- xHyperlink1 ----
|
||||
xHyperlink1.setText("<html>Some <b>Bold</b> Text");
|
||||
panel1.add(xHyperlink1, "cell 1 11");
|
||||
|
||||
//---- xHyperlink2 ----
|
||||
xHyperlink2.setText("Some text");
|
||||
panel1.add(xHyperlink2, "cell 2 11");
|
||||
}
|
||||
add(panel1, "cell 4 0 1 3,aligny top,growy 0");
|
||||
|
||||
@@ -400,6 +441,12 @@ public class FlatHtmlTest
|
||||
private JLabel label14;
|
||||
private JLabel label15;
|
||||
private JLabel label16;
|
||||
private JLabel label17;
|
||||
private JComboBox<String> comboBox1;
|
||||
private JComboBox<String> comboBox2;
|
||||
private JLabel label18;
|
||||
private JXHyperlink xHyperlink1;
|
||||
private JXHyperlink xHyperlink2;
|
||||
private JLabel label1;
|
||||
private JScrollPane scrollPane15;
|
||||
private JEditorPane editorPane1;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.2.0.298" Java: "14" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -36,7 +36,7 @@ new FormModel {
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3"
|
||||
"$columnConstraints": "[fill][fill][fill]"
|
||||
"$rowConstraints": "[][][][][][][][][][]"
|
||||
"$rowConstraints": "[][][][][][][][][][][][]"
|
||||
} ) {
|
||||
name: "panel1"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
@@ -227,6 +227,52 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 9"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label17"
|
||||
"text": "JComboBox:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 10"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
name: "comboBox1"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "<html>Some <b>Bold</b> Text"
|
||||
addElement( "<html>Some <b>Bold</b> Text" )
|
||||
addElement( "abc" )
|
||||
addElement( "def" )
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 10"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
name: "comboBox2"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "Some Text"
|
||||
addElement( "Some Text" )
|
||||
addElement( "abc" )
|
||||
addElement( "def" )
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 10"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label18"
|
||||
"text": "JXHyperlink:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 11"
|
||||
} )
|
||||
add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) {
|
||||
name: "xHyperlink1"
|
||||
"text": "<html>Some <b>Bold</b> Text"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 11"
|
||||
} )
|
||||
add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) {
|
||||
name: "xHyperlink2"
|
||||
"text": "Some text"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 11"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 0 1 3,aligny top,growy 0"
|
||||
} )
|
||||
@@ -296,7 +342,7 @@ new FormModel {
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 695, 755 )
|
||||
"size": new java.awt.Dimension( 820, 755 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.formdev.flatlaf.testing;
|
||||
import java.awt.*;
|
||||
import java.beans.PropertyVetoException;
|
||||
import javax.swing.*;
|
||||
import com.formdev.flatlaf.extras.TriStateCheckBox;
|
||||
import com.formdev.flatlaf.extras.components.FlatTriStateCheckBox;
|
||||
import com.formdev.flatlaf.icons.FlatFileViewFloppyDriveIcon;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
import net.miginfocom.swing.*;
|
||||
@@ -63,9 +63,9 @@ public class FlatInternalFrameTest
|
||||
maximizableCheckBox.isSelected(),
|
||||
iconifiableCheckBox.isSelected() );
|
||||
|
||||
if( iconCheckBox.getState() == TriStateCheckBox.State.SELECTED )
|
||||
if( iconCheckBox.getState() == FlatTriStateCheckBox.State.SELECTED )
|
||||
internalFrame.setFrameIcon( new FlatFileViewFloppyDriveIcon() );
|
||||
else if( iconCheckBox.getState() == TriStateCheckBox.State.UNSELECTED )
|
||||
else if( iconCheckBox.getState() == FlatTriStateCheckBox.State.UNSELECTED )
|
||||
internalFrame.setFrameIcon( null );
|
||||
|
||||
if( menuBarCheckBox.isSelected() ) {
|
||||
@@ -115,7 +115,7 @@ public class FlatInternalFrameTest
|
||||
closableCheckBox = new JCheckBox();
|
||||
iconifiableCheckBox = new JCheckBox();
|
||||
maximizableCheckBox = new JCheckBox();
|
||||
iconCheckBox = new TriStateCheckBox();
|
||||
iconCheckBox = new FlatTriStateCheckBox();
|
||||
menuBarCheckBox = new JCheckBox();
|
||||
titleLabel = new JLabel();
|
||||
titleField = new JTextField();
|
||||
@@ -207,7 +207,7 @@ public class FlatInternalFrameTest
|
||||
private JCheckBox closableCheckBox;
|
||||
private JCheckBox iconifiableCheckBox;
|
||||
private JCheckBox maximizableCheckBox;
|
||||
private TriStateCheckBox iconCheckBox;
|
||||
private FlatTriStateCheckBox iconCheckBox;
|
||||
private JCheckBox menuBarCheckBox;
|
||||
private JLabel titleLabel;
|
||||
private JTextField titleField;
|
||||
|
||||
@@ -50,7 +50,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1,alignx left,growx 0"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) {
|
||||
name: "iconCheckBox"
|
||||
"text": "Frame icon"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
|
||||
@@ -180,7 +180,7 @@ public class FlatPaintingStringTest
|
||||
@Override
|
||||
protected void paintComponent( Graphics g ) {
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g2 );
|
||||
|
||||
// simulate component y position at a fraction
|
||||
if( scaleFactor > 1 && SystemInfo.isJava_9_orLater )
|
||||
@@ -241,6 +241,8 @@ public class FlatPaintingStringTest
|
||||
double textY = t.getTranslateY() + (y * t.getScaleY());
|
||||
setToolTipText( textY + " + " + yCorrection + " = " + (textY + yCorrection) );
|
||||
}
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g2, oldRenderingHints );
|
||||
}
|
||||
|
||||
private int scale( int value ) {
|
||||
|
||||
@@ -471,7 +471,7 @@ public class FlatPaintingTest
|
||||
@Override
|
||||
protected void paintComponent( Graphics g ) {
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g2 );
|
||||
|
||||
g2.scale( scale, scale );
|
||||
g2.translate( 1, 1 );
|
||||
@@ -503,6 +503,8 @@ public class FlatPaintingTest
|
||||
g2d.setColor( Color.magenta );
|
||||
g2d.drawRect( x2 - gap, y2 - gap, width2 + (gap * 2) - 1, height2 + (gap * 2) - 1 );
|
||||
} );
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g2, oldRenderingHints );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright 2020 FormDev Software GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.formdev.flatlaf.testing;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.util.Objects;
|
||||
import javax.swing.AbstractListModel;
|
||||
import javax.swing.ComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.plaf.basic.BasicComboBoxRenderer;
|
||||
|
||||
/**
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatTestEnumComboBox<E>
|
||||
extends JComboBox<E>
|
||||
{
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public void init( Class<E> enumType, boolean supportDefault ) {
|
||||
setRenderer( new EnumComboBoxRenderer() );
|
||||
setModel( new EnumComboBoxModel<>( enumType, supportDefault ) );
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public E getSelectedValue() {
|
||||
return (E) getSelectedItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSelectedIndex() {
|
||||
if( getSelectedItem() == null && getItemCount() > 0 && getItemAt( 0 ) == null )
|
||||
return 0;
|
||||
|
||||
return super.getSelectedIndex();
|
||||
}
|
||||
|
||||
//---- class EnumComboBoxRenderer -----------------------------------------
|
||||
|
||||
public static class EnumComboBoxRenderer
|
||||
extends BasicComboBoxRenderer
|
||||
{
|
||||
@SuppressWarnings( "rawtypes" )
|
||||
@Override
|
||||
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus ) {
|
||||
setEnabled( value != null || isSelected );
|
||||
if( value == null )
|
||||
value = "(default)";
|
||||
return super.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus );
|
||||
}
|
||||
}
|
||||
|
||||
//---- class EnumComboBoxModel --------------------------------------------
|
||||
|
||||
public static class EnumComboBoxModel<E>
|
||||
extends AbstractListModel<E>
|
||||
implements ComboBoxModel<E>
|
||||
{
|
||||
private final boolean supportDefault;
|
||||
private final E[] values;
|
||||
private Object selectedItem;
|
||||
|
||||
public EnumComboBoxModel( Class<E> enumType, boolean supportDefault ) {
|
||||
this.supportDefault = supportDefault;
|
||||
values = enumType.getEnumConstants();
|
||||
|
||||
if( !supportDefault )
|
||||
selectedItem = values[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return values.length + (supportDefault ? 1 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public E getElementAt( int index ) {
|
||||
if( supportDefault ) {
|
||||
if( index == 0 )
|
||||
return null;
|
||||
index--;
|
||||
}
|
||||
return values[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSelectedItem() {
|
||||
return selectedItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedItem( Object anItem ) {
|
||||
if( !Objects.equals( selectedItem, anItem ) ) {
|
||||
selectedItem = anItem;
|
||||
fireContentsChanged( this, -1, -1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,8 @@ import com.formdev.flatlaf.demo.LookAndFeelsComboBox;
|
||||
import com.formdev.flatlaf.demo.DemoPrefs;
|
||||
import com.formdev.flatlaf.demo.intellijthemes.*;
|
||||
import com.formdev.flatlaf.extras.*;
|
||||
import com.formdev.flatlaf.extras.TriStateCheckBox.State;
|
||||
import com.formdev.flatlaf.extras.components.FlatTriStateCheckBox;
|
||||
import com.formdev.flatlaf.extras.components.FlatTriStateCheckBox.State;
|
||||
import com.formdev.flatlaf.ui.FlatUIUtils;
|
||||
import com.formdev.flatlaf.util.SystemInfo;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
@@ -67,6 +68,9 @@ public class FlatTestFrame
|
||||
public boolean applyComponentOrientationToFrame;
|
||||
|
||||
public static FlatTestFrame create( String[] args, String title ) {
|
||||
// disable text antialiasing
|
||||
// System.setProperty( "awt.useSystemAAFontSettings", "off" );
|
||||
|
||||
DemoPrefs.init( PREFS_ROOT_PATH );
|
||||
|
||||
// set scale factor
|
||||
@@ -660,7 +664,7 @@ public class FlatTestFrame
|
||||
inspectCheckBox = new JCheckBox();
|
||||
explicitColorsCheckBox = new JCheckBox();
|
||||
backgroundCheckBox = new JCheckBox();
|
||||
opaqueTriStateCheckBox = new TriStateCheckBox();
|
||||
opaqueTriStateCheckBox = new FlatTriStateCheckBox();
|
||||
sizeVariantComboBox = new JComboBox<>();
|
||||
closeButton = new JButton();
|
||||
themesPanel = new IJThemesPanel();
|
||||
@@ -805,7 +809,7 @@ public class FlatTestFrame
|
||||
private JCheckBox inspectCheckBox;
|
||||
private JCheckBox explicitColorsCheckBox;
|
||||
private JCheckBox backgroundCheckBox;
|
||||
private TriStateCheckBox opaqueTriStateCheckBox;
|
||||
private FlatTriStateCheckBox opaqueTriStateCheckBox;
|
||||
private JComboBox<String> sizeVariantComboBox;
|
||||
private JButton closeButton;
|
||||
private IJThemesPanel themesPanel;
|
||||
|
||||
@@ -107,7 +107,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 7 0"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) {
|
||||
name: "opaqueTriStateCheckBox"
|
||||
"text": "opaque"
|
||||
"mnemonic": 79
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.formdev.flatlaf.testing.extras;
|
||||
|
||||
import javax.swing.*;
|
||||
import com.formdev.flatlaf.extras.*;
|
||||
import com.formdev.flatlaf.extras.components.*;
|
||||
import com.formdev.flatlaf.testing.*;
|
||||
import net.miginfocom.swing.*;
|
||||
|
||||
@@ -37,8 +38,8 @@ public class FlatExtrasTest
|
||||
public FlatExtrasTest() {
|
||||
initComponents();
|
||||
|
||||
triStateLabel1.setText( triStateCheckBox1.getState().toString() );
|
||||
triStateLabel2.setText( triStateCheckBox2.getState().toString() );
|
||||
triStateCheckBox1Changed();
|
||||
triStateCheckBox2Changed();
|
||||
|
||||
addSVGIcon( "actions/copy.svg" );
|
||||
addSVGIcon( "actions/colors.svg" );
|
||||
@@ -89,6 +90,10 @@ public class FlatExtrasTest
|
||||
triStateLabel2.setText( triStateCheckBox2.getState().toString() );
|
||||
}
|
||||
|
||||
private void triStateCheckBox3Changed() {
|
||||
triStateLabel3.setText( triStateCheckBox3.getState().toString() );
|
||||
}
|
||||
|
||||
private void disabledChanged() {
|
||||
boolean enabled = !disabledCheckBox.isSelected();
|
||||
|
||||
@@ -117,9 +122,11 @@ public class FlatExtrasTest
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||
label1 = new JLabel();
|
||||
triStateCheckBox1 = new TriStateCheckBox();
|
||||
triStateCheckBox1 = new FlatTriStateCheckBox();
|
||||
triStateLabel1 = new JLabel();
|
||||
triStateCheckBox2 = new TriStateCheckBox();
|
||||
triStateCheckBox3 = new FlatTriStateCheckBox();
|
||||
triStateLabel3 = new JLabel();
|
||||
triStateCheckBox2 = new FlatTriStateCheckBox();
|
||||
triStateLabel2 = new JLabel();
|
||||
label2 = new JLabel();
|
||||
svgIconsPanel = new JPanel();
|
||||
@@ -165,20 +172,31 @@ public class FlatExtrasTest
|
||||
triStateLabel1.setEnabled(false);
|
||||
add(triStateLabel1, "cell 2 0,gapx 30");
|
||||
|
||||
//---- triStateCheckBox3 ----
|
||||
triStateCheckBox3.setText("alt state cycle order");
|
||||
triStateCheckBox3.setAltStateCycleOrder(true);
|
||||
triStateCheckBox3.addActionListener(e -> triStateCheckBox3Changed());
|
||||
add(triStateCheckBox3, "cell 1 1");
|
||||
|
||||
//---- triStateLabel3 ----
|
||||
triStateLabel3.setText("text");
|
||||
triStateLabel3.setEnabled(false);
|
||||
add(triStateLabel3, "cell 2 1,gapx 30");
|
||||
|
||||
//---- triStateCheckBox2 ----
|
||||
triStateCheckBox2.setText("third state disabled");
|
||||
triStateCheckBox2.setThirdStateEnabled(false);
|
||||
triStateCheckBox2.setAllowIndeterminate(false);
|
||||
triStateCheckBox2.addActionListener(e -> triStateCheckBox2Changed());
|
||||
add(triStateCheckBox2, "cell 1 1");
|
||||
add(triStateCheckBox2, "cell 1 2");
|
||||
|
||||
//---- triStateLabel2 ----
|
||||
triStateLabel2.setText("text");
|
||||
triStateLabel2.setEnabled(false);
|
||||
add(triStateLabel2, "cell 2 1,gapx 30");
|
||||
add(triStateLabel2, "cell 2 2,gapx 30");
|
||||
|
||||
//---- label2 ----
|
||||
label2.setText("SVG Icons:");
|
||||
add(label2, "cell 0 2");
|
||||
add(label2, "cell 0 3");
|
||||
|
||||
//======== svgIconsPanel ========
|
||||
{
|
||||
@@ -189,58 +207,60 @@ public class FlatExtrasTest
|
||||
// rows
|
||||
"[grow,center]"));
|
||||
}
|
||||
add(svgIconsPanel, "cell 1 2 2 1");
|
||||
add(svgIconsPanel, "cell 1 3 2 1");
|
||||
|
||||
//---- label3 ----
|
||||
label3.setText("The icons may change colors when switching to another theme.");
|
||||
add(label3, "cell 1 3 2 1");
|
||||
add(label3, "cell 1 4 2 1");
|
||||
|
||||
//---- label4 ----
|
||||
label4.setText("Disabled SVG Icons:");
|
||||
add(label4, "cell 0 4");
|
||||
add(label4, "cell 0 5");
|
||||
|
||||
//---- disabledLabel ----
|
||||
disabledLabel.setText("label");
|
||||
add(disabledLabel, "cell 1 4 2 1");
|
||||
add(disabledLabel, "cell 1 5 2 1");
|
||||
|
||||
//---- disabledButton ----
|
||||
disabledButton.setText("button");
|
||||
add(disabledButton, "cell 1 4 2 1");
|
||||
add(disabledTabbedPane, "cell 1 4 2 1");
|
||||
add(disabledButton, "cell 1 5 2 1");
|
||||
add(disabledTabbedPane, "cell 1 5 2 1");
|
||||
|
||||
//---- label5 ----
|
||||
label5.setText("only setIcon()");
|
||||
label5.setEnabled(false);
|
||||
add(label5, "cell 1 4 2 1,gapx 20");
|
||||
add(label5, "cell 1 5 2 1,gapx 20");
|
||||
|
||||
//---- disabledCheckBox ----
|
||||
disabledCheckBox.setText("disabled");
|
||||
disabledCheckBox.setSelected(true);
|
||||
disabledCheckBox.setMnemonic('D');
|
||||
disabledCheckBox.addActionListener(e -> disabledChanged());
|
||||
add(disabledCheckBox, "cell 0 5,alignx left,growx 0");
|
||||
add(disabledCheckBox, "cell 0 6,alignx left,growx 0");
|
||||
|
||||
//---- disabledLabel2 ----
|
||||
disabledLabel2.setText("label");
|
||||
add(disabledLabel2, "cell 1 5 2 1");
|
||||
add(disabledLabel2, "cell 1 6 2 1");
|
||||
|
||||
//---- disabledButton2 ----
|
||||
disabledButton2.setText("button");
|
||||
add(disabledButton2, "cell 1 5 2 1");
|
||||
add(disabledTabbedPane2, "cell 1 5 2 1");
|
||||
add(disabledButton2, "cell 1 6 2 1");
|
||||
add(disabledTabbedPane2, "cell 1 6 2 1");
|
||||
|
||||
//---- label6 ----
|
||||
label6.setText("setIcon() and setDisabledIcon()");
|
||||
label6.setEnabled(false);
|
||||
add(label6, "cell 1 5 2 1,gapx 20");
|
||||
add(label6, "cell 1 6 2 1,gapx 20");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
}
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
private JLabel label1;
|
||||
private TriStateCheckBox triStateCheckBox1;
|
||||
private FlatTriStateCheckBox triStateCheckBox1;
|
||||
private JLabel triStateLabel1;
|
||||
private TriStateCheckBox triStateCheckBox2;
|
||||
private FlatTriStateCheckBox triStateCheckBox3;
|
||||
private JLabel triStateLabel3;
|
||||
private FlatTriStateCheckBox triStateCheckBox2;
|
||||
private JLabel triStateLabel2;
|
||||
private JLabel label2;
|
||||
private JPanel svgIconsPanel;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.2.0.298" Java: "15" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -15,7 +15,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) {
|
||||
name: "triStateCheckBox1"
|
||||
"text": "three states"
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "triStateCheckBox1Changed", false ) )
|
||||
@@ -29,26 +29,41 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 0,gapx 30"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) {
|
||||
name: "triStateCheckBox2"
|
||||
"text": "third state disabled"
|
||||
"thirdStateEnabled": false
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "triStateCheckBox2Changed", false ) )
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) {
|
||||
name: "triStateCheckBox3"
|
||||
"text": "alt state cycle order"
|
||||
"altStateCycleOrder": true
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "triStateCheckBox3Changed", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "triStateLabel3"
|
||||
"text": "text"
|
||||
"enabled": false
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 1,gapx 30"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) {
|
||||
name: "triStateCheckBox2"
|
||||
"text": "third state disabled"
|
||||
"allowIndeterminate": false
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "triStateCheckBox2Changed", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "triStateLabel2"
|
||||
"text": "text"
|
||||
"enabled": false
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 1,gapx 30"
|
||||
"value": "cell 2 2,gapx 30"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label2"
|
||||
"text": "SVG Icons:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3"
|
||||
@@ -57,43 +72,43 @@ new FormModel {
|
||||
} ) {
|
||||
name: "svgIconsPanel"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2 2 1"
|
||||
"value": "cell 1 3 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label3"
|
||||
"text": "The icons may change colors when switching to another theme."
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3 2 1"
|
||||
"value": "cell 1 4 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label4"
|
||||
"text": "Disabled SVG Icons:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4"
|
||||
"value": "cell 0 5"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "disabledLabel"
|
||||
"text": "label"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 4 2 1"
|
||||
"value": "cell 1 5 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "disabledButton"
|
||||
"text": "button"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 4 2 1"
|
||||
"value": "cell 1 5 2 1"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
|
||||
name: "disabledTabbedPane"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 4 2 1"
|
||||
"value": "cell 1 5 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label5"
|
||||
"text": "only setIcon()"
|
||||
"enabled": false
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 4 2 1,gapx 20"
|
||||
"value": "cell 1 5 2 1,gapx 20"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "disabledCheckBox"
|
||||
@@ -102,35 +117,35 @@ new FormModel {
|
||||
"mnemonic": 68
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "disabledChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 5,alignx left,growx 0"
|
||||
"value": "cell 0 6,alignx left,growx 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "disabledLabel2"
|
||||
"text": "label"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 5 2 1"
|
||||
"value": "cell 1 6 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "disabledButton2"
|
||||
"text": "button"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 5 2 1"
|
||||
"value": "cell 1 6 2 1"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
|
||||
name: "disabledTabbedPane2"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 5 2 1"
|
||||
"value": "cell 1 6 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label6"
|
||||
"text": "setIcon() and setDisabledIcon()"
|
||||
"enabled": false
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 5 2 1,gapx 20"
|
||||
"value": "cell 1 6 2 1,gapx 20"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 595, 300 )
|
||||
"size": new java.awt.Dimension( 595, 470 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,8 @@ public class FlatJideOssTest
|
||||
|
||||
FlatJideOssTest() {
|
||||
initComponents();
|
||||
|
||||
tristateCheckBox1Changed();
|
||||
}
|
||||
|
||||
private void tabScrollChanged() {
|
||||
@@ -104,6 +106,16 @@ public class FlatJideOssTest
|
||||
popupMenu.showPopup();
|
||||
}
|
||||
|
||||
private void tristateCheckBox1Changed() {
|
||||
String text = null;
|
||||
switch( tristateCheckBox1.getState() ) {
|
||||
case TristateCheckBox.STATE_UNSELECTED: text = "UNSELECTED"; break;
|
||||
case TristateCheckBox.STATE_SELECTED: text = "SELECTED"; break;
|
||||
case TristateCheckBox.STATE_MIXED: text = "MIXED"; break;
|
||||
}
|
||||
triStateLabel1.setText( text );
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||
JPanel panel9 = new JPanel();
|
||||
@@ -135,6 +147,9 @@ public class FlatJideOssTest
|
||||
JPanel panel10 = new JPanel();
|
||||
JLabel jidePopupLabel = new JLabel();
|
||||
JButton showJidePopupButton = new JButton();
|
||||
JLabel label9 = new JLabel();
|
||||
tristateCheckBox1 = new TristateCheckBox();
|
||||
triStateLabel1 = new JLabel();
|
||||
CellConstraints cc = new CellConstraints();
|
||||
|
||||
//======== this ========
|
||||
@@ -303,8 +318,10 @@ public class FlatJideOssTest
|
||||
"insets 3 0 3 3,hidemode 3",
|
||||
// columns
|
||||
"[fill]" +
|
||||
"[fill]" +
|
||||
"[fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- jidePopupLabel ----
|
||||
@@ -315,6 +332,20 @@ public class FlatJideOssTest
|
||||
showJidePopupButton.setText("show JidePopup");
|
||||
showJidePopupButton.addActionListener(e -> showJidePopupButtonActionPerformed(e));
|
||||
panel10.add(showJidePopupButton, "cell 1 0");
|
||||
|
||||
//---- label9 ----
|
||||
label9.setText("TristateCheckBox:");
|
||||
panel10.add(label9, "cell 0 1");
|
||||
|
||||
//---- tristateCheckBox1 ----
|
||||
tristateCheckBox1.setText("three states");
|
||||
tristateCheckBox1.addActionListener(e -> tristateCheckBox1Changed());
|
||||
panel10.add(tristateCheckBox1, "cell 1 1");
|
||||
|
||||
//---- triStateLabel1 ----
|
||||
triStateLabel1.setText("text");
|
||||
triStateLabel1.setEnabled(false);
|
||||
panel10.add(triStateLabel1, "cell 2 1");
|
||||
}
|
||||
panel9.add(panel10, cc.xy(1, 9));
|
||||
}
|
||||
@@ -330,5 +361,7 @@ public class FlatJideOssTest
|
||||
private JCheckBox moreTabsCheckBox;
|
||||
private JCheckBox tabScrollCheckBox;
|
||||
private JCheckBox hasFullBorderCheckBox;
|
||||
private TristateCheckBox tristateCheckBox1;
|
||||
private JLabel triStateLabel1;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -194,8 +194,8 @@ new FormModel {
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 3 0 3 3,hidemode 3"
|
||||
"$columnConstraints": "[fill][fill]"
|
||||
"$rowConstraints": "[]"
|
||||
"$columnConstraints": "[fill][fill][fill]"
|
||||
"$rowConstraints": "[][]"
|
||||
} ) {
|
||||
name: "panel10"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
@@ -211,6 +211,32 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label9"
|
||||
"text": "TristateCheckBox:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "com.jidesoft.swing.TristateCheckBox" ) {
|
||||
name: "tristateCheckBox1"
|
||||
"text": "three states"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tristateCheckBox1Changed", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "triStateLabel1"
|
||||
"text": "text"
|
||||
"enabled": false
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 1"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
|
||||
"gridY": 9
|
||||
} )
|
||||
|
||||
@@ -16,12 +16,14 @@
|
||||
|
||||
package com.formdev.flatlaf.testing.jideoss;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JSlider;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import com.formdev.flatlaf.testing.FlatTestFrame;
|
||||
import com.formdev.flatlaf.testing.FlatTestPanel;
|
||||
import com.jidesoft.plaf.LookAndFeelFactory;
|
||||
@@ -46,8 +48,43 @@ public class FlatRangeSliderTest
|
||||
} );
|
||||
}
|
||||
|
||||
private final JSlider[] allSliders;
|
||||
private final JSlider[] directionalSliders;
|
||||
|
||||
FlatRangeSliderTest() {
|
||||
initComponents();
|
||||
|
||||
allSliders = new JSlider[] {
|
||||
horizontalRangeSlider,
|
||||
verticalRangeSlider,
|
||||
horizontalSlider,
|
||||
verticalSlider,
|
||||
horizontalRangeSlider2,
|
||||
verticalRangeSlider2,
|
||||
horizontalSlider2,
|
||||
verticalSlider2,
|
||||
};
|
||||
directionalSliders = new JSlider[] {
|
||||
horizontalRangeSlider,
|
||||
verticalRangeSlider,
|
||||
horizontalSlider,
|
||||
verticalSlider,
|
||||
};
|
||||
|
||||
ChangeListener sliderChanged = e -> {
|
||||
JSlider slider = (JSlider) e.getSource();
|
||||
String text;
|
||||
if( slider instanceof RangeSlider ) {
|
||||
RangeSlider rangeSlider = (RangeSlider) slider;
|
||||
text = rangeSlider.getLowValue() + " - " + rangeSlider.getHighValue()
|
||||
+ " " + slider.getValueIsAdjusting();
|
||||
} else
|
||||
text = slider.getValue() + " " + slider.getValueIsAdjusting();
|
||||
sliderValueLabel.setText( text );
|
||||
// System.out.println( text );
|
||||
};
|
||||
for( JSlider slider : allSliders )
|
||||
slider.addChangeListener( sliderChanged );
|
||||
}
|
||||
|
||||
private void paintLabels() {
|
||||
@@ -66,6 +103,26 @@ public class FlatRangeSliderTest
|
||||
verticalSlider.setPaintTicks( selected );
|
||||
}
|
||||
|
||||
private void sliderSnapToTicksChanged() {
|
||||
boolean snapToTicks = sliderSnapToTicksCheckBox.isSelected();
|
||||
for( JSlider slider : allSliders )
|
||||
slider.setSnapToTicks( snapToTicks );
|
||||
}
|
||||
|
||||
private void majorThickSpacingChanged() {
|
||||
int majorTickSpacing = (Integer) majorTickSpacingSpinner.getValue();
|
||||
for( JSlider slider : directionalSliders ) {
|
||||
slider.setLabelTable( null );
|
||||
slider.setMajorTickSpacing( majorTickSpacing );
|
||||
}
|
||||
}
|
||||
|
||||
private void minorThickSpacingChanged() {
|
||||
int minorTickSpacing = (Integer) minorTickSpacingSpinner.getValue();
|
||||
for( JSlider slider : directionalSliders )
|
||||
slider.setMinorTickSpacing( minorTickSpacing );
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||
JLabel tabbedPaneLabel = new JLabel();
|
||||
@@ -81,13 +138,18 @@ public class FlatRangeSliderTest
|
||||
verticalSlider2 = new JSlider();
|
||||
paintTick = new JCheckBox();
|
||||
paintLabel = new JCheckBox();
|
||||
sliderSnapToTicksCheckBox = new JCheckBox();
|
||||
majorTickSpacingSpinner = new JSpinner();
|
||||
minorTickSpacingSpinner = new JSpinner();
|
||||
sliderValueLabel = new JLabel();
|
||||
|
||||
//======== this ========
|
||||
setLayout(new MigLayout(
|
||||
"insets dialog,hidemode 3",
|
||||
// columns
|
||||
"[left]" +
|
||||
"[240,left]",
|
||||
"[240,left]" +
|
||||
"[fill]",
|
||||
// rows
|
||||
"[fill]" +
|
||||
"[center]" +
|
||||
@@ -170,14 +232,33 @@ public class FlatRangeSliderTest
|
||||
paintTick.setMnemonic('T');
|
||||
paintTick.setSelected(true);
|
||||
paintTick.addActionListener(e -> paintTicks());
|
||||
add(paintTick, "cell 0 6 2 1");
|
||||
add(paintTick, "cell 0 6 3 1");
|
||||
|
||||
//---- paintLabel ----
|
||||
paintLabel.setText("PaintLabels");
|
||||
paintLabel.setMnemonic('L');
|
||||
paintLabel.setSelected(true);
|
||||
paintLabel.addActionListener(e -> paintLabels());
|
||||
add(paintLabel, "cell 0 6 2 1");
|
||||
add(paintLabel, "cell 0 6 3 1");
|
||||
|
||||
//---- sliderSnapToTicksCheckBox ----
|
||||
sliderSnapToTicksCheckBox.setText("snap to ticks");
|
||||
sliderSnapToTicksCheckBox.addActionListener(e -> sliderSnapToTicksChanged());
|
||||
add(sliderSnapToTicksCheckBox, "cell 0 6 3 1");
|
||||
|
||||
//---- majorTickSpacingSpinner ----
|
||||
majorTickSpacingSpinner.setModel(new SpinnerNumberModel(10, 0, 100, 5));
|
||||
majorTickSpacingSpinner.addChangeListener(e -> majorThickSpacingChanged());
|
||||
add(majorTickSpacingSpinner, "cell 0 6 3 1");
|
||||
|
||||
//---- minorTickSpacingSpinner ----
|
||||
minorTickSpacingSpinner.setModel(new SpinnerNumberModel(5, 0, 100, 5));
|
||||
minorTickSpacingSpinner.addChangeListener(e -> minorThickSpacingChanged());
|
||||
add(minorTickSpacingSpinner, "cell 0 6 3 1");
|
||||
|
||||
//---- sliderValueLabel ----
|
||||
sliderValueLabel.setText("slider value");
|
||||
add(sliderValueLabel, "cell 0 6 3 1");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
}
|
||||
|
||||
@@ -192,5 +273,9 @@ public class FlatRangeSliderTest
|
||||
private JSlider verticalSlider2;
|
||||
private JCheckBox paintTick;
|
||||
private JCheckBox paintLabel;
|
||||
private JCheckBox sliderSnapToTicksCheckBox;
|
||||
private JSpinner majorTickSpacingSpinner;
|
||||
private JSpinner minorTickSpacingSpinner;
|
||||
private JLabel sliderValueLabel;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.2.0.298" Java: "15" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -8,7 +8,7 @@ new FormModel {
|
||||
}
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets dialog,hidemode 3"
|
||||
"$columnConstraints": "[left][240,left]"
|
||||
"$columnConstraints": "[left][240,left][fill]"
|
||||
"$rowConstraints": "[fill][center][][][][grow,fill][]"
|
||||
} ) {
|
||||
name: "this"
|
||||
@@ -136,7 +136,7 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "paintTicks", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 6 2 1"
|
||||
"value": "cell 0 6 3 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "paintLabel"
|
||||
@@ -148,7 +148,46 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "paintLabels", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 6 2 1"
|
||||
"value": "cell 0 6 3 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "sliderSnapToTicksCheckBox"
|
||||
"text": "snap to ticks"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "sliderSnapToTicksChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 6 3 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||
name: "majorTickSpacingSpinner"
|
||||
"model": new javax.swing.SpinnerNumberModel( 10, 0, 100, 5 )
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "majorThickSpacingChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 6 3 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||
name: "minorTickSpacingSpinner"
|
||||
"model": new javax.swing.SpinnerNumberModel( 5, 0, 100, 5 )
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "minorThickSpacingChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 6 3 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "sliderValueLabel"
|
||||
"text": "slider value"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 6 3 1"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
|
||||
@@ -928,6 +928,9 @@ Tree.textForeground
|
||||
Tree.timeFactor
|
||||
Tree.wideSelection
|
||||
TreeUI
|
||||
TristateCheckBox.clearMixed.clientProperty
|
||||
TristateCheckBox.setMixed.clientProperty
|
||||
UIColorHighlighter.stripingBackground
|
||||
Viewport.background
|
||||
Viewport.font
|
||||
Viewport.foreground
|
||||
|
||||
Reference in New Issue
Block a user