Compare commits

...

48 Commits

Author SHA1 Message Date
Karl Tauber
78a8035b92 Linux: rounded borders for popups (issue #949) 2025-01-27 17:15:38 +01:00
Karl Tauber
c32c00a5eb Linux with FlatLaf window decorations:
- moved window resizer components from layered pane to rootpane so that border is included in area where user can resize window
- scale border thickness
2025-01-26 17:48:19 +01:00
Karl Tauber
3a8a55a545 Linux with FlatLaf window decorations: right and bottom window resize drag areas were 2px smaller than at left and top sides 2025-01-26 17:23:59 +01:00
Karl Tauber
6c49b8bc4d Linux: hide popups when window is moved, resized, maximized, restored, iconified or switched to another window (issue #962) 2025-01-25 09:48:52 +01:00
Karl Tauber
cca9707f6b Popup: on Windows 10, update drop shadow of heavy-weight popup if popup moved/resized (issue #942) 2025-01-25 07:45:57 +01:00
Karl Tauber
f30dd876e4 Linux: updated libflatlaf-linux-arm64.so for Linux on ARM64; now built on ARM64 Linux (ubuntu-24.04-arm); previous was cross-compiled on X86_64 Linux (issue #899)
built by GitHub Actions: https://github.com/JFormDesigner/FlatLaf/actions/runs/12932258675
2025-01-23 16:38:16 +01:00
Karl Tauber
c6872d48b3 GitHub Actions:
- build Linux ARM64 native library on ubuntu-24.04-arm
- build on various Java versions only if build on Java 11 succeeded
- build Java version matrix only on main repo
2025-01-23 16:15:22 +01:00
Karl Tauber
5e78b21df7 macOS native rounded borders: (PR #772)
- removed opacity from contentView.layer
- catch and log exceptions
2025-01-21 11:59:40 +01:00
Karl Tauber
2ef87dc789 macOS: re-enabled rounded popup border (see PR #772) on macOS 14.4+ (was disabled in 3.5.x)
deferred rounded border setup, if popup window is not yet created, could make a difference (see commit 656d25b75e)
2025-01-20 19:42:55 +01:00
Karl Tauber
28904c34cc Linux: added libflatlaf-linux-arm64.so for Linux on ARM64 (issue #899)
built by GitHub Actions: https://github.com/JFormDesigner/FlatLaf/actions/runs/12845430366
2025-01-18 17:09:32 +01:00
Karl Tauber
91f19bf94c Native Libraries:
- Linux: added dumps
- macOS: replaced deprecated Gradle `exec`
2025-01-18 16:53:30 +01:00
Karl Tauber
0ea188f8db Linux: support cross-compile native library for ARM64 on x86_64 Linux (issue #899) 2025-01-18 14:50:42 +01:00
Karl Tauber
6c77b81277 Linux: support building native library for ARM64 when Gradle build runs on ARM64 Linux (issue #899) 2025-01-16 20:10:57 +01:00
Karl Tauber
ddee4ef526 GitHub Actions: natives.yml: install libxt-dev to fix build error on ubuntu 24.04 (did work without this on ubuntu 22.04) 2025-01-09 15:57:46 +01:00
Karl Tauber
f11f68282b update to Gradle 8.12 2025-01-09 15:39:27 +01:00
Karl Tauber
ac0cceb09b added Exocharts as Gold sponsor 2025-01-09 15:19:47 +01:00
Karl Tauber
a238fd4505 Button: fixed background and foreground colors for borderless and toolBarButton style default buttons (JButton.isDefaultButton() is true) (issue #947) 2025-01-09 14:38:36 +01:00
Karl Tauber
8dc6242889 FlatLaf window decorations: minimize and maximize icons were not shown for custom scale factors less than 100% (e.g. `-Dflatlaf.uiScale=75%) (issue #951) 2025-01-09 14:19:44 +01:00
Karl Tauber
d17fffb82a PopupFactory: fixed NPE on Windows 10 when owner is null (issue #952) 2025-01-09 12:26:57 +01:00
Karl Tauber
0ad3180b10 FileChooser: improved performance when navigating to large directories with thousands of files (issue #953) 2025-01-09 12:04:25 +01:00
Karl Tauber
80ba75fdeb List:
- fixed wrong x/width bounds of alternating rows for multi-column lists (PR #939)
- Demo: added "alternating rows" checkboxes to "Data Components" page
2024-12-18 12:22:04 +01:00
Karl Tauber
7027821c00 Merge PR #939: Support for alternate row color in JList 2024-12-18 00:30:01 +01:00
Karl Tauber
a3a49cef73 Merge PR #936: CheckBox: support styling indeterminate state of tri-state check boxes 2024-12-17 23:46:12 +01:00
Dar
abf77d5399 mod: code format 2024-12-16 15:55:40 +01:00
Dar
6404b8de2a fix: filter combobox by name 2024-12-16 15:49:19 +01:00
Dar
19055d5a18 mod: combobox does not support alternate row color 2024-12-13 09:21:14 +01:00
Dar
c12adf12e7 new: support for alternate row color in JList 2024-12-13 09:20:23 +01:00
Karl Tauber
b9c68fbe77 CheckBox: support styling indeterminate state of tri-state check boxes (issue #919) 2024-12-11 16:54:03 +01:00
Karl Tauber
7bdfd49921 Merge PR #935: Tree: support wide cell renderer 2024-12-11 13:33:03 +01:00
Karl Tauber
58fa2a5085 Demo, Testing, Theme Editor: re-generated UI code using JFormDesigner 8.3, which now supports class FlatClientProperties 2024-12-10 19:49:46 +01:00
Karl Tauber
a400799db5 Extras: use default activation keys if passing null to FlatInspector.install() or to FlatUIDefaultsInspector.install() 2024-12-09 23:55:02 +01:00
Karl Tauber
2a8e487c1f Tree: support wide cell renderer (issue #922) 2024-12-09 19:50:00 +01:00
Karl Tauber
145631fd43 FlatComponentsTest: added "transparent background" checkbox 2024-12-09 17:10:33 +01:00
Karl Tauber
6a774d8c70 GitHub Actions: use lftp directly to upload FlatLaf demo and theme editor
previously used github action `sebastianpopp/ftp-action`, which uses Docker, was very slow (about two minutes to upload one file)
2024-12-09 13:44:54 +01:00
Karl Tauber
bfd746f981 GitHub Actions: no longer upload theme editor snapshot; update gradle wrapper validation action 2024-12-09 01:23:55 +01:00
Karl Tauber
3af54b7215 Merge branch 'flatlaf-3.5.4' into main 2024-12-09 01:12:27 +01:00
Karl Tauber
3ba9fc6c1c release 3.5.4 2024-12-09 00:44:57 +01:00
Karl Tauber
0a9ecd66a9 Linux: fixed NPE when using FlatLaf window decorations and switching theme (issue #933; regression in 3.5.3)
caused by fix for #907; commit d471f08b15
2024-12-09 00:43:44 +01:00
Karl Tauber
6991d6729e Merge PR #931: Fixing NPE when using HTML text on a component with null font
(cherry picked from commit 41332de275)
2024-12-08 23:01:00 +01:00
Karl Tauber
304cb0d57b Merge PR #903: Support for alternate row color in JTree 2024-12-08 13:44:58 +01:00
Karl Tauber
41332de275 Merge PR #931: Fixing NPE when using HTML text on a component with null font 2024-12-08 13:37:02 +01:00
Karl Tauber
ef61ae504b FlatSVGIcon: color filters now can access painting component to implement component state based color mappings (PR #906) 2024-12-07 19:52:23 +01:00
Eduwardo Horibe
f96baf1bc2 Fixing NPE when using HTML text on a component with null font 2024-12-06 18:52:14 -03:00
Dar
a20cfa6db3 mod: style tester 2024-10-23 15:36:17 +02:00
Dar
6ac6698ecf mod: added 3.6 tag 2024-10-23 15:32:16 +02:00
Dar
8004d2761a fix: respect the selection arc 2024-10-23 15:30:06 +02:00
Dar
25c2bbc851 fix: alternate row color paint 2024-10-22 18:05:14 +02:00
Dar
33e37a7167 new: support for alternate row color in jtree
see: https://github.com/JFormDesigner/FlatLaf/issues/900
2024-10-22 16:46:30 +02:00
86 changed files with 2237 additions and 631 deletions

View File

@@ -20,8 +20,43 @@ on:
jobs: jobs:
build: build:
name: build (11)
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v4
- name: Setup Java 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: temurin # pre-installed on ubuntu-latest
cache: gradle
- name: Check with Error Prone
run: ./gradlew errorprone clean
- name: Build with Gradle
run: ./gradlew build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: FlatLaf-build-artifacts
path: |
flatlaf-*/build/libs
flatlaf-*/flatlaf-*/build/libs
!**/*-javadoc.jar
!**/*-sources.jar
build-on:
runs-on: ubuntu-latest
needs: build
if: github.repository == 'JFormDesigner/FlatLaf'
strategy: strategy:
matrix: matrix:
# test against # test against
@@ -30,7 +65,6 @@ jobs:
# - latest Java version(s) # - latest Java version(s)
java: java:
- 8 - 8
- 11 # LTS
- 17 # LTS - 17 # LTS
- 21 # LTS - 21 # LTS
- 23 # latest - 23 # latest
@@ -42,9 +76,6 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
if: matrix.java == '8'
- name: Setup Java ${{ matrix.java }} - name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:
@@ -52,28 +83,13 @@ jobs:
distribution: temurin # Java 8, 11, 17 and 21 are pre-installed on ubuntu-latest distribution: temurin # Java 8, 11, 17 and 21 are pre-installed on ubuntu-latest
cache: gradle cache: gradle
- name: Check with Error Prone
if: matrix.java == '11'
run: ./gradlew errorprone clean -Dtoolchain=${{ matrix.toolchain }}
- name: Build with Gradle - name: Build with Gradle
run: ./gradlew build -Dtoolchain=${{ matrix.toolchain }} run: ./gradlew build -Dtoolchain=${{ matrix.toolchain }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: matrix.java == '11'
with:
name: FlatLaf-build-artifacts
path: |
flatlaf-*/build/libs
flatlaf-*/flatlaf-*/build/libs
!**/*-javadoc.jar
!**/*-sources.jar
snapshot: snapshot:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: build-on
if: | if: |
github.event_name == 'push' && github.event_name == 'push' &&
(github.ref == 'refs/heads/main' || startsWith( github.ref, 'refs/heads/develop-' )) && (github.ref == 'refs/heads/main' || startsWith( github.ref, 'refs/heads/develop-' )) &&
@@ -90,26 +106,15 @@ jobs:
cache: gradle cache: gradle
- name: Publish snapshot to oss.sonatype.org - name: Publish snapshot to oss.sonatype.org
run: ./gradlew publish :flatlaf-theme-editor:build -PskipFonts -Dorg.gradle.internal.publish.checksums.insecure=true -Dorg.gradle.parallel=false run: ./gradlew publish -PskipFonts -Dorg.gradle.internal.publish.checksums.insecure=true -Dorg.gradle.parallel=false
env: env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
- name: Upload theme editor
uses: sebastianpopp/ftp-action@releases/v2
with:
host: ${{ secrets.FTP_SERVER }}
user: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
forceSsl: true
localDir: "flatlaf-theme-editor/build/libs"
remoteDir: "snapshots"
options: "--only-newer --no-recursion --verbose=1"
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: build-on
if: | if: |
github.event_name == 'push' && github.event_name == 'push' &&
startsWith( github.ref, 'refs/tags/' ) && startsWith( github.ref, 'refs/tags/' ) &&
@@ -133,24 +138,12 @@ jobs:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
- name: Upload demo - name: Install lftp
uses: sebastianpopp/ftp-action@releases/v2 run: sudo apt-get -y install lftp
with:
host: ${{ secrets.FTP_SERVER }}
user: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
forceSsl: true
localDir: "flatlaf-demo/build/libs"
remoteDir: "."
options: "--only-newer --no-recursion --verbose=1"
- name: Upload theme editor - name: Upload demo and theme editor
uses: sebastianpopp/ftp-action@releases/v2 run: >
with: lftp -c "set ftp:ssl-force true;
host: ${{ secrets.FTP_SERVER }} open -u ${{ secrets.FTP_USERNAME }},${{ secrets.FTP_PASSWORD }} ${{ secrets.FTP_SERVER }};
user: ${{ secrets.FTP_USERNAME }} mput flatlaf-demo/build/libs/flatlaf-demo-*.jar;
password: ${{ secrets.FTP_PASSWORD }} mput flatlaf-theme-editor/build/libs/flatlaf-theme-editor-*.jar"
forceSsl: true
localDir: "flatlaf-theme-editor/build/libs"
remoteDir: "."
options: "--only-newer --no-recursion --verbose=1"

View File

@@ -21,16 +21,25 @@ jobs:
strategy: strategy:
matrix: matrix:
os: os:
- windows - windows-latest
- macos - macos-latest
- ubuntu - ubuntu-latest
- ubuntu-24.04-arm
runs-on: ${{ matrix.os }}-latest runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2 - uses: gradle/actions/wrapper-validation@v4
- name: install libxt-dev
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
run: sudo apt install libxt-dev
- name: install g++-aarch64-linux-gnu
if: matrix.os == 'ubuntu-latest'
run: sudo apt install g++-aarch64-linux-gnu
- name: Setup Java 11 - name: Setup Java 11
uses: actions/setup-java@v4 uses: actions/setup-java@v4

View File

@@ -1,6 +1,50 @@
FlatLaf Change Log FlatLaf Change Log
================== ==================
## 3.6-SNAPSHOT
#### New features and improvements
- macOS: Re-enabled rounded popup border (see PR #772) on macOS 14.4+ (was
disabled in 3.5.x).
- CheckBox: Support styling indeterminate state of
[tri-state check boxes](https://www.javadoc.io/doc/com.formdev/flatlaf-extras/latest/com/formdev/flatlaf/extras/components/FlatTriStateCheckBox.html).
(PR #936; issue #919)
- List: Support for alternate row highlighting. (PR #939)
- Tree: Support for alternate row highlighting. (PR #903)
- Tree: Support wide cell renderer. (issue #922)
- Extras: `FlatSVGIcon` color filters now can access painting component to
implement component state based color mappings. (issue #906)
- Linux: Added `libflatlaf-linux-arm64.so` for Linux on ARM64. (issue #899)
#### Fixed bugs
- Button: Fixed background and foreground colors for `borderless` and
`toolBarButton` style default buttons (`JButton.isDefaultButton()` is `true`).
(issue #947)
- FileChooser: Improved performance when navigating to large directories with
thousands of files. (issue #953)
- PopupFactory: Fixed NPE on Windows 10 when `owner` is `null`. (issue #952)
- Popup: On Windows 10, drop shadow of heavy-weight popup was not updated if
popup moved/resized. (issue #942)
- FlatLaf window decorations: Minimize and maximize icons were not shown for
custom scale factors less than 100% (e.g. `-Dflatlaf.uiScale=75%`). (issue
#951)
- Linux: Popups (menus and combobox lists) were not hidden when window is moved,
resized, maximized, restored, iconified or switched to another window. (issue
#962)
## 3.5.4
#### Fixed bugs
- HTML: Fixed NPE when using HTML text on a component with `null` font. (issue
#930; PR #931; regression in 3.5)
- Linux: Fixed NPE when using FlatLaf window decorations and switching theme.
(issue #933; regression in 3.5.3)
## 3.5.3 ## 3.5.3
#### Fixed bugs #### Fixed bugs

View File

@@ -35,7 +35,9 @@ Sponsors
### Current Sponsors ### Current Sponsors
[![None Sponsors](images/none-sponsors.png)](https://www.formdev.com/flatlaf/sponsor/) <a href="https://exocharts.com/"><img src="https://www.formdev.com/flatlaf/sponsor/Exocharts.png" width="200" alt="Exocharts" title="Exocharts - Professional Grade OrderFlow"></a>
<!-- [![None Sponsors](images/none-sponsors.png)](https://www.formdev.com/flatlaf/sponsor/) -->
[Become a Sponsor](https://www.formdev.com/flatlaf/sponsor/) [Become a Sponsor](https://www.formdev.com/flatlaf/sponsor/)

View File

@@ -156,5 +156,6 @@ flatlafPublish {
NativeArtifact( "${natives}/libflatlaf-macos-arm64.dylib", "macos-arm64", "dylib" ), NativeArtifact( "${natives}/libflatlaf-macos-arm64.dylib", "macos-arm64", "dylib" ),
NativeArtifact( "${natives}/libflatlaf-macos-x86_64.dylib", "macos-x86_64", "dylib" ), NativeArtifact( "${natives}/libflatlaf-macos-x86_64.dylib", "macos-x86_64", "dylib" ),
NativeArtifact( "${natives}/libflatlaf-linux-x86_64.so", "linux-x86_64", "so" ), NativeArtifact( "${natives}/libflatlaf-linux-x86_64.so", "linux-x86_64", "so" ),
NativeArtifact( "${natives}/libflatlaf-linux-arm64.so", "linux-arm64", "so" ),
) )
} }

View File

@@ -384,6 +384,7 @@ public interface FlatClientProperties
* If this value is {@code 1 - 4}, then {@code DWMWCP_ROUNDSMALL} is used. * If this value is {@code 1 - 4}, then {@code DWMWCP_ROUNDSMALL} is used.
* If it is {@code >= 5}, then {@code DWMWCP_ROUND} is used. * If it is {@code >= 5}, then {@code DWMWCP_ROUND} is used.
* <li><strong>macOS</strong> (10.14 and later): Any corner radius is supported. * <li><strong>macOS</strong> (10.14 and later): Any corner radius is supported.
* <li><strong>Linux</strong> (since FlatLaf 3.6): Any corner radius is supported.
* </ul> * </ul>
* <strong>Component</strong> {@link javax.swing.JComponent}<br> * <strong>Component</strong> {@link javax.swing.JComponent}<br>
* <strong>Value type</strong> {@link java.lang.Integer}<br> * <strong>Value type</strong> {@link java.lang.Integer}<br>
@@ -402,6 +403,7 @@ public interface FlatClientProperties
* Supported platforms: * Supported platforms:
* <ul> * <ul>
* <li><strong>macOS</strong> (10.14 and later) * <li><strong>macOS</strong> (10.14 and later)
* <li><strong>Linux</strong> (since FlatLaf 3.6)
* </ul> * </ul>
* <strong>Component</strong> {@link javax.swing.JComponent}<br> * <strong>Component</strong> {@link javax.swing.JComponent}<br>
* <strong>Value type</strong> {@link java.lang.Integer} or {@link java.lang.Float}<br> * <strong>Value type</strong> {@link java.lang.Integer} or {@link java.lang.Float}<br>
@@ -1410,13 +1412,23 @@ public interface FlatClientProperties
//---- JTree -------------------------------------------------------------- //---- JTree --------------------------------------------------------------
/** /**
* Override if a tree shows a wide selection. Default is {@code true}. * Specifies whether tree shows a wide selection. Default is {@code true}.
* <p> * <p>
* <strong>Component</strong> {@link javax.swing.JTree}<br> * <strong>Component</strong> {@link javax.swing.JTree}<br>
* <strong>Value type</strong> {@link java.lang.Boolean} * <strong>Value type</strong> {@link java.lang.Boolean}
*/ */
String TREE_WIDE_SELECTION = "JTree.wideSelection"; String TREE_WIDE_SELECTION = "JTree.wideSelection";
/**
* Specifies whether tree uses a wide cell renderer. Default is {@code false}.
* <p>
* <strong>Component</strong> {@link javax.swing.JTree}<br>
* <strong>Value type</strong> {@link java.lang.Boolean}
*
* @since 3.6
*/
String TREE_WIDE_CELL_RENDERER = "JTree.wideCellRenderer";
/** /**
* Specifies whether tree item selection is painted. Default is {@code true}. * Specifies whether tree item selection is painted. Default is {@code true}.
* If set to {@code false}, then the tree cell renderer is responsible for painting selection. * If set to {@code false}, then the tree cell renderer is responsible for painting selection.

View File

@@ -111,6 +111,7 @@ public abstract class FlatLaf
private PopupFactory oldPopupFactory; private PopupFactory oldPopupFactory;
private MnemonicHandler mnemonicHandler; private MnemonicHandler mnemonicHandler;
private boolean subMenuUsabilityHelperInstalled; private boolean subMenuUsabilityHelperInstalled;
private LinuxPopupMenuCanceler linuxPopupMenuCanceler;
private Consumer<UIDefaults> postInitialization; private Consumer<UIDefaults> postInitialization;
private List<Function<Object, Object>> uiDefaultsGetters; private List<Function<Object, Object>> uiDefaultsGetters;
@@ -305,6 +306,10 @@ public abstract class FlatLaf
// install submenu usability helper // install submenu usability helper
subMenuUsabilityHelperInstalled = SubMenuUsabilityHelper.install(); subMenuUsabilityHelperInstalled = SubMenuUsabilityHelper.install();
// install Linux popup menu canceler
if( SystemInfo.isLinux )
linuxPopupMenuCanceler = new LinuxPopupMenuCanceler();
// listen to desktop property changes to update UI if system font or scaling changes // listen to desktop property changes to update UI if system font or scaling changes
if( SystemInfo.isWindows ) { if( SystemInfo.isWindows ) {
// Windows 10 allows increasing font size independent of scaling: // Windows 10 allows increasing font size independent of scaling:
@@ -397,6 +402,12 @@ public abstract class FlatLaf
subMenuUsabilityHelperInstalled = false; subMenuUsabilityHelperInstalled = false;
} }
// uninstall Linux popup menu canceler
if( linuxPopupMenuCanceler != null ) {
linuxPopupMenuCanceler.uninstall();
linuxPopupMenuCanceler = null;
}
// restore default link color // restore default link color
new HTMLEditorKit().getStyleSheet().addRule( "a, address { color: blue; }" ); new HTMLEditorKit().getStyleSheet().addRule( "a, address { color: blue; }" );
postInitialization = null; postInitialization = null;

View File

@@ -141,7 +141,7 @@ public interface FlatSystemProperties
* (requires Windows 11 or macOS) * (requires Windows 11 or macOS)
* <p> * <p>
* <strong>Allowed Values</strong> {@code false} and {@code true}<br> * <strong>Allowed Values</strong> {@code false} and {@code true}<br>
* <strong>Default</strong> {@code true}; except on macOS 14.4+ where it is {@code false} * <strong>Default</strong> {@code true}; except in FlatLaf 3.5.x on macOS 14.4+ where it was {@code false}
* *
* @since 3.5.2 * @since 3.5.2
*/ */

View File

@@ -0,0 +1,164 @@
/*
* Copyright 2025 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;
import java.awt.Component;
import java.awt.Window;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JPopupMenu;
import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
/**
* Cancels (hides) popup menus on Linux.
* <p>
* On Linux, popups are not hidden under following conditions, which results in
* misplaced popups:
* <ul>
* <li>window moved or resized
* <li>window maximized or restored
* <li>window iconified
* <li>window deactivated (e.g. activated other application)
* </ul>
*
* On Windows and macOS, popups are automatically hidden.
* <p>
* The implementation is similar to what's done in
* {@code javax.swing.plaf.basic.BasicPopupMenuUI.MouseGrabber},
* but only hides popup in some conditions.
*
* @author Karl Tauber
*/
class LinuxPopupMenuCanceler
extends WindowAdapter
implements ChangeListener, ComponentListener
{
private MenuElement[] lastPathSelectedPath;
private Window window;
LinuxPopupMenuCanceler() {
MenuSelectionManager msm = MenuSelectionManager.defaultManager();
msm.addChangeListener( this );
lastPathSelectedPath = msm.getSelectedPath();
if( lastPathSelectedPath.length > 0 )
addWindowListeners( lastPathSelectedPath[0] );
}
void uninstall() {
MenuSelectionManager.defaultManager().removeChangeListener( this );
}
private void addWindowListeners( MenuElement selected ) {
// see BasicPopupMenuUI.MouseGrabber.grabWindow()
Component invoker = selected.getComponent();
if( invoker instanceof JPopupMenu )
invoker = ((JPopupMenu)invoker).getInvoker();
window = (invoker instanceof Window)
? (Window) invoker
: SwingUtilities.windowForComponent( invoker );
if( window != null ) {
window.addWindowListener( this );
window.addComponentListener( this );
}
}
private void removeWindowListeners() {
if( window != null ) {
window.removeWindowListener( this );
window.removeComponentListener( this );
window = null;
}
}
private void cancelPopupMenu() {
try {
MenuSelectionManager msm = MenuSelectionManager.defaultManager();
MenuElement[] selectedPath = msm.getSelectedPath();
for( MenuElement e : selectedPath ) {
if( e instanceof JPopupMenu )
((JPopupMenu)e).putClientProperty( "JPopupMenu.firePopupMenuCanceled", true );
}
msm.clearSelectedPath();
} catch( RuntimeException ex ) {
removeWindowListeners();
throw ex;
} catch( Error ex ) {
removeWindowListeners();
throw ex;
}
}
//---- ChangeListener ----
@Override
public void stateChanged( ChangeEvent e ) {
MenuElement[] selectedPath = MenuSelectionManager.defaultManager().getSelectedPath();
if( selectedPath.length == 0 )
removeWindowListeners();
else if( lastPathSelectedPath.length == 0 )
addWindowListeners( selectedPath[0] );
lastPathSelectedPath = selectedPath;
}
//---- WindowListener ----
@Override
public void windowIconified( WindowEvent e ) {
cancelPopupMenu();
}
@Override
public void windowDeactivated( WindowEvent e ) {
cancelPopupMenu();
}
@Override
public void windowClosing( WindowEvent e ) {
cancelPopupMenu();
}
//---- ComponentListener ----
@Override
public void componentResized( ComponentEvent e ) {
cancelPopupMenu();
}
@Override
public void componentMoved( ComponentEvent e ) {
cancelPopupMenu();
}
@Override
public void componentShown( ComponentEvent e ) {
}
@Override
public void componentHidden( ComponentEvent e ) {
cancelPopupMenu();
}
}

View File

@@ -17,6 +17,7 @@
package com.formdev.flatlaf.icons; package com.formdev.flatlaf.icons;
import static com.formdev.flatlaf.FlatClientProperties.*; import static com.formdev.flatlaf.FlatClientProperties.*;
import static com.formdev.flatlaf.ui.FlatUIUtils.stateColor;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@@ -48,6 +49,8 @@ import com.formdev.flatlaf.ui.FlatUIUtils;
* @uiDefault CheckBox.icon.borderWidth int or float optional; defaults to Component.borderWidth * @uiDefault CheckBox.icon.borderWidth int or float optional; defaults to Component.borderWidth
* @uiDefault CheckBox.icon.selectedBorderWidth int or float optional; defaults to CheckBox.icon.borderWidth * @uiDefault CheckBox.icon.selectedBorderWidth int or float optional; defaults to CheckBox.icon.borderWidth
* @uiDefault CheckBox.icon.disabledSelectedBorderWidth int or float optional; defaults to CheckBox.icon.selectedBorderWidth * @uiDefault CheckBox.icon.disabledSelectedBorderWidth int or float optional; defaults to CheckBox.icon.selectedBorderWidth
* @uiDefault CheckBox.icon.indeterminateBorderWidth int or float optional; defaults to CheckBox.icon.selectedBorderWidth
* @uiDefault CheckBox.icon.disabledIndeterminateBorderWidth int or float optional; defaults to CheckBox.icon.disabledSelectedBorderWidth
* @uiDefault CheckBox.arc int * @uiDefault CheckBox.arc int
* *
* @uiDefault CheckBox.icon.focusColor Color optional; defaults to Component.focusColor * @uiDefault CheckBox.icon.focusColor Color optional; defaults to Component.focusColor
@@ -56,30 +59,45 @@ import com.formdev.flatlaf.ui.FlatUIUtils;
* @uiDefault CheckBox.icon.selectedBorderColor Color * @uiDefault CheckBox.icon.selectedBorderColor Color
* @uiDefault CheckBox.icon.selectedBackground Color * @uiDefault CheckBox.icon.selectedBackground Color
* @uiDefault CheckBox.icon.checkmarkColor Color * @uiDefault CheckBox.icon.checkmarkColor Color
* @uiDefault CheckBox.icon.indeterminateBorderColor Color optional; defaults to CheckBox.icon.selectedBorderColor
* @uiDefault CheckBox.icon.indeterminateBackground Color optional; defaults to CheckBox.icon.selectedBackground
* @uiDefault CheckBox.icon.indeterminateCheckmarkColor Color optional; defaults to CheckBox.icon.checkmarkColor
* *
* @uiDefault CheckBox.icon.disabledBorderColor Color * @uiDefault CheckBox.icon.disabledBorderColor Color
* @uiDefault CheckBox.icon.disabledBackground Color * @uiDefault CheckBox.icon.disabledBackground Color
* @uiDefault CheckBox.icon.disabledSelectedBorderColor Color optional; CheckBox.icon.disabledBorderColor is used if not specified * @uiDefault CheckBox.icon.disabledSelectedBorderColor Color optional; defaults to CheckBox.icon.disabledBorderColor
* @uiDefault CheckBox.icon.disabledSelectedBackground Color optional; CheckBox.icon.disabledBackground is used if not specified * @uiDefault CheckBox.icon.disabledSelectedBackground Color optional; defaults to CheckBox.icon.disabledBackground
* @uiDefault CheckBox.icon.disabledCheckmarkColor Color * @uiDefault CheckBox.icon.disabledCheckmarkColor Color
* @uiDefault CheckBox.icon.disabledIndeterminateBorderColor Color optional; defaults to CheckBox.icon.disabledSelectedBorderColor
* @uiDefault CheckBox.icon.disabledIndeterminateBackground Color optional; defaults to CheckBox.icon.disabledSelectedBackground
* @uiDefault CheckBox.icon.disabledIndeterminateCheckmarkColor Color optional; defaults to CheckBox.icon.disabledCheckmarkColor
* *
* @uiDefault CheckBox.icon.focusedBorderColor Color optional * @uiDefault CheckBox.icon.focusedBorderColor Color optional
* @uiDefault CheckBox.icon.focusedBackground Color optional * @uiDefault CheckBox.icon.focusedBackground Color optional
* @uiDefault CheckBox.icon.focusedSelectedBorderColor Color optional; CheckBox.icon.focusedBorderColor is used if not specified * @uiDefault CheckBox.icon.focusedSelectedBorderColor Color optional; defaults to CheckBox.icon.focusedBorderColor
* @uiDefault CheckBox.icon.focusedSelectedBackground Color optional; CheckBox.icon.focusedBackground is used if not specified * @uiDefault CheckBox.icon.focusedSelectedBackground Color optional; defaults to CheckBox.icon.focusedBackground
* @uiDefault CheckBox.icon.focusedCheckmarkColor Color optional; CheckBox.icon.checkmarkColor is used if not specified * @uiDefault CheckBox.icon.focusedCheckmarkColor Color optional; defaults to CheckBox.icon.checkmarkColor
* @uiDefault CheckBox.icon.focusedIndeterminateBorderColor Color optional; defaults to CheckBox.icon.focusedSelectedBorderColor
* @uiDefault CheckBox.icon.focusedIndeterminateBackground Color optional; defaults to CheckBox.icon.focusedSelectedBackground
* @uiDefault CheckBox.icon.focusedIndeterminateCheckmarkColor Color optional; defaults to CheckBox.icon.focusedCheckmarkColor
* *
* @uiDefault CheckBox.icon.hoverBorderColor Color optional * @uiDefault CheckBox.icon.hoverBorderColor Color optional
* @uiDefault CheckBox.icon.hoverBackground Color optional * @uiDefault CheckBox.icon.hoverBackground Color optional
* @uiDefault CheckBox.icon.hoverSelectedBorderColor Color optional; CheckBox.icon.hoverBorderColor is used if not specified * @uiDefault CheckBox.icon.hoverSelectedBorderColor Color optional; defaults to CheckBox.icon.hoverBorderColor
* @uiDefault CheckBox.icon.hoverSelectedBackground Color optional; CheckBox.icon.hoverBackground is used if not specified * @uiDefault CheckBox.icon.hoverSelectedBackground Color optional; defaults to CheckBox.icon.hoverBackground
* @uiDefault CheckBox.icon.hoverCheckmarkColor Color optional; CheckBox.icon.checkmarkColor is used if not specified * @uiDefault CheckBox.icon.hoverCheckmarkColor Color optional; defaults to CheckBox.icon.checkmarkColor
* @uiDefault CheckBox.icon.hoverIndeterminateBorderColor Color optional; defaults to CheckBox.icon.hoverSelectedBorderColor
* @uiDefault CheckBox.icon.hoverIndeterminateBackground Color optional; defaults to CheckBox.icon.hoverSelectedBackground
* @uiDefault CheckBox.icon.hoverIndeterminateCheckmarkColor Color optional; defaults to CheckBox.icon.hoverCheckmarkColor
* *
* @uiDefault CheckBox.icon.pressedBorderColor Color optional * @uiDefault CheckBox.icon.pressedBorderColor Color optional
* @uiDefault CheckBox.icon.pressedBackground Color optional * @uiDefault CheckBox.icon.pressedBackground Color optional
* @uiDefault CheckBox.icon.pressedSelectedBorderColor Color optional; CheckBox.icon.pressedBorderColor is used if not specified * @uiDefault CheckBox.icon.pressedSelectedBorderColor Color optional; defaults to CheckBox.icon.pressedBorderColor
* @uiDefault CheckBox.icon.pressedSelectedBackground Color optional; CheckBox.icon.pressedBackground is used if not specified * @uiDefault CheckBox.icon.pressedSelectedBackground Color optional; defaults to CheckBox.icon.pressedBackground
* @uiDefault CheckBox.icon.pressedCheckmarkColor Color optional; CheckBox.icon.checkmarkColor is used if not specified * @uiDefault CheckBox.icon.pressedCheckmarkColor Color optional; defaults to CheckBox.icon.checkmarkColor
* @uiDefault CheckBox.icon.pressedIndeterminateBorderColor Color optional; defaults to CheckBox.icon.pressedSelectedBorderColor
* @uiDefault CheckBox.icon.pressedIndeterminateBackground Color optional; defaults to CheckBox.icon.pressedSelectedBackground
* @uiDefault CheckBox.icon.pressedIndeterminateCheckmarkColor Color optional; defaults to CheckBox.icon.pressedCheckmarkColor
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
@@ -92,6 +110,8 @@ public class FlatCheckBoxIcon
/** @since 2 */ @Styleable protected float borderWidth = getUIFloat( "CheckBox.icon.borderWidth", FlatUIUtils.getUIFloat( "Component.borderWidth", 1 ), style ); /** @since 2 */ @Styleable protected float borderWidth = getUIFloat( "CheckBox.icon.borderWidth", FlatUIUtils.getUIFloat( "Component.borderWidth", 1 ), style );
/** @since 2 */ @Styleable protected float selectedBorderWidth = getUIFloat( "CheckBox.icon.selectedBorderWidth", Float.MIN_VALUE, style ); /** @since 2 */ @Styleable protected float selectedBorderWidth = getUIFloat( "CheckBox.icon.selectedBorderWidth", Float.MIN_VALUE, style );
/** @since 2 */ @Styleable protected float disabledSelectedBorderWidth = getUIFloat( "CheckBox.icon.disabledSelectedBorderWidth", Float.MIN_VALUE, style ); /** @since 2 */ @Styleable protected float disabledSelectedBorderWidth = getUIFloat( "CheckBox.icon.disabledSelectedBorderWidth", Float.MIN_VALUE, style );
/** @since 3.6 */ @Styleable protected float indeterminateBorderWidth = getUIFloat( "CheckBox.icon.indeterminateBorderWidth", Float.MIN_VALUE, style );
/** @since 3.6 */ @Styleable protected float disabledIndeterminateBorderWidth = getUIFloat( "CheckBox.icon.disabledIndeterminateBorderWidth", Float.MIN_VALUE, style );
@Styleable protected int arc = FlatUIUtils.getUIInt( "CheckBox.arc", 2 ); @Styleable protected int arc = FlatUIUtils.getUIInt( "CheckBox.arc", 2 );
// enabled // enabled
@@ -100,6 +120,9 @@ public class FlatCheckBoxIcon
@Styleable protected Color selectedBorderColor = getUIColor( "CheckBox.icon.selectedBorderColor", style ); @Styleable protected Color selectedBorderColor = getUIColor( "CheckBox.icon.selectedBorderColor", style );
@Styleable protected Color selectedBackground = getUIColor( "CheckBox.icon.selectedBackground", style ); @Styleable protected Color selectedBackground = getUIColor( "CheckBox.icon.selectedBackground", style );
@Styleable protected Color checkmarkColor = getUIColor( "CheckBox.icon.checkmarkColor", style ); @Styleable protected Color checkmarkColor = getUIColor( "CheckBox.icon.checkmarkColor", style );
/** @since 3.6 */ @Styleable protected Color indeterminateBorderColor = getUIColor( "CheckBox.icon.indeterminateBorderColor", style );
/** @since 3.6 */ @Styleable protected Color indeterminateBackground = getUIColor( "CheckBox.icon.indeterminateBackground", style );
/** @since 3.6 */ @Styleable protected Color indeterminateCheckmarkColor = getUIColor( "CheckBox.icon.indeterminateCheckmarkColor", style );
// disabled // disabled
@Styleable protected Color disabledBorderColor = getUIColor( "CheckBox.icon.disabledBorderColor", style ); @Styleable protected Color disabledBorderColor = getUIColor( "CheckBox.icon.disabledBorderColor", style );
@@ -107,6 +130,9 @@ public class FlatCheckBoxIcon
/** @since 2 */ @Styleable protected Color disabledSelectedBorderColor = getUIColor( "CheckBox.icon.disabledSelectedBorderColor", style ); /** @since 2 */ @Styleable protected Color disabledSelectedBorderColor = getUIColor( "CheckBox.icon.disabledSelectedBorderColor", style );
/** @since 2 */ @Styleable protected Color disabledSelectedBackground = getUIColor( "CheckBox.icon.disabledSelectedBackground", style ); /** @since 2 */ @Styleable protected Color disabledSelectedBackground = getUIColor( "CheckBox.icon.disabledSelectedBackground", style );
@Styleable protected Color disabledCheckmarkColor = getUIColor( "CheckBox.icon.disabledCheckmarkColor", style ); @Styleable protected Color disabledCheckmarkColor = getUIColor( "CheckBox.icon.disabledCheckmarkColor", style );
/** @since 3.6 */ @Styleable protected Color disabledIndeterminateBorderColor = getUIColor( "CheckBox.icon.disabledIndeterminateBorderColor", style );
/** @since 3.6 */ @Styleable protected Color disabledIndeterminateBackground = getUIColor( "CheckBox.icon.disabledIndeterminateBackground", style );
/** @since 3.6 */ @Styleable protected Color disabledIndeterminateCheckmarkColor = getUIColor( "CheckBox.icon.disabledIndeterminateCheckmarkColor", style );
// focused // focused
@Styleable protected Color focusedBorderColor = getUIColor( "CheckBox.icon.focusedBorderColor", style ); @Styleable protected Color focusedBorderColor = getUIColor( "CheckBox.icon.focusedBorderColor", style );
@@ -114,6 +140,9 @@ public class FlatCheckBoxIcon
/** @since 2 */ @Styleable protected Color focusedSelectedBorderColor = getUIColor( "CheckBox.icon.focusedSelectedBorderColor", style ); /** @since 2 */ @Styleable protected Color focusedSelectedBorderColor = getUIColor( "CheckBox.icon.focusedSelectedBorderColor", style );
/** @since 2 */ @Styleable protected Color focusedSelectedBackground = getUIColor( "CheckBox.icon.focusedSelectedBackground", style ); /** @since 2 */ @Styleable protected Color focusedSelectedBackground = getUIColor( "CheckBox.icon.focusedSelectedBackground", style );
/** @since 2 */ @Styleable protected Color focusedCheckmarkColor = getUIColor( "CheckBox.icon.focusedCheckmarkColor", style ); /** @since 2 */ @Styleable protected Color focusedCheckmarkColor = getUIColor( "CheckBox.icon.focusedCheckmarkColor", style );
/** @since 3.6 */ @Styleable protected Color focusedIndeterminateBorderColor = getUIColor( "CheckBox.icon.focusedIndeterminateBorderColor", style );
/** @since 3.6 */ @Styleable protected Color focusedIndeterminateBackground = getUIColor( "CheckBox.icon.focusedIndeterminateBackground", style );
/** @since 3.6 */ @Styleable protected Color focusedIndeterminateCheckmarkColor = getUIColor( "CheckBox.icon.focusedIndeterminateCheckmarkColor", style );
// hover // hover
@Styleable protected Color hoverBorderColor = getUIColor( "CheckBox.icon.hoverBorderColor", style ); @Styleable protected Color hoverBorderColor = getUIColor( "CheckBox.icon.hoverBorderColor", style );
@@ -121,6 +150,9 @@ public class FlatCheckBoxIcon
/** @since 2 */ @Styleable protected Color hoverSelectedBorderColor = getUIColor( "CheckBox.icon.hoverSelectedBorderColor", style ); /** @since 2 */ @Styleable protected Color hoverSelectedBorderColor = getUIColor( "CheckBox.icon.hoverSelectedBorderColor", style );
/** @since 2 */ @Styleable protected Color hoverSelectedBackground = getUIColor( "CheckBox.icon.hoverSelectedBackground", style ); /** @since 2 */ @Styleable protected Color hoverSelectedBackground = getUIColor( "CheckBox.icon.hoverSelectedBackground", style );
/** @since 2 */ @Styleable protected Color hoverCheckmarkColor = getUIColor( "CheckBox.icon.hoverCheckmarkColor", style ); /** @since 2 */ @Styleable protected Color hoverCheckmarkColor = getUIColor( "CheckBox.icon.hoverCheckmarkColor", style );
/** @since 3.6 */ @Styleable protected Color hoverIndeterminateBorderColor = getUIColor( "CheckBox.icon.hoverIndeterminateBorderColor", style );
/** @since 3.6 */ @Styleable protected Color hoverIndeterminateBackground = getUIColor( "CheckBox.icon.hoverIndeterminateBackground", style );
/** @since 3.6 */ @Styleable protected Color hoverIndeterminateCheckmarkColor = getUIColor( "CheckBox.icon.hoverIndeterminateCheckmarkColor", style );
// pressed // pressed
/** @since 2 */ @Styleable protected Color pressedBorderColor = getUIColor( "CheckBox.icon.pressedBorderColor", style ); /** @since 2 */ @Styleable protected Color pressedBorderColor = getUIColor( "CheckBox.icon.pressedBorderColor", style );
@@ -128,6 +160,9 @@ public class FlatCheckBoxIcon
/** @since 2 */ @Styleable protected Color pressedSelectedBorderColor = getUIColor( "CheckBox.icon.pressedSelectedBorderColor", style ); /** @since 2 */ @Styleable protected Color pressedSelectedBorderColor = getUIColor( "CheckBox.icon.pressedSelectedBorderColor", style );
/** @since 2 */ @Styleable protected Color pressedSelectedBackground = getUIColor( "CheckBox.icon.pressedSelectedBackground", style ); /** @since 2 */ @Styleable protected Color pressedSelectedBackground = getUIColor( "CheckBox.icon.pressedSelectedBackground", style );
/** @since 2 */ @Styleable protected Color pressedCheckmarkColor = getUIColor( "CheckBox.icon.pressedCheckmarkColor", style ); /** @since 2 */ @Styleable protected Color pressedCheckmarkColor = getUIColor( "CheckBox.icon.pressedCheckmarkColor", style );
/** @since 3.6 */ @Styleable protected Color pressedIndeterminateBorderColor = getUIColor( "CheckBox.icon.pressedIndeterminateBorderColor", style );
/** @since 3.6 */ @Styleable protected Color pressedIndeterminateBackground = getUIColor( "CheckBox.icon.pressedIndeterminateBackground", style );
/** @since 3.6 */ @Styleable protected Color pressedIndeterminateCheckmarkColor = getUIColor( "CheckBox.icon.pressedIndeterminateCheckmarkColor", style );
protected String getPropertyPrefix() { protected String getPropertyPrefix() {
return "CheckBox."; return "CheckBox.";
@@ -182,11 +217,17 @@ public class FlatCheckBoxIcon
boolean indeterminate = isIndeterminate( c ); boolean indeterminate = isIndeterminate( c );
boolean selected = indeterminate || isSelected( c ); boolean selected = indeterminate || isSelected( c );
boolean isFocused = FlatUIUtils.isPermanentFocusOwner( c ); boolean isFocused = FlatUIUtils.isPermanentFocusOwner( c );
float bw = selected float bw = Float.MIN_VALUE;
? (disabledSelectedBorderWidth != Float.MIN_VALUE && !c.isEnabled() if( !c.isEnabled() ) {
? disabledSelectedBorderWidth bw = (indeterminate && disabledIndeterminateBorderWidth != Float.MIN_VALUE)
: (selectedBorderWidth != Float.MIN_VALUE ? selectedBorderWidth : borderWidth)) ? disabledIndeterminateBorderWidth
: borderWidth; : (selected ? disabledSelectedBorderWidth : selectedBorderWidth);
}
if( bw == Float.MIN_VALUE ) {
bw = (indeterminate && indeterminateBorderWidth != Float.MIN_VALUE)
? indeterminateBorderWidth
: ((selected && selectedBorderWidth != Float.MIN_VALUE) ? selectedBorderWidth : borderWidth);
}
// paint focused border // paint focused border
if( isFocused && focusWidth > 0 && FlatButtonUI.isFocusPainted( c ) ) { if( isFocused && focusWidth > 0 && FlatButtonUI.isFocusPainted( c ) ) {
@@ -195,15 +236,15 @@ public class FlatCheckBoxIcon
} }
// paint border // paint border
g.setColor( getBorderColor( c, selected ) ); g.setColor( getBorderColor( c, selected, indeterminate ) );
paintBorder( c, g, bw ); paintBorder( c, g, bw );
// paint background // paint background
Color bg = FlatUIUtils.deriveColor( getBackground( c, selected ), Color baseBg = stateColor( indeterminate, indeterminateBackground, selected, selectedBackground, background );
selected ? selectedBackground : background ); Color bg = FlatUIUtils.deriveColor( getBackground( c, selected, indeterminate ), baseBg );
if( bg.getAlpha() < 255 ) { if( bg.getAlpha() < 255 ) {
// fill background with default color before filling with non-opaque background // fill background with default color before filling with non-opaque background
g.setColor( selected ? selectedBackground : background ); g.setColor( baseBg );
paintBackground( c, g, bw ); paintBackground( c, g, bw );
} }
g.setColor( bg ); g.setColor( bg );
@@ -211,7 +252,7 @@ public class FlatCheckBoxIcon
// paint checkmark // paint checkmark
if( selected ) { if( selected ) {
g.setColor( getCheckmarkColor( c ) ); g.setColor( getCheckmarkColor( c, indeterminate ) );
if( indeterminate ) if( indeterminate )
paintIndeterminate( c, g ); paintIndeterminate( c, g );
else else
@@ -272,30 +313,33 @@ public class FlatCheckBoxIcon
return focusColor; return focusColor;
} }
protected Color getBorderColor( Component c, boolean selected ) { /** @since 3.6 */
protected Color getBorderColor( Component c, boolean selected, boolean indeterminate ) {
return FlatButtonUI.buttonStateColor( c, return FlatButtonUI.buttonStateColor( c,
selected ? selectedBorderColor : borderColor, stateColor( indeterminate, indeterminateBorderColor, selected, selectedBorderColor, borderColor ),
(selected && disabledSelectedBorderColor != null) ? disabledSelectedBorderColor : disabledBorderColor, stateColor( indeterminate, disabledIndeterminateBorderColor, selected, disabledSelectedBorderColor, disabledBorderColor ),
(selected && focusedSelectedBorderColor != null) ? focusedSelectedBorderColor : focusedBorderColor, stateColor( indeterminate, focusedIndeterminateBorderColor, selected, focusedSelectedBorderColor, focusedBorderColor ),
(selected && hoverSelectedBorderColor != null) ? hoverSelectedBorderColor : hoverBorderColor, stateColor( indeterminate, hoverIndeterminateBorderColor, selected, hoverSelectedBorderColor, hoverBorderColor ),
(selected && pressedSelectedBorderColor != null) ? pressedSelectedBorderColor : pressedBorderColor ); stateColor( indeterminate, pressedIndeterminateBorderColor, selected, pressedSelectedBorderColor, pressedBorderColor ) );
} }
protected Color getBackground( Component c, boolean selected ) { /** @since 3.6 */
protected Color getBackground( Component c, boolean selected, boolean indeterminate ) {
return FlatButtonUI.buttonStateColor( c, return FlatButtonUI.buttonStateColor( c,
selected ? selectedBackground : background, stateColor( indeterminate, indeterminateBackground, selected, selectedBackground, background ),
(selected && disabledSelectedBackground != null) ? disabledSelectedBackground : disabledBackground, stateColor( indeterminate, disabledIndeterminateBackground, selected, disabledSelectedBackground, disabledBackground ),
(selected && focusedSelectedBackground != null) ? focusedSelectedBackground : focusedBackground, stateColor( indeterminate, focusedIndeterminateBackground, selected, focusedSelectedBackground, focusedBackground ),
(selected && hoverSelectedBackground != null) ? hoverSelectedBackground : hoverBackground, stateColor( indeterminate, hoverIndeterminateBackground, selected, hoverSelectedBackground, hoverBackground ),
(selected && pressedSelectedBackground != null) ? pressedSelectedBackground : pressedBackground ); stateColor( indeterminate, pressedIndeterminateBackground, selected, pressedSelectedBackground, pressedBackground ) );
} }
protected Color getCheckmarkColor( Component c ) { /** @since 3.6 */
protected Color getCheckmarkColor( Component c, boolean indeterminate ) {
return FlatButtonUI.buttonStateColor( c, return FlatButtonUI.buttonStateColor( c,
checkmarkColor, stateColor( indeterminate, indeterminateCheckmarkColor, checkmarkColor ),
disabledCheckmarkColor, stateColor( indeterminate, disabledIndeterminateCheckmarkColor, disabledCheckmarkColor ),
focusedCheckmarkColor, stateColor( indeterminate, focusedIndeterminateCheckmarkColor, focusedCheckmarkColor ),
hoverCheckmarkColor, stateColor( indeterminate, hoverIndeterminateCheckmarkColor, hoverCheckmarkColor ),
pressedCheckmarkColor ); stateColor( indeterminate, pressedIndeterminateCheckmarkColor, pressedCheckmarkColor ) );
} }
} }

View File

@@ -63,7 +63,7 @@ public class FlatWindowCloseIcon
int iy = y + ((height - iwh) / 2); int iy = y + ((height - iwh) / 2);
int ix2 = ix + iwh - 1; int ix2 = ix + iwh - 1;
int iy2 = iy + iwh - 1; int iy2 = iy + iwh - 1;
float thickness = SystemInfo.isWindows_11_orLater ? (float) scaleFactor : (int) scaleFactor; float thickness = Math.max( SystemInfo.isWindows_11_orLater ? (float) scaleFactor : (int) scaleFactor, 1 );
Path2D path = new Path2D.Float( Path2D.WIND_EVEN_ODD, 4 ); Path2D path = new Path2D.Float( Path2D.WIND_EVEN_ODD, 4 );
path.moveTo( ix, iy ); path.moveTo( ix, iy );

View File

@@ -38,7 +38,7 @@ public class FlatWindowIconifyIcon
@Override @Override
protected void paintIconAt1x( Graphics2D g, int x, int y, int width, int height, double scaleFactor ) { protected void paintIconAt1x( Graphics2D g, int x, int y, int width, int height, double scaleFactor ) {
int iw = (int) (getSymbolHeight() * scaleFactor); int iw = (int) (getSymbolHeight() * scaleFactor);
int ih = (int) scaleFactor; int ih = Math.max( (int) scaleFactor, 1 );
int ix = x + ((width - iw) / 2); int ix = x + ((width - iw) / 2);
int iy = y + ((height - ih) / 2); int iy = y + ((height - ih) / 2);

View File

@@ -42,7 +42,7 @@ public class FlatWindowMaximizeIcon
int iwh = (int) (getSymbolHeight() * scaleFactor); int iwh = (int) (getSymbolHeight() * scaleFactor);
int ix = x + ((width - iwh) / 2); int ix = x + ((width - iwh) / 2);
int iy = y + ((height - iwh) / 2); int iy = y + ((height - iwh) / 2);
float thickness = SystemInfo.isWindows_11_orLater ? (float) scaleFactor : (int) scaleFactor; float thickness = Math.max( SystemInfo.isWindows_11_orLater ? (float) scaleFactor : (int) scaleFactor, 1 );
int arc = Math.max( (int) (1.5 * scaleFactor), 2 ); int arc = Math.max( (int) (1.5 * scaleFactor), 2 );
g.fill( SystemInfo.isWindows_11_orLater g.fill( SystemInfo.isWindows_11_orLater

View File

@@ -45,7 +45,7 @@ public class FlatWindowRestoreIcon
int iwh = (int) (getSymbolHeight() * scaleFactor); int iwh = (int) (getSymbolHeight() * scaleFactor);
int ix = x + ((width - iwh) / 2); int ix = x + ((width - iwh) / 2);
int iy = y + ((height - iwh) / 2); int iy = y + ((height - iwh) / 2);
float thickness = SystemInfo.isWindows_11_orLater ? (float) scaleFactor : (int) scaleFactor; float thickness = Math.max( SystemInfo.isWindows_11_orLater ? (float) scaleFactor : (int) scaleFactor, 1 );
int arc = Math.max( (int) (1.5 * scaleFactor), 2 ); int arc = Math.max( (int) (1.5 * scaleFactor), 2 );
int arcOuter = (int) (arc + (1.5 * scaleFactor)); int arcOuter = (int) (arc + (1.5 * scaleFactor));

View File

@@ -653,7 +653,8 @@ public class FlatButtonUI
} }
protected Color getBackground( JComponent c ) { protected Color getBackground( JComponent c ) {
boolean toolBarButton = isToolBarButton( c ) || isBorderlessButton( c ); boolean def = isDefaultButton( c );
boolean toolBarButton = !def && (isToolBarButton( c ) || isBorderlessButton( c ));
// selected state // selected state
if( ((AbstractButton)c).isSelected() ) { if( ((AbstractButton)c).isSelected() ) {
@@ -681,7 +682,6 @@ public class FlatButtonUI
toolbarPressedBackground ); toolbarPressedBackground );
} }
boolean def = isDefaultButton( c );
return buttonStateColor( c, return buttonStateColor( c,
getBackgroundBase( c, def ), getBackgroundBase( c, def ),
disabledBackground, disabledBackground,
@@ -733,7 +733,8 @@ public class FlatButtonUI
protected Color getForeground( JComponent c ) { protected Color getForeground( JComponent c ) {
Color fg = c.getForeground(); Color fg = c.getForeground();
boolean toolBarButton = isToolBarButton( c ) || isBorderlessButton( c ); boolean def = isDefaultButton( c );
boolean toolBarButton = !def && (isToolBarButton( c ) || isBorderlessButton( c ));
// selected state // selected state
if( ((AbstractButton)c).isSelected() ) { if( ((AbstractButton)c).isSelected() ) {
@@ -759,7 +760,6 @@ public class FlatButtonUI
toolbarPressedForeground ); toolbarPressedForeground );
} }
boolean def = isDefaultButton( c );
return buttonStateColor( c, return buttonStateColor( c,
getForegroundBase( c, def ), getForegroundBase( c, def ),
disabledText, disabledText,

View File

@@ -74,7 +74,7 @@ public class FlatDropShadowBorder
this.shadowColor = shadowColor; this.shadowColor = shadowColor;
this.shadowInsets = shadowInsets; this.shadowInsets = shadowInsets;
this.shadowOpacity = shadowOpacity; this.shadowOpacity = Math.min( Math.max( shadowOpacity, 0f ), 1f );
shadowSize = maxInset( shadowInsets ); shadowSize = maxInset( shadowInsets );
} }

View File

@@ -376,31 +376,68 @@ public class FlatFileChooserUI
if( icon != null ) if( icon != null )
return icon; return icon;
// get system icon // new proxy icon
if( f != null ) { //
try { // Note: Since this is a super light weight icon object, we do not add it
icon = getFileChooser().getFileSystemView().getSystemIcon( f ); // to the icon cache here. This keeps cache small in case of large directories
} catch( NullPointerException ex ) { // with thousands of files when icons of all files are only needed to compute
// Java 21 may throw a NPE for exe files that use default Windows exe icon // the layout of list/table, but never painted because located outside of visible area.
} // When an icon needs to be painted, the proxy adds it to the icon cache
// and loads the real icon.
return new FlatFileViewIcon( f );
}
if( icon != null ) { //---- class FlatFileViewIcon -----------------------------------------
if( icon instanceof ImageIcon )
icon = new ScaledImageIcon( (ImageIcon) icon ); /**
cacheIcon( f, icon ); * A proxy icon that has a fixed (scaled) width/height (16x16) and
return icon; * gets/loads the real (system) icon only for painting.
} * Avoids unnecessary getting/loading system icons.
*/
private class FlatFileViewIcon
implements Icon
{
private final File f;
private Icon realIcon;
FlatFileViewIcon( File f ) {
this.f = f;
} }
// get default icon @Override
icon = super.getIcon( f ); public int getIconWidth() {
return UIScale.scale( 16 );
if( icon instanceof ImageIcon ) {
icon = new ScaledImageIcon( (ImageIcon) icon );
cacheIcon( f, icon );
} }
return icon; @Override
public int getIconHeight() {
return UIScale.scale( 16 );
}
@Override
public void paintIcon( Component c, Graphics g, int x, int y ) {
// get icon on demand
if( realIcon == null ) {
// get system icon
try {
if( f != null )
realIcon = getFileChooser().getFileSystemView().getSystemIcon( f );
} catch( NullPointerException ex ) {
// Java 21 may throw a NPE for exe files that use default Windows exe icon
}
// get default icon
if( realIcon == null )
realIcon = FlatFileView.super.getIcon( f );
if( realIcon instanceof ImageIcon )
realIcon = new ScaledImageIcon( (ImageIcon) realIcon );
cacheIcon( f, this );
}
realIcon.paintIcon( c, g, x, y );
}
} }
} }

View File

@@ -17,6 +17,7 @@
package com.formdev.flatlaf.ui; package com.formdev.flatlaf.ui;
import java.awt.Color; import java.awt.Color;
import java.awt.Font;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.util.Arrays; import java.util.Arrays;
@@ -74,9 +75,9 @@ public class FlatHTML
for( int i = 1; i <= 7; i++ ) for( int i = 1; i <= 7; i++ )
System.out.println( i+": "+ styleSheet.getPointSize( i ) ); System.out.println( i+": "+ styleSheet.getPointSize( i ) );
debug*/ debug*/
int fontBaseSize = c.getFont().getSize(); Font font = c.getFont();
if( styleSheet.getPointSize( 7 ) != 36f || if( styleSheet.getPointSize( 7 ) != 36f ||
styleSheet.getPointSize( 4 ) == fontBaseSize ) font == null || styleSheet.getPointSize( 4 ) == font.getSize() )
return; return;
// check whether view uses "absolute-size" keywords (e.g. "x-large") for font-size // check whether view uses "absolute-size" keywords (e.g. "x-large") for font-size
@@ -97,7 +98,7 @@ debug*/
return; return;
// BASE_SIZE rule is parsed in javax.swing.text.html.StyleSheet.addRule() // BASE_SIZE rule is parsed in javax.swing.text.html.StyleSheet.addRule()
String style = "<style>BASE_SIZE " + c.getFont().getSize() + "</style>"; String style = "<style>BASE_SIZE " + font.getSize() + "</style>";
String openTag = ""; String openTag = "";
String closeTag = ""; String closeTag = "";

View File

@@ -57,6 +57,7 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault List.foreground Color * @uiDefault List.foreground Color
* @uiDefault List.selectionBackground Color * @uiDefault List.selectionBackground Color
* @uiDefault List.selectionForeground Color * @uiDefault List.selectionForeground Color
* @uiDefault List.alternateRowColor Color
* @uiDefault List.dropLineColor Color * @uiDefault List.dropLineColor Color
* @uiDefault List.border Border * @uiDefault List.border Border
* @uiDefault List.cellRenderer ListCellRenderer * @uiDefault List.cellRenderer ListCellRenderer
@@ -93,6 +94,7 @@ public class FlatListUI
@Styleable protected Color selectionForeground; @Styleable protected Color selectionForeground;
@Styleable protected Color selectionInactiveBackground; @Styleable protected Color selectionInactiveBackground;
@Styleable protected Color selectionInactiveForeground; @Styleable protected Color selectionInactiveForeground;
/** @since 3.6 */ @Styleable protected Color alternateRowColor;
/** @since 3 */ @Styleable protected Insets selectionInsets; /** @since 3 */ @Styleable protected Insets selectionInsets;
/** @since 3 */ @Styleable protected int selectionArc; /** @since 3 */ @Styleable protected int selectionArc;
@@ -129,6 +131,7 @@ public class FlatListUI
selectionForeground = UIManager.getColor( "List.selectionForeground" ); selectionForeground = UIManager.getColor( "List.selectionForeground" );
selectionInactiveBackground = UIManager.getColor( "List.selectionInactiveBackground" ); selectionInactiveBackground = UIManager.getColor( "List.selectionInactiveBackground" );
selectionInactiveForeground = UIManager.getColor( "List.selectionInactiveForeground" ); selectionInactiveForeground = UIManager.getColor( "List.selectionInactiveForeground" );
alternateRowColor = UIManager.getColor( "List.alternateRowColor" );
selectionInsets = UIManager.getInsets( "List.selectionInsets" ); selectionInsets = UIManager.getInsets( "List.selectionInsets" );
selectionArc = UIManager.getInt( "List.selectionArc" ); selectionArc = UIManager.getInt( "List.selectionArc" );
@@ -143,6 +146,7 @@ public class FlatListUI
selectionForeground = null; selectionForeground = null;
selectionInactiveBackground = null; selectionInactiveBackground = null;
selectionInactiveForeground = null; selectionInactiveForeground = null;
alternateRowColor = null;
oldStyleValues = null; oldStyleValues = null;
} }
@@ -299,13 +303,24 @@ public class FlatListUI
{ {
boolean isSelected = selModel.isSelectedIndex( row ); boolean isSelected = selModel.isSelectedIndex( row );
// paint alternating rows
if( alternateRowColor != null && row % 2 != 0 &&
!"ComboBox.list".equals( list.getName() ) ) // combobox does not support alternate row color
{
g.setColor( alternateRowColor );
float arc = UIScale.scale( selectionArc / 2f );
FlatUIUtils.paintSelection( (Graphics2D) g, rowBounds.x, rowBounds.y, rowBounds.width, rowBounds.height,
UIScale.scale( selectionInsets ), arc, arc, arc, arc, 0 );
}
// get renderer component // get renderer component
@SuppressWarnings( "unchecked" ) @SuppressWarnings( "unchecked" )
Component rendererComponent = cellRenderer.getListCellRendererComponent( list, Component rendererComponent = cellRenderer.getListCellRendererComponent( list,
dataModel.getElementAt( row ), row, isSelected, dataModel.getElementAt( row ), row, isSelected,
FlatUIUtils.isPermanentFocusOwner( list ) && (row == leadIndex) ); FlatUIUtils.isPermanentFocusOwner( list ) && (row == leadIndex) );
// // use smaller cell width if list is used in JFileChooser
boolean isFileList = Boolean.TRUE.equals( list.getClientProperty( "List.isFileList" ) ); boolean isFileList = Boolean.TRUE.equals( list.getClientProperty( "List.isFileList" ) );
int cx, cw; int cx, cw;
if( isFileList ) { if( isFileList ) {

View File

@@ -90,10 +90,10 @@ class FlatNativeLibrary
classifier = SystemInfo.isAARCH64 ? "macos-arm64" : "macos-x86_64"; classifier = SystemInfo.isAARCH64 ? "macos-arm64" : "macos-x86_64";
ext = "dylib"; ext = "dylib";
} else if( SystemInfo.isLinux && SystemInfo.isX86_64 ) { } else if( SystemInfo.isLinux && (SystemInfo.isX86_64 || SystemInfo.isAARCH64)) {
// Linux: requires x86_64 // Linux: requires x86_64 or aarch64
classifier = "linux-x86_64"; classifier = SystemInfo.isAARCH64 ? "linux-arm64" : "linux-x86_64";
ext = "so"; ext = "so";
// Load libjawt.so (part of JRE) explicitly because it is not found // Load libjawt.so (part of JRE) explicitly because it is not found

View File

@@ -25,6 +25,7 @@ import java.awt.Dimension;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.awt.GraphicsConfiguration; import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice; import java.awt.GraphicsDevice;
import java.awt.GraphicsDevice.WindowTranslucency;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
import java.awt.Insets; import java.awt.Insets;
import java.awt.MouseInfo; import java.awt.MouseInfo;
@@ -117,8 +118,8 @@ public class FlatPopupFactory
// macOS and Linux adds drop shadow to heavy weight popups // macOS and Linux adds drop shadow to heavy weight popups
if( SystemInfo.isMacOS || SystemInfo.isLinux ) { if( SystemInfo.isMacOS || SystemInfo.isLinux ) {
NonFlashingPopup popup = new NonFlashingPopup( getPopupForScreenOfOwner( owner, contents, x, y, true ), owner, contents ); NonFlashingPopup popup = new NonFlashingPopup( getPopupForScreenOfOwner( owner, contents, x, y, true ), owner, contents );
if( popup.popupWindow != null && isMacOSBorderSupported() ) if( popup.popupWindow != null && (isMacOSBorderSupported() || isLinuxBorderSupported( popup.popupWindow )) )
setupRoundedBorder( popup.popupWindow, owner, contents ); setupRoundedBorder( popup, popup.popupWindow, owner, contents );
return popup; return popup;
} }
@@ -128,7 +129,7 @@ public class FlatPopupFactory
{ {
NonFlashingPopup popup = new NonFlashingPopup( getPopupForScreenOfOwner( owner, contents, x, y, true ), owner, contents ); NonFlashingPopup popup = new NonFlashingPopup( getPopupForScreenOfOwner( owner, contents, x, y, true ), owner, contents );
if( popup.popupWindow != null ) if( popup.popupWindow != null )
setupRoundedBorder( popup.popupWindow, owner, contents ); setupRoundedBorder( popup, popup.popupWindow, owner, contents );
return popup; return popup;
} }
@@ -138,7 +139,7 @@ public class FlatPopupFactory
// create drop shadow popup // create drop shadow popup
Popup popupForScreenOfOwner = getPopupForScreenOfOwner( owner, contents, x, y, forceHeavyWeight ); Popup popupForScreenOfOwner = getPopupForScreenOfOwner( owner, contents, x, y, forceHeavyWeight );
GraphicsConfiguration gc = owner.getGraphicsConfiguration(); GraphicsConfiguration gc = (owner != null) ? owner.getGraphicsConfiguration() : null;
return (gc != null && gc.isTranslucencyCapable()) return (gc != null && gc.isTranslucencyCapable())
? new DropShadowPopup( popupForScreenOfOwner, owner, contents ) ? new DropShadowPopup( popupForScreenOfOwner, owner, contents )
: new NonFlashingPopup( popupForScreenOfOwner, owner, contents ); : new NonFlashingPopup( popupForScreenOfOwner, owner, contents );
@@ -306,7 +307,7 @@ public class FlatPopupFactory
break; break;
} }
} }
if( gc == null ) if( gc == null && owner != null )
gc = owner.getGraphicsConfiguration(); gc = owner.getGraphicsConfiguration();
if( gc == null ) if( gc == null )
return null; return null;
@@ -365,18 +366,20 @@ public class FlatPopupFactory
} }
private static boolean isMacOSBorderSupported() { private static boolean isMacOSBorderSupported() {
// do not use rounded border on macOS 14.4+ because it may freeze the application
// and crash the macOS WindowServer process (reports vary from Finder restarts to OS restarts)
// https://github.com/apache/netbeans/issues/7560#issuecomment-2226439215
// https://github.com/apache/netbeans/issues/6647#issuecomment-2070124442
boolean isMacOS_14_4_orLater = (SystemInfo.osVersion >= SystemInfo.toVersion( 14, 4, 0, 0 ));
return SystemInfo.isMacOS && return SystemInfo.isMacOS &&
FlatSystemProperties.getBoolean( FlatSystemProperties.USE_ROUNDED_POPUP_BORDER, !isMacOS_14_4_orLater ) && FlatSystemProperties.getBoolean( FlatSystemProperties.USE_ROUNDED_POPUP_BORDER, true ) &&
FlatNativeMacLibrary.isLoaded(); FlatNativeMacLibrary.isLoaded();
} }
private static void setupRoundedBorder( Window popupWindow, Component owner, Component contents ) { private static boolean isLinuxBorderSupported( Window window ) {
return SystemInfo.isLinux &&
FlatSystemProperties.getBoolean( FlatSystemProperties.USE_ROUNDED_POPUP_BORDER, true ) &&
window.getGraphicsConfiguration().getDevice().isWindowTranslucencySupported( WindowTranslucency.PERPIXEL_TRANSPARENT );
}
private static void setupRoundedBorder( NonFlashingPopup popup,
Window popupWindow, Component owner, Component contents )
{
int borderCornerRadius = getBorderCornerRadius( owner, contents ); int borderCornerRadius = getBorderCornerRadius( owner, contents );
float borderWidth = getRoundedBorderWidth( owner, contents ); float borderWidth = getRoundedBorderWidth( owner, contents );
@@ -403,7 +406,7 @@ public class FlatPopupFactory
if( popupWindow.isDisplayable() ) { if( popupWindow.isDisplayable() ) {
// native window already created // native window already created
setupRoundedBorderImpl( popupWindow, borderCornerRadius, borderWidth, borderColor ); setupRoundedBorderImpl( popup, popupWindow, borderCornerRadius, borderWidth, borderColor );
} else { } else {
// native window not yet created --> add listener to set native border after window creation // native window not yet created --> add listener to set native border after window creation
AtomicReference<HierarchyListener> l = new AtomicReference<>(); AtomicReference<HierarchyListener> l = new AtomicReference<>();
@@ -411,7 +414,7 @@ public class FlatPopupFactory
if( e.getID() == HierarchyEvent.HIERARCHY_CHANGED && if( e.getID() == HierarchyEvent.HIERARCHY_CHANGED &&
(e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0 ) (e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0 )
{ {
setupRoundedBorderImpl( popupWindow, borderCornerRadius, borderWidth, borderColor ); setupRoundedBorderImpl( popup, popupWindow, borderCornerRadius, borderWidth, borderColor );
popupWindow.removeHierarchyListener( l.get() ); popupWindow.removeHierarchyListener( l.get() );
} }
} ); } );
@@ -419,7 +422,9 @@ public class FlatPopupFactory
} }
} }
private static void setupRoundedBorderImpl( Window popupWindow, int borderCornerRadius, float borderWidth, Color borderColor ) { private static void setupRoundedBorderImpl( NonFlashingPopup popup,
Window popupWindow, int borderCornerRadius, float borderWidth, Color borderColor )
{
if( SystemInfo.isWindows ) { if( SystemInfo.isWindows ) {
// get native window handle // get native window handle
long hwnd = FlatNativeWindowsLibrary.getHWND( popupWindow ); long hwnd = FlatNativeWindowsLibrary.getHWND( popupWindow );
@@ -439,6 +444,12 @@ public class FlatPopupFactory
// set corner radius, border width and color // set corner radius, border width and color
FlatNativeMacLibrary.setWindowRoundedBorder( popupWindow, borderCornerRadius, FlatNativeMacLibrary.setWindowRoundedBorder( popupWindow, borderCornerRadius,
borderWidth, (borderColor != null) ? borderColor.getRGB() : 0 ); borderWidth, (borderColor != null) ? borderColor.getRGB() : 0 );
} else if( SystemInfo.isLinux ) {
if( popupWindow instanceof RootPaneContainer ) {
popup.windowRoundedBorder = new FlatWindowRoundedBorder(
((RootPaneContainer)popupWindow).getRootPane(),
borderCornerRadius, borderWidth, borderColor );
}
} }
} }
@@ -471,7 +482,7 @@ public class FlatPopupFactory
"Popup.roundedBorderWidth"; "Popup.roundedBorderWidth";
Object value = getOption( owner, contents, FlatClientProperties.POPUP_ROUNDED_BORDER_WIDTH, uiKey ); Object value = getOption( owner, contents, FlatClientProperties.POPUP_ROUNDED_BORDER_WIDTH, uiKey );
return (value instanceof Number) ? ((Number)value).floatValue() : 0; return (value instanceof Number) ? ((Number)value).floatValue() : 1;
} }
//---- fixes -------------------------------------------------------------- //---- fixes --------------------------------------------------------------
@@ -584,6 +595,7 @@ public class FlatPopupFactory
// heavy weight // heavy weight
Window popupWindow; Window popupWindow;
private Color oldPopupWindowBackground; private Color oldPopupWindowBackground;
private FlatWindowRoundedBorder windowRoundedBorder;
private boolean disposed; private boolean disposed;
@@ -609,6 +621,7 @@ public class FlatPopupFactory
contents = reusePopup.contents; contents = reusePopup.contents;
popupWindow = reusePopup.popupWindow; popupWindow = reusePopup.popupWindow;
oldPopupWindowBackground = reusePopup.oldPopupWindowBackground; oldPopupWindowBackground = reusePopup.oldPopupWindowBackground;
windowRoundedBorder = reusePopup.windowRoundedBorder;
} }
NonFlashingPopup cloneForReuse() { NonFlashingPopup cloneForReuse() {
@@ -680,6 +693,11 @@ public class FlatPopupFactory
contents = null; contents = null;
} }
if( windowRoundedBorder != null ) {
windowRoundedBorder.uninstall();
windowRoundedBorder = null;
}
if( popupWindow != null ) { if( popupWindow != null ) {
// restore background so that it can not affect other LaFs (when switching) // restore background so that it can not affect other LaFs (when switching)
// because popup windows are cached and reused // because popup windows are cached and reused
@@ -715,6 +733,7 @@ public class FlatPopupFactory
private class DropShadowPopup private class DropShadowPopup
extends NonFlashingPopup extends NonFlashingPopup
implements ComponentListener
{ {
// light weight // light weight
private JComponent lightComp; private JComponent lightComp;
@@ -774,7 +793,7 @@ public class FlatPopupFactory
} }
// Windows 11: reset corner preference on reused heavy weight popups // Windows 11: reset corner preference on reused heavy weight popups
if( isWindows11BorderSupported() ) { if( SystemInfo.isWindows_11_orLater && FlatNativeWindowsLibrary.isLoaded() ) {
resetWindows11Border( popupWindow ); resetWindows11Border( popupWindow );
if( dropShadowWindow != null ) if( dropShadowWindow != null )
resetWindows11Border( dropShadowWindow ); resetWindows11Border( dropShadowWindow );
@@ -844,10 +863,18 @@ public class FlatPopupFactory
if( insets.left != 0 || insets.top != 0 ) if( insets.left != 0 || insets.top != 0 )
lightComp.setLocation( lightComp.getX() - insets.left, lightComp.getY() - insets.top ); lightComp.setLocation( lightComp.getX() - insets.left, lightComp.getY() - insets.top );
} }
if( popupWindow != null ) {
removeAllPopupWindowComponentListeners();
popupWindow.addComponentListener( this );
}
} }
@Override @Override
void hideImpl() { void hideImpl() {
if( popupWindow != null )
removeAllPopupWindowComponentListeners();
if( dropShadowDelegate != null ) { if( dropShadowDelegate != null ) {
dropShadowDelegate.hide(); dropShadowDelegate.hide();
dropShadowDelegate = null; dropShadowDelegate = null;
@@ -947,23 +974,55 @@ public class FlatPopupFactory
@Override @Override
void reset( Component contents, int ownerX, int ownerY ) { void reset( Component contents, int ownerX, int ownerY ) {
if( popupWindow != null )
removeAllPopupWindowComponentListeners();
super.reset( contents, ownerX, ownerY ); super.reset( contents, ownerX, ownerY );
if( dropShadowWindow != null ) { updateDropShadowWindowBounds();
// set preferred size of drop shadow panel }
Dimension prefSize = popupWindow.getPreferredSize();
Insets insets = dropShadowPanel2.getInsets();
int w = prefSize.width + insets.left + insets.right;
int h = prefSize.height + insets.top + insets.bottom;
dropShadowPanel2.setPreferredSize( new Dimension( w, h ) );
dropShadowPanel2.invalidate();
dropShadowWindow.pack();
// update drop shadow popup window location private void updateDropShadowWindowBounds() {
int x = popupWindow.getX() - insets.left; if( dropShadowWindow == null )
int y = popupWindow.getY() - insets.top; return;
dropShadowWindow.setLocation( x, y );
// calculate size of drop shadow window
Dimension size = popupWindow.getSize();
Insets insets = dropShadowPanel2.getInsets();
int w = size.width + insets.left + insets.right;
int h = size.height + insets.top + insets.bottom;
// update drop shadow popup window bounds
int x = popupWindow.getX() - insets.left;
int y = popupWindow.getY() - insets.top;
dropShadowWindow.setBounds( x, y, w, h );
dropShadowWindow.validate();
}
private void removeAllPopupWindowComponentListeners() {
// make sure that there is no old component listener
// necessary because this class is cloned if reusing popup windows
for( ComponentListener l : popupWindow.getComponentListeners() ) {
if( l instanceof DropShadowPopup )
popupWindow.removeComponentListener( l );
} }
} }
//---- interface ComponentListener ----
@Override
public void componentResized( ComponentEvent e ) {
if( e.getSource() == popupWindow )
updateDropShadowWindowBounds();
}
@Override
public void componentMoved( ComponentEvent e ) {
if( e.getSource() == popupWindow )
updateDropShadowWindowBounds();
}
@Override public void componentShown( ComponentEvent e ) {}
@Override public void componentHidden( ComponentEvent e ) {}
} }
} }

View File

@@ -684,7 +684,7 @@ public class FlatRootPaneUI
* Window border used for non-native window decorations. * Window border used for non-native window decorations.
*/ */
public static class FlatWindowBorder public static class FlatWindowBorder
extends BorderUIResource.EmptyBorderUIResource extends FlatEmptyBorder
{ {
protected final Color activeBorderColor = UIManager.getColor( "RootPane.activeBorderColor" ); protected final Color activeBorderColor = UIManager.getColor( "RootPane.activeBorderColor" );
protected final Color inactiveBorderColor = UIManager.getColor( "RootPane.inactiveBorderColor" ); protected final Color inactiveBorderColor = UIManager.getColor( "RootPane.inactiveBorderColor" );
@@ -717,7 +717,10 @@ public class FlatRootPaneUI
} }
private void paintImpl( Graphics2D g, int x, int y, int width, int height, double scaleFactor ) { private void paintImpl( Graphics2D g, int x, int y, int width, int height, double scaleFactor ) {
g.drawRect( x, y, width - 1, height - 1 ); Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
float lineWidth = (float) (UIScale.scale( 1f ) * scaleFactor);
g.fill( FlatUIUtils.createRectangle( x, y, width, height, lineWidth ) );
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
} }
protected boolean isWindowMaximized( Component c ) { protected boolean isWindowMaximized( Component c ) {

View File

@@ -102,9 +102,11 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault Tree.selectionForeground Color * @uiDefault Tree.selectionForeground Color
* @uiDefault Tree.selectionInactiveBackground Color * @uiDefault Tree.selectionInactiveBackground Color
* @uiDefault Tree.selectionInactiveForeground Color * @uiDefault Tree.selectionInactiveForeground Color
* @uiDefault Tree.alternateRowColor Color
* @uiDefault Tree.selectionInsets Insets * @uiDefault Tree.selectionInsets Insets
* @uiDefault Tree.selectionArc int * @uiDefault Tree.selectionArc int
* @uiDefault Tree.wideSelection boolean * @uiDefault Tree.wideSelection boolean
* @uiDefault Tree.wideCellRenderer boolean
* @uiDefault Tree.showCellFocusIndicator boolean * @uiDefault Tree.showCellFocusIndicator boolean
* @uiDefault Tree.showDefaultIcons boolean * @uiDefault Tree.showDefaultIcons boolean
* *
@@ -141,9 +143,11 @@ public class FlatTreeUI
@Styleable protected Color selectionInactiveBackground; @Styleable protected Color selectionInactiveBackground;
@Styleable protected Color selectionInactiveForeground; @Styleable protected Color selectionInactiveForeground;
@Styleable protected Color selectionBorderColor; @Styleable protected Color selectionBorderColor;
/** @since 3.6 */ @Styleable protected Color alternateRowColor;
/** @since 3 */ @Styleable protected Insets selectionInsets; /** @since 3 */ @Styleable protected Insets selectionInsets;
/** @since 3 */ @Styleable protected int selectionArc; /** @since 3 */ @Styleable protected int selectionArc;
@Styleable protected boolean wideSelection; @Styleable protected boolean wideSelection;
/** @since 3.6 */ @Styleable protected boolean wideCellRenderer;
@Styleable protected boolean showCellFocusIndicator; @Styleable protected boolean showCellFocusIndicator;
/** @since 3 */ protected boolean showDefaultIcons; /** @since 3 */ protected boolean showDefaultIcons;
@@ -192,9 +196,11 @@ public class FlatTreeUI
selectionInactiveBackground = UIManager.getColor( "Tree.selectionInactiveBackground" ); selectionInactiveBackground = UIManager.getColor( "Tree.selectionInactiveBackground" );
selectionInactiveForeground = UIManager.getColor( "Tree.selectionInactiveForeground" ); selectionInactiveForeground = UIManager.getColor( "Tree.selectionInactiveForeground" );
selectionBorderColor = UIManager.getColor( "Tree.selectionBorderColor" ); selectionBorderColor = UIManager.getColor( "Tree.selectionBorderColor" );
alternateRowColor = UIManager.getColor( "Tree.alternateRowColor" );
selectionInsets = UIManager.getInsets( "Tree.selectionInsets" ); selectionInsets = UIManager.getInsets( "Tree.selectionInsets" );
selectionArc = UIManager.getInt( "Tree.selectionArc" ); selectionArc = UIManager.getInt( "Tree.selectionArc" );
wideSelection = UIManager.getBoolean( "Tree.wideSelection" ); wideSelection = UIManager.getBoolean( "Tree.wideSelection" );
wideCellRenderer = UIManager.getBoolean( "Tree.wideCellRenderer" );
showCellFocusIndicator = UIManager.getBoolean( "Tree.showCellFocusIndicator" ); showCellFocusIndicator = UIManager.getBoolean( "Tree.showCellFocusIndicator" );
showDefaultIcons = UIManager.getBoolean( "Tree.showDefaultIcons" ); showDefaultIcons = UIManager.getBoolean( "Tree.showDefaultIcons" );
@@ -227,6 +233,7 @@ public class FlatTreeUI
selectionInactiveBackground = null; selectionInactiveBackground = null;
selectionInactiveForeground = null; selectionInactiveForeground = null;
selectionBorderColor = null; selectionBorderColor = null;
alternateRowColor = null;
defaultLeafIcon = null; defaultLeafIcon = null;
defaultClosedIcon = null; defaultClosedIcon = null;
@@ -310,6 +317,7 @@ public class FlatTreeUI
if( e.getSource() == tree ) { if( e.getSource() == tree ) {
switch( e.getPropertyName() ) { switch( e.getPropertyName() ) {
case TREE_WIDE_SELECTION: case TREE_WIDE_SELECTION:
case TREE_WIDE_CELL_RENDERER:
case TREE_PAINT_SELECTION: case TREE_PAINT_SELECTION:
HiDPIUtils.repaint( tree ); HiDPIUtils.repaint( tree );
break; break;
@@ -571,6 +579,27 @@ public class FlatTreeUI
boolean isDropRow = isDropRow( row ); boolean isDropRow = isDropRow( row );
boolean needsSelectionPainting = (isSelected || isDropRow) && isPaintSelection(); boolean needsSelectionPainting = (isSelected || isDropRow) && isPaintSelection();
// paint alternating rows
if( alternateRowColor != null && row % 2 != 0 ) {
g.setColor( alternateRowColor );
float arc = UIScale.scale( selectionArc / 2f );
FlatUIUtils.paintSelection( (Graphics2D) g, 0, bounds.y, tree.getWidth(), bounds.height,
UIScale.scale( selectionInsets ), arc, arc, arc, arc, 0 );
}
// update bounds for wide cell renderer
if( isWideSelection() && isWideCellRenderer() ) {
Rectangle wideBounds = new Rectangle( bounds );
if( tree.getComponentOrientation().isLeftToRight() )
wideBounds.width = tree.getWidth() - bounds.x - insets.right;
else {
wideBounds.x = insets.left;
wideBounds.width = bounds.x + bounds.width - insets.left;
}
bounds = wideBounds;
}
// do not paint row if editing // do not paint row if editing
if( isEditing ) { if( isEditing ) {
// paint wide selection // paint wide selection
@@ -795,6 +824,11 @@ public class FlatTreeUI
return clientPropertyBoolean( tree, TREE_WIDE_SELECTION, wideSelection ); return clientPropertyBoolean( tree, TREE_WIDE_SELECTION, wideSelection );
} }
/** @since 3.6 */
protected boolean isWideCellRenderer() {
return clientPropertyBoolean( tree, TREE_WIDE_CELL_RENDERER, wideCellRenderer );
}
protected boolean isPaintSelection() { protected boolean isPaintSelection() {
return clientPropertyBoolean( tree, TREE_PAINT_SELECTION, paintSelection ); return clientPropertyBoolean( tree, TREE_PAINT_SELECTION, paintSelection );
} }

View File

@@ -129,6 +129,20 @@ public class FlatUIUtils
return insets.top == 0 && insets.left == 0 && insets.bottom == 0 && insets.right == 0; return insets.top == 0 && insets.left == 0 && insets.bottom == 0 && insets.right == 0;
} }
/** @since 3.6 */
public static Color stateColor( boolean state, Color stateColor, Color defaultColor ) {
return (state && stateColor != null) ? stateColor : defaultColor;
}
/** @since 3.6 */
public static Color stateColor( boolean state1, Color state1Color,
boolean state2, Color state2Color, Color defaultColor )
{
return (state1 && state1Color != null)
? state1Color
: ((state2 && state2Color != null) ? state2Color : defaultColor);
}
public static Color getUIColor( String key, int defaultColorRGB ) { public static Color getUIColor( String key, int defaultColorRGB ) {
Color color = UIManager.getColor( key ); Color color = UIManager.getColor( key );
return (color != null) ? color : new Color( defaultColorRGB ); return (color != null) ? color : new Color( defaultColorRGB );
@@ -397,7 +411,8 @@ public class FlatUIUtils
GraphicsConfiguration gc = c.getGraphicsConfiguration(); GraphicsConfiguration gc = c.getGraphicsConfiguration();
GraphicsDevice gd = (gc != null) ? gc.getDevice() : null; GraphicsDevice gd = (gc != null) ? gc.getDevice() : null;
Window fullScreenWindow = (gd != null) ? gd.getFullScreenWindow() : null; Window fullScreenWindow = (gd != null) ? gd.getFullScreenWindow() : null;
return (fullScreenWindow != null && fullScreenWindow == SwingUtilities.windowForComponent( c )); return (fullScreenWindow != null &&
(fullScreenWindow == c || fullScreenWindow == SwingUtilities.windowForComponent( c )));
} }
public static Boolean isRoundRect( Component c ) { public static Boolean isRoundRect( Component c ) {

View File

@@ -41,7 +41,6 @@ import java.util.function.Supplier;
import javax.swing.DesktopManager; import javax.swing.DesktopManager;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JInternalFrame; import javax.swing.JInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JRootPane; import javax.swing.JRootPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
@@ -60,8 +59,6 @@ import com.formdev.flatlaf.util.UIScale;
public abstract class FlatWindowResizer public abstract class FlatWindowResizer
implements PropertyChangeListener, ComponentListener implements PropertyChangeListener, ComponentListener
{ {
protected final static Integer WINDOW_RESIZER_LAYER = JLayeredPane.DRAG_LAYER + 1;
protected final JComponent resizeComp; protected final JComponent resizeComp;
protected final int borderDragThickness = FlatUIUtils.getUIInt( "RootPane.borderDragThickness", 5 ); protected final int borderDragThickness = FlatUIUtils.getUIInt( "RootPane.borderDragThickness", 5 );
@@ -82,12 +79,12 @@ public abstract class FlatWindowResizer
leftDragComp = createDragBorderComponent( NW_RESIZE_CURSOR, W_RESIZE_CURSOR, SW_RESIZE_CURSOR ); leftDragComp = createDragBorderComponent( NW_RESIZE_CURSOR, W_RESIZE_CURSOR, SW_RESIZE_CURSOR );
rightDragComp = createDragBorderComponent( NE_RESIZE_CURSOR, E_RESIZE_CURSOR, SE_RESIZE_CURSOR ); rightDragComp = createDragBorderComponent( NE_RESIZE_CURSOR, E_RESIZE_CURSOR, SE_RESIZE_CURSOR );
Container cont = (resizeComp instanceof JRootPane) ? ((JRootPane)resizeComp).getLayeredPane() : resizeComp; // for rootpanes, add after glasspane
Object cons = (cont instanceof JLayeredPane) ? WINDOW_RESIZER_LAYER : null; int insertIndex = (resizeComp instanceof JRootPane) ? 1 : 0;
cont.add( topDragComp, cons, 0 ); resizeComp.add( topDragComp, insertIndex++ );
cont.add( bottomDragComp, cons, 1 ); resizeComp.add( bottomDragComp, insertIndex++ );
cont.add( leftDragComp, cons, 2 ); resizeComp.add( leftDragComp, insertIndex++ );
cont.add( rightDragComp, cons, 3 ); resizeComp.add( rightDragComp, insertIndex++ );
resizeComp.addComponentListener( this ); resizeComp.addComponentListener( this );
resizeComp.addPropertyChangeListener( "ancestor", this ); resizeComp.addPropertyChangeListener( "ancestor", this );
@@ -106,11 +103,10 @@ public abstract class FlatWindowResizer
resizeComp.removeComponentListener( this ); resizeComp.removeComponentListener( this );
resizeComp.removePropertyChangeListener( "ancestor", this ); resizeComp.removePropertyChangeListener( "ancestor", this );
Container cont = topDragComp.getParent(); resizeComp.remove( topDragComp );
cont.remove( topDragComp ); resizeComp.remove( bottomDragComp );
cont.remove( bottomDragComp ); resizeComp.remove( leftDragComp );
cont.remove( leftDragComp ); resizeComp.remove( rightDragComp );
cont.remove( rightDragComp );
} }
public void doLayout() { public void doLayout() {
@@ -121,7 +117,7 @@ public abstract class FlatWindowResizer
int y = 0; int y = 0;
int width = resizeComp.getWidth(); int width = resizeComp.getWidth();
int height = resizeComp.getHeight(); int height = resizeComp.getHeight();
if( width == 0 || height == 0 ) if( width <= 0 || height <= 0 )
return; return;
Insets resizeInsets = getResizeInsets(); Insets resizeInsets = getResizeInsets();
@@ -251,8 +247,7 @@ public abstract class FlatWindowResizer
centerComp = new JPanel(); centerComp = new JPanel();
centerComp.setOpaque( false ); centerComp.setOpaque( false );
centerComp.setVisible( false ); centerComp.setVisible( false );
Container cont = rootPane.getLayeredPane(); rootPane.add( centerComp, 5 );
cont.add( centerComp, WINDOW_RESIZER_LAYER, 4 );
// On Linux, limit window resizing to screen bounds because otherwise // On Linux, limit window resizing to screen bounds because otherwise
// there would be a strange effect when the mouse is moved over a sidebar // there would be a strange effect when the mouse is moved over a sidebar
@@ -262,8 +257,7 @@ public abstract class FlatWindowResizer
@Override @Override
public void uninstall() { public void uninstall() {
Container cont = topDragComp.getParent(); resizeComp.remove( centerComp );
cont.remove( centerComp );
super.uninstall(); super.uninstall();
} }
@@ -272,7 +266,8 @@ public abstract class FlatWindowResizer
public void doLayout() { public void doLayout() {
super.doLayout(); super.doLayout();
centerComp.setBounds( 0, 0, resizeComp.getWidth(), resizeComp.getHeight() ); if( centerComp != null && centerComp.isVisible() )
centerComp.setBounds( 0, 0, resizeComp.getWidth(), resizeComp.getHeight() );
} }
@Override @Override
@@ -376,6 +371,7 @@ public abstract class FlatWindowResizer
@Override @Override
protected void beginResizing( int resizeDir ) { protected void beginResizing( int resizeDir ) {
centerComp.setBounds( 0, 0, resizeComp.getWidth(), resizeComp.getHeight() );
centerComp.setCursor( getPredefinedCursor( resizeDir ) ); centerComp.setCursor( getPredefinedCursor( resizeDir ) );
centerComp.setVisible( true ); centerComp.setVisible( true );
} }

View File

@@ -0,0 +1,361 @@
/*
* Copyright 2025 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.ui;
import static javax.swing.SwingConstants.*;
import java.awt.Color;
import java.awt.Container;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.IllegalComponentStateException;
import java.awt.Shape;
import java.awt.Window;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.geom.Area;
import java.awt.geom.Path2D;
import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
import javax.swing.JLayeredPane;
import javax.swing.JRootPane;
import com.formdev.flatlaf.util.UIScale;
/**
* Rounded border for {@link Window}.
* Used for popups and for FlatLaf window decorations.
* <p>
* Border is painted only if window is not maximized (in both directions) and
* not in full screen mode. If maximized in one direction (vertically or horizontally),
* then a square border is painted.
* <p>
* Note: The rootpane of the window should have a {@link FlatEmptyBorder} with
* same insets as border width used in this class.
*
* @author Karl Tauber
* @since 3.6
*/
public class FlatWindowRoundedBorder
implements PropertyChangeListener, ComponentListener
{
protected final JRootPane rootPane;
protected final int borderCornerRadius;
protected final float borderWidth;
protected final Color borderColor;
protected final Shape cornerShape;
// edges
protected final RoundedBorderComponent northComp;
protected final RoundedBorderComponent southComp;
protected final RoundedBorderComponent westComp;
protected final RoundedBorderComponent eastComp;
// corners
protected final RoundedBorderComponent northWestComp;
protected final RoundedBorderComponent northEastComp;
protected final RoundedBorderComponent southWestComp;
protected final RoundedBorderComponent southEastComp;
protected Window window;
protected boolean windowIsRounded;
public FlatWindowRoundedBorder( JRootPane rootPane, int borderCornerRadius,
float borderWidth, Color borderColor )
{
this.rootPane = rootPane;
this.borderCornerRadius = borderCornerRadius;
this.borderWidth = borderWidth;
this.borderColor = borderColor;
// create shape used to paint rounded corners
cornerShape = createCornerShape();
// create edges
northComp = new RoundedBorderComponent( NORTH );
southComp = new RoundedBorderComponent( SOUTH );
westComp = new RoundedBorderComponent( WEST );
eastComp = new RoundedBorderComponent( EAST );
// create corners
northWestComp = new RoundedBorderComponent( NORTH_WEST );
northEastComp = new RoundedBorderComponent( NORTH_EAST );
southWestComp = new RoundedBorderComponent( SOUTH_WEST );
southEastComp = new RoundedBorderComponent( SOUTH_EAST );
// insert before layered pane
int insertIndex = rootPane.getComponentCount() - 1;
JLayeredPane layeredPane = rootPane.getLayeredPane();
for( int i = insertIndex; i >= 0; i-- ) {
if( rootPane.getComponent( insertIndex ) == layeredPane )
break;
}
// add edges
rootPane.add( northComp, insertIndex++ );
rootPane.add( southComp, insertIndex++ );
rootPane.add( westComp, insertIndex++ );
rootPane.add( eastComp, insertIndex++ );
// add corners
rootPane.add( northWestComp, insertIndex++ );
rootPane.add( northEastComp, insertIndex++ );
rootPane.add( southWestComp, insertIndex++ );
rootPane.add( southEastComp, insertIndex++ );
// add listeners
rootPane.addComponentListener( this );
rootPane.addPropertyChangeListener( "ancestor", this );
if( rootPane.isDisplayable() )
addNotify();
else
updateVisibility();
}
public void uninstall() {
removeNotify();
// remove listeners
rootPane.removeComponentListener( this );
rootPane.removePropertyChangeListener( "ancestor", this );
// remove edges
rootPane.remove( northComp );
rootPane.remove( southComp );
rootPane.remove( westComp );
rootPane.remove( eastComp );
// remove corners
rootPane.remove( northWestComp );
rootPane.remove( northEastComp );
rootPane.remove( southWestComp );
rootPane.remove( southEastComp );
}
public void doLayout() {
if( !northComp.isVisible() )
return;
int x = 0;
int y = 0;
int width = rootPane.getWidth();
int height = rootPane.getHeight();
if( width <= 0 || height <= 0 )
return;
// for layout, round-up scaled border width and radius to ensure that components are large enough
int lineWidth = (int) Math.ceil( UIScale.scale( borderWidth ) );
int cornerSize = (windowIsRounded && lineWidth > 0)
? (int) Math.ceil( UIScale.scale( (float) borderCornerRadius ) )
: 0;
int cornerSize2x = cornerSize * 2;
// edges
northComp.setBounds( x + cornerSize, y, width - cornerSize2x, lineWidth );
southComp.setBounds( x + cornerSize, y + height - lineWidth, width - cornerSize2x, lineWidth );
westComp.setBounds( x, y + cornerSize, lineWidth, height - cornerSize2x );
eastComp.setBounds( x + width - lineWidth, y + cornerSize, lineWidth, height - cornerSize2x );
// corners
northWestComp.setBounds( x, y, cornerSize, cornerSize );
northEastComp.setBounds( x + width - cornerSize, y, cornerSize, cornerSize );
southWestComp.setBounds( x, y + height - cornerSize, cornerSize, cornerSize );
southEastComp.setBounds( x + width - cornerSize, y + height - cornerSize, cornerSize, cornerSize );
}
protected void addNotify() {
Container parent = rootPane.getParent();
window = (parent instanceof Window) ? (Window) parent : null;
updateVisibility();
updateWindowShape();
doLayout();
}
protected void removeNotify() {
if( window != null ) {
window.setShape( null );
window = null;
}
updateVisibility();
}
protected void updateVisibility() {
boolean visible = needsBorder();
if( visible == northComp.isVisible() )
return;
// edges
northComp.setVisible( visible );
southComp.setVisible( visible );
westComp.setVisible( visible );
eastComp.setVisible( visible );
// corners
northWestComp.setVisible( visible );
northEastComp.setVisible( visible );
southWestComp.setVisible( visible );
southEastComp.setVisible( visible );
}
protected boolean needsBorder() {
if( window == null || FlatUIUtils.isFullScreen( window ) )
return false;
if( window instanceof Frame )
return (((Frame)window).getExtendedState() & Frame.MAXIMIZED_BOTH) != Frame.MAXIMIZED_BOTH;
return true;
}
protected void updateWindowShape() {
windowIsRounded = false;
if( window == null )
return;
if( !northComp.isVisible() ||
(window instanceof Frame && (((Frame)window).getExtendedState() & Frame.MAXIMIZED_BOTH) != 0) )
{
window.setShape( null );
return;
}
int arc = UIScale.scale( borderCornerRadius * 2 );
// use a slightly smaller arc for the shape so that at least parts of
// the antialiased arc outside are shown
arc -= 2;
if( arc > 0 ) {
try {
window.setShape( new RoundRectangle2D.Float( 0, 0,
rootPane.getWidth(), rootPane.getHeight(), arc, arc ) );
windowIsRounded = true;
} catch( IllegalComponentStateException | UnsupportedOperationException ex ) {
window.setShape( null );
}
} else
window.setShape( null );
}
protected Shape createCornerShape() {
float lineWidth = UIScale.scale( borderWidth );
int arc = UIScale.scale( borderCornerRadius * 2 );
int wh = arc * 3;
float innerArc = arc - (lineWidth * 2);
float innerWH = wh - (lineWidth * 2);
Path2D path = new Path2D.Float( Path2D.WIND_EVEN_ODD );
path.append( new RoundRectangle2D.Float( 0, 0, wh, wh, arc, arc ), false );
path.append( new RoundRectangle2D.Float( lineWidth, lineWidth, innerWH, innerWH, innerArc, innerArc ), false );
Area area = new Area( path );
int cornerSize = (int) Math.ceil( UIScale.scale( (float) borderCornerRadius ) );
area.intersect( new Area( new Rectangle2D.Float( 0, 0, cornerSize, cornerSize ) ) );
return area;
}
//---- interface PropertyChangeListener ----
@Override
public void propertyChange( PropertyChangeEvent e ) {
switch( e.getPropertyName() ) {
case "ancestor":
if( e.getNewValue() != null )
addNotify();
else
removeNotify();
break;
}
}
//---- interface ComponentListener ----
@Override
public void componentResized( ComponentEvent e ) {
updateVisibility();
updateWindowShape();
doLayout();
}
@Override public void componentMoved( ComponentEvent e ) {}
@Override public void componentShown( ComponentEvent e ) {}
@Override public void componentHidden( ComponentEvent e ) {}
//---- class RoundedBorderComponent ---------------------------------------
protected class RoundedBorderComponent
extends JComponent
{
private final int position;
protected RoundedBorderComponent( int position ) {
this.position = position;
}
@Override
public void paint( Graphics g ) {
Graphics2D g2 = (Graphics2D) g;
int width = getWidth();
int height = getHeight();
float lineWidth = UIScale.scale( borderWidth );
/*debug
g.setColor( java.awt.Color.green );
g.drawRect( 0, 0, width - 1, height - 1 );
debug*/
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
g.setColor( borderColor );
switch( position ) {
case NORTH: g2.fill( new Rectangle2D.Float( 0, 0, width, lineWidth ) ); break;
case SOUTH: g2.fill( new Rectangle2D.Float( 0, height - lineWidth, width, lineWidth ) ); break;
case WEST: g2.fill( new Rectangle2D.Float( 0, 0, lineWidth, height ) ); break;
case EAST: g2.fill( new Rectangle2D.Float( width - lineWidth, 0, lineWidth, height ) ); break;
case NORTH_WEST:
g2.fill( cornerShape );
break;
case NORTH_EAST:
g2.translate( width, 0 );
g2.rotate( Math.toRadians( 90 ) );
g2.fill( cornerShape );
break;
case SOUTH_WEST:
g2.translate( 0, height );
g2.rotate( Math.toRadians( -90 ) );
g2.fill( cornerShape );
break;
case SOUTH_EAST:
g2.translate( width, height );
g2.rotate( Math.toRadians( 180 ) );
g2.fill( cornerShape );
break;
}
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
}
}
}

View File

@@ -246,7 +246,6 @@ PasswordField.revealIconColor = @foreground
#---- Popup ---- #---- Popup ----
[mac]Popup.roundedBorderWidth = 1
Popup.dropShadowColor = #000 Popup.dropShadowColor = #000
Popup.dropShadowOpacity = 0.25 Popup.dropShadowOpacity = 0.25

View File

@@ -289,7 +289,7 @@ ComboBox.popupInsets = 0,0,0,0
ComboBox.selectionInsets = 0,0,0,0 ComboBox.selectionInsets = 0,0,0,0
ComboBox.selectionArc = 0 ComboBox.selectionArc = 0
ComboBox.borderCornerRadius = $Popup.borderCornerRadius ComboBox.borderCornerRadius = $Popup.borderCornerRadius
[mac]ComboBox.roundedBorderWidth = $Popup.roundedBorderWidth ComboBox.roundedBorderWidth = $Popup.roundedBorderWidth
#---- Component ---- #---- Component ----
@@ -506,7 +506,7 @@ PasswordField.revealIcon = com.formdev.flatlaf.icons.FlatRevealIcon
#---- Popup ---- #---- Popup ----
Popup.borderCornerRadius = 4 Popup.borderCornerRadius = 4
[mac]Popup.roundedBorderWidth = 0 Popup.roundedBorderWidth = 1
Popup.dropShadowPainted = true Popup.dropShadowPainted = true
Popup.dropShadowInsets = -4,-4,4,4 Popup.dropShadowInsets = -4,-4,4,4
@@ -516,7 +516,7 @@ Popup.dropShadowInsets = -4,-4,4,4
PopupMenu.border = com.formdev.flatlaf.ui.FlatPopupMenuBorder PopupMenu.border = com.formdev.flatlaf.ui.FlatPopupMenuBorder
PopupMenu.borderInsets = 4,1,4,1 PopupMenu.borderInsets = 4,1,4,1
PopupMenu.borderCornerRadius = $Popup.borderCornerRadius PopupMenu.borderCornerRadius = $Popup.borderCornerRadius
[mac]PopupMenu.roundedBorderWidth = $Popup.roundedBorderWidth PopupMenu.roundedBorderWidth = $Popup.roundedBorderWidth
PopupMenu.background = @menuBackground PopupMenu.background = @menuBackground
PopupMenu.scrollArrowColor = @buttonArrowColor PopupMenu.scrollArrowColor = @buttonArrowColor
@@ -913,7 +913,7 @@ ToolTipManager.enableToolTipMode = activeApplication
#---- ToolTip ---- #---- ToolTip ----
ToolTip.borderCornerRadius = $Popup.borderCornerRadius ToolTip.borderCornerRadius = $Popup.borderCornerRadius
[mac]ToolTip.roundedBorderWidth = $Popup.roundedBorderWidth ToolTip.roundedBorderWidth = $Popup.roundedBorderWidth
#---- Tree ---- #---- Tree ----
@@ -934,6 +934,7 @@ Tree.rendererMargins = 1,2,1,2
Tree.selectionInsets = 0,0,0,0 Tree.selectionInsets = 0,0,0,0
Tree.selectionArc = 0 Tree.selectionArc = 0
Tree.wideSelection = true Tree.wideSelection = true
Tree.wideCellRenderer = false
Tree.repaintWholeRow = true Tree.repaintWholeRow = true
Tree.paintLines = false Tree.paintLines = false
Tree.showCellFocusIndicator = false Tree.showCellFocusIndicator = false

View File

@@ -253,6 +253,7 @@ PasswordField.revealIconColor = tint(@foreground,40%)
#---- Popup ---- #---- Popup ----
[mac]Popup.roundedBorderWidth = 0
Popup.dropShadowColor = #000 Popup.dropShadowColor = #000
Popup.dropShadowOpacity = 0.15 Popup.dropShadowOpacity = 0.15

View File

@@ -16,6 +16,7 @@
package com.formdev.flatlaf.ui; package com.formdev.flatlaf.ui;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Locale; import java.util.Locale;
import javax.swing.JComponent; import javax.swing.JComponent;
@@ -73,6 +74,15 @@ public class TestFlatHTML
testHtmlBaseSize( "<html>${BASE_SIZE}<style type='text/css'>body { color: #f00; }</style><h1>header1</h1>" + body + "</html>", "header1\n" + bodyPlain ); testHtmlBaseSize( "<html>${BASE_SIZE}<style type='text/css'>body { color: #f00; }</style><h1>header1</h1>" + body + "</html>", "header1\n" + bodyPlain );
} }
@Test
void htmlOnComponentWithNullFont() {
assertDoesNotThrow( () -> {
JLabel label = new JLabel();
label.setFont( null );
label.setText( "<html>foo<br>bar</html>" );
} );
}
private void testHtmlBaseSize( String html, String expectedPlain ) { private void testHtmlBaseSize( String html, String expectedPlain ) {
testHtmlBaseSizeImpl( html, expectedPlain ); testHtmlBaseSizeImpl( html, expectedPlain );
testHtmlBaseSizeImpl( html.toUpperCase( Locale.ENGLISH ), expectedPlain.toUpperCase( Locale.ENGLISH ) ); testHtmlBaseSizeImpl( html.toUpperCase( Locale.ENGLISH ), expectedPlain.toUpperCase( Locale.ENGLISH ) );

View File

@@ -270,6 +270,7 @@ public class TestFlatStyleableInfo
"selectionForeground", Color.class, "selectionForeground", Color.class,
"selectionInactiveBackground", Color.class, "selectionInactiveBackground", Color.class,
"selectionInactiveForeground", Color.class, "selectionInactiveForeground", Color.class,
"alternateRowColor", Color.class,
"selectionInsets", Insets.class, "selectionInsets", Insets.class,
"selectionArc", int.class, "selectionArc", int.class,
@@ -517,6 +518,8 @@ public class TestFlatStyleableInfo
"icon.borderWidth", float.class, "icon.borderWidth", float.class,
"icon.selectedBorderWidth", float.class, "icon.selectedBorderWidth", float.class,
"icon.disabledSelectedBorderWidth", float.class, "icon.disabledSelectedBorderWidth", float.class,
"icon.indeterminateBorderWidth", float.class,
"icon.disabledIndeterminateBorderWidth", float.class,
"icon.arc", int.class, "icon.arc", int.class,
// enabled // enabled
@@ -525,6 +528,9 @@ public class TestFlatStyleableInfo
"icon.selectedBorderColor", Color.class, "icon.selectedBorderColor", Color.class,
"icon.selectedBackground", Color.class, "icon.selectedBackground", Color.class,
"icon.checkmarkColor", Color.class, "icon.checkmarkColor", Color.class,
"icon.indeterminateBorderColor", Color.class,
"icon.indeterminateBackground", Color.class,
"icon.indeterminateCheckmarkColor", Color.class,
// disabled // disabled
"icon.disabledBorderColor", Color.class, "icon.disabledBorderColor", Color.class,
@@ -532,6 +538,9 @@ public class TestFlatStyleableInfo
"icon.disabledSelectedBorderColor", Color.class, "icon.disabledSelectedBorderColor", Color.class,
"icon.disabledSelectedBackground", Color.class, "icon.disabledSelectedBackground", Color.class,
"icon.disabledCheckmarkColor", Color.class, "icon.disabledCheckmarkColor", Color.class,
"icon.disabledIndeterminateBorderColor", Color.class,
"icon.disabledIndeterminateBackground", Color.class,
"icon.disabledIndeterminateCheckmarkColor", Color.class,
// focused // focused
"icon.focusedBorderColor", Color.class, "icon.focusedBorderColor", Color.class,
@@ -539,6 +548,9 @@ public class TestFlatStyleableInfo
"icon.focusedSelectedBorderColor", Color.class, "icon.focusedSelectedBorderColor", Color.class,
"icon.focusedSelectedBackground", Color.class, "icon.focusedSelectedBackground", Color.class,
"icon.focusedCheckmarkColor", Color.class, "icon.focusedCheckmarkColor", Color.class,
"icon.focusedIndeterminateBorderColor", Color.class,
"icon.focusedIndeterminateBackground", Color.class,
"icon.focusedIndeterminateCheckmarkColor", Color.class,
// hover // hover
"icon.hoverBorderColor", Color.class, "icon.hoverBorderColor", Color.class,
@@ -546,13 +558,19 @@ public class TestFlatStyleableInfo
"icon.hoverSelectedBorderColor", Color.class, "icon.hoverSelectedBorderColor", Color.class,
"icon.hoverSelectedBackground", Color.class, "icon.hoverSelectedBackground", Color.class,
"icon.hoverCheckmarkColor", Color.class, "icon.hoverCheckmarkColor", Color.class,
"icon.hoverIndeterminateBorderColor", Color.class,
"icon.hoverIndeterminateBackground", Color.class,
"icon.hoverIndeterminateCheckmarkColor", Color.class,
// pressed // pressed
"icon.pressedBorderColor", Color.class, "icon.pressedBorderColor", Color.class,
"icon.pressedBackground", Color.class, "icon.pressedBackground", Color.class,
"icon.pressedSelectedBorderColor", Color.class, "icon.pressedSelectedBorderColor", Color.class,
"icon.pressedSelectedBackground", Color.class, "icon.pressedSelectedBackground", Color.class,
"icon.pressedCheckmarkColor", Color.class "icon.pressedCheckmarkColor", Color.class,
"icon.pressedIndeterminateBorderColor", Color.class,
"icon.pressedIndeterminateBackground", Color.class,
"icon.pressedIndeterminateCheckmarkColor", Color.class
); );
} }
@@ -965,9 +983,11 @@ public class TestFlatStyleableInfo
"selectionInactiveBackground", Color.class, "selectionInactiveBackground", Color.class,
"selectionInactiveForeground", Color.class, "selectionInactiveForeground", Color.class,
"selectionBorderColor", Color.class, "selectionBorderColor", Color.class,
"alternateRowColor", Color.class,
"selectionInsets", Insets.class, "selectionInsets", Insets.class,
"selectionArc", int.class, "selectionArc", int.class,
"wideSelection", boolean.class, "wideSelection", boolean.class,
"wideCellRenderer", boolean.class,
"showCellFocusIndicator", boolean.class, "showCellFocusIndicator", boolean.class,
"paintSelection", boolean.class, "paintSelection", boolean.class,
@@ -1144,6 +1164,8 @@ public class TestFlatStyleableInfo
"borderWidth", float.class, "borderWidth", float.class,
"selectedBorderWidth", float.class, "selectedBorderWidth", float.class,
"disabledSelectedBorderWidth", float.class, "disabledSelectedBorderWidth", float.class,
"indeterminateBorderWidth", float.class,
"disabledIndeterminateBorderWidth", float.class,
"arc", int.class, "arc", int.class,
// enabled // enabled
@@ -1152,6 +1174,9 @@ public class TestFlatStyleableInfo
"selectedBorderColor", Color.class, "selectedBorderColor", Color.class,
"selectedBackground", Color.class, "selectedBackground", Color.class,
"checkmarkColor", Color.class, "checkmarkColor", Color.class,
"indeterminateBorderColor", Color.class,
"indeterminateBackground", Color.class,
"indeterminateCheckmarkColor", Color.class,
// disabled // disabled
"disabledBorderColor", Color.class, "disabledBorderColor", Color.class,
@@ -1159,6 +1184,9 @@ public class TestFlatStyleableInfo
"disabledSelectedBorderColor", Color.class, "disabledSelectedBorderColor", Color.class,
"disabledSelectedBackground", Color.class, "disabledSelectedBackground", Color.class,
"disabledCheckmarkColor", Color.class, "disabledCheckmarkColor", Color.class,
"disabledIndeterminateBorderColor", Color.class,
"disabledIndeterminateBackground", Color.class,
"disabledIndeterminateCheckmarkColor", Color.class,
// focused // focused
"focusedBorderColor", Color.class, "focusedBorderColor", Color.class,
@@ -1166,6 +1194,9 @@ public class TestFlatStyleableInfo
"focusedSelectedBorderColor", Color.class, "focusedSelectedBorderColor", Color.class,
"focusedSelectedBackground", Color.class, "focusedSelectedBackground", Color.class,
"focusedCheckmarkColor", Color.class, "focusedCheckmarkColor", Color.class,
"focusedIndeterminateBorderColor", Color.class,
"focusedIndeterminateBackground", Color.class,
"focusedIndeterminateCheckmarkColor", Color.class,
// hover // hover
"hoverBorderColor", Color.class, "hoverBorderColor", Color.class,
@@ -1173,13 +1204,19 @@ public class TestFlatStyleableInfo
"hoverSelectedBorderColor", Color.class, "hoverSelectedBorderColor", Color.class,
"hoverSelectedBackground", Color.class, "hoverSelectedBackground", Color.class,
"hoverCheckmarkColor", Color.class, "hoverCheckmarkColor", Color.class,
"hoverIndeterminateBorderColor", Color.class,
"hoverIndeterminateBackground", Color.class,
"hoverIndeterminateCheckmarkColor", Color.class,
// pressed // pressed
"pressedBorderColor", Color.class, "pressedBorderColor", Color.class,
"pressedBackground", Color.class, "pressedBackground", Color.class,
"pressedSelectedBorderColor", Color.class, "pressedSelectedBorderColor", Color.class,
"pressedSelectedBackground", Color.class, "pressedSelectedBackground", Color.class,
"pressedCheckmarkColor", Color.class "pressedCheckmarkColor", Color.class,
"pressedIndeterminateBorderColor", Color.class,
"pressedIndeterminateBackground", Color.class,
"pressedIndeterminateCheckmarkColor", Color.class
); );
} }

View File

@@ -370,6 +370,7 @@ public class TestFlatStyleableValue
testColor( c, ui, "selectionForeground", 0x123456 ); testColor( c, ui, "selectionForeground", 0x123456 );
testColor( c, ui, "selectionInactiveBackground", 0x123456 ); testColor( c, ui, "selectionInactiveBackground", 0x123456 );
testColor( c, ui, "selectionInactiveForeground", 0x123456 ); testColor( c, ui, "selectionInactiveForeground", 0x123456 );
testColor( c, ui, "alternateRowColor", 0x123456 );
testInsets( c, ui, "selectionInsets", 1,2,3,4 ); testInsets( c, ui, "selectionInsets", 1,2,3,4 );
testInteger( c, ui, "selectionArc", 123 ); testInteger( c, ui, "selectionArc", 123 );
@@ -938,9 +939,11 @@ public class TestFlatStyleableValue
testColor( c, ui, "selectionInactiveBackground", 0x123456 ); testColor( c, ui, "selectionInactiveBackground", 0x123456 );
testColor( c, ui, "selectionInactiveForeground", 0x123456 ); testColor( c, ui, "selectionInactiveForeground", 0x123456 );
testColor( c, ui, "selectionBorderColor", 0x123456 ); testColor( c, ui, "selectionBorderColor", 0x123456 );
testColor( c, ui, "alternateRowColor", 0x123456 );
testInsets( c, ui, "selectionInsets", 1,2,3,4 ); testInsets( c, ui, "selectionInsets", 1,2,3,4 );
testInteger( c, ui, "selectionArc", 123 ); testInteger( c, ui, "selectionArc", 123 );
testBoolean( c, ui, "wideSelection", true ); testBoolean( c, ui, "wideSelection", true );
testBoolean( c, ui, "wideCellRenderer", true );
testBoolean( c, ui, "showCellFocusIndicator", true ); testBoolean( c, ui, "showCellFocusIndicator", true );
testBoolean( c, ui, "paintSelection", false ); testBoolean( c, ui, "paintSelection", false );
@@ -1146,6 +1149,8 @@ public class TestFlatStyleableValue
testValue( icon, "borderWidth", 1.5f ); testValue( icon, "borderWidth", 1.5f );
testValue( icon, "selectedBorderWidth", 1.5f ); testValue( icon, "selectedBorderWidth", 1.5f );
testValue( icon, "disabledSelectedBorderWidth", 1.5f ); testValue( icon, "disabledSelectedBorderWidth", 1.5f );
testValue( icon, "indeterminateBorderWidth", 1.5f );
testValue( icon, "disabledIndeterminateBorderWidth", 1.5f );
testValue( icon, "arc", 5 ); testValue( icon, "arc", 5 );
// enabled // enabled
@@ -1154,6 +1159,9 @@ public class TestFlatStyleableValue
testValue( icon, "selectedBorderColor", Color.WHITE ); testValue( icon, "selectedBorderColor", Color.WHITE );
testValue( icon, "selectedBackground", Color.WHITE ); testValue( icon, "selectedBackground", Color.WHITE );
testValue( icon, "checkmarkColor", Color.WHITE ); testValue( icon, "checkmarkColor", Color.WHITE );
testValue( icon, "indeterminateBorderColor", Color.WHITE );
testValue( icon, "indeterminateBackground", Color.WHITE );
testValue( icon, "indeterminateCheckmarkColor", Color.WHITE );
// disabled // disabled
testValue( icon, "disabledBorderColor", Color.WHITE ); testValue( icon, "disabledBorderColor", Color.WHITE );
@@ -1161,6 +1169,9 @@ public class TestFlatStyleableValue
testValue( icon, "disabledSelectedBorderColor", Color.WHITE ); testValue( icon, "disabledSelectedBorderColor", Color.WHITE );
testValue( icon, "disabledSelectedBackground", Color.WHITE ); testValue( icon, "disabledSelectedBackground", Color.WHITE );
testValue( icon, "disabledCheckmarkColor", Color.WHITE ); testValue( icon, "disabledCheckmarkColor", Color.WHITE );
testValue( icon, "disabledIndeterminateBorderColor", Color.WHITE );
testValue( icon, "disabledIndeterminateBackground", Color.WHITE );
testValue( icon, "disabledIndeterminateCheckmarkColor", Color.WHITE );
// focused // focused
testValue( icon, "focusedBorderColor", Color.WHITE ); testValue( icon, "focusedBorderColor", Color.WHITE );
@@ -1168,6 +1179,9 @@ public class TestFlatStyleableValue
testValue( icon, "focusedSelectedBorderColor", Color.WHITE ); testValue( icon, "focusedSelectedBorderColor", Color.WHITE );
testValue( icon, "focusedSelectedBackground", Color.WHITE ); testValue( icon, "focusedSelectedBackground", Color.WHITE );
testValue( icon, "focusedCheckmarkColor", Color.WHITE ); testValue( icon, "focusedCheckmarkColor", Color.WHITE );
testValue( icon, "focusedIndeterminateBorderColor", Color.WHITE );
testValue( icon, "focusedIndeterminateBackground", Color.WHITE );
testValue( icon, "focusedIndeterminateCheckmarkColor", Color.WHITE );
// hover // hover
testValue( icon, "hoverBorderColor", Color.WHITE ); testValue( icon, "hoverBorderColor", Color.WHITE );
@@ -1175,6 +1189,9 @@ public class TestFlatStyleableValue
testValue( icon, "hoverSelectedBorderColor", Color.WHITE ); testValue( icon, "hoverSelectedBorderColor", Color.WHITE );
testValue( icon, "hoverSelectedBackground", Color.WHITE ); testValue( icon, "hoverSelectedBackground", Color.WHITE );
testValue( icon, "hoverCheckmarkColor", Color.WHITE ); testValue( icon, "hoverCheckmarkColor", Color.WHITE );
testValue( icon, "hoverIndeterminateBorderColor", Color.WHITE );
testValue( icon, "hoverIndeterminateBackground", Color.WHITE );
testValue( icon, "hoverIndeterminateCheckmarkColor", Color.WHITE );
// pressed // pressed
testValue( icon, "pressedBorderColor", Color.WHITE ); testValue( icon, "pressedBorderColor", Color.WHITE );
@@ -1182,6 +1199,9 @@ public class TestFlatStyleableValue
testValue( icon, "pressedSelectedBorderColor", Color.WHITE ); testValue( icon, "pressedSelectedBorderColor", Color.WHITE );
testValue( icon, "pressedSelectedBackground", Color.WHITE ); testValue( icon, "pressedSelectedBackground", Color.WHITE );
testValue( icon, "pressedCheckmarkColor", Color.WHITE ); testValue( icon, "pressedCheckmarkColor", Color.WHITE );
testValue( icon, "pressedIndeterminateBorderColor", Color.WHITE );
testValue( icon, "pressedIndeterminateBackground", Color.WHITE );
testValue( icon, "pressedIndeterminateCheckmarkColor", Color.WHITE );
} }
@Test @Test

View File

@@ -433,6 +433,7 @@ public class TestFlatStyling
ui.applyStyle( "selectionForeground: #fff" ); ui.applyStyle( "selectionForeground: #fff" );
ui.applyStyle( "selectionInactiveBackground: #fff" ); ui.applyStyle( "selectionInactiveBackground: #fff" );
ui.applyStyle( "selectionInactiveForeground: #fff" ); ui.applyStyle( "selectionInactiveForeground: #fff" );
ui.applyStyle( "alternateRowColor: #fff" );
ui.applyStyle( "selectionInsets: 1,2,3,4" ); ui.applyStyle( "selectionInsets: 1,2,3,4" );
ui.applyStyle( "selectionArc: 8" ); ui.applyStyle( "selectionArc: 8" );
@@ -1187,9 +1188,11 @@ public class TestFlatStyling
ui.applyStyle( "selectionInactiveBackground: #fff" ); ui.applyStyle( "selectionInactiveBackground: #fff" );
ui.applyStyle( "selectionInactiveForeground: #fff" ); ui.applyStyle( "selectionInactiveForeground: #fff" );
ui.applyStyle( "selectionBorderColor: #fff" ); ui.applyStyle( "selectionBorderColor: #fff" );
ui.applyStyle( "alternateRowColor: #fff" );
ui.applyStyle( "selectionInsets: 1,2,3,4" ); ui.applyStyle( "selectionInsets: 1,2,3,4" );
ui.applyStyle( "selectionArc: 8" ); ui.applyStyle( "selectionArc: 8" );
ui.applyStyle( "wideSelection: true" ); ui.applyStyle( "wideSelection: true" );
ui.applyStyle( "wideCellRenderer: true" );
ui.applyStyle( "showCellFocusIndicator: true" ); ui.applyStyle( "showCellFocusIndicator: true" );
ui.applyStyle( "paintSelection: false" ); ui.applyStyle( "paintSelection: false" );
@@ -1388,6 +1391,8 @@ public class TestFlatStyling
icon.applyStyleProperty( "borderWidth", 1.5f ); icon.applyStyleProperty( "borderWidth", 1.5f );
icon.applyStyleProperty( "selectedBorderWidth", 1.5f ); icon.applyStyleProperty( "selectedBorderWidth", 1.5f );
icon.applyStyleProperty( "disabledSelectedBorderWidth", 1.5f ); icon.applyStyleProperty( "disabledSelectedBorderWidth", 1.5f );
icon.applyStyleProperty( "indeterminateBorderWidth", 1.5f );
icon.applyStyleProperty( "disabledIndeterminateBorderWidth", 1.5f );
icon.applyStyleProperty( "arc", 5 ); icon.applyStyleProperty( "arc", 5 );
// enabled // enabled
@@ -1396,6 +1401,9 @@ public class TestFlatStyling
icon.applyStyleProperty( "selectedBorderColor", Color.WHITE ); icon.applyStyleProperty( "selectedBorderColor", Color.WHITE );
icon.applyStyleProperty( "selectedBackground", Color.WHITE ); icon.applyStyleProperty( "selectedBackground", Color.WHITE );
icon.applyStyleProperty( "checkmarkColor", Color.WHITE ); icon.applyStyleProperty( "checkmarkColor", Color.WHITE );
icon.applyStyleProperty( "indeterminateBorderColor", Color.WHITE );
icon.applyStyleProperty( "indeterminateBackground", Color.WHITE );
icon.applyStyleProperty( "indeterminateCheckmarkColor", Color.WHITE );
// disabled // disabled
icon.applyStyleProperty( "disabledBorderColor", Color.WHITE ); icon.applyStyleProperty( "disabledBorderColor", Color.WHITE );
@@ -1403,6 +1411,9 @@ public class TestFlatStyling
icon.applyStyleProperty( "disabledSelectedBorderColor", Color.WHITE ); icon.applyStyleProperty( "disabledSelectedBorderColor", Color.WHITE );
icon.applyStyleProperty( "disabledSelectedBackground", Color.WHITE ); icon.applyStyleProperty( "disabledSelectedBackground", Color.WHITE );
icon.applyStyleProperty( "disabledCheckmarkColor", Color.WHITE ); icon.applyStyleProperty( "disabledCheckmarkColor", Color.WHITE );
icon.applyStyleProperty( "disabledIndeterminateBorderColor", Color.WHITE );
icon.applyStyleProperty( "disabledIndeterminateBackground", Color.WHITE );
icon.applyStyleProperty( "disabledIndeterminateCheckmarkColor", Color.WHITE );
// focused // focused
icon.applyStyleProperty( "focusedBorderColor", Color.WHITE ); icon.applyStyleProperty( "focusedBorderColor", Color.WHITE );
@@ -1410,6 +1421,9 @@ public class TestFlatStyling
icon.applyStyleProperty( "focusedSelectedBorderColor", Color.WHITE ); icon.applyStyleProperty( "focusedSelectedBorderColor", Color.WHITE );
icon.applyStyleProperty( "focusedSelectedBackground", Color.WHITE ); icon.applyStyleProperty( "focusedSelectedBackground", Color.WHITE );
icon.applyStyleProperty( "focusedCheckmarkColor", Color.WHITE ); icon.applyStyleProperty( "focusedCheckmarkColor", Color.WHITE );
icon.applyStyleProperty( "focusedIndeterminateBorderColor", Color.WHITE );
icon.applyStyleProperty( "focusedIndeterminateBackground", Color.WHITE );
icon.applyStyleProperty( "focusedIndeterminateCheckmarkColor", Color.WHITE );
// hover // hover
icon.applyStyleProperty( "hoverBorderColor", Color.WHITE ); icon.applyStyleProperty( "hoverBorderColor", Color.WHITE );
@@ -1417,6 +1431,9 @@ public class TestFlatStyling
icon.applyStyleProperty( "hoverSelectedBorderColor", Color.WHITE ); icon.applyStyleProperty( "hoverSelectedBorderColor", Color.WHITE );
icon.applyStyleProperty( "hoverSelectedBackground", Color.WHITE ); icon.applyStyleProperty( "hoverSelectedBackground", Color.WHITE );
icon.applyStyleProperty( "hoverCheckmarkColor", Color.WHITE ); icon.applyStyleProperty( "hoverCheckmarkColor", Color.WHITE );
icon.applyStyleProperty( "hoverIndeterminateBorderColor", Color.WHITE );
icon.applyStyleProperty( "hoverIndeterminateBackground", Color.WHITE );
icon.applyStyleProperty( "hoverIndeterminateCheckmarkColor", Color.WHITE );
// pressed // pressed
icon.applyStyleProperty( "pressedBorderColor", Color.WHITE ); icon.applyStyleProperty( "pressedBorderColor", Color.WHITE );
@@ -1424,6 +1441,9 @@ public class TestFlatStyling
icon.applyStyleProperty( "pressedSelectedBorderColor", Color.WHITE ); icon.applyStyleProperty( "pressedSelectedBorderColor", Color.WHITE );
icon.applyStyleProperty( "pressedSelectedBackground", Color.WHITE ); icon.applyStyleProperty( "pressedSelectedBackground", Color.WHITE );
icon.applyStyleProperty( "pressedCheckmarkColor", Color.WHITE ); icon.applyStyleProperty( "pressedCheckmarkColor", Color.WHITE );
icon.applyStyleProperty( "pressedIndeterminateBorderColor", Color.WHITE );
icon.applyStyleProperty( "pressedIndeterminateBackground", Color.WHITE );
icon.applyStyleProperty( "pressedIndeterminateCheckmarkColor", Color.WHITE );
} }
@Test @Test

View File

@@ -277,22 +277,22 @@ class BasicComponentsPanel
//---- button5 ---- //---- button5 ----
button5.setText("Square"); button5.setText("Square");
button5.putClientProperty("JButton.buttonType", "square"); button5.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_SQUARE);
add(button5, "cell 3 1"); add(button5, "cell 3 1");
//---- button6 ---- //---- button6 ----
button6.setText("Round"); button6.setText("Round");
button6.putClientProperty("JButton.buttonType", "roundRect"); button6.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_ROUND_RECT);
add(button6, "cell 4 1"); add(button6, "cell 4 1");
//---- button3 ---- //---- button3 ----
button3.setText("Help"); button3.setText("Help");
button3.putClientProperty("JButton.buttonType", "help"); button3.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(button3, "cell 4 1"); add(button3, "cell 4 1");
//---- button4 ---- //---- button4 ----
button4.setText("Help"); button4.setText("Help");
button4.putClientProperty("JButton.buttonType", "help"); button4.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
button4.setEnabled(false); button4.setEnabled(false);
add(button4, "cell 4 1"); add(button4, "cell 4 1");
@@ -432,7 +432,7 @@ class BasicComponentsPanel
//---- comboBox6 ---- //---- comboBox6 ----
comboBox6.setEditable(true); comboBox6.setEditable(true);
comboBox6.putClientProperty("JTextField.placeholderText", "Placeholder"); comboBox6.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "Placeholder");
add(comboBox6, "cell 5 5,growx"); add(comboBox6, "cell 5 5,growx");
//---- textFieldLabel ---- //---- textFieldLabel ----
@@ -463,7 +463,7 @@ class BasicComponentsPanel
add(textField4, "cell 4 6,growx"); add(textField4, "cell 4 6,growx");
//---- textField6 ---- //---- textField6 ----
textField6.putClientProperty("JTextField.placeholderText", "Placeholder"); textField6.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "Placeholder");
add(textField6, "cell 5 6,growx"); add(textField6, "cell 5 6,growx");
//---- formattedTextFieldLabel ---- //---- formattedTextFieldLabel ----
@@ -494,7 +494,7 @@ class BasicComponentsPanel
add(formattedTextField4, "cell 4 7,growx"); add(formattedTextField4, "cell 4 7,growx");
//---- formattedTextField5 ---- //---- formattedTextField5 ----
formattedTextField5.putClientProperty("JTextField.placeholderText", "Placeholder"); formattedTextField5.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "Placeholder");
add(formattedTextField5, "cell 5 7,growx"); add(formattedTextField5, "cell 5 7,growx");
//---- passwordFieldLabel ---- //---- passwordFieldLabel ----
@@ -522,7 +522,7 @@ class BasicComponentsPanel
add(passwordField4, "cell 4 8,growx"); add(passwordField4, "cell 4 8,growx");
//---- passwordField5 ---- //---- passwordField5 ----
passwordField5.putClientProperty("JTextField.placeholderText", "Placeholder"); passwordField5.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "Placeholder");
add(passwordField5, "cell 5 8,growx"); add(passwordField5, "cell 5 8,growx");
//---- textAreaLabel ---- //---- textAreaLabel ----
@@ -703,11 +703,11 @@ class BasicComponentsPanel
add(errorHintsLabel, "cell 0 12"); add(errorHintsLabel, "cell 0 12");
//---- errorHintsTextField ---- //---- errorHintsTextField ----
errorHintsTextField.putClientProperty("JComponent.outline", "error"); errorHintsTextField.putClientProperty(FlatClientProperties.OUTLINE, FlatClientProperties.OUTLINE_ERROR);
add(errorHintsTextField, "cell 1 12,growx"); add(errorHintsTextField, "cell 1 12,growx");
//---- errorHintsComboBox ---- //---- errorHintsComboBox ----
errorHintsComboBox.putClientProperty("JComponent.outline", "error"); errorHintsComboBox.putClientProperty(FlatClientProperties.OUTLINE, FlatClientProperties.OUTLINE_ERROR);
errorHintsComboBox.setModel(new DefaultComboBoxModel<>(new String[] { errorHintsComboBox.setModel(new DefaultComboBoxModel<>(new String[] {
"Editable" "Editable"
})); }));
@@ -715,7 +715,7 @@ class BasicComponentsPanel
add(errorHintsComboBox, "cell 2 12,growx"); add(errorHintsComboBox, "cell 2 12,growx");
//---- errorHintsSpinner ---- //---- errorHintsSpinner ----
errorHintsSpinner.putClientProperty("JComponent.outline", "error"); errorHintsSpinner.putClientProperty(FlatClientProperties.OUTLINE, FlatClientProperties.OUTLINE_ERROR);
add(errorHintsSpinner, "cell 3 12,growx"); add(errorHintsSpinner, "cell 3 12,growx");
//---- warningHintsLabel ---- //---- warningHintsLabel ----
@@ -723,18 +723,18 @@ class BasicComponentsPanel
add(warningHintsLabel, "cell 0 13"); add(warningHintsLabel, "cell 0 13");
//---- warningHintsTextField ---- //---- warningHintsTextField ----
warningHintsTextField.putClientProperty("JComponent.outline", "warning"); warningHintsTextField.putClientProperty(FlatClientProperties.OUTLINE, FlatClientProperties.OUTLINE_WARNING);
add(warningHintsTextField, "cell 1 13,growx"); add(warningHintsTextField, "cell 1 13,growx");
//---- warningHintsComboBox ---- //---- warningHintsComboBox ----
warningHintsComboBox.putClientProperty("JComponent.outline", "warning"); warningHintsComboBox.putClientProperty(FlatClientProperties.OUTLINE, FlatClientProperties.OUTLINE_WARNING);
warningHintsComboBox.setModel(new DefaultComboBoxModel<>(new String[] { warningHintsComboBox.setModel(new DefaultComboBoxModel<>(new String[] {
"Not editable" "Not editable"
})); }));
add(warningHintsComboBox, "cell 2 13,growx"); add(warningHintsComboBox, "cell 2 13,growx");
//---- warningHintsSpinner ---- //---- warningHintsSpinner ----
warningHintsSpinner.putClientProperty("JComponent.outline", "warning"); warningHintsSpinner.putClientProperty(FlatClientProperties.OUTLINE, FlatClientProperties.OUTLINE_WARNING);
add(warningHintsSpinner, "cell 3 13,growx"); add(warningHintsSpinner, "cell 3 13,growx");
//---- iconsLabel ---- //---- iconsLabel ----
@@ -765,53 +765,53 @@ class BasicComponentsPanel
//---- h00Label ---- //---- h00Label ----
h00Label.setText("H00"); h00Label.setText("H00");
h00Label.putClientProperty("FlatLaf.styleClass", "h00"); h00Label.putClientProperty(FlatClientProperties.STYLE_CLASS, "h00");
add(h00Label, "cell 1 16 5 1"); add(h00Label, "cell 1 16 5 1");
//---- h0Label ---- //---- h0Label ----
h0Label.setText("H0"); h0Label.setText("H0");
h0Label.putClientProperty("FlatLaf.styleClass", "h0"); h0Label.putClientProperty(FlatClientProperties.STYLE_CLASS, "h0");
add(h0Label, "cell 1 16 5 1"); add(h0Label, "cell 1 16 5 1");
//---- h1Label ---- //---- h1Label ----
h1Label.setText("H1"); h1Label.setText("H1");
h1Label.putClientProperty("FlatLaf.styleClass", "h1"); h1Label.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1");
add(h1Label, "cell 1 16 5 1"); add(h1Label, "cell 1 16 5 1");
//---- h2Label ---- //---- h2Label ----
h2Label.setText("H2"); h2Label.setText("H2");
h2Label.putClientProperty("FlatLaf.styleClass", "h2"); h2Label.putClientProperty(FlatClientProperties.STYLE_CLASS, "h2");
add(h2Label, "cell 1 16 5 1"); add(h2Label, "cell 1 16 5 1");
//---- h3Label ---- //---- h3Label ----
h3Label.setText("H3"); h3Label.setText("H3");
h3Label.putClientProperty("FlatLaf.styleClass", "h3"); h3Label.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
add(h3Label, "cell 1 16 5 1"); add(h3Label, "cell 1 16 5 1");
//---- h4Label ---- //---- h4Label ----
h4Label.setText("H4"); h4Label.setText("H4");
h4Label.putClientProperty("FlatLaf.styleClass", "h4"); h4Label.putClientProperty(FlatClientProperties.STYLE_CLASS, "h4");
add(h4Label, "cell 1 16 5 1"); add(h4Label, "cell 1 16 5 1");
//---- lightLabel ---- //---- lightLabel ----
lightLabel.setText("light"); lightLabel.setText("light");
lightLabel.putClientProperty("FlatLaf.style", "font: 200% $light.font"); lightLabel.putClientProperty(FlatClientProperties.STYLE, "font: 200% $light.font");
add(lightLabel, "cell 1 16 5 1,gapx 30"); add(lightLabel, "cell 1 16 5 1,gapx 30");
//---- semiboldLabel ---- //---- semiboldLabel ----
semiboldLabel.setText("semibold"); semiboldLabel.setText("semibold");
semiboldLabel.putClientProperty("FlatLaf.style", "font: 200% $semibold.font"); semiboldLabel.putClientProperty(FlatClientProperties.STYLE, "font: 200% $semibold.font");
add(semiboldLabel, "cell 1 16 5 1"); add(semiboldLabel, "cell 1 16 5 1");
//---- fontZoomLabel ---- //---- fontZoomLabel ----
fontZoomLabel.setText("(200%)"); fontZoomLabel.setText("(200%)");
fontZoomLabel.putClientProperty("FlatLaf.styleClass", "small"); fontZoomLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
fontZoomLabel.setEnabled(false); fontZoomLabel.setEnabled(false);
add(fontZoomLabel, "cell 1 16 5 1"); add(fontZoomLabel, "cell 1 16 5 1");
//---- largeLabel ---- //---- largeLabel ----
largeLabel.setText("large"); largeLabel.setText("large");
largeLabel.putClientProperty("FlatLaf.styleClass", "large"); largeLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "large");
add(largeLabel, "cell 1 17 5 1"); add(largeLabel, "cell 1 17 5 1");
//---- defaultLabel ---- //---- defaultLabel ----
@@ -820,22 +820,22 @@ class BasicComponentsPanel
//---- mediumLabel ---- //---- mediumLabel ----
mediumLabel.setText("medium"); mediumLabel.setText("medium");
mediumLabel.putClientProperty("FlatLaf.styleClass", "medium"); mediumLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "medium");
add(mediumLabel, "cell 1 17 5 1"); add(mediumLabel, "cell 1 17 5 1");
//---- smallLabel ---- //---- smallLabel ----
smallLabel.setText("small"); smallLabel.setText("small");
smallLabel.putClientProperty("FlatLaf.styleClass", "small"); smallLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(smallLabel, "cell 1 17 5 1"); add(smallLabel, "cell 1 17 5 1");
//---- miniLabel ---- //---- miniLabel ----
miniLabel.setText("mini"); miniLabel.setText("mini");
miniLabel.putClientProperty("FlatLaf.styleClass", "mini"); miniLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "mini");
add(miniLabel, "cell 1 17 5 1"); add(miniLabel, "cell 1 17 5 1");
//---- monospacedLabel ---- //---- monospacedLabel ----
monospacedLabel.setText("monospaced"); monospacedLabel.setText("monospaced");
monospacedLabel.putClientProperty("FlatLaf.styleClass", "monospaced"); monospacedLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "monospaced");
add(monospacedLabel, "cell 1 17 5 1,gapx 30"); add(monospacedLabel, "cell 1 17 5 1,gapx 30");
//======== popupMenu1 ======== //======== popupMenu1 ========

View File

@@ -22,6 +22,7 @@ import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import javax.swing.*; import javax.swing.*;
import javax.swing.UIDefaults.ActiveValue;
import javax.swing.table.*; import javax.swing.table.*;
import javax.swing.tree.*; import javax.swing.tree.*;
import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.FlatClientProperties;
@@ -65,6 +66,45 @@ class DataComponentsPanel
tree3.putClientProperty( FlatClientProperties.STYLE, "selectionInsets: 0,1,0,1; selectionArc: 6" ); tree3.putClientProperty( FlatClientProperties.STYLE, "selectionInsets: 0,1,0,1; selectionArc: 6" );
} }
private void listAlternatingRowsChanged() {
ActiveValue alternateRowColor = null;
if( listAlternatingRowsCheckBox.isSelected() ) {
alternateRowColor = table -> {
Color background = list1.getBackground();
return FlatLaf.isLafDark()
? ColorFunctions.lighten( background, 0.05f )
: ColorFunctions.darken( background, 0.05f );
};
}
UIManager.put( "List.alternateRowColor", alternateRowColor );
list1.updateUI();
list2.updateUI();
list3.updateUI();
}
private void treeWideSelectionChanged() {
boolean wideSelection = treeWideSelectionCheckBox.isSelected();
tree1.putClientProperty( FlatClientProperties.TREE_WIDE_SELECTION, wideSelection );
tree2.putClientProperty( FlatClientProperties.TREE_WIDE_SELECTION, wideSelection );
tree3.putClientProperty( FlatClientProperties.TREE_WIDE_SELECTION, wideSelection );
}
private void treeAlternatingRowsChanged() {
ActiveValue alternateRowColor = null;
if( treeAlternatingRowsCheckBox.isSelected() ) {
alternateRowColor = table -> {
Color background = tree1.getBackground();
return FlatLaf.isLafDark()
? ColorFunctions.lighten( background, 0.05f )
: ColorFunctions.darken( background, 0.05f );
};
}
UIManager.put( "Tree.alternateRowColor", alternateRowColor );
tree1.updateUI();
tree2.updateUI();
tree3.updateUI();
}
private void dndChanged() { private void dndChanged() {
boolean dnd = dndCheckBox.isSelected(); boolean dnd = dndCheckBox.isSelected();
DropMode dropMode = dnd ? DropMode.ON_OR_INSERT : DropMode.USE_SELECTION; DropMode dropMode = dnd ? DropMode.ON_OR_INSERT : DropMode.USE_SELECTION;
@@ -142,18 +182,20 @@ class DataComponentsPanel
} }
private void alternatingRowsChanged() { private void alternatingRowsChanged() {
Color alternateRowColor = null; ActiveValue alternateRowColor = null;
if( alternatingRowsCheckBox.isSelected() ) { if( alternatingRowsCheckBox.isSelected() ) {
Color background = table1.getBackground(); alternateRowColor = table -> {
alternateRowColor = FlatLaf.isLafDark() Color background = table1.getBackground();
? ColorFunctions.lighten( background, 0.05f ) return FlatLaf.isLafDark()
: ColorFunctions.darken( background, 0.05f ); ? ColorFunctions.lighten( background, 0.05f )
: ColorFunctions.darken( background, 0.05f );
};
} }
UIManager.put( "Table.alternateRowColor", alternateRowColor ); UIManager.put( "Table.alternateRowColor", alternateRowColor );
table1.repaint(); table1.repaint();
} }
@SuppressWarnings( { "unchecked", "rawtypes" } ) @SuppressWarnings( { "rawtypes" } )
private void initComponents() { private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JLabel label1 = new JLabel(); JLabel label1 = new JLabel();
@@ -166,6 +208,8 @@ class DataComponentsPanel
list3 = new JList<>(); list3 = new JList<>();
JScrollPane scrollPane2 = new JScrollPane(); JScrollPane scrollPane2 = new JScrollPane();
list2 = new JList<>(); list2 = new JList<>();
JPanel listOptionsPanel = new JPanel();
listAlternatingRowsCheckBox = new JCheckBox();
JLabel treeLabel = new JLabel(); JLabel treeLabel = new JLabel();
JScrollPane scrollPane3 = new JScrollPane(); JScrollPane scrollPane3 = new JScrollPane();
tree1 = new JTree(); tree1 = new JTree();
@@ -173,6 +217,9 @@ class DataComponentsPanel
tree3 = new JTree(); tree3 = new JTree();
JScrollPane scrollPane4 = new JScrollPane(); JScrollPane scrollPane4 = new JScrollPane();
tree2 = new JTree(); tree2 = new JTree();
JPanel treeOptionsPanel = new JPanel();
treeWideSelectionCheckBox = new JCheckBox();
treeAlternatingRowsCheckBox = new JCheckBox();
JLabel tableLabel = new JLabel(); JLabel tableLabel = new JLabel();
JScrollPane scrollPane5 = new JScrollPane(); JScrollPane scrollPane5 = new JScrollPane();
table1 = new JTable(); table1 = new JTable();
@@ -273,6 +320,22 @@ class DataComponentsPanel
} }
add(scrollPane2, "cell 3 1"); add(scrollPane2, "cell 3 1");
//======== listOptionsPanel ========
{
listOptionsPanel.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns
"[fill]",
// rows
"[]"));
//---- listAlternatingRowsCheckBox ----
listAlternatingRowsCheckBox.setText("alternating rows");
listAlternatingRowsCheckBox.addActionListener(e -> listAlternatingRowsChanged());
listOptionsPanel.add(listAlternatingRowsCheckBox, "cell 0 0");
}
add(listOptionsPanel, "cell 4 1");
//---- treeLabel ---- //---- treeLabel ----
treeLabel.setText("JTree:"); treeLabel.setText("JTree:");
add(treeLabel, "cell 0 2,aligny top,growy 0"); add(treeLabel, "cell 0 2,aligny top,growy 0");
@@ -334,6 +397,29 @@ class DataComponentsPanel
} }
add(scrollPane4, "cell 3 2"); add(scrollPane4, "cell 3 2");
//======== treeOptionsPanel ========
{
treeOptionsPanel.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns
"[fill]",
// rows
"[]0" +
"[]"));
//---- treeWideSelectionCheckBox ----
treeWideSelectionCheckBox.setText("wide selection");
treeWideSelectionCheckBox.setSelected(true);
treeWideSelectionCheckBox.addActionListener(e -> treeWideSelectionChanged());
treeOptionsPanel.add(treeWideSelectionCheckBox, "cell 0 0");
//---- treeAlternatingRowsCheckBox ----
treeAlternatingRowsCheckBox.setText("alternating rows");
treeAlternatingRowsCheckBox.addActionListener(e -> treeAlternatingRowsChanged());
treeOptionsPanel.add(treeAlternatingRowsCheckBox, "cell 0 1");
}
add(treeOptionsPanel, "cell 4 2");
//---- tableLabel ---- //---- tableLabel ----
tableLabel.setText("JTable:"); tableLabel.setText("JTable:");
add(tableLabel, "cell 0 3,aligny top,growy 0"); add(tableLabel, "cell 0 3,aligny top,growy 0");
@@ -379,7 +465,7 @@ class DataComponentsPanel
{ {
TableColumnModel cm = table1.getColumnModel(); TableColumnModel cm = table1.getColumnModel();
cm.getColumn(2).setCellEditor(new DefaultCellEditor( cm.getColumn(2).setCellEditor(new DefaultCellEditor(
new JComboBox(new DefaultComboBoxModel(new String[] { new JComboBox<>(new DefaultComboBoxModel<>(new String[] {
"January", "January",
"February", "February",
"March", "March",
@@ -394,7 +480,7 @@ class DataComponentsPanel
"December" "December"
})))); }))));
cm.getColumn(3).setCellEditor(new DefaultCellEditor( cm.getColumn(3).setCellEditor(new DefaultCellEditor(
new JComboBox(new DefaultComboBoxModel(new String[] { new JComboBox<>(new DefaultComboBoxModel<>(new String[] {
"January", "January",
"February", "February",
"March", "March",
@@ -513,9 +599,12 @@ class DataComponentsPanel
private JList<String> list1; private JList<String> list1;
private JList<String> list3; private JList<String> list3;
private JList<String> list2; private JList<String> list2;
private JCheckBox listAlternatingRowsCheckBox;
private JTree tree1; private JTree tree1;
private JTree tree3; private JTree tree3;
private JTree tree2; private JTree tree2;
private JCheckBox treeWideSelectionCheckBox;
private JCheckBox treeAlternatingRowsCheckBox;
private JTable table1; private JTable table1;
private JCheckBox roundedSelectionCheckBox; private JCheckBox roundedSelectionCheckBox;
private JCheckBox showHorizontalLinesCheckBox; private JCheckBox showHorizontalLinesCheckBox;

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "8.2.0.0.331" Java: "21" encoding: "UTF-8" JFDML JFormDesigner: "8.3" encoding: "UTF-8"
new FormModel { new FormModel {
contentType: "form/swing" contentType: "form/swing"
@@ -92,6 +92,25 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 1" "value": "cell 3 1"
} ) } )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3"
"$columnConstraints": "[fill]"
"$rowConstraints": "[]"
} ) {
name: "listOptionsPanel"
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "listAlternatingRowsCheckBox"
"text": "alternating rows"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "listAlternatingRowsChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "treeLabel" name: "treeLabel"
"text": "JTree:" "text": "JTree:"
@@ -192,6 +211,36 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 2" "value": "cell 3 2"
} ) } )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3"
"$columnConstraints": "[fill]"
"$rowConstraints": "[]0[]"
} ) {
name: "treeOptionsPanel"
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "treeWideSelectionCheckBox"
"text": "wide selection"
"selected": true
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "treeWideSelectionChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "treeAlternatingRowsCheckBox"
"text": "alternating rows"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "treeAlternatingRowsChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 2"
} )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "tableLabel" name: "tableLabel"
"text": "JTable:" "text": "JTable:"

View File

@@ -19,6 +19,7 @@ package com.formdev.flatlaf.demo;
import java.awt.*; import java.awt.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.*; import javax.swing.border.*;
import com.formdev.flatlaf.FlatClientProperties;
import net.miginfocom.swing.*; import net.miginfocom.swing.*;
/** /**
@@ -176,12 +177,12 @@ class MoreComponentsPanel
add(scrollBar3, "cell 2 0 1 6,growy"); add(scrollBar3, "cell 2 0 1 6,growy");
//---- scrollBar7 ---- //---- scrollBar7 ----
scrollBar7.putClientProperty("JScrollBar.showButtons", true); scrollBar7.putClientProperty(FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS, true);
add(scrollBar7, "cell 2 0 1 6,growy"); add(scrollBar7, "cell 2 0 1 6,growy");
//---- scrollBar8 ---- //---- scrollBar8 ----
scrollBar8.setEnabled(false); scrollBar8.setEnabled(false);
scrollBar8.putClientProperty("JScrollBar.showButtons", true); scrollBar8.putClientProperty(FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS, true);
add(scrollBar8, "cell 2 0 1 6,growy"); add(scrollBar8, "cell 2 0 1 6,growy");
//---- separator2 ---- //---- separator2 ----
@@ -301,13 +302,13 @@ class MoreComponentsPanel
//---- scrollBar5 ---- //---- scrollBar5 ----
scrollBar5.setOrientation(Adjustable.HORIZONTAL); scrollBar5.setOrientation(Adjustable.HORIZONTAL);
scrollBar5.putClientProperty("JScrollBar.showButtons", true); scrollBar5.putClientProperty(FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS, true);
add(scrollBar5, "cell 1 3,growx"); add(scrollBar5, "cell 1 3,growx");
//---- scrollBar6 ---- //---- scrollBar6 ----
scrollBar6.setOrientation(Adjustable.HORIZONTAL); scrollBar6.setOrientation(Adjustable.HORIZONTAL);
scrollBar6.setEnabled(false); scrollBar6.setEnabled(false);
scrollBar6.putClientProperty("JScrollBar.showButtons", true); scrollBar6.putClientProperty(FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS, true);
add(scrollBar6, "cell 1 4,growx"); add(scrollBar6, "cell 1 4,growx");
//---- separatorLabel ---- //---- separatorLabel ----
@@ -518,7 +519,7 @@ class MoreComponentsPanel
//======== panel5 ======== //======== panel5 ========
{ {
panel5.putClientProperty("FlatLaf.style", "arc: 16; background: darken($Panel.background,5%)"); panel5.putClientProperty(FlatClientProperties.STYLE, "arc: 16; background: darken($Panel.background,5%)");
panel5.setLayout(new BorderLayout()); panel5.setLayout(new BorderLayout());
//---- label9 ---- //---- label9 ----
@@ -530,7 +531,7 @@ class MoreComponentsPanel
//======== panel4 ======== //======== panel4 ========
{ {
panel4.putClientProperty("FlatLaf.style", "border: 1,1,1,1,@disabledForeground,1,16; background: darken($Panel.background,5%)"); panel4.putClientProperty(FlatClientProperties.STYLE, "border: 1,1,1,1,@disabledForeground,1,16; background: darken($Panel.background,5%)");
panel4.setLayout(new BorderLayout()); panel4.setLayout(new BorderLayout());
//---- label8 ---- //---- label8 ----
@@ -546,14 +547,14 @@ class MoreComponentsPanel
//---- label13 ---- //---- label13 ----
label13.setText("rounded background"); label13.setText("rounded background");
label13.putClientProperty("FlatLaf.style", "arc: 999; border: 2,10,2,10"); label13.putClientProperty(FlatClientProperties.STYLE, "arc: 999; border: 2,10,2,10");
label13.setBackground(new Color(0xb8e4f3)); label13.setBackground(new Color(0xb8e4f3));
label13.setForeground(new Color(0x135b76)); label13.setForeground(new Color(0x135b76));
add(label13, "cell 1 13 4 1"); add(label13, "cell 1 13 4 1");
//---- label10 ---- //---- label10 ----
label10.setText("rounded border"); label10.setText("rounded border");
label10.putClientProperty("FlatLaf.style", "arc: 999; border: 2,10,2,10,#135b76"); label10.putClientProperty(FlatClientProperties.STYLE, "arc: 999; border: 2,10,2,10,#135b76");
label10.setBackground(new Color(0xb8e4f3)); label10.setBackground(new Color(0xb8e4f3));
label10.setForeground(new Color(0x135b76)); label10.setForeground(new Color(0x135b76));
add(label10, "cell 1 13 4 1"); add(label10, "cell 1 13 4 1");

View File

@@ -16,6 +16,7 @@
package com.formdev.flatlaf.demo; package com.formdev.flatlaf.demo;
import com.formdev.flatlaf.FlatClientProperties;
import static com.formdev.flatlaf.FlatClientProperties.*; import static com.formdev.flatlaf.FlatClientProperties.*;
import java.awt.*; import java.awt.*;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@@ -471,7 +472,7 @@ class TabsPanel
//---- tabPlacementLabel ---- //---- tabPlacementLabel ----
tabPlacementLabel.setText("Tab placement"); tabPlacementLabel.setText("Tab placement");
tabPlacementLabel.putClientProperty("FlatLaf.styleClass", "h3"); tabPlacementLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
panel1.add(tabPlacementLabel, "cell 0 0"); panel1.add(tabPlacementLabel, "cell 0 0");
//======== tabPlacementToolBar ======== //======== tabPlacementToolBar ========
@@ -482,38 +483,38 @@ class TabsPanel
//---- topPlacementButton ---- //---- topPlacementButton ----
topPlacementButton.setText("top"); topPlacementButton.setText("top");
topPlacementButton.setSelected(true); topPlacementButton.setSelected(true);
topPlacementButton.putClientProperty("FlatLaf.styleClass", "small"); topPlacementButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
topPlacementButton.addActionListener(e -> tabPlacementChanged()); topPlacementButton.addActionListener(e -> tabPlacementChanged());
tabPlacementToolBar.add(topPlacementButton); tabPlacementToolBar.add(topPlacementButton);
//---- bottomPlacementButton ---- //---- bottomPlacementButton ----
bottomPlacementButton.setText("bottom"); bottomPlacementButton.setText("bottom");
bottomPlacementButton.putClientProperty("FlatLaf.styleClass", "small"); bottomPlacementButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
bottomPlacementButton.addActionListener(e -> tabPlacementChanged()); bottomPlacementButton.addActionListener(e -> tabPlacementChanged());
tabPlacementToolBar.add(bottomPlacementButton); tabPlacementToolBar.add(bottomPlacementButton);
//---- leftPlacementButton ---- //---- leftPlacementButton ----
leftPlacementButton.setText("left"); leftPlacementButton.setText("left");
leftPlacementButton.putClientProperty("FlatLaf.styleClass", "small"); leftPlacementButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
leftPlacementButton.addActionListener(e -> tabPlacementChanged()); leftPlacementButton.addActionListener(e -> tabPlacementChanged());
tabPlacementToolBar.add(leftPlacementButton); tabPlacementToolBar.add(leftPlacementButton);
//---- rightPlacementButton ---- //---- rightPlacementButton ----
rightPlacementButton.setText("right"); rightPlacementButton.setText("right");
rightPlacementButton.putClientProperty("FlatLaf.styleClass", "small"); rightPlacementButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
rightPlacementButton.addActionListener(e -> tabPlacementChanged()); rightPlacementButton.addActionListener(e -> tabPlacementChanged());
tabPlacementToolBar.add(rightPlacementButton); tabPlacementToolBar.add(rightPlacementButton);
tabPlacementToolBar.addSeparator(); tabPlacementToolBar.addSeparator();
//---- scrollButton ---- //---- scrollButton ----
scrollButton.setText("scroll"); scrollButton.setText("scroll");
scrollButton.putClientProperty("FlatLaf.styleClass", "small"); scrollButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
scrollButton.addActionListener(e -> scrollChanged()); scrollButton.addActionListener(e -> scrollChanged());
tabPlacementToolBar.add(scrollButton); tabPlacementToolBar.add(scrollButton);
//---- borderButton ---- //---- borderButton ----
borderButton.setText("border"); borderButton.setText("border");
borderButton.putClientProperty("FlatLaf.styleClass", "small"); borderButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
borderButton.addActionListener(e -> borderChanged()); borderButton.addActionListener(e -> borderChanged());
tabPlacementToolBar.add(borderButton); tabPlacementToolBar.add(borderButton);
} }
@@ -522,7 +523,7 @@ class TabsPanel
//---- tabLayoutLabel ---- //---- tabLayoutLabel ----
tabLayoutLabel.setText("Tab layout"); tabLayoutLabel.setText("Tab layout");
tabLayoutLabel.putClientProperty("FlatLaf.styleClass", "h3"); tabLayoutLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
panel1.add(tabLayoutLabel, "cell 0 2"); panel1.add(tabLayoutLabel, "cell 0 2");
//======== tabLayoutToolBar ======== //======== tabLayoutToolBar ========
@@ -533,13 +534,13 @@ class TabsPanel
//---- scrollTabLayoutButton ---- //---- scrollTabLayoutButton ----
scrollTabLayoutButton.setText("scroll"); scrollTabLayoutButton.setText("scroll");
scrollTabLayoutButton.setSelected(true); scrollTabLayoutButton.setSelected(true);
scrollTabLayoutButton.putClientProperty("FlatLaf.styleClass", "small"); scrollTabLayoutButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
scrollTabLayoutButton.addActionListener(e -> tabLayoutChanged()); scrollTabLayoutButton.addActionListener(e -> tabLayoutChanged());
tabLayoutToolBar.add(scrollTabLayoutButton); tabLayoutToolBar.add(scrollTabLayoutButton);
//---- wrapTabLayoutButton ---- //---- wrapTabLayoutButton ----
wrapTabLayoutButton.setText("wrap"); wrapTabLayoutButton.setText("wrap");
wrapTabLayoutButton.putClientProperty("FlatLaf.styleClass", "small"); wrapTabLayoutButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
wrapTabLayoutButton.addActionListener(e -> tabLayoutChanged()); wrapTabLayoutButton.addActionListener(e -> tabLayoutChanged());
tabLayoutToolBar.add(wrapTabLayoutButton); tabLayoutToolBar.add(wrapTabLayoutButton);
} }
@@ -548,20 +549,20 @@ class TabsPanel
//---- scrollLayoutNoteLabel ---- //---- scrollLayoutNoteLabel ----
scrollLayoutNoteLabel.setText("(use mouse wheel to scroll; arrow button shows hidden tabs)"); scrollLayoutNoteLabel.setText("(use mouse wheel to scroll; arrow button shows hidden tabs)");
scrollLayoutNoteLabel.setEnabled(false); scrollLayoutNoteLabel.setEnabled(false);
scrollLayoutNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); scrollLayoutNoteLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
panel1.add(scrollLayoutNoteLabel, "cell 0 3"); panel1.add(scrollLayoutNoteLabel, "cell 0 3");
//---- wrapLayoutNoteLabel ---- //---- wrapLayoutNoteLabel ----
wrapLayoutNoteLabel.setText("(probably better to use scroll layout?)"); wrapLayoutNoteLabel.setText("(probably better to use scroll layout?)");
wrapLayoutNoteLabel.setEnabled(false); wrapLayoutNoteLabel.setEnabled(false);
wrapLayoutNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); wrapLayoutNoteLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
panel1.add(wrapLayoutNoteLabel, "cell 0 3"); panel1.add(wrapLayoutNoteLabel, "cell 0 3");
panel1.add(scrollLayoutTabbedPane, "cell 0 4"); panel1.add(scrollLayoutTabbedPane, "cell 0 4");
panel1.add(wrapLayoutTabbedPane, "cell 0 4,width 100:100,height pref*2px"); panel1.add(wrapLayoutTabbedPane, "cell 0 4,width 100:100,height pref*2px");
//---- closableTabsLabel ---- //---- closableTabsLabel ----
closableTabsLabel.setText("Closable tabs"); closableTabsLabel.setText("Closable tabs");
closableTabsLabel.putClientProperty("FlatLaf.styleClass", "h3"); closableTabsLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
panel1.add(closableTabsLabel, "cell 0 5"); panel1.add(closableTabsLabel, "cell 0 5");
//======== closableTabsToolBar ======== //======== closableTabsToolBar ========
@@ -572,19 +573,19 @@ class TabsPanel
//---- squareCloseButton ---- //---- squareCloseButton ----
squareCloseButton.setText("square"); squareCloseButton.setText("square");
squareCloseButton.setSelected(true); squareCloseButton.setSelected(true);
squareCloseButton.putClientProperty("FlatLaf.styleClass", "small"); squareCloseButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
squareCloseButton.addActionListener(e -> closeButtonStyleChanged()); squareCloseButton.addActionListener(e -> closeButtonStyleChanged());
closableTabsToolBar.add(squareCloseButton); closableTabsToolBar.add(squareCloseButton);
//---- circleCloseButton ---- //---- circleCloseButton ----
circleCloseButton.setText("circle"); circleCloseButton.setText("circle");
circleCloseButton.putClientProperty("FlatLaf.styleClass", "small"); circleCloseButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
circleCloseButton.addActionListener(e -> closeButtonStyleChanged()); circleCloseButton.addActionListener(e -> closeButtonStyleChanged());
closableTabsToolBar.add(circleCloseButton); closableTabsToolBar.add(circleCloseButton);
//---- redCrossCloseButton ---- //---- redCrossCloseButton ----
redCrossCloseButton.setText("red cross"); redCrossCloseButton.setText("red cross");
redCrossCloseButton.putClientProperty("FlatLaf.styleClass", "small"); redCrossCloseButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
redCrossCloseButton.addActionListener(e -> closeButtonStyleChanged()); redCrossCloseButton.addActionListener(e -> closeButtonStyleChanged());
closableTabsToolBar.add(redCrossCloseButton); closableTabsToolBar.add(redCrossCloseButton);
} }
@@ -593,7 +594,7 @@ class TabsPanel
//---- tabAreaComponentsLabel ---- //---- tabAreaComponentsLabel ----
tabAreaComponentsLabel.setText("Custom tab area components"); tabAreaComponentsLabel.setText("Custom tab area components");
tabAreaComponentsLabel.putClientProperty("FlatLaf.styleClass", "h3"); tabAreaComponentsLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
panel1.add(tabAreaComponentsLabel, "cell 0 7"); panel1.add(tabAreaComponentsLabel, "cell 0 7");
//======== tabAreaComponentsToolBar ======== //======== tabAreaComponentsToolBar ========
@@ -604,14 +605,14 @@ class TabsPanel
//---- leadingComponentButton ---- //---- leadingComponentButton ----
leadingComponentButton.setText("leading"); leadingComponentButton.setText("leading");
leadingComponentButton.setSelected(true); leadingComponentButton.setSelected(true);
leadingComponentButton.putClientProperty("FlatLaf.styleClass", "small"); leadingComponentButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
leadingComponentButton.addActionListener(e -> customComponentsChanged()); leadingComponentButton.addActionListener(e -> customComponentsChanged());
tabAreaComponentsToolBar.add(leadingComponentButton); tabAreaComponentsToolBar.add(leadingComponentButton);
//---- trailingComponentButton ---- //---- trailingComponentButton ----
trailingComponentButton.setText("trailing"); trailingComponentButton.setText("trailing");
trailingComponentButton.setSelected(true); trailingComponentButton.setSelected(true);
trailingComponentButton.putClientProperty("FlatLaf.styleClass", "small"); trailingComponentButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
trailingComponentButton.addActionListener(e -> customComponentsChanged()); trailingComponentButton.addActionListener(e -> customComponentsChanged());
tabAreaComponentsToolBar.add(trailingComponentButton); tabAreaComponentsToolBar.add(trailingComponentButton);
} }
@@ -642,13 +643,13 @@ class TabsPanel
//---- tabIconPlacementLabel ---- //---- tabIconPlacementLabel ----
tabIconPlacementLabel.setText("Tab icon placement"); tabIconPlacementLabel.setText("Tab icon placement");
tabIconPlacementLabel.putClientProperty("FlatLaf.styleClass", "h3"); tabIconPlacementLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
panel2.add(tabIconPlacementLabel, "cell 0 0"); panel2.add(tabIconPlacementLabel, "cell 0 0");
//---- tabIconPlacementNodeLabel ---- //---- tabIconPlacementNodeLabel ----
tabIconPlacementNodeLabel.setText("(top/bottom/leading/trailing)"); tabIconPlacementNodeLabel.setText("(top/bottom/leading/trailing)");
tabIconPlacementNodeLabel.setEnabled(false); tabIconPlacementNodeLabel.setEnabled(false);
tabIconPlacementNodeLabel.putClientProperty("FlatLaf.styleClass", "small"); tabIconPlacementNodeLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
panel2.add(tabIconPlacementNodeLabel, "cell 0 1"); panel2.add(tabIconPlacementNodeLabel, "cell 0 1");
panel2.add(iconTopTabbedPane, "cell 0 2"); panel2.add(iconTopTabbedPane, "cell 0 2");
panel2.add(iconBottomTabbedPane, "cell 0 3"); panel2.add(iconBottomTabbedPane, "cell 0 3");
@@ -657,13 +658,13 @@ class TabsPanel
//---- tabAreaAlignmentLabel ---- //---- tabAreaAlignmentLabel ----
tabAreaAlignmentLabel.setText("Tab area alignment"); tabAreaAlignmentLabel.setText("Tab area alignment");
tabAreaAlignmentLabel.putClientProperty("FlatLaf.styleClass", "h3"); tabAreaAlignmentLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
panel2.add(tabAreaAlignmentLabel, "cell 0 6"); panel2.add(tabAreaAlignmentLabel, "cell 0 6");
//---- tabAreaAlignmentNoteLabel ---- //---- tabAreaAlignmentNoteLabel ----
tabAreaAlignmentNoteLabel.setText("(leading/center/trailing/fill)"); tabAreaAlignmentNoteLabel.setText("(leading/center/trailing/fill)");
tabAreaAlignmentNoteLabel.setEnabled(false); tabAreaAlignmentNoteLabel.setEnabled(false);
tabAreaAlignmentNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); tabAreaAlignmentNoteLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
panel2.add(tabAreaAlignmentNoteLabel, "cell 0 7"); panel2.add(tabAreaAlignmentNoteLabel, "cell 0 7");
panel2.add(alignLeadingTabbedPane, "cell 0 8"); panel2.add(alignLeadingTabbedPane, "cell 0 8");
panel2.add(alignCenterTabbedPane, "cell 0 9"); panel2.add(alignCenterTabbedPane, "cell 0 9");
@@ -692,13 +693,13 @@ class TabsPanel
//---- tabWidthModeLabel ---- //---- tabWidthModeLabel ----
tabWidthModeLabel.setText("Tab width mode"); tabWidthModeLabel.setText("Tab width mode");
tabWidthModeLabel.putClientProperty("FlatLaf.styleClass", "h3"); tabWidthModeLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
panel3.add(tabWidthModeLabel, "cell 0 0"); panel3.add(tabWidthModeLabel, "cell 0 0");
//---- tabWidthModeNoteLabel ---- //---- tabWidthModeNoteLabel ----
tabWidthModeNoteLabel.setText("(preferred/equal/compact)"); tabWidthModeNoteLabel.setText("(preferred/equal/compact)");
tabWidthModeNoteLabel.setEnabled(false); tabWidthModeNoteLabel.setEnabled(false);
tabWidthModeNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); tabWidthModeNoteLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
panel3.add(tabWidthModeNoteLabel, "cell 0 1"); panel3.add(tabWidthModeNoteLabel, "cell 0 1");
panel3.add(widthPreferredTabbedPane, "cell 0 2"); panel3.add(widthPreferredTabbedPane, "cell 0 2");
panel3.add(widthEqualTabbedPane, "cell 0 3"); panel3.add(widthEqualTabbedPane, "cell 0 3");
@@ -706,14 +707,14 @@ class TabsPanel
//---- minMaxTabWidthLabel ---- //---- minMaxTabWidthLabel ----
minMaxTabWidthLabel.setText("Minimum/maximum tab width"); minMaxTabWidthLabel.setText("Minimum/maximum tab width");
minMaxTabWidthLabel.putClientProperty("FlatLaf.styleClass", "h3"); minMaxTabWidthLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
panel3.add(minMaxTabWidthLabel, "cell 0 5"); panel3.add(minMaxTabWidthLabel, "cell 0 5");
panel3.add(minimumTabWidthTabbedPane, "cell 0 6"); panel3.add(minimumTabWidthTabbedPane, "cell 0 6");
panel3.add(maximumTabWidthTabbedPane, "cell 0 7"); panel3.add(maximumTabWidthTabbedPane, "cell 0 7");
//---- tabAlignmentLabel ---- //---- tabAlignmentLabel ----
tabAlignmentLabel.setText("Tab title alignment"); tabAlignmentLabel.setText("Tab title alignment");
tabAlignmentLabel.putClientProperty("FlatLaf.styleClass", "h3"); tabAlignmentLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
panel3.add(tabAlignmentLabel, "cell 0 8"); panel3.add(tabAlignmentLabel, "cell 0 8");
//======== panel5 ======== //======== panel5 ========
@@ -733,13 +734,13 @@ class TabsPanel
//---- tabAlignmentNoteLabel ---- //---- tabAlignmentNoteLabel ----
tabAlignmentNoteLabel.setText("(leading/center/trailing)"); tabAlignmentNoteLabel.setText("(leading/center/trailing)");
tabAlignmentNoteLabel.setEnabled(false); tabAlignmentNoteLabel.setEnabled(false);
tabAlignmentNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); tabAlignmentNoteLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
panel5.add(tabAlignmentNoteLabel, "cell 0 0"); panel5.add(tabAlignmentNoteLabel, "cell 0 0");
//---- tabAlignmentNoteLabel2 ---- //---- tabAlignmentNoteLabel2 ----
tabAlignmentNoteLabel2.setText("(trailing)"); tabAlignmentNoteLabel2.setText("(trailing)");
tabAlignmentNoteLabel2.setEnabled(false); tabAlignmentNoteLabel2.setEnabled(false);
tabAlignmentNoteLabel2.putClientProperty("FlatLaf.styleClass", "small"); tabAlignmentNoteLabel2.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
panel5.add(tabAlignmentNoteLabel2, "cell 1 0,alignx right,growx 0"); panel5.add(tabAlignmentNoteLabel2, "cell 1 0,alignx right,growx 0");
panel5.add(tabAlignLeadingTabbedPane, "cell 0 1"); panel5.add(tabAlignLeadingTabbedPane, "cell 0 1");
@@ -787,19 +788,19 @@ class TabsPanel
//---- scrollAsNeededSingleButton ---- //---- scrollAsNeededSingleButton ----
scrollAsNeededSingleButton.setText("asNeededSingle"); scrollAsNeededSingleButton.setText("asNeededSingle");
scrollAsNeededSingleButton.setSelected(true); scrollAsNeededSingleButton.setSelected(true);
scrollAsNeededSingleButton.putClientProperty("FlatLaf.styleClass", "small"); scrollAsNeededSingleButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
scrollAsNeededSingleButton.addActionListener(e -> scrollButtonsPolicyChanged()); scrollAsNeededSingleButton.addActionListener(e -> scrollButtonsPolicyChanged());
scrollButtonsPolicyToolBar.add(scrollAsNeededSingleButton); scrollButtonsPolicyToolBar.add(scrollAsNeededSingleButton);
//---- scrollAsNeededButton ---- //---- scrollAsNeededButton ----
scrollAsNeededButton.setText("asNeeded"); scrollAsNeededButton.setText("asNeeded");
scrollAsNeededButton.putClientProperty("FlatLaf.styleClass", "small"); scrollAsNeededButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
scrollAsNeededButton.addActionListener(e -> scrollButtonsPolicyChanged()); scrollAsNeededButton.addActionListener(e -> scrollButtonsPolicyChanged());
scrollButtonsPolicyToolBar.add(scrollAsNeededButton); scrollButtonsPolicyToolBar.add(scrollAsNeededButton);
//---- scrollNeverButton ---- //---- scrollNeverButton ----
scrollNeverButton.setText("never"); scrollNeverButton.setText("never");
scrollNeverButton.putClientProperty("FlatLaf.styleClass", "small"); scrollNeverButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
scrollNeverButton.addActionListener(e -> scrollButtonsPolicyChanged()); scrollNeverButton.addActionListener(e -> scrollButtonsPolicyChanged());
scrollButtonsPolicyToolBar.add(scrollNeverButton); scrollButtonsPolicyToolBar.add(scrollNeverButton);
} }
@@ -817,13 +818,13 @@ class TabsPanel
//---- popupAsNeededButton ---- //---- popupAsNeededButton ----
popupAsNeededButton.setText("asNeeded"); popupAsNeededButton.setText("asNeeded");
popupAsNeededButton.setSelected(true); popupAsNeededButton.setSelected(true);
popupAsNeededButton.putClientProperty("FlatLaf.styleClass", "small"); popupAsNeededButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
popupAsNeededButton.addActionListener(e -> tabsPopupPolicyChanged()); popupAsNeededButton.addActionListener(e -> tabsPopupPolicyChanged());
tabsPopupPolicyToolBar.add(popupAsNeededButton); tabsPopupPolicyToolBar.add(popupAsNeededButton);
//---- popupNeverButton ---- //---- popupNeverButton ----
popupNeverButton.setText("never"); popupNeverButton.setText("never");
popupNeverButton.putClientProperty("FlatLaf.styleClass", "small"); popupNeverButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
popupNeverButton.addActionListener(e -> tabsPopupPolicyChanged()); popupNeverButton.addActionListener(e -> tabsPopupPolicyChanged());
tabsPopupPolicyToolBar.add(popupNeverButton); tabsPopupPolicyToolBar.add(popupNeverButton);
} }
@@ -846,13 +847,13 @@ class TabsPanel
//---- scrollBothButton ---- //---- scrollBothButton ----
scrollBothButton.setText("both"); scrollBothButton.setText("both");
scrollBothButton.setSelected(true); scrollBothButton.setSelected(true);
scrollBothButton.putClientProperty("FlatLaf.styleClass", "small"); scrollBothButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
scrollBothButton.addActionListener(e -> scrollButtonsPlacementChanged()); scrollBothButton.addActionListener(e -> scrollButtonsPlacementChanged());
scrollButtonsPlacementToolBar.add(scrollBothButton); scrollButtonsPlacementToolBar.add(scrollBothButton);
//---- scrollTrailingButton ---- //---- scrollTrailingButton ----
scrollTrailingButton.setText("trailing"); scrollTrailingButton.setText("trailing");
scrollTrailingButton.putClientProperty("FlatLaf.styleClass", "small"); scrollTrailingButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
scrollTrailingButton.addActionListener(e -> scrollButtonsPlacementChanged()); scrollTrailingButton.addActionListener(e -> scrollButtonsPlacementChanged());
scrollButtonsPlacementToolBar.add(scrollTrailingButton); scrollButtonsPlacementToolBar.add(scrollTrailingButton);
} }
@@ -869,13 +870,13 @@ class TabsPanel
//---- underlinedTabTypeButton ---- //---- underlinedTabTypeButton ----
underlinedTabTypeButton.setText("underlined"); underlinedTabTypeButton.setText("underlined");
underlinedTabTypeButton.setSelected(true); underlinedTabTypeButton.setSelected(true);
underlinedTabTypeButton.putClientProperty("FlatLaf.styleClass", "small"); underlinedTabTypeButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
underlinedTabTypeButton.addActionListener(e -> tabTypeChanged()); underlinedTabTypeButton.addActionListener(e -> tabTypeChanged());
tabTypeToolBar.add(underlinedTabTypeButton); tabTypeToolBar.add(underlinedTabTypeButton);
//---- cardTabTypeButton ---- //---- cardTabTypeButton ----
cardTabTypeButton.setText("card"); cardTabTypeButton.setText("card");
cardTabTypeButton.putClientProperty("FlatLaf.styleClass", "small"); cardTabTypeButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
cardTabTypeButton.addActionListener(e -> tabTypeChanged()); cardTabTypeButton.addActionListener(e -> tabTypeChanged());
tabTypeToolBar.add(cardTabTypeButton); tabTypeToolBar.add(cardTabTypeButton);
} }
@@ -893,25 +894,25 @@ class TabsPanel
//---- rotationNoneButton ---- //---- rotationNoneButton ----
rotationNoneButton.setText("none"); rotationNoneButton.setText("none");
rotationNoneButton.setSelected(true); rotationNoneButton.setSelected(true);
rotationNoneButton.putClientProperty("FlatLaf.styleClass", "small"); rotationNoneButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
rotationNoneButton.addActionListener(e -> tabRotationChanged()); rotationNoneButton.addActionListener(e -> tabRotationChanged());
tabRotationToolBar.add(rotationNoneButton); tabRotationToolBar.add(rotationNoneButton);
//---- rotationAutoButton ---- //---- rotationAutoButton ----
rotationAutoButton.setText("auto"); rotationAutoButton.setText("auto");
rotationAutoButton.putClientProperty("FlatLaf.styleClass", "small"); rotationAutoButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
rotationAutoButton.addActionListener(e -> tabRotationChanged()); rotationAutoButton.addActionListener(e -> tabRotationChanged());
tabRotationToolBar.add(rotationAutoButton); tabRotationToolBar.add(rotationAutoButton);
//---- rotationLeftButton ---- //---- rotationLeftButton ----
rotationLeftButton.setText("left"); rotationLeftButton.setText("left");
rotationLeftButton.putClientProperty("FlatLaf.styleClass", "small"); rotationLeftButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
rotationLeftButton.addActionListener(e -> tabRotationChanged()); rotationLeftButton.addActionListener(e -> tabRotationChanged());
tabRotationToolBar.add(rotationLeftButton); tabRotationToolBar.add(rotationLeftButton);
//---- rotationRightButton ---- //---- rotationRightButton ----
rotationRightButton.setText("right"); rotationRightButton.setText("right");
rotationRightButton.putClientProperty("FlatLaf.styleClass", "small"); rotationRightButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
rotationRightButton.addActionListener(e -> tabRotationChanged()); rotationRightButton.addActionListener(e -> tabRotationChanged());
tabRotationToolBar.add(rotationRightButton); tabRotationToolBar.add(rotationRightButton);
} }

View File

@@ -45,6 +45,7 @@ import javax.swing.*;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.border.CompoundBorder; import javax.swing.border.CompoundBorder;
import javax.swing.event.*; import javax.swing.event.*;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.FlatDarculaLaf; import com.formdev.flatlaf.FlatDarculaLaf;
import com.formdev.flatlaf.FlatDarkLaf; import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.FlatIntelliJLaf; import com.formdev.flatlaf.FlatIntelliJLaf;
@@ -554,7 +555,7 @@ public class IJThemesPanel
"light", "light",
"dark" "dark"
})); }));
filterComboBox.putClientProperty("JComponent.minimumWidth", 0); filterComboBox.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
filterComboBox.setFocusable(false); filterComboBox.setFocusable(false);
filterComboBox.addActionListener(e -> filterChanged()); filterComboBox.addActionListener(e -> filterChanged());
add(filterComboBox, "cell 0 0,alignx right,growx 0"); add(filterComboBox, "cell 0 0,alignx right,growx 0");

View File

@@ -125,9 +125,12 @@ public class FlatInspector
* Installs a key listener into the application that allows enabling and disabling * Installs a key listener into the application that allows enabling and disabling
* the UI inspector with the given keystroke (e.g. "ctrl shift alt X"). * the UI inspector with the given keystroke (e.g. "ctrl shift alt X").
* *
* @param activationKeys a keystroke (e.g. "ctrl shift alt X") * @param activationKeys a keystroke (e.g. "ctrl shift alt X"), or {@code null} to use "ctrl shift alt X"
*/ */
public static void install( String activationKeys ) { public static void install( String activationKeys ) {
if( activationKeys == null )
activationKeys = "ctrl shift alt X";
KeyStroke keyStroke = KeyStroke.getKeyStroke( activationKeys ); KeyStroke keyStroke = KeyStroke.getKeyStroke( activationKeys );
Toolkit.getDefaultToolkit().addAWTEventListener( e -> { Toolkit.getDefaultToolkit().addAWTEventListener( e -> {
if( e.getID() == KeyEvent.KEY_RELEASED && if( e.getID() == KeyEvent.KEY_RELEASED &&

View File

@@ -37,6 +37,7 @@ import java.net.URL;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Function; import java.util.function.Function;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
@@ -588,7 +589,12 @@ public class FlatSVGIcon
: GrayFilter.createDisabledIconFilter( dark ); : GrayFilter.createDisabledIconFilter( dark );
} }
Graphics2D g2 = new GraphicsFilter( (Graphics2D) g.create(), colorFilter, ColorFilter.getInstance(), grayFilter ); ColorFilter globalColorFilter = ColorFilter.getInstance();
globalColorFilter.c = c;
if( colorFilter != null )
colorFilter.c = c;
Graphics2D g2 = new GraphicsFilter( (Graphics2D) g.create(), colorFilter, globalColorFilter, grayFilter );
try { try {
setRenderingHints( g2 ); setRenderingHints( g2 );
@@ -596,6 +602,10 @@ public class FlatSVGIcon
paintSvg( g2, x, y ); paintSvg( g2, x, y );
} finally { } finally {
g2.dispose(); g2.dispose();
globalColorFilter.c = null;
if( colorFilter != null )
colorFilter.c = null;
} }
} }
@@ -760,6 +770,8 @@ public class FlatSVGIcon
private Map<Color, Color> colorMap; private Map<Color, Color> colorMap;
private Map<Color, Color> darkColorMap; private Map<Color, Color> darkColorMap;
private Function<Color, Color> mapper; private Function<Color, Color> mapper;
private BiFunction<Component, Color, Color> mapperEx;
private Component c;
/** /**
* Returns the global ColorFilter that is applied to all icons. * Returns the global ColorFilter that is applied to all icons.
@@ -800,6 +812,22 @@ public class FlatSVGIcon
setMapper( mapper ); setMapper( mapper );
} }
/**
* Creates a color modifying function that changes painted colors.
* The {@link BiFunction} gets passed the component and
* the original color and returns a modified one.
* <p>
* Examples:
* A ColorFilter can be used to brighten colors of the icon (depending on component state if desired):
* <pre>new ColorFilter( (c, color) -&gt; c.isEnabled() ? color.brighter() : color );</pre>
*
* @param mapperEx The color mapper function
* @since 3.6
*/
public ColorFilter( BiFunction<Component, Color, Color> mapperEx ) {
setMapperEx( mapperEx );
}
/** /**
* Returns a color modifying function or {@code null} * Returns a color modifying function or {@code null}
* *
@@ -821,12 +849,39 @@ public class FlatSVGIcon
* <pre>filter.setMapper( color -&gt; Color.RED );</pre> * <pre>filter.setMapper( color -&gt; Color.RED );</pre>
* *
* @param mapper The color mapper function * @param mapper The color mapper function
* @see #setMapperEx(BiFunction)
* @since 1.2 * @since 1.2
*/ */
public void setMapper( Function<Color, Color> mapper ) { public void setMapper( Function<Color, Color> mapper ) {
this.mapper = mapper; this.mapper = mapper;
} }
/**
* Returns a color modifying function or {@code null}
*
* @since 3.6
*/
public BiFunction<Component, Color, Color> getMapperEx() {
return mapperEx;
}
/**
* Sets a color modifying function that changes painted colors.
* The {@link BiFunction} gets passed the component and
* the original color and returns a modified one.
* <p>
* Examples:
* A ColorFilter can be used to brighten colors of the icon (depending on component state if desired):
* <pre>filter.setMapperEx( (c, color) -&gt; c.isEnabled() ? color.brighter() : color );</pre>
*
* @param mapperEx The color mapper function
* @see #setMapper(Function)
* @since 3.6
*/
public void setMapperEx( BiFunction<Component, Color, Color> mapperEx ) {
this.mapperEx = mapperEx;
}
/** /**
* Returns the color mappings used for light themes. * Returns the color mappings used for light themes.
* *
@@ -936,6 +991,11 @@ public class FlatSVGIcon
} }
public Color filter( Color color ) { public Color filter( Color color ) {
return filter( c, color );
}
/** @since 3.6 */
public Color filter( Component c, Color color ) {
// apply mappings // apply mappings
color = applyMappings( color ); color = applyMappings( color );
@@ -943,6 +1003,10 @@ public class FlatSVGIcon
if( mapper != null ) if( mapper != null )
color = mapper.apply( color ); color = mapper.apply( color );
// apply mapperEx function
if( mapperEx != null )
color = mapperEx.apply( c, color );
return color; return color;
} }
@@ -974,6 +1038,16 @@ public class FlatSVGIcon
return color; return color;
} }
/**
* Returns the component passed to {@link FlatSVGIcon#paintIcon(Component, Graphics, int, int)}.
* This allows color mapping depend on component state (e.g. enabled, selected, hover, etc).
*
* @since 3.6
*/
public Component getPaintingComponent() {
return c;
}
/** /**
* Creates a color modifying function that uses {@link RGBImageFilter#filterRGB(int, int, int)}. * Creates a color modifying function that uses {@link RGBImageFilter#filterRGB(int, int, int)}.
* Can be set to a {@link ColorFilter} using {@link ColorFilter#setMapper(Function)}. * Can be set to a {@link ColorFilter} using {@link ColorFilter#setMapper(Function)}.

View File

@@ -85,9 +85,12 @@ public class FlatUIDefaultsInspector
* Installs a key listener into the application that allows enabling and disabling * Installs a key listener into the application that allows enabling and disabling
* the UI inspector with the given keystroke (e.g. "ctrl shift alt Y"). * the UI inspector with the given keystroke (e.g. "ctrl shift alt Y").
* *
* @param activationKeys a keystroke (e.g. "ctrl shift alt Y") * @param activationKeys a keystroke (e.g. "ctrl shift alt Y"), or {@code null} to use "ctrl shift alt Y"
*/ */
public static void install( String activationKeys ) { public static void install( String activationKeys ) {
if( activationKeys == null )
activationKeys = "ctrl shift alt Y";
KeyStroke keyStroke = KeyStroke.getKeyStroke( activationKeys ); KeyStroke keyStroke = KeyStroke.getKeyStroke( activationKeys );
Toolkit.getDefaultToolkit().addAWTEventListener( e -> { Toolkit.getDefaultToolkit().addAWTEventListener( e -> {
if( e.getID() == KeyEvent.KEY_RELEASED && if( e.getID() == KeyEvent.KEY_RELEASED &&

View File

@@ -29,19 +29,37 @@ public class FlatTree
implements FlatComponentExtension, FlatStyleableComponent implements FlatComponentExtension, FlatStyleableComponent
{ {
/** /**
* Returns if the tree shows a wide selection * Returns whether tree shows a wide selection
*/ */
public boolean isWideSelection() { public boolean isWideSelection() {
return getClientPropertyBoolean( TREE_WIDE_SELECTION, "Tree.wideSelection" ); return getClientPropertyBoolean( TREE_WIDE_SELECTION, "Tree.wideSelection" );
} }
/** /**
* Sets if the tree shows a wide selection * Specifies whether tree shows a wide selection
*/ */
public void setWideSelection( boolean wideSelection ) { public void setWideSelection( boolean wideSelection ) {
putClientProperty( TREE_WIDE_SELECTION, wideSelection ); putClientProperty( TREE_WIDE_SELECTION, wideSelection );
} }
/**
* Returns whether tree uses a wide cell renderer.
*
* @since 3.6
*/
public boolean isWideCellRenderer() {
return getClientPropertyBoolean( TREE_WIDE_CELL_RENDERER, "Tree.wideCellRenderer" );
}
/**
* Specifies whether tree uses a wide cell renderer.
*
* @since 3.6
*/
public void setWideCellRenderer( boolean wideCellRenderer ) {
putClientProperty( TREE_WIDE_CELL_RENDERER, wideCellRenderer );
}
/** /**
* Returns whether tree item selection is painted. Default is {@code true}. * Returns whether tree item selection is painted. Default is {@code true}.
* If set to {@code false}, then the tree cell renderer is responsible for painting selection. * If set to {@code false}, then the tree cell renderer is responsible for painting selection.

View File

@@ -62,6 +62,9 @@ CheckBox.icon.pressedBackground = CheckBox.icon.background
CheckBox.icon.focusedSelectedBackground = CheckBox.icon.selectedBackground CheckBox.icon.focusedSelectedBackground = CheckBox.icon.selectedBackground
CheckBox.icon.hoverSelectedBackground = CheckBox.icon.selectedBackground CheckBox.icon.hoverSelectedBackground = CheckBox.icon.selectedBackground
CheckBox.icon.pressedSelectedBackground = CheckBox.icon.selectedBackground CheckBox.icon.pressedSelectedBackground = CheckBox.icon.selectedBackground
CheckBox.icon.focusedIndeterminateBackground = CheckBox.icon.indeterminateBackground
CheckBox.icon.hoverIndeterminateBackground = CheckBox.icon.indeterminateBackground
CheckBox.icon.pressedIndeterminateBackground = CheckBox.icon.indeterminateBackground
CheckBox.icon[filled].disabledBackground = CheckBox.icon[filled].background CheckBox.icon[filled].disabledBackground = CheckBox.icon[filled].background
CheckBox.icon[filled].focusedBackground = CheckBox.icon[filled].background CheckBox.icon[filled].focusedBackground = CheckBox.icon[filled].background
@@ -70,7 +73,9 @@ CheckBox.icon[filled].pressedBackground = CheckBox.icon[filled].background
CheckBox.icon[filled].focusedSelectedBackground = CheckBox.icon[filled].selectedBackground CheckBox.icon[filled].focusedSelectedBackground = CheckBox.icon[filled].selectedBackground
CheckBox.icon[filled].hoverSelectedBackground = CheckBox.icon[filled].selectedBackground CheckBox.icon[filled].hoverSelectedBackground = CheckBox.icon[filled].selectedBackground
CheckBox.icon[filled].pressedSelectedBackground = CheckBox.icon[filled].selectedBackground CheckBox.icon[filled].pressedSelectedBackground = CheckBox.icon[filled].selectedBackground
CheckBox.icon[filled].focusedIndeterminateBackground = CheckBox.icon[filled].indeterminateBackground
CheckBox.icon[filled].hoverIndeterminateBackground = CheckBox.icon[filled].indeterminateBackground
CheckBox.icon[filled].pressedIndeterminateBackground = CheckBox.icon[filled].indeterminateBackground
#---- CheckBoxMenuItem ---- #---- CheckBoxMenuItem ----

View File

@@ -23,6 +23,7 @@ import javax.swing.LookAndFeel;
import javax.swing.UIDefaults; import javax.swing.UIDefaults;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.UIDefaults.ActiveValue; import javax.swing.UIDefaults.ActiveValue;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.FlatDefaultsAddon; import com.formdev.flatlaf.FlatDefaultsAddon;
import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.jideoss.ui.FlatJidePainter; import com.formdev.flatlaf.jideoss.ui.FlatJidePainter;
@@ -55,8 +56,8 @@ public class FlatJideOssDefaultsAddon
public void afterDefaultsLoading( LookAndFeel laf, UIDefaults defaults ) { public void afterDefaultsLoading( LookAndFeel laf, UIDefaults defaults ) {
// TristateCheckBox // TristateCheckBox
defaults.put( "TristateCheckBox.icon", null ); defaults.put( "TristateCheckBox.icon", null );
defaults.put( "TristateCheckBox.setMixed.clientProperty", new Object[] { "JButton.selectedState", "indeterminate" } ); defaults.put( "TristateCheckBox.setMixed.clientProperty", new Object[] { FlatClientProperties.SELECTED_STATE, FlatClientProperties.SELECTED_STATE_INDETERMINATE } );
defaults.put( "TristateCheckBox.clearMixed.clientProperty", new Object[] { "JButton.selectedState", null } ); defaults.put( "TristateCheckBox.clearMixed.clientProperty", new Object[] { FlatClientProperties.SELECTED_STATE, null } );
} }
@Override @Override

View File

@@ -5,12 +5,15 @@ This sub-project contains the source code for the FlatLaf Linux native library.
The native library can be built only on Linux and requires a C++ compiler. The native library can be built only on Linux and requires a C++ compiler.
The native library is available for following CPU architectures: `x86_64` (or
`amd64`) and `arm64` (or `aarch64`).
To be able to build FlatLaf on any platform, and without C++ compiler, the To be able to build FlatLaf on any platform, and without C++ compiler, the
pre-built native library is checked into Git at pre-built native libraries are checked into Git at
[flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/](https://github.com/JFormDesigner/FlatLaf/tree/main/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives). [flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/](https://github.com/JFormDesigner/FlatLaf/tree/main/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives).
The native library was built on a GitHub server with the help of GitHub Actions. The native libraries were built on a GitHub server with the help of GitHub
See: Actions. See:
[Native Libraries](https://github.com/JFormDesigner/FlatLaf/actions/workflows/natives.yml) [Native Libraries](https://github.com/JFormDesigner/FlatLaf/actions/workflows/natives.yml)
workflow. Then the produced Artifacts ZIP was downloaded and the native library workflow. Then the produced Artifacts ZIP was downloaded and the native library
checked into Git. checked into Git.
@@ -18,19 +21,27 @@ checked into Git.
## Development ## Development
To build the library on Linux, some packages needs to be installed. To build the library on Linux, some packages needs to be installed:
- `build-essential` - GCC and development tools
- `libxt-dev` - X11 toolkit development headers
- `g++-aarch64-linux-gnu` - GNU C++ compiler for the arm64 architecture (only on
x86_64 Linux for cross-compiling for arm64 architecture)
### Ubuntu ### Ubuntu
`build-essential` contains GCC and development tools. `libxt-dev` contains the
X11 toolkit development headers.
~~~ ~~~
sudo apt update sudo apt update
sudo apt install build-essential libxt-dev sudo apt install build-essential libxt-dev
~~~ ~~~
Only on x86_64 Linux for cross-compiling for arm64 architecture:
~~~
sudo apt install g++-aarch64-linux-gnu
~~~
### CentOS ### CentOS

View File

@@ -14,6 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
import java.io.FileOutputStream
plugins { plugins {
`cpp-library` `cpp-library`
`flatlaf-cpp-library` `flatlaf-cpp-library`
@@ -28,11 +30,14 @@ flatlafJniHeaders {
} }
library { library {
targetMachines = listOf( machines.linux.x86_64 ) targetMachines = listOf(
machines.linux.x86_64,
machines.linux.architecture( "aarch64" ),
)
} }
var javaHome = System.getProperty( "java.home" ) var javaHome = System.getProperty( "java.home" )
if( javaHome.endsWith( "jre" ) ) if( javaHome.endsWith( "jre" ) && !file( "${javaHome}/include" ).exists() )
javaHome += "/.." javaHome += "/.."
tasks { tasks {
@@ -40,8 +45,16 @@ tasks {
group = "build" group = "build"
description = "Builds natives" description = "Builds natives"
if( org.gradle.internal.os.OperatingSystem.current().isLinux ) if( org.gradle.internal.os.OperatingSystem.current().isLinux ) {
dependsOn( "linkRelease" ) val osArch = System.getProperty( "os.arch" )
if( osArch == "amd64" ) {
dependsOn( "linkReleaseX86-64" )
if( file( "/usr/bin/aarch64-linux-gnu-gcc" ).exists() )
dependsOn( "linkCrossAarch64" )
}
if( osArch == "aarch64" )
dependsOn( "linkReleaseAarch64" )
}
} }
withType<CppCompile>().configureEach { withType<CppCompile>().configureEach {
@@ -67,7 +80,7 @@ tasks {
onlyIf { name.contains( "Release" ) } onlyIf { name.contains( "Release" ) }
val nativesDir = project( ":flatlaf-core" ).projectDir.resolve( "src/main/resources/com/formdev/flatlaf/natives" ) val nativesDir = project( ":flatlaf-core" ).projectDir.resolve( "src/main/resources/com/formdev/flatlaf/natives" )
val libraryName = "libflatlaf-linux-x86_64.so" val libraryName = if( name.contains( "X86-64" ) ) "libflatlaf-linux-x86_64.so" else "libflatlaf-linux-arm64.so"
val jawt = "jawt" val jawt = "jawt"
var jawtPath = "${javaHome}/lib" var jawtPath = "${javaHome}/lib"
if( JavaVersion.current() == JavaVersion.VERSION_1_8 ) if( JavaVersion.current() == JavaVersion.VERSION_1_8 )
@@ -85,8 +98,103 @@ tasks {
copy { copy {
from( linkedFile ) from( linkedFile )
into( nativesDir ) into( nativesDir )
rename( "libflatlaf-natives-linux.so", libraryName ) rename( linkedFile.get().asFile.name, libraryName )
}
// dump( linkedFile.asFile.get(), true )
}
}
if( org.gradle.internal.os.OperatingSystem.current().isLinux &&
System.getProperty( "os.arch" ) == "amd64" &&
file( "/usr/bin/aarch64-linux-gnu-gcc" ).exists() )
{
register<Exec>( "compileCrossAarch64Cpp" ) {
val include = layout.projectDirectory.dir( "src/main/headers" )
val src = layout.projectDirectory.dir( "src/main/cpp" )
workingDir = file( layout.buildDirectory.dir( "obj/main/release/aarch64-cross" ) )
doFirst {
workingDir.mkdirs()
}
commandLine = listOf(
"aarch64-linux-gnu-gcc",
"-c",
"-fPIC",
"-fvisibility=hidden",
"-O3",
"-I", "${javaHome}/include",
"-I", "${javaHome}/include/linux",
"-I", "$include",
"$src/ApiVersion.cpp",
"$src/X11WmUtils.cpp",
)
}
register<Exec>( "linkCrossAarch64" ) {
dependsOn( "compileCrossAarch64Cpp" )
val nativesDir = project( ":flatlaf-core" ).projectDir.resolve( "src/main/resources/com/formdev/flatlaf/natives" )
val libraryName = "libflatlaf-linux-arm64.so"
val outDir = file( layout.buildDirectory.dir( "lib/main/release/aarch64-cross" ) )
val objDir = file( layout.buildDirectory.dir( "obj/main/release/aarch64-cross" ) )
doFirst {
outDir.mkdirs()
}
commandLine = listOf(
"aarch64-linux-gnu-gcc",
"-shared",
"-Wl,-soname,$libraryName",
"-o", "$outDir/$libraryName",
"$objDir/ApiVersion.o",
"$objDir/X11WmUtils.o",
"-L${layout.projectDirectory}/lib/aarch64",
"-ljawt",
)
doLast {
// copy shared library to flatlaf-core resources
copy {
from( "$outDir/$libraryName" )
into( nativesDir )
}
// dump( file( "$outDir/$libraryName" ), false )
} }
} }
} }
} }
/*dump
interface InjectedExecOps { @get:Inject val execOps: ExecOperations }
val injected = project.objects.newInstance<InjectedExecOps>()
fun dump( dylib: File, disassemble: Boolean ) {
val dylibDir = dylib.parent
injected.execOps.exec { commandLine( "size", dylib ); standardOutput = FileOutputStream( "$dylibDir/size.txt" ) }
injected.execOps.exec {
commandLine( "objdump",
// commands
"--archive-headers",
"--section-headers",
"--private-headers",
"--reloc",
"--dynamic-reloc",
"--syms",
// files
dylib )
standardOutput = FileOutputStream( "$dylibDir/objdump.txt" )
}
if( disassemble )
injected.execOps.exec { commandLine( "objdump", "--disassemble-all", dylib ); standardOutput = FileOutputStream( "$dylibDir/disassemble.txt" ) }
injected.execOps.exec { commandLine( "objdump", "--full-contents", dylib ); standardOutput = FileOutputStream( "$dylibDir/full-contents.txt" ) }
injected.execOps.exec { commandLine( "hexdump", dylib ); standardOutput = FileOutputStream( "$dylibDir/hexdump.txt" ) }
}
dump*/

View File

@@ -0,0 +1,4 @@
Contains libraries used to compile FlatLaf native libraries.
- `aarch64/libjawt.so` is `<jdk>/lib/libjawt.so` from Eclipse Temurin 11.0.25+9 aarch64,
which is required to cross build aarch64/arm64 .so on x86_64

View File

@@ -43,6 +43,9 @@ var javaHome = System.getProperty( "java.home" )
if( javaHome.endsWith( "jre" ) ) if( javaHome.endsWith( "jre" ) )
javaHome += "/.." javaHome += "/.."
interface InjectedExecOps { @get:Inject val execOps: ExecOperations }
val injected = project.objects.newInstance<InjectedExecOps>()
tasks { tasks {
register( "build-natives" ) { register( "build-natives" ) {
group = "build" group = "build"
@@ -95,21 +98,21 @@ tasks {
doLast { doLast {
// sign shared library // sign shared library
// exec { commandLine( "codesign", "-s", "FormDev Software GmbH", "--timestamp", "${linkedFile.asFile.get()}" ) } // injected.execOps.exec { commandLine( "codesign", "-s", "FormDev Software GmbH", "--timestamp", "${linkedFile.asFile.get()}" ) }
// copy shared library to flatlaf-core resources // copy shared library to flatlaf-core resources
copy { copy {
from( linkedFile ) from( linkedFile )
into( nativesDir ) into( nativesDir )
rename( "libflatlaf-natives-macos.dylib", libraryName ) rename( linkedFile.get().asFile.name, libraryName )
} }
/*dump /*dump
val dylib = linkedFile.asFile.get() val dylib = linkedFile.asFile.get()
val dylibDir = dylib.parent val dylibDir = dylib.parent
exec { commandLine( "size", dylib ) } injected.execOps.exec { commandLine( "size", dylib ); standardOutput = FileOutputStream( "$dylibDir/size.txt" ) }
exec { commandLine( "size", "-m", dylib ) } injected.execOps.exec { commandLine( "size", "-m", dylib ); standardOutput = FileOutputStream( "$dylibDir/size-m.txt" ) }
exec { injected.execOps.exec {
commandLine( "objdump", commandLine( "objdump",
// commands // commands
"--archive-headers", "--archive-headers",
@@ -127,8 +130,8 @@ tasks {
dylib ) dylib )
standardOutput = FileOutputStream( "$dylibDir/objdump.txt" ) standardOutput = FileOutputStream( "$dylibDir/objdump.txt" )
} }
exec { commandLine( "objdump", "--disassemble-all", dylib ); standardOutput = FileOutputStream( "$dylibDir/disassemble.txt" ) } injected.execOps.exec { commandLine( "objdump", "--disassemble-all", dylib ); standardOutput = FileOutputStream( "$dylibDir/disassemble.txt" ) }
exec { commandLine( "objdump", "--full-contents", dylib ); standardOutput = FileOutputStream( "$dylibDir/full-contents.txt" ) } injected.execOps.exec { commandLine( "objdump", "--full-contents", dylib ); standardOutput = FileOutputStream( "$dylibDir/full-contents.txt" ) }
dump*/ dump*/
} }
} }

View File

@@ -29,15 +29,21 @@
#endif #endif
#define JNI_COCOA_TRY() \
@try {
#define JNI_COCOA_CATCH() \
} @catch( NSException *ex ) { \
NSLog( @"Exception: %@\nReason: %@\nUser Info: %@\nStack: %@", \
[ex name], [ex reason], [ex userInfo], [ex callStackSymbols] ); \
}
#define JNI_COCOA_ENTER() \ #define JNI_COCOA_ENTER() \
@autoreleasepool { \ @autoreleasepool { \
@try { JNI_COCOA_TRY()
#define JNI_COCOA_EXIT() \ #define JNI_COCOA_EXIT() \
} @catch( NSException *ex ) { \ JNI_COCOA_CATCH() \
NSLog( @"Exception: %@\nReason: %@\nUser Info: %@\nStack: %@", \
[ex name], [ex reason], [ex userInfo], [ex callStackSymbols] ); \
} \
} }

View File

@@ -100,10 +100,13 @@ JNIEXPORT jboolean JNICALL Java_com_formdev_flatlaf_ui_FlatNativeMacLibrary_setW
return FALSE; return FALSE;
[FlatJNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ [FlatJNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
JNI_COCOA_TRY()
nsWindow.hasShadow = YES; nsWindow.hasShadow = YES;
nsWindow.contentView.wantsLayer = YES; nsWindow.contentView.wantsLayer = YES;
nsWindow.contentView.layer.cornerRadius = radius; nsWindow.contentView.layer.cornerRadius = radius;
nsWindow.contentView.layer.masksToBounds = YES; nsWindow.contentView.layer.masksToBounds = YES;
nsWindow.contentView.layer.opaque = NO;
nsWindow.contentView.layer.borderWidth = borderWidth; nsWindow.contentView.layer.borderWidth = borderWidth;
if( borderWidth > 0 ) { if( borderWidth > 0 ) {
@@ -120,6 +123,8 @@ JNIEXPORT jboolean JNICALL Java_com_formdev_flatlaf_ui_FlatNativeMacLibrary_setW
[nsWindow.contentView.layer removeAllAnimations]; [nsWindow.contentView.layer removeAllAnimations];
[nsWindow invalidateShadow]; [nsWindow invalidateShadow];
JNI_COCOA_CATCH()
}]; }];
return TRUE; return TRUE;
@@ -157,6 +162,8 @@ JNIEXPORT jboolean JNICALL Java_com_formdev_flatlaf_ui_FlatNativeMacLibrary_setW
WindowData* windowData = getWindowData( nsWindow, true ); WindowData* windowData = getWindowData( nsWindow, true );
[FlatJNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ [FlatJNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
JNI_COCOA_TRY()
// NSLog( @"\n%@\n\n", [nsWindow.contentView.superview _subtreeDescription] ); // NSLog( @"\n%@\n\n", [nsWindow.contentView.superview _subtreeDescription] );
// add/remove toolbar // add/remove toolbar
@@ -235,6 +242,8 @@ JNIEXPORT jboolean JNICALL Java_com_formdev_flatlaf_ui_FlatNativeMacLibrary_setW
windowData.didExitFullScreenObserver = nil; windowData.didExitFullScreenObserver = nil;
} }
} }
JNI_COCOA_CATCH()
}]; }];
return TRUE; return TRUE;

View File

@@ -8,8 +8,8 @@ The native library can be built only on Windows and requires a C++ compiler.
Tested with Microsoft Visual C++ (MSVC) 2019 and 2022 (comes with Visual Studio Tested with Microsoft Visual C++ (MSVC) 2019 and 2022 (comes with Visual Studio
2019 and 2022). 2019 and 2022).
The native library is available for folloging CPU architectures: `x86_64` (or The native library is available for following CPU architectures: `x86_64` (or
`amd64`), `x86` and `arm64`. `amd64`), `x86` and `arm64` (or `aarch64`).
To be able to build FlatLaf on any platform, and without C++ compiler, the To be able to build FlatLaf on any platform, and without C++ compiler, the
pre-built DLLs are checked into Git at pre-built DLLs are checked into Git at

View File

@@ -91,7 +91,7 @@ tasks {
copy { copy {
from( linkedFile ) from( linkedFile )
into( nativesDir ) into( nativesDir )
rename( "flatlaf-natives-windows.dll", libraryName ) rename( linkedFile.get().asFile.name, libraryName )
} }
} }
} }

View File

@@ -1,12 +1,11 @@
- Java 1.8.0_202 - Java 1.8.0_202
+ Java 1.8.0_292 + Java 1.8.0_322
- OS Windows 10 - OS Windows 10
+ OS Mac OS X + OS Mac OS X
#---- ComboBox ---- #---- ComboBox ----
+ ComboBox.roundedBorderWidth 1
+ ComboBox.showPopupOnNavigation true + ComboBox.showPopupOnNavigation true
@@ -47,16 +46,6 @@
+ OptionPane.isYesLast true + OptionPane.isYesLast true
#---- Popup ----
+ Popup.roundedBorderWidth 1
#---- PopupMenu ----
+ PopupMenu.roundedBorderWidth 1
#---- ProgressBar ---- #---- ProgressBar ----
- ProgressBar.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] - ProgressBar.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI]
@@ -88,11 +77,6 @@
- TitlePane.small.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] - TitlePane.small.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI]
+ TitlePane.small.font [active] Helvetica Neue plain 12 javax.swing.plaf.FontUIResource [UI] + TitlePane.small.font [active] Helvetica Neue plain 12 javax.swing.plaf.FontUIResource [UI]
#---- ToolTip ----
+ ToolTip.roundedBorderWidth 1
- defaultFont Segoe UI plain 12 javax.swing.plaf.FontUIResource [UI] - defaultFont Segoe UI plain 12 javax.swing.plaf.FontUIResource [UI]
+ defaultFont Helvetica Neue plain 13 javax.swing.plaf.FontUIResource [UI] + defaultFont Helvetica Neue plain 13 javax.swing.plaf.FontUIResource [UI]

View File

@@ -222,6 +222,7 @@ ComboBox.minimumWidth 72
ComboBox.noActionOnKeyNavigation false ComboBox.noActionOnKeyNavigation false
ComboBox.padding 2,6,2,6 javax.swing.plaf.InsetsUIResource [UI] ComboBox.padding 2,6,2,6 javax.swing.plaf.InsetsUIResource [UI]
ComboBox.popupInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI] ComboBox.popupInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI]
ComboBox.roundedBorderWidth 1
ComboBox.selectionArc 0 ComboBox.selectionArc 0
ComboBox.selectionBackground #4b6eaf HSL 219 40 49 javax.swing.plaf.ColorUIResource [UI] ComboBox.selectionBackground #4b6eaf HSL 219 40 49 javax.swing.plaf.ColorUIResource [UI]
ComboBox.selectionForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] ComboBox.selectionForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
@@ -744,6 +745,7 @@ Popup.dropShadowColor #000000 HSL 0 0 0 javax.swing.plaf.Colo
Popup.dropShadowInsets -4,-4,4,4 javax.swing.plaf.InsetsUIResource [UI] Popup.dropShadowInsets -4,-4,4,4 javax.swing.plaf.InsetsUIResource [UI]
Popup.dropShadowOpacity 0.25 Popup.dropShadowOpacity 0.25
Popup.dropShadowPainted true Popup.dropShadowPainted true
Popup.roundedBorderWidth 1
#---- PopupMenu ---- #---- PopupMenu ----
@@ -757,6 +759,7 @@ PopupMenu.consumeEventOnClose false
PopupMenu.font [active] $defaultFont [UI] PopupMenu.font [active] $defaultFont [UI]
PopupMenu.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] PopupMenu.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
PopupMenu.hoverScrollArrowBackground #484c4e HSL 200 4 29 javax.swing.plaf.ColorUIResource [UI] PopupMenu.hoverScrollArrowBackground #484c4e HSL 200 4 29 javax.swing.plaf.ColorUIResource [UI]
PopupMenu.roundedBorderWidth 1
PopupMenu.scrollArrowColor #9b9b9b HSL 0 0 61 javax.swing.plaf.ColorUIResource [UI] PopupMenu.scrollArrowColor #9b9b9b HSL 0 0 61 javax.swing.plaf.ColorUIResource [UI]
@@ -1375,6 +1378,7 @@ ToolTip.border [lazy] 4,6,4,6 false com.formdev.flatlaf.ui.F
ToolTip.borderCornerRadius 4 ToolTip.borderCornerRadius 4
ToolTip.font [active] $defaultFont [UI] ToolTip.font [active] $defaultFont [UI]
ToolTip.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] ToolTip.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
ToolTip.roundedBorderWidth 1
#---- ToolTipManager ---- #---- ToolTipManager ----
@@ -1431,6 +1435,7 @@ Tree.showDefaultIcons false
Tree.textBackground #46494b HSL 204 3 28 javax.swing.plaf.ColorUIResource [UI] Tree.textBackground #46494b HSL 204 3 28 javax.swing.plaf.ColorUIResource [UI]
Tree.textForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] Tree.textForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
Tree.timeFactor 1000 Tree.timeFactor 1000
Tree.wideCellRenderer false
Tree.wideSelection true Tree.wideSelection true
TreeUI com.formdev.flatlaf.ui.FlatTreeUI TreeUI com.formdev.flatlaf.ui.FlatTreeUI

View File

@@ -1,12 +1,14 @@
- Java 1.8.0_202 - Java 1.8.0_202
+ Java 1.8.0_292 + Java 1.8.0_322
- OS Windows 10 - OS Windows 10
+ OS Mac OS X + OS Mac OS X
#---- ComboBox ---- #---- ComboBox ----
- ComboBox.roundedBorderWidth 1
+ ComboBox.roundedBorderWidth 0 + ComboBox.roundedBorderWidth 0
+ ComboBox.showPopupOnNavigation true + ComboBox.showPopupOnNavigation true
@@ -49,11 +51,13 @@
#---- Popup ---- #---- Popup ----
- Popup.roundedBorderWidth 1
+ Popup.roundedBorderWidth 0 + Popup.roundedBorderWidth 0
#---- PopupMenu ---- #---- PopupMenu ----
- PopupMenu.roundedBorderWidth 1
+ PopupMenu.roundedBorderWidth 0 + PopupMenu.roundedBorderWidth 0
@@ -92,6 +96,7 @@
#---- ToolTip ---- #---- ToolTip ----
- ToolTip.roundedBorderWidth 1
+ ToolTip.roundedBorderWidth 0 + ToolTip.roundedBorderWidth 0
- defaultFont Segoe UI plain 12 javax.swing.plaf.FontUIResource [UI] - defaultFont Segoe UI plain 12 javax.swing.plaf.FontUIResource [UI]
+ defaultFont Helvetica Neue plain 13 javax.swing.plaf.FontUIResource [UI] + defaultFont Helvetica Neue plain 13 javax.swing.plaf.FontUIResource [UI]

View File

@@ -226,6 +226,7 @@ ComboBox.minimumWidth 72
ComboBox.noActionOnKeyNavigation false ComboBox.noActionOnKeyNavigation false
ComboBox.padding 2,6,2,6 javax.swing.plaf.InsetsUIResource [UI] ComboBox.padding 2,6,2,6 javax.swing.plaf.InsetsUIResource [UI]
ComboBox.popupInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI] ComboBox.popupInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI]
ComboBox.roundedBorderWidth 1
ComboBox.selectionArc 0 ComboBox.selectionArc 0
ComboBox.selectionBackground #2675bf HSL 209 67 45 javax.swing.plaf.ColorUIResource [UI] ComboBox.selectionBackground #2675bf HSL 209 67 45 javax.swing.plaf.ColorUIResource [UI]
ComboBox.selectionForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] ComboBox.selectionForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
@@ -749,6 +750,7 @@ Popup.dropShadowColor #000000 HSL 0 0 0 javax.swing.plaf.Colo
Popup.dropShadowInsets -4,-4,4,4 javax.swing.plaf.InsetsUIResource [UI] Popup.dropShadowInsets -4,-4,4,4 javax.swing.plaf.InsetsUIResource [UI]
Popup.dropShadowOpacity 0.15 Popup.dropShadowOpacity 0.15
Popup.dropShadowPainted true Popup.dropShadowPainted true
Popup.roundedBorderWidth 1
#---- PopupMenu ---- #---- PopupMenu ----
@@ -762,6 +764,7 @@ PopupMenu.consumeEventOnClose false
PopupMenu.font [active] $defaultFont [UI] PopupMenu.font [active] $defaultFont [UI]
PopupMenu.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] PopupMenu.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
PopupMenu.hoverScrollArrowBackground #e5e5e5 HSL 0 0 90 javax.swing.plaf.ColorUIResource [UI] PopupMenu.hoverScrollArrowBackground #e5e5e5 HSL 0 0 90 javax.swing.plaf.ColorUIResource [UI]
PopupMenu.roundedBorderWidth 1
PopupMenu.scrollArrowColor #666666 HSL 0 0 40 javax.swing.plaf.ColorUIResource [UI] PopupMenu.scrollArrowColor #666666 HSL 0 0 40 javax.swing.plaf.ColorUIResource [UI]
@@ -1380,6 +1383,7 @@ ToolTip.border [lazy] 4,6,4,6 false com.formdev.flatlaf.ui.F
ToolTip.borderCornerRadius 4 ToolTip.borderCornerRadius 4
ToolTip.font [active] $defaultFont [UI] ToolTip.font [active] $defaultFont [UI]
ToolTip.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] ToolTip.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
ToolTip.roundedBorderWidth 1
#---- ToolTipManager ---- #---- ToolTipManager ----
@@ -1436,6 +1440,7 @@ Tree.showDefaultIcons false
Tree.textBackground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] Tree.textBackground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
Tree.textForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] Tree.textForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
Tree.timeFactor 1000 Tree.timeFactor 1000
Tree.wideCellRenderer false
Tree.wideSelection true Tree.wideSelection true
TreeUI com.formdev.flatlaf.ui.FlatTreeUI TreeUI com.formdev.flatlaf.ui.FlatTreeUI

View File

@@ -228,6 +228,7 @@ ComboBox.noActionOnKeyNavigation false
ComboBox.padding 2,6,2,6 javax.swing.plaf.InsetsUIResource [UI] ComboBox.padding 2,6,2,6 javax.swing.plaf.InsetsUIResource [UI]
ComboBox.popupBackground #323232 HSL 0 0 20 javax.swing.plaf.ColorUIResource [UI] ComboBox.popupBackground #323232 HSL 0 0 20 javax.swing.plaf.ColorUIResource [UI]
ComboBox.popupInsets 5,0,5,0 javax.swing.plaf.InsetsUIResource [UI] ComboBox.popupInsets 5,0,5,0 javax.swing.plaf.InsetsUIResource [UI]
ComboBox.roundedBorderWidth 1
ComboBox.selectionArc 8 ComboBox.selectionArc 8
ComboBox.selectionBackground #1458b8 HSL 215 80 40 javax.swing.plaf.ColorUIResource [UI] ComboBox.selectionBackground #1458b8 HSL 215 80 40 javax.swing.plaf.ColorUIResource [UI]
ComboBox.selectionForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] ComboBox.selectionForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
@@ -752,6 +753,7 @@ Popup.dropShadowColor #000000 HSL 0 0 0 javax.swing.plaf.Colo
Popup.dropShadowInsets -4,-4,4,4 javax.swing.plaf.InsetsUIResource [UI] Popup.dropShadowInsets -4,-4,4,4 javax.swing.plaf.InsetsUIResource [UI]
Popup.dropShadowOpacity 0.25 Popup.dropShadowOpacity 0.25
Popup.dropShadowPainted true Popup.dropShadowPainted true
Popup.roundedBorderWidth 1
#---- PopupMenu ---- #---- PopupMenu ----
@@ -765,6 +767,7 @@ PopupMenu.consumeEventOnClose false
PopupMenu.font [active] $defaultFont [UI] PopupMenu.font [active] $defaultFont [UI]
PopupMenu.foreground #dddddd HSL 0 0 87 javax.swing.plaf.ColorUIResource [UI] PopupMenu.foreground #dddddd HSL 0 0 87 javax.swing.plaf.ColorUIResource [UI]
PopupMenu.hoverScrollArrowBackground #2b2b2b HSL 0 0 17 javax.swing.plaf.ColorUIResource [UI] PopupMenu.hoverScrollArrowBackground #2b2b2b HSL 0 0 17 javax.swing.plaf.ColorUIResource [UI]
PopupMenu.roundedBorderWidth 1
PopupMenu.scrollArrowColor #b7b7b7 HSL 0 0 72 javax.swing.plaf.ColorUIResource [UI] PopupMenu.scrollArrowColor #b7b7b7 HSL 0 0 72 javax.swing.plaf.ColorUIResource [UI]
@@ -1385,6 +1388,7 @@ ToolTip.border [lazy] 4,6,4,6 false com.formdev.flatlaf.ui.F
ToolTip.borderCornerRadius 4 ToolTip.borderCornerRadius 4
ToolTip.font [active] $defaultFont [UI] ToolTip.font [active] $defaultFont [UI]
ToolTip.foreground #dddddd HSL 0 0 87 javax.swing.plaf.ColorUIResource [UI] ToolTip.foreground #dddddd HSL 0 0 87 javax.swing.plaf.ColorUIResource [UI]
ToolTip.roundedBorderWidth 1
#---- ToolTipManager ---- #---- ToolTipManager ----
@@ -1441,6 +1445,7 @@ Tree.showDefaultIcons false
Tree.textBackground #282828 HSL 0 0 16 javax.swing.plaf.ColorUIResource [UI] Tree.textBackground #282828 HSL 0 0 16 javax.swing.plaf.ColorUIResource [UI]
Tree.textForeground #dddddd HSL 0 0 87 javax.swing.plaf.ColorUIResource [UI] Tree.textForeground #dddddd HSL 0 0 87 javax.swing.plaf.ColorUIResource [UI]
Tree.timeFactor 1000 Tree.timeFactor 1000
Tree.wideCellRenderer false
Tree.wideSelection true Tree.wideSelection true
TreeUI com.formdev.flatlaf.ui.FlatTreeUI TreeUI com.formdev.flatlaf.ui.FlatTreeUI

View File

@@ -232,6 +232,7 @@ ComboBox.noActionOnKeyNavigation false
ComboBox.padding 2,6,2,6 javax.swing.plaf.InsetsUIResource [UI] ComboBox.padding 2,6,2,6 javax.swing.plaf.InsetsUIResource [UI]
ComboBox.popupBackground #ececec HSL 0 0 93 javax.swing.plaf.ColorUIResource [UI] ComboBox.popupBackground #ececec HSL 0 0 93 javax.swing.plaf.ColorUIResource [UI]
ComboBox.popupInsets 5,0,5,0 javax.swing.plaf.InsetsUIResource [UI] ComboBox.popupInsets 5,0,5,0 javax.swing.plaf.InsetsUIResource [UI]
ComboBox.roundedBorderWidth 1
ComboBox.selectionArc 8 ComboBox.selectionArc 8
ComboBox.selectionBackground #3d9aff HSL 211 100 62 javax.swing.plaf.ColorUIResource [UI] ComboBox.selectionBackground #3d9aff HSL 211 100 62 javax.swing.plaf.ColorUIResource [UI]
ComboBox.selectionForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] ComboBox.selectionForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
@@ -756,6 +757,7 @@ Popup.dropShadowColor #000000 HSL 0 0 0 javax.swing.plaf.Colo
Popup.dropShadowInsets -4,-4,4,4 javax.swing.plaf.InsetsUIResource [UI] Popup.dropShadowInsets -4,-4,4,4 javax.swing.plaf.InsetsUIResource [UI]
Popup.dropShadowOpacity 0.15 Popup.dropShadowOpacity 0.15
Popup.dropShadowPainted true Popup.dropShadowPainted true
Popup.roundedBorderWidth 1
#---- PopupMenu ---- #---- PopupMenu ----
@@ -769,6 +771,7 @@ PopupMenu.consumeEventOnClose false
PopupMenu.font [active] $defaultFont [UI] PopupMenu.font [active] $defaultFont [UI]
PopupMenu.foreground #262626 HSL 0 0 15 javax.swing.plaf.ColorUIResource [UI] PopupMenu.foreground #262626 HSL 0 0 15 javax.swing.plaf.ColorUIResource [UI]
PopupMenu.hoverScrollArrowBackground #e9e9e9 HSL 0 0 91 javax.swing.plaf.ColorUIResource [UI] PopupMenu.hoverScrollArrowBackground #e9e9e9 HSL 0 0 91 javax.swing.plaf.ColorUIResource [UI]
PopupMenu.roundedBorderWidth 1
PopupMenu.scrollArrowColor #7d7d7d HSL 0 0 49 javax.swing.plaf.ColorUIResource [UI] PopupMenu.scrollArrowColor #7d7d7d HSL 0 0 49 javax.swing.plaf.ColorUIResource [UI]
@@ -1389,6 +1392,7 @@ ToolTip.border [lazy] 4,6,4,6 false com.formdev.flatlaf.ui.F
ToolTip.borderCornerRadius 4 ToolTip.borderCornerRadius 4
ToolTip.font [active] $defaultFont [UI] ToolTip.font [active] $defaultFont [UI]
ToolTip.foreground #262626 HSL 0 0 15 javax.swing.plaf.ColorUIResource [UI] ToolTip.foreground #262626 HSL 0 0 15 javax.swing.plaf.ColorUIResource [UI]
ToolTip.roundedBorderWidth 1
#---- ToolTipManager ---- #---- ToolTipManager ----
@@ -1445,6 +1449,7 @@ Tree.showDefaultIcons false
Tree.textBackground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] Tree.textBackground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
Tree.textForeground #262626 HSL 0 0 15 javax.swing.plaf.ColorUIResource [UI] Tree.textForeground #262626 HSL 0 0 15 javax.swing.plaf.ColorUIResource [UI]
Tree.timeFactor 1000 Tree.timeFactor 1000
Tree.wideCellRenderer false
Tree.wideSelection true Tree.wideSelection true
TreeUI com.formdev.flatlaf.ui.FlatTreeUI TreeUI com.formdev.flatlaf.ui.FlatTreeUI

View File

@@ -254,6 +254,7 @@ ComboBox.noActionOnKeyNavigation false
ComboBox.padding 2,6,2,6 javax.swing.plaf.InsetsUIResource [UI] ComboBox.padding 2,6,2,6 javax.swing.plaf.InsetsUIResource [UI]
ComboBox.popupBackground #ffffcc HSL 60 100 90 javax.swing.plaf.ColorUIResource [UI] ComboBox.popupBackground #ffffcc HSL 60 100 90 javax.swing.plaf.ColorUIResource [UI]
ComboBox.popupInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI] ComboBox.popupInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI]
ComboBox.roundedBorderWidth 1
ComboBox.selectionArc 0 ComboBox.selectionArc 0
ComboBox.selectionBackground #00aa00 HSL 120 100 33 javax.swing.plaf.ColorUIResource [UI] ComboBox.selectionBackground #00aa00 HSL 120 100 33 javax.swing.plaf.ColorUIResource [UI]
ComboBox.selectionForeground #ffff00 HSL 60 100 50 javax.swing.plaf.ColorUIResource [UI] ComboBox.selectionForeground #ffff00 HSL 60 100 50 javax.swing.plaf.ColorUIResource [UI]
@@ -782,6 +783,7 @@ Popup.dropShadowColor #00ff00 HSL 120 100 50 javax.swing.plaf.Colo
Popup.dropShadowInsets -6,6,6,6 javax.swing.plaf.InsetsUIResource [UI] Popup.dropShadowInsets -6,6,6,6 javax.swing.plaf.InsetsUIResource [UI]
Popup.dropShadowOpacity 0.5 Popup.dropShadowOpacity 0.5
Popup.dropShadowPainted true Popup.dropShadowPainted true
Popup.roundedBorderWidth 1
#---- PopupMenu ---- #---- PopupMenu ----
@@ -795,6 +797,7 @@ PopupMenu.consumeEventOnClose false
PopupMenu.font [active] $defaultFont [UI] PopupMenu.font [active] $defaultFont [UI]
PopupMenu.foreground #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] PopupMenu.foreground #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI]
PopupMenu.hoverScrollArrowBackground #00ff00 HSL 120 100 50 javax.swing.plaf.ColorUIResource [UI] PopupMenu.hoverScrollArrowBackground #00ff00 HSL 120 100 50 javax.swing.plaf.ColorUIResource [UI]
PopupMenu.roundedBorderWidth 1
PopupMenu.scrollArrowColor #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI] PopupMenu.scrollArrowColor #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI]
@@ -1438,6 +1441,7 @@ ToolTip.border [lazy] line: #000000 HSL 0 0 0 java.awt
ToolTip.borderCornerRadius 4 ToolTip.borderCornerRadius 4
ToolTip.font [active] $defaultFont [UI] ToolTip.font [active] $defaultFont [UI]
ToolTip.foreground #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] ToolTip.foreground #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI]
ToolTip.roundedBorderWidth 1
#---- ToolTipManager ---- #---- ToolTipManager ----
@@ -1495,6 +1499,7 @@ Tree.showDefaultIcons false
Tree.textBackground #fff0ff HSL 300 100 97 javax.swing.plaf.ColorUIResource [UI] Tree.textBackground #fff0ff HSL 300 100 97 javax.swing.plaf.ColorUIResource [UI]
Tree.textForeground #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] Tree.textForeground #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI]
Tree.timeFactor 1000 Tree.timeFactor 1000
Tree.wideCellRenderer false
Tree.wideSelection true Tree.wideSelection true
TreeUI com.formdev.flatlaf.ui.FlatTreeUI TreeUI com.formdev.flatlaf.ui.FlatTreeUI

View File

@@ -198,17 +198,17 @@ public class FlatComponentStateTest
//---- label11 ---- //---- label11 ----
label11.setText("JButton"); label11.setText("JButton");
label11.putClientProperty("FlatLaf.styleClass", "h3"); label11.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
add(label11, "cell 1 0 2 1"); add(label11, "cell 1 0 2 1");
//---- label12 ---- //---- label12 ----
label12.setText("JToggleButton"); label12.setText("JToggleButton");
label12.putClientProperty("FlatLaf.styleClass", "h3"); label12.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
add(label12, "cell 5 0 3 1"); add(label12, "cell 5 0 3 1");
//---- label32 ---- //---- label32 ----
label32.setText("Help Button"); label32.setText("Help Button");
label32.putClientProperty("FlatLaf.styleClass", "h3"); label32.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
add(label32, "cell 9 0 2 1"); add(label32, "cell 9 0 2 1");
//---- label5 ---- //---- label5 ----
@@ -257,26 +257,26 @@ public class FlatComponentStateTest
//---- testStateButton1 ---- //---- testStateButton1 ----
testStateButton1.setText("text"); testStateButton1.setText("text");
testStateButton1.putClientProperty("JComponent.minimumWidth", 0); testStateButton1.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton1, "cell 1 2"); add(testStateButton1, "cell 1 2");
//---- testStateButton7 ---- //---- testStateButton7 ----
testStateButton7.setText("text"); testStateButton7.setText("text");
testStateButton7.setStateDefault(true); testStateButton7.setStateDefault(true);
testStateButton7.putClientProperty("JComponent.minimumWidth", 0); testStateButton7.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton7, "cell 2 2"); add(testStateButton7, "cell 2 2");
//---- testStateButton4 ---- //---- testStateButton4 ----
testStateButton4.setText("text"); testStateButton4.setText("text");
testStateButton4.setStateFocused(true); testStateButton4.setStateFocused(true);
testStateButton4.putClientProperty("JComponent.minimumWidth", 0); testStateButton4.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton4, "cell 3 2"); add(testStateButton4, "cell 3 2");
//---- testStateButton10 ---- //---- testStateButton10 ----
testStateButton10.setText("text"); testStateButton10.setText("text");
testStateButton10.setStateFocused(true); testStateButton10.setStateFocused(true);
testStateButton10.setStateDefault(true); testStateButton10.setStateDefault(true);
testStateButton10.putClientProperty("JComponent.minimumWidth", 0); testStateButton10.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton10, "cell 4 2"); add(testStateButton10, "cell 4 2");
//---- testStateToggleButton1 ---- //---- testStateToggleButton1 ----
@@ -300,14 +300,14 @@ public class FlatComponentStateTest
add(testStateToggleButton12, "cell 8 2"); add(testStateToggleButton12, "cell 8 2");
//---- testStateButton15 ---- //---- testStateButton15 ----
testStateButton15.putClientProperty("JComponent.minimumWidth", 0); testStateButton15.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
testStateButton15.putClientProperty("JButton.buttonType", "help"); testStateButton15.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(testStateButton15, "cell 9 2"); add(testStateButton15, "cell 9 2");
//---- testStateButton19 ---- //---- testStateButton19 ----
testStateButton19.setStateFocused(true); testStateButton19.setStateFocused(true);
testStateButton19.putClientProperty("JComponent.minimumWidth", 0); testStateButton19.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
testStateButton19.putClientProperty("JButton.buttonType", "help"); testStateButton19.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(testStateButton19, "cell 10 2"); add(testStateButton19, "cell 10 2");
//---- label2 ---- //---- label2 ----
@@ -317,21 +317,21 @@ public class FlatComponentStateTest
//---- testStateButton2 ---- //---- testStateButton2 ----
testStateButton2.setText("text"); testStateButton2.setText("text");
testStateButton2.setStateHover(true); testStateButton2.setStateHover(true);
testStateButton2.putClientProperty("JComponent.minimumWidth", 0); testStateButton2.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton2, "cell 1 3"); add(testStateButton2, "cell 1 3");
//---- testStateButton8 ---- //---- testStateButton8 ----
testStateButton8.setText("text"); testStateButton8.setText("text");
testStateButton8.setStateHover(true); testStateButton8.setStateHover(true);
testStateButton8.setStateDefault(true); testStateButton8.setStateDefault(true);
testStateButton8.putClientProperty("JComponent.minimumWidth", 0); testStateButton8.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton8, "cell 2 3"); add(testStateButton8, "cell 2 3");
//---- testStateButton5 ---- //---- testStateButton5 ----
testStateButton5.setText("text"); testStateButton5.setText("text");
testStateButton5.setStateHover(true); testStateButton5.setStateHover(true);
testStateButton5.setStateFocused(true); testStateButton5.setStateFocused(true);
testStateButton5.putClientProperty("JComponent.minimumWidth", 0); testStateButton5.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton5, "cell 3 3"); add(testStateButton5, "cell 3 3");
//---- testStateButton11 ---- //---- testStateButton11 ----
@@ -339,7 +339,7 @@ public class FlatComponentStateTest
testStateButton11.setStateHover(true); testStateButton11.setStateHover(true);
testStateButton11.setStateFocused(true); testStateButton11.setStateFocused(true);
testStateButton11.setStateDefault(true); testStateButton11.setStateDefault(true);
testStateButton11.putClientProperty("JComponent.minimumWidth", 0); testStateButton11.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton11, "cell 4 3"); add(testStateButton11, "cell 4 3");
//---- testStateToggleButton2 ---- //---- testStateToggleButton2 ----
@@ -368,15 +368,15 @@ public class FlatComponentStateTest
//---- testStateButton16 ---- //---- testStateButton16 ----
testStateButton16.setStateHover(true); testStateButton16.setStateHover(true);
testStateButton16.putClientProperty("JComponent.minimumWidth", 0); testStateButton16.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
testStateButton16.putClientProperty("JButton.buttonType", "help"); testStateButton16.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(testStateButton16, "cell 9 3"); add(testStateButton16, "cell 9 3");
//---- testStateButton20 ---- //---- testStateButton20 ----
testStateButton20.setStateHover(true); testStateButton20.setStateHover(true);
testStateButton20.setStateFocused(true); testStateButton20.setStateFocused(true);
testStateButton20.putClientProperty("JComponent.minimumWidth", 0); testStateButton20.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
testStateButton20.putClientProperty("JButton.buttonType", "help"); testStateButton20.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(testStateButton20, "cell 10 3"); add(testStateButton20, "cell 10 3");
//---- label3 ---- //---- label3 ----
@@ -386,21 +386,21 @@ public class FlatComponentStateTest
//---- testStateButton3 ---- //---- testStateButton3 ----
testStateButton3.setText("text"); testStateButton3.setText("text");
testStateButton3.setStatePressed(true); testStateButton3.setStatePressed(true);
testStateButton3.putClientProperty("JComponent.minimumWidth", 0); testStateButton3.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton3, "cell 1 4"); add(testStateButton3, "cell 1 4");
//---- testStateButton9 ---- //---- testStateButton9 ----
testStateButton9.setText("text"); testStateButton9.setText("text");
testStateButton9.setStatePressed(true); testStateButton9.setStatePressed(true);
testStateButton9.setStateDefault(true); testStateButton9.setStateDefault(true);
testStateButton9.putClientProperty("JComponent.minimumWidth", 0); testStateButton9.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton9, "cell 2 4"); add(testStateButton9, "cell 2 4");
//---- testStateButton6 ---- //---- testStateButton6 ----
testStateButton6.setText("text"); testStateButton6.setText("text");
testStateButton6.setStatePressed(true); testStateButton6.setStatePressed(true);
testStateButton6.setStateFocused(true); testStateButton6.setStateFocused(true);
testStateButton6.putClientProperty("JComponent.minimumWidth", 0); testStateButton6.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton6, "cell 3 4"); add(testStateButton6, "cell 3 4");
//---- testStateButton12 ---- //---- testStateButton12 ----
@@ -408,7 +408,7 @@ public class FlatComponentStateTest
testStateButton12.setStatePressed(true); testStateButton12.setStatePressed(true);
testStateButton12.setStateFocused(true); testStateButton12.setStateFocused(true);
testStateButton12.setStateDefault(true); testStateButton12.setStateDefault(true);
testStateButton12.putClientProperty("JComponent.minimumWidth", 0); testStateButton12.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton12, "cell 4 4"); add(testStateButton12, "cell 4 4");
//---- testStateToggleButton3 ---- //---- testStateToggleButton3 ----
@@ -437,15 +437,15 @@ public class FlatComponentStateTest
//---- testStateButton17 ---- //---- testStateButton17 ----
testStateButton17.setStatePressed(true); testStateButton17.setStatePressed(true);
testStateButton17.putClientProperty("JComponent.minimumWidth", 0); testStateButton17.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
testStateButton17.putClientProperty("JButton.buttonType", "help"); testStateButton17.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(testStateButton17, "cell 9 4"); add(testStateButton17, "cell 9 4");
//---- testStateButton21 ---- //---- testStateButton21 ----
testStateButton21.setStatePressed(true); testStateButton21.setStatePressed(true);
testStateButton21.setStateFocused(true); testStateButton21.setStateFocused(true);
testStateButton21.putClientProperty("JComponent.minimumWidth", 0); testStateButton21.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
testStateButton21.putClientProperty("JButton.buttonType", "help"); testStateButton21.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(testStateButton21, "cell 10 4"); add(testStateButton21, "cell 10 4");
//---- label4 ---- //---- label4 ----
@@ -455,14 +455,14 @@ public class FlatComponentStateTest
//---- testStateButton13 ---- //---- testStateButton13 ----
testStateButton13.setText("text"); testStateButton13.setText("text");
testStateButton13.setEnabled(false); testStateButton13.setEnabled(false);
testStateButton13.putClientProperty("JComponent.minimumWidth", 0); testStateButton13.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton13, "cell 1 5"); add(testStateButton13, "cell 1 5");
//---- testStateButton14 ---- //---- testStateButton14 ----
testStateButton14.setText("text"); testStateButton14.setText("text");
testStateButton14.setEnabled(false); testStateButton14.setEnabled(false);
testStateButton14.setStateDefault(true); testStateButton14.setStateDefault(true);
testStateButton14.putClientProperty("JComponent.minimumWidth", 0); testStateButton14.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton14, "cell 2 5"); add(testStateButton14, "cell 2 5");
//---- testStateToggleButton4 ---- //---- testStateToggleButton4 ----
@@ -478,8 +478,8 @@ public class FlatComponentStateTest
//---- testStateButton18 ---- //---- testStateButton18 ----
testStateButton18.setEnabled(false); testStateButton18.setEnabled(false);
testStateButton18.putClientProperty("JComponent.minimumWidth", 0); testStateButton18.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
testStateButton18.putClientProperty("JButton.buttonType", "help"); testStateButton18.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(testStateButton18, "cell 9 5"); add(testStateButton18, "cell 9 5");
//---- label10 ---- //---- label10 ----
@@ -488,12 +488,12 @@ public class FlatComponentStateTest
//---- button1 ---- //---- button1 ----
button1.setText("text"); button1.setText("text");
button1.putClientProperty("JComponent.minimumWidth", 0); button1.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(button1, "cell 1 6"); add(button1, "cell 1 6");
//---- testDefaultButton1 ---- //---- testDefaultButton1 ----
testDefaultButton1.setText("text"); testDefaultButton1.setText("text");
testDefaultButton1.putClientProperty("JComponent.minimumWidth", 0); testDefaultButton1.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testDefaultButton1, "cell 2 6"); add(testDefaultButton1, "cell 2 6");
//---- toggleButton1 ---- //---- toggleButton1 ----
@@ -506,19 +506,19 @@ public class FlatComponentStateTest
add(toggleButton2, "cell 6 6"); add(toggleButton2, "cell 6 6");
//---- button2 ---- //---- button2 ----
button2.putClientProperty("JComponent.minimumWidth", 0); button2.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
button2.putClientProperty("JButton.buttonType", "help"); button2.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(button2, "cell 9 6"); add(button2, "cell 9 6");
add(separator1, "cell 0 7 11 1"); add(separator1, "cell 0 7 11 1");
//---- label22 ---- //---- label22 ----
label22.setText("JCheckBox"); label22.setText("JCheckBox");
label22.putClientProperty("FlatLaf.styleClass", "h3"); label22.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
add(label22, "cell 1 8 2 1"); add(label22, "cell 1 8 2 1");
//---- label27 ---- //---- label27 ----
label27.setText("JRadioButton"); label27.setText("JRadioButton");
label27.putClientProperty("FlatLaf.styleClass", "h3"); label27.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
add(label27, "cell 5 8 2 1"); add(label27, "cell 5 8 2 1");
//---- label23 ---- //---- label23 ----

View File

@@ -16,6 +16,7 @@
package com.formdev.flatlaf.testing; package com.formdev.flatlaf.testing;
import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.ComponentOrientation; import java.awt.ComponentOrientation;
@@ -32,6 +33,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.function.Supplier;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.*; import javax.swing.border.*;
import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelEvent;
@@ -492,53 +494,33 @@ public class FlatComponents2Test
list.setVisibleRowCount( visibleRowCount ); list.setVisibleRowCount( visibleRowCount );
} }
private void listAlternatingRowsChanged() {
UIManager.put( "List.alternateRowColor", listAlternatingRowsCheckBox.isSelected() ? Color.YELLOW : null );
FlatLaf.updateUILater();
}
private void treeRendererChanged() { private void treeRendererChanged() {
Object sel = treeRendererComboBox.getSelectedItem(); Object sel = treeRendererComboBox.getSelectedItem();
if( !(sel instanceof String) ) if( !(sel instanceof String) )
return; return;
JTree[] trees = { tree1, tree2, xTree1 }; Supplier<TreeCellRenderer> creator;
switch( (String) sel ) { switch( (String) sel ) {
case "default": default:
for( JTree tree : trees ) case "default": creator = DefaultTreeCellRenderer::new; break;
tree.setCellRenderer( new DefaultTreeCellRenderer() ); case "defaultSubclass": creator = TestDefaultTreeCellRenderer::new; break;
break; case "defaultWithIcons": creator = TestDefaultWithIconsTreeCellRenderer::new; break;
case "defaultWithIcon": creator = TestDefaultWithIconTreeCellRenderer::new; break;
case "defaultSubclass": case "label": creator = TestLabelTreeCellRenderer::new; break;
for( JTree tree : trees ) case "wide": creator = TestWideTreeCellRenderer::new; break;
tree.setCellRenderer( new TestDefaultTreeCellRenderer() ); case "swingxDefault": creator = DefaultTreeRenderer::new; break;
break; case "jideCheckBox": creator = () -> new CheckBoxTreeCellRenderer( new DefaultTreeCellRenderer() ); break;
case "jideStyled": creator = StyledTreeCellRenderer::new; break;
case "defaultWithIcons":
for( JTree tree : trees )
tree.setCellRenderer( new TestDefaultWithIconsTreeCellRenderer() );
break;
case "defaultWithIcon":
for( JTree tree : trees )
tree.setCellRenderer( new TestDefaultWithIconTreeCellRenderer() );
break;
case "label":
for( JTree tree : trees )
tree.setCellRenderer( new TestLabelTreeCellRenderer() );
break;
case "swingxDefault":
for( JTree tree : trees )
tree.setCellRenderer( new DefaultTreeRenderer() );
break;
case "jideCheckBox":
for( JTree tree : trees )
tree.setCellRenderer( new CheckBoxTreeCellRenderer( new DefaultTreeCellRenderer() ) );
break;
case "jideStyled":
for( JTree tree : trees )
tree.setCellRenderer( new StyledTreeCellRenderer() );
break;
} }
JTree[] trees = { tree1, tree2, xTree1 };
for( JTree tree : trees )
tree.setCellRenderer( creator.get() );
} }
private void treeWideSelectionChanged() { private void treeWideSelectionChanged() {
@@ -547,6 +529,17 @@ public class FlatComponents2Test
tree.putClientProperty( FlatClientProperties.TREE_WIDE_SELECTION, wideSelection ); tree.putClientProperty( FlatClientProperties.TREE_WIDE_SELECTION, wideSelection );
} }
private void treeWideCellRendererChanged() {
boolean wideCellRenderer = treeWideCellRendererCheckBox.isSelected();
for( JTree tree : allTrees )
tree.putClientProperty( FlatClientProperties.TREE_WIDE_CELL_RENDERER, wideCellRenderer );
}
private void treeAlternatingRowsChanged() {
UIManager.put( "Tree.alternateRowColor", treeAlternatingRowsCheckBox.isSelected() ? Color.cyan : null );
FlatLaf.updateUILater();
}
private void treePaintSelectionChanged() { private void treePaintSelectionChanged() {
boolean paintSelection = treePaintSelectionCheckBox.isSelected(); boolean paintSelection = treePaintSelectionCheckBox.isSelected();
for( JTree tree : allTrees ) for( JTree tree : allTrees )
@@ -687,11 +680,14 @@ public class FlatComponents2Test
listLayoutOrientationField = new JComboBox<>(); listLayoutOrientationField = new JComboBox<>();
JLabel listVisibleRowCountLabel = new JLabel(); JLabel listVisibleRowCountLabel = new JLabel();
listVisibleRowCountSpinner = new JSpinner(); listVisibleRowCountSpinner = new JSpinner();
listAlternatingRowsCheckBox = new JCheckBox();
treeOptionsPanel = new JPanel(); treeOptionsPanel = new JPanel();
JLabel treeRendererLabel = new JLabel(); JLabel treeRendererLabel = new JLabel();
treeRendererComboBox = new JComboBox<>(); treeRendererComboBox = new JComboBox<>();
treeWideSelectionCheckBox = new JCheckBox(); treeWideSelectionCheckBox = new JCheckBox();
treeWideCellRendererCheckBox = new JCheckBox();
treePaintSelectionCheckBox = new JCheckBox(); treePaintSelectionCheckBox = new JCheckBox();
treeAlternatingRowsCheckBox = new JCheckBox();
treePaintLinesCheckBox = new JCheckBox(); treePaintLinesCheckBox = new JCheckBox();
treeRedLinesCheckBox = new JCheckBox(); treeRedLinesCheckBox = new JCheckBox();
treeEditableCheckBox = new JCheckBox(); treeEditableCheckBox = new JCheckBox();
@@ -753,7 +749,7 @@ public class FlatComponents2Test
// rows // rows
"[]" + "[]" +
"[grow]" + "[grow]" +
"[]" + "[]0" +
"[]")); "[]"));
//---- listLabel ---- //---- listLabel ----
@@ -796,7 +792,7 @@ public class FlatComponents2Test
// rows // rows
"[]" + "[]" +
"[grow]" + "[grow]" +
"[]" + "[]0" +
"[]")); "[]"));
//---- tableLabel ---- //---- tableLabel ----
@@ -833,7 +829,7 @@ public class FlatComponents2Test
// rows // rows
"[]" + "[]" +
"[grow]" + "[grow]" +
"[]" + "[]0" +
"[]")); "[]"));
//---- treeLabel ---- //---- treeLabel ----
@@ -1022,6 +1018,7 @@ public class FlatComponents2Test
// rows // rows
"[]" + "[]" +
"[]" + "[]" +
"[]" +
"[]")); "[]"));
//---- listRendererLabel ---- //---- listRendererLabel ----
@@ -1059,6 +1056,11 @@ public class FlatComponents2Test
listVisibleRowCountSpinner.setModel(new SpinnerNumberModel(8, 0, null, 1)); listVisibleRowCountSpinner.setModel(new SpinnerNumberModel(8, 0, null, 1));
listVisibleRowCountSpinner.addChangeListener(e -> listVisibleRowCountChanged()); listVisibleRowCountSpinner.addChangeListener(e -> listVisibleRowCountChanged());
listOptionsPanel.add(listVisibleRowCountSpinner, "cell 1 2"); listOptionsPanel.add(listVisibleRowCountSpinner, "cell 1 2");
//---- listAlternatingRowsCheckBox ----
listAlternatingRowsCheckBox.setText("alternating rows");
listAlternatingRowsCheckBox.addActionListener(e -> listAlternatingRowsChanged());
listOptionsPanel.add(listAlternatingRowsCheckBox, "cell 0 3 2 1,alignx left,growx 0");
} }
add(listOptionsPanel, "cell 0 4 4 1"); add(listOptionsPanel, "cell 0 4 4 1");
@@ -1088,6 +1090,7 @@ public class FlatComponents2Test
"defaultWithIcons", "defaultWithIcons",
"defaultWithIcon", "defaultWithIcon",
"label", "label",
"wide",
"swingxDefault", "swingxDefault",
"jideCheckBox", "jideCheckBox",
"jideStyled" "jideStyled"
@@ -1100,12 +1103,22 @@ public class FlatComponents2Test
treeWideSelectionCheckBox.addActionListener(e -> treeWideSelectionChanged()); treeWideSelectionCheckBox.addActionListener(e -> treeWideSelectionChanged());
treeOptionsPanel.add(treeWideSelectionCheckBox, "cell 0 1"); treeOptionsPanel.add(treeWideSelectionCheckBox, "cell 0 1");
//---- treeWideCellRendererCheckBox ----
treeWideCellRendererCheckBox.setText("wide cell renderer");
treeWideCellRendererCheckBox.addActionListener(e -> treeWideCellRendererChanged());
treeOptionsPanel.add(treeWideCellRendererCheckBox, "cell 0 1");
//---- treePaintSelectionCheckBox ---- //---- treePaintSelectionCheckBox ----
treePaintSelectionCheckBox.setText("paint selection"); treePaintSelectionCheckBox.setText("paint selection");
treePaintSelectionCheckBox.setSelected(true); treePaintSelectionCheckBox.setSelected(true);
treePaintSelectionCheckBox.addActionListener(e -> treePaintSelectionChanged()); treePaintSelectionCheckBox.addActionListener(e -> treePaintSelectionChanged());
treeOptionsPanel.add(treePaintSelectionCheckBox, "cell 0 2"); treeOptionsPanel.add(treePaintSelectionCheckBox, "cell 0 2");
//---- treeAlternatingRowsCheckBox ----
treeAlternatingRowsCheckBox.setText("alternating rows");
treeAlternatingRowsCheckBox.addActionListener(e -> treeAlternatingRowsChanged());
treeOptionsPanel.add(treeAlternatingRowsCheckBox, "cell 0 2");
//---- treePaintLinesCheckBox ---- //---- treePaintLinesCheckBox ----
treePaintLinesCheckBox.setText("paint lines"); treePaintLinesCheckBox.setText("paint lines");
treePaintLinesCheckBox.addActionListener(e -> treePaintLinesChanged()); treePaintLinesCheckBox.addActionListener(e -> treePaintLinesChanged());
@@ -1263,10 +1276,13 @@ public class FlatComponents2Test
private JComboBox<String> listRendererComboBox; private JComboBox<String> listRendererComboBox;
private JComboBox<String> listLayoutOrientationField; private JComboBox<String> listLayoutOrientationField;
private JSpinner listVisibleRowCountSpinner; private JSpinner listVisibleRowCountSpinner;
private JCheckBox listAlternatingRowsCheckBox;
private JPanel treeOptionsPanel; private JPanel treeOptionsPanel;
private JComboBox<String> treeRendererComboBox; private JComboBox<String> treeRendererComboBox;
private JCheckBox treeWideSelectionCheckBox; private JCheckBox treeWideSelectionCheckBox;
private JCheckBox treeWideCellRendererCheckBox;
private JCheckBox treePaintSelectionCheckBox; private JCheckBox treePaintSelectionCheckBox;
private JCheckBox treeAlternatingRowsCheckBox;
private JCheckBox treePaintLinesCheckBox; private JCheckBox treePaintLinesCheckBox;
private JCheckBox treeRedLinesCheckBox; private JCheckBox treeRedLinesCheckBox;
private JCheckBox treeEditableCheckBox; private JCheckBox treeEditableCheckBox;
@@ -1372,7 +1388,7 @@ public class FlatComponents2Test
@Override @Override
public String getElementAt( int index ) { public String getElementAt( int index ) {
return (index < 20) return (index < 20)
? "item " + (index + 1) ? "item " + (index + 1) + ((index + 1) % 5 == 0 ? " ####" : "")
: "item " + (index + 1) + " " + randomRowString( index ); : "item " + (index + 1) + " " + randomRowString( index );
} }
} }
@@ -1794,6 +1810,32 @@ public class FlatComponents2Test
} }
} }
//---- class TestLabelTreeCellRenderer ------------------------------------
private static class TestWideTreeCellRenderer
extends JPanel
implements TreeCellRenderer
{
private final JLabel label = new JLabel();
private final JLabel icon = new JLabel( UIManager.getIcon( "FileView.floppyDriveIcon" ) );
TestWideTreeCellRenderer() {
super( new BorderLayout() );
setOpaque( false );
add( label, BorderLayout.CENTER );
add( icon, BorderLayout.LINE_END );
setBorder( new LineBorder( Color.red ) );
}
@Override
public Component getTreeCellRendererComponent( JTree tree, Object value, boolean selected, boolean expanded,
boolean leaf, int row, boolean hasFocus )
{
label.setText( String.valueOf( value ) );
return this;
}
}
//---- class TestComboBoxTableCellRenderer -------------------------------- //---- class TestComboBoxTableCellRenderer --------------------------------
private static class TestComboBoxTableCellRenderer private static class TestComboBoxTableCellRenderer

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "8.2.2.0.9999" Java: "21.0.1" encoding: "UTF-8" JFDML JFormDesigner: "8.3" encoding: "UTF-8"
new FormModel { new FormModel {
contentType: "form/swing" contentType: "form/swing"
@@ -33,7 +33,7 @@ new FormModel {
} ) } )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$columnConstraints": "[fill]" "$columnConstraints": "[fill]"
"$rowConstraints": "[][grow][][]" "$rowConstraints": "[][grow][]0[]"
"$layoutConstraints": "ltr,insets 0,hidemode 3" "$layoutConstraints": "ltr,insets 0,hidemode 3"
} ) { } ) {
name: "panel1" name: "panel1"
@@ -95,7 +95,7 @@ new FormModel {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3" "$layoutConstraints": "insets 0,hidemode 3"
"$columnConstraints": "[fill]" "$columnConstraints": "[fill]"
"$rowConstraints": "[][grow][][]" "$rowConstraints": "[][grow][]0[]"
} ) { } ) {
name: "panel3" name: "panel3"
"$client.FlatLaf.internal.testing.ignore": true "$client.FlatLaf.internal.testing.ignore": true
@@ -146,7 +146,7 @@ new FormModel {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3" "$layoutConstraints": "insets 0,hidemode 3"
"$columnConstraints": "[fill]" "$columnConstraints": "[fill]"
"$rowConstraints": "[][grow][][]" "$rowConstraints": "[][grow][]0[]"
} ) { } ) {
name: "panel2" name: "panel2"
"$client.FlatLaf.internal.testing.ignore": true "$client.FlatLaf.internal.testing.ignore": true
@@ -385,7 +385,7 @@ new FormModel {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 8,hidemode 3" "$layoutConstraints": "insets 8,hidemode 3"
"$columnConstraints": "[fill][fill]" "$columnConstraints": "[fill][fill]"
"$rowConstraints": "[][][]" "$rowConstraints": "[][][][]"
} ) { } ) {
name: "listOptionsPanel" name: "listOptionsPanel"
"border": new javax.swing.border.TitledBorder( "JList Control" ) "border": new javax.swing.border.TitledBorder( "JList Control" )
@@ -455,6 +455,16 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2" "value": "cell 1 2"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "listAlternatingRowsCheckBox"
"text": "alternating rows"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "listAlternatingRowsChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3 2 1,alignx left,growx 0"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4 4 1" "value": "cell 0 4 4 1"
} ) } )
@@ -484,6 +494,7 @@ new FormModel {
addElement( "defaultWithIcons" ) addElement( "defaultWithIcons" )
addElement( "defaultWithIcon" ) addElement( "defaultWithIcon" )
addElement( "label" ) addElement( "label" )
addElement( "wide" )
addElement( "swingxDefault" ) addElement( "swingxDefault" )
addElement( "jideCheckBox" ) addElement( "jideCheckBox" )
addElement( "jideStyled" ) addElement( "jideStyled" )
@@ -505,6 +516,16 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1" "value": "cell 0 1"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "treeWideCellRendererCheckBox"
"text": "wide cell renderer"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "treeWideCellRendererChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "treePaintSelectionCheckBox" name: "treePaintSelectionCheckBox"
"text": "paint selection" "text": "paint selection"
@@ -516,6 +537,16 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2" "value": "cell 0 2"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "treeAlternatingRowsCheckBox"
"text": "alternating rows"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "treeAlternatingRowsChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "treePaintLinesCheckBox" name: "treePaintLinesCheckBox"
"text": "paint lines" "text": "paint lines"

View File

@@ -20,6 +20,7 @@ import java.awt.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.*; import javax.swing.border.*;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.plaf.ColorUIResource;
import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.extras.components.*; import com.formdev.flatlaf.extras.components.*;
import com.formdev.flatlaf.extras.components.FlatButton.ButtonType; import com.formdev.flatlaf.extras.components.FlatButton.ButtonType;
@@ -144,6 +145,36 @@ public class FlatComponentsTest
} }
} }
private void transparentBackground() {
EventQueue.invokeLater( () -> {
boolean transparent = transparentBackgroundCheckBox.isSelected();
Color transparentColor = new Color( 0, true );
ColorUIResource restoreColor = new ColorUIResource( Color.white );
FlatTestFrame.updateComponentsRecur( this, (c, type) -> {
if( c instanceof JComboBox ) {
((JComboBox<?>)c).putClientProperty( FlatClientProperties.STYLE,
transparent ? "background: #0000; buttonBackground: #0000; buttonEditableBackground: #0000" : null );
} else if( c instanceof JSpinner ) {
((JSpinner)c).putClientProperty( FlatClientProperties.STYLE,
transparent ? "background: #0000; buttonBackground: #0000" : null );
} else if( c instanceof JComponent )
c.setBackground( transparent ? transparentColor : restoreColor );
else
return;
// if background color is transparent it is also required to make the component non-opaque
// DO NOT USE LookAndFeel.installProperty() in real-world applications
// instead use c.setOpaque( false )
if( transparent )
LookAndFeel.installProperty( (JComponent) c, "opaque", false );
} );
if( !transparent )
SwingUtilities.updateComponentTreeUI( this );
} );
}
private void roundRectChanged() { private void roundRectChanged() {
Boolean roundRect = roundRectCheckBox.isSelected() ? true : null; Boolean roundRect = roundRectCheckBox.isSelected() ? true : null;
@@ -398,6 +429,7 @@ public class FlatComponentsTest
magentaCyanOutlineRadioButton = new JRadioButton(); magentaCyanOutlineRadioButton = new JRadioButton();
focusPaintedCheckBox = new JCheckBox(); focusPaintedCheckBox = new JCheckBox();
hideArrowButtonCheckBox = new JCheckBox(); hideArrowButtonCheckBox = new JCheckBox();
transparentBackgroundCheckBox = new JCheckBox();
JLabel scrollBarLabel = new JLabel(); JLabel scrollBarLabel = new JLabel();
JScrollBar scrollBar1 = new JScrollBar(); JScrollBar scrollBar1 = new JScrollBar();
JScrollBar scrollBar4 = new JScrollBar(); JScrollBar scrollBar4 = new JScrollBar();
@@ -1256,6 +1288,7 @@ public class FlatComponentsTest
"[]0" + "[]0" +
"[]0" + "[]0" +
"[]0" + "[]0" +
"[]0" +
"[]")); "[]"));
//---- buttonTypeComboBox ---- //---- buttonTypeComboBox ----
@@ -1309,7 +1342,7 @@ public class FlatComponentsTest
magentaCyanOutlineRadioButton.addActionListener(e -> outlineChanged()); magentaCyanOutlineRadioButton.addActionListener(e -> outlineChanged());
panel4.add(magentaCyanOutlineRadioButton); panel4.add(magentaCyanOutlineRadioButton);
} }
panel5.add(panel4, "cell 0 2 1 3"); panel5.add(panel4, "cell 0 2 1 4");
//---- focusPaintedCheckBox ---- //---- focusPaintedCheckBox ----
focusPaintedCheckBox.setText("focusPainted"); focusPaintedCheckBox.setText("focusPainted");
@@ -1321,6 +1354,11 @@ public class FlatComponentsTest
hideArrowButtonCheckBox.setText("hide arrow button"); hideArrowButtonCheckBox.setText("hide arrow button");
hideArrowButtonCheckBox.addActionListener(e -> hideArrowButton()); hideArrowButtonCheckBox.addActionListener(e -> hideArrowButton());
panel5.add(hideArrowButtonCheckBox, "cell 1 3"); panel5.add(hideArrowButtonCheckBox, "cell 1 3");
//---- transparentBackgroundCheckBox ----
transparentBackgroundCheckBox.setText("transparent background");
transparentBackgroundCheckBox.addActionListener(e -> transparentBackground());
panel5.add(transparentBackgroundCheckBox, "cell 1 4");
} }
add(panel5, "cell 5 13 2 10,grow"); add(panel5, "cell 5 13 2 10,grow");
@@ -1728,6 +1766,7 @@ public class FlatComponentsTest
private JRadioButton magentaCyanOutlineRadioButton; private JRadioButton magentaCyanOutlineRadioButton;
private JCheckBox focusPaintedCheckBox; private JCheckBox focusPaintedCheckBox;
private JCheckBox hideArrowButtonCheckBox; private JCheckBox hideArrowButtonCheckBox;
private JCheckBox transparentBackgroundCheckBox;
private JSlider slider1; private JSlider slider1;
private JSlider slider6; private JSlider slider6;
private JCheckBox sliderPaintTrackCheckBox; private JCheckBox sliderPaintTrackCheckBox;

View File

@@ -993,7 +993,7 @@ new FormModel {
} ) } )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$columnConstraints": "[][]" "$columnConstraints": "[][]"
"$rowConstraints": "[]0[]0[]0[]0[]" "$rowConstraints": "[]0[]0[]0[]0[]0[]"
"$layoutConstraints": "ltr,insets dialog,hidemode 3" "$layoutConstraints": "ltr,insets dialog,hidemode 3"
} ) { } ) {
name: "panel5" name: "panel5"
@@ -1092,7 +1092,7 @@ new FormModel {
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "outlineChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "outlineChanged", false ) )
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2 1 3" "value": "cell 0 2 1 4"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "focusPaintedCheckBox" name: "focusPaintedCheckBox"
@@ -1115,6 +1115,16 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3" "value": "cell 1 3"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "transparentBackgroundCheckBox"
"text": "transparent background"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "transparentBackground", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 13 2 10,grow" "value": "cell 5 13 2 10,grow"
} ) } )

View File

@@ -21,6 +21,7 @@ import javax.swing.*;
import javax.swing.border.*; import javax.swing.border.*;
import javax.swing.plaf.basic.BasicComboBoxEditor; import javax.swing.plaf.basic.BasicComboBoxEditor;
import javax.swing.plaf.basic.BasicComboBoxRenderer; import javax.swing.plaf.basic.BasicComboBoxRenderer;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.icons.FlatFileViewFloppyDriveIcon; import com.formdev.flatlaf.icons.FlatFileViewFloppyDriveIcon;
import com.formdev.flatlaf.util.UIScale; import com.formdev.flatlaf.util.UIScale;
import net.miginfocom.swing.*; import net.miginfocom.swing.*;
@@ -342,22 +343,22 @@ public class FlatCustomBordersTest
//---- button5 ---- //---- button5 ----
button5.setText("text"); button5.setText("text");
button5.putClientProperty("JButton.buttonType", "roundRect"); button5.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_ROUND_RECT);
add(button5, "cell 1 2"); add(button5, "cell 1 2");
//---- button6 ---- //---- button6 ----
button6.setText("text"); button6.setText("text");
button6.putClientProperty("JButton.buttonType", "roundRect"); button6.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_ROUND_RECT);
add(button6, "cell 2 2"); add(button6, "cell 2 2");
//---- button7 ---- //---- button7 ----
button7.setText("text"); button7.setText("text");
button7.putClientProperty("JButton.buttonType", "roundRect"); button7.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_ROUND_RECT);
add(button7, "cell 3 2"); add(button7, "cell 3 2");
//---- button8 ---- //---- button8 ----
button8.setText("text"); button8.setText("text");
button8.putClientProperty("JButton.buttonType", "roundRect"); button8.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_ROUND_RECT);
add(button8, "cell 4 2"); add(button8, "cell 4 2");
//---- label5 ---- //---- label5 ----
@@ -372,31 +373,31 @@ public class FlatCustomBordersTest
add(comboBox27, "cell 7 3"); add(comboBox27, "cell 7 3");
//---- comboBox5 ---- //---- comboBox5 ----
comboBox5.putClientProperty("JComponent.roundRect", true); comboBox5.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
add(comboBox5, "cell 1 4"); add(comboBox5, "cell 1 4");
//---- comboBox6 ---- //---- comboBox6 ----
comboBox6.putClientProperty("JComponent.roundRect", true); comboBox6.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
add(comboBox6, "cell 2 4"); add(comboBox6, "cell 2 4");
//---- comboBox7 ---- //---- comboBox7 ----
comboBox7.putClientProperty("JComponent.roundRect", true); comboBox7.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
add(comboBox7, "cell 3 4"); add(comboBox7, "cell 3 4");
//---- comboBox8 ---- //---- comboBox8 ----
comboBox8.putClientProperty("JComponent.roundRect", true); comboBox8.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
add(comboBox8, "cell 4 4"); add(comboBox8, "cell 4 4");
//---- comboBox24 ---- //---- comboBox24 ----
comboBox24.putClientProperty("JComponent.roundRect", true); comboBox24.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
add(comboBox24, "cell 5 4"); add(comboBox24, "cell 5 4");
//---- comboBox26 ---- //---- comboBox26 ----
comboBox26.putClientProperty("JComponent.roundRect", true); comboBox26.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
add(comboBox26, "cell 6 4"); add(comboBox26, "cell 6 4");
//---- comboBox28 ---- //---- comboBox28 ----
comboBox28.putClientProperty("JComponent.roundRect", true); comboBox28.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
add(comboBox28, "cell 7 4"); add(comboBox28, "cell 7 4");
//---- comboBox9 ---- //---- comboBox9 ----
@@ -428,37 +429,37 @@ public class FlatCustomBordersTest
add(comboBox21, "cell 7 5"); add(comboBox21, "cell 7 5");
//---- comboBox13 ---- //---- comboBox13 ----
comboBox13.putClientProperty("JComponent.roundRect", true); comboBox13.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
comboBox13.setEditable(true); comboBox13.setEditable(true);
add(comboBox13, "cell 1 6"); add(comboBox13, "cell 1 6");
//---- comboBox14 ---- //---- comboBox14 ----
comboBox14.putClientProperty("JComponent.roundRect", true); comboBox14.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
comboBox14.setEditable(true); comboBox14.setEditable(true);
add(comboBox14, "cell 2 6"); add(comboBox14, "cell 2 6");
//---- comboBox15 ---- //---- comboBox15 ----
comboBox15.putClientProperty("JComponent.roundRect", true); comboBox15.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
comboBox15.setEditable(true); comboBox15.setEditable(true);
add(comboBox15, "cell 3 6"); add(comboBox15, "cell 3 6");
//---- comboBox16 ---- //---- comboBox16 ----
comboBox16.putClientProperty("JComponent.roundRect", true); comboBox16.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
comboBox16.setEditable(true); comboBox16.setEditable(true);
add(comboBox16, "cell 4 6"); add(comboBox16, "cell 4 6");
//---- comboBox18 ---- //---- comboBox18 ----
comboBox18.putClientProperty("JComponent.roundRect", true); comboBox18.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
comboBox18.setEditable(true); comboBox18.setEditable(true);
add(comboBox18, "cell 5 6"); add(comboBox18, "cell 5 6");
//---- comboBox20 ---- //---- comboBox20 ----
comboBox20.putClientProperty("JComponent.roundRect", true); comboBox20.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
comboBox20.setEditable(true); comboBox20.setEditable(true);
add(comboBox20, "cell 6 6"); add(comboBox20, "cell 6 6");
//---- comboBox22 ---- //---- comboBox22 ----
comboBox22.putClientProperty("JComponent.roundRect", true); comboBox22.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
comboBox22.setEditable(true); comboBox22.setEditable(true);
add(comboBox22, "cell 7 6"); add(comboBox22, "cell 7 6");
@@ -471,19 +472,19 @@ public class FlatCustomBordersTest
add(spinner4, "cell 4 7"); add(spinner4, "cell 4 7");
//---- spinner5 ---- //---- spinner5 ----
spinner5.putClientProperty("JComponent.roundRect", true); spinner5.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
add(spinner5, "cell 1 8"); add(spinner5, "cell 1 8");
//---- spinner6 ---- //---- spinner6 ----
spinner6.putClientProperty("JComponent.roundRect", true); spinner6.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
add(spinner6, "cell 2 8"); add(spinner6, "cell 2 8");
//---- spinner7 ---- //---- spinner7 ----
spinner7.putClientProperty("JComponent.roundRect", true); spinner7.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
add(spinner7, "cell 3 8"); add(spinner7, "cell 3 8");
//---- spinner8 ---- //---- spinner8 ----
spinner8.putClientProperty("JComponent.roundRect", true); spinner8.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
add(spinner8, "cell 4 8"); add(spinner8, "cell 4 8");
//---- textFieldLabel ---- //---- textFieldLabel ----
@@ -492,11 +493,11 @@ public class FlatCustomBordersTest
//---- textField1 ---- //---- textField1 ----
textField1.setText("text"); textField1.setText("text");
textField1.putClientProperty("JComponent.roundRect", false); textField1.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, false);
add(textField1, "cell 1 9,growx"); add(textField1, "cell 1 9,growx");
//---- textField2 ---- //---- textField2 ----
textField2.putClientProperty("JComponent.roundRect", false); textField2.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, false);
textField2.setText("text"); textField2.setText("text");
add(textField2, "cell 2 9"); add(textField2, "cell 2 9");
@@ -505,27 +506,27 @@ public class FlatCustomBordersTest
add(textField3, "cell 3 9"); add(textField3, "cell 3 9");
//---- textField4 ---- //---- textField4 ----
textField4.putClientProperty("JComponent.roundRect", false); textField4.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, false);
textField4.setText("text"); textField4.setText("text");
add(textField4, "cell 4 9"); add(textField4, "cell 4 9");
//---- textField5 ---- //---- textField5 ----
textField5.setText("text"); textField5.setText("text");
textField5.putClientProperty("JComponent.roundRect", true); textField5.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
add(textField5, "cell 1 10,growx"); add(textField5, "cell 1 10,growx");
//---- textField6 ---- //---- textField6 ----
textField6.putClientProperty("JComponent.roundRect", true); textField6.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
textField6.setText("text"); textField6.setText("text");
add(textField6, "cell 2 10"); add(textField6, "cell 2 10");
//---- textField7 ---- //---- textField7 ----
textField7.setText("text"); textField7.setText("text");
textField7.putClientProperty("JComponent.roundRect", true); textField7.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
add(textField7, "cell 3 10"); add(textField7, "cell 3 10");
//---- textField8 ---- //---- textField8 ----
textField8.putClientProperty("JComponent.roundRect", true); textField8.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
textField8.setText("text"); textField8.setText("text");
add(textField8, "cell 4 10"); add(textField8, "cell 4 10");

View File

@@ -22,6 +22,7 @@ import java.awt.Font;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
import javax.swing.*; import javax.swing.*;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.fonts.inter.FlatInterFont; import com.formdev.flatlaf.fonts.inter.FlatInterFont;
import com.formdev.flatlaf.fonts.jetbrains_mono.FlatJetBrainsMonoFont; import com.formdev.flatlaf.fonts.jetbrains_mono.FlatJetBrainsMonoFont;
import com.formdev.flatlaf.fonts.roboto.FlatRobotoFont; import com.formdev.flatlaf.fonts.roboto.FlatRobotoFont;
@@ -132,7 +133,7 @@ public class FlatFontsTest
//---- previewFamilyNameLabel ---- //---- previewFamilyNameLabel ----
previewFamilyNameLabel.setText("name"); previewFamilyNameLabel.setText("name");
previewFamilyNameLabel.putClientProperty("FlatLaf.styleClass", "h1"); previewFamilyNameLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1");
add(previewFamilyNameLabel, "cell 1 1"); add(previewFamilyNameLabel, "cell 1 1");
//======== familiesScrollPane ======== //======== familiesScrollPane ========

View File

@@ -21,6 +21,10 @@ import java.awt.event.MouseEvent;
import java.util.Random; import java.util.Random;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.*; import javax.swing.border.*;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.FlatSystemProperties;
import com.formdev.flatlaf.util.Animator; import com.formdev.flatlaf.util.Animator;
import com.formdev.flatlaf.util.UIScale; import com.formdev.flatlaf.util.UIScale;
import net.miginfocom.swing.*; import net.miginfocom.swing.*;
@@ -43,6 +47,8 @@ public class FlatPopupTest
FlatPopupTest() { FlatPopupTest() {
initComponents(); initComponents();
addPopupMenuListener( popupMenu1, "popupMenu1" );
addPopupMenuListener( popupMenu2, "popupMenu2" );
} }
private void showPopupMenu() { private void showPopupMenu() {
@@ -114,6 +120,46 @@ public class FlatPopupTest
} }
} }
private void showDirectPopup() {
DirectPopupContent content = new DirectPopupContent();
content.putClientProperty( FlatClientProperties.POPUP_FORCE_HEAVY_WEIGHT, true );
Point pt = showDirectPopupButton.getLocationOnScreen();
System.setProperty( FlatSystemProperties.USE_ROUNDED_POPUP_BORDER, "false" );
UIManager.put( "Popup.dropShadowColor", Color.red );
UIManager.put( "Popup.dropShadowInsets", new Insets( 5, 5, 5, 5 ) );
UIManager.put( "Popup.dropShadowOpacity", 1f );
Popup popup = PopupFactory.getSharedInstance().getPopup( showDirectPopupButton,
content, pt.x, pt.y + showDirectPopupButton.getHeight() + 10 );
content.popup = popup;
popup.show();
System.clearProperty( FlatSystemProperties.USE_ROUNDED_POPUP_BORDER );
UIManager.put( "Popup.dropShadowColor", null );
UIManager.put( "Popup.dropShadowInsets", null );
UIManager.put( "Popup.dropShadowOpacity", null );
}
private void addPopupMenuListener( JPopupMenu popupMenu, String name ) {
popupMenu.addPopupMenuListener( new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible( PopupMenuEvent e ) {
System.out.println( "popupMenuWillBecomeVisible " + name );
}
@Override
public void popupMenuWillBecomeInvisible( PopupMenuEvent e ) {
System.out.println( "popupMenuWillBecomeInvisible " + name );
}
@Override
public void popupMenuCanceled( PopupMenuEvent e ) {
System.out.println( "popupMenuCanceled " + name );
}
} );
}
@Override @Override
public void updateUI() { public void updateUI() {
super.updateUI(); super.updateUI();
@@ -128,15 +174,12 @@ public class FlatPopupTest
} }
} }
private void countChanged() {
// TODO add your code here
}
private void initComponents() { private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
label1 = new JLabel(); label1 = new JLabel();
label2 = new JLabel(); label2 = new JLabel();
showPopupMenuButton = new JButton(); showPopupMenuButton = new JButton();
showDirectPopupButton = new JButton();
showLargePopupMenuButton = new JButton(); showLargePopupMenuButton = new JButton();
showPopupButton = new JButton(); showPopupButton = new JButton();
hidePopupButton = new JButton(); hidePopupButton = new JButton();
@@ -209,6 +252,11 @@ public class FlatPopupTest
showPopupMenuButton.addActionListener(e -> showPopupMenu()); showPopupMenuButton.addActionListener(e -> showPopupMenu());
add(showPopupMenuButton, "cell 0 2"); add(showPopupMenuButton, "cell 0 2");
//---- showDirectPopupButton ----
showDirectPopupButton.setText("show direct move/resize popup");
showDirectPopupButton.addActionListener(e -> showDirectPopup());
add(showDirectPopupButton, "cell 2 2 2 1");
//---- showLargePopupMenuButton ---- //---- showLargePopupMenuButton ----
showLargePopupMenuButton.setText("show heavy-weight JPopupMenu"); showLargePopupMenuButton.setText("show heavy-weight JPopupMenu");
showLargePopupMenuButton.addActionListener(e -> showLargePopupMenu()); showLargePopupMenuButton.addActionListener(e -> showLargePopupMenu());
@@ -240,7 +288,6 @@ public class FlatPopupTest
//---- countField ---- //---- countField ----
countField.setModel(new SpinnerNumberModel(1, 1, null, 1)); countField.setModel(new SpinnerNumberModel(1, 1, null, 1));
countField.addChangeListener(e -> countChanged());
add(countField, "cell 5 4"); add(countField, "cell 5 4");
//---- label4 ---- //---- label4 ----
@@ -366,6 +413,7 @@ public class FlatPopupTest
private JLabel label1; private JLabel label1;
private JLabel label2; private JLabel label2;
private JButton showPopupMenuButton; private JButton showPopupMenuButton;
private JButton showDirectPopupButton;
private JButton showLargePopupMenuButton; private JButton showLargePopupMenuButton;
private JButton showPopupButton; private JButton showPopupButton;
private JButton hidePopupButton; private JButton hidePopupButton;
@@ -444,4 +492,69 @@ public class FlatPopupTest
private JLabel label6; private JLabel label6;
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on // JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
} }
//---- class MyPopupContent -----------------------------------------------
private static class DirectPopupContent
extends JPanel
{
Popup popup;
DirectPopupContent() {
initComponents();
}
private void resizePopup() {
Window popupWindow = SwingUtilities.windowForComponent( this );
popupWindow.setSize( popupWindow.getWidth() + 20, popupWindow.getHeight() + 50 );
}
private void movePopup() {
Window popupWindow = SwingUtilities.windowForComponent( this );
popupWindow.setLocation( popupWindow.getX() + 20, popupWindow.getY() + 50 );
}
private void hidePopup() {
popup.hide();
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off
resizeButton = new JButton();
moveButton = new JButton();
hideButton = new JButton();
//======== this ========
setLayout(new MigLayout(
"hidemode 3",
// columns
"[fill]" +
"[fill]" +
"[fill]",
// rows
"[]"));
//---- resizeButton ----
resizeButton.setText("Resize");
resizeButton.addActionListener(e -> resizePopup());
add(resizeButton, "cell 0 0");
//---- moveButton ----
moveButton.setText("Move");
moveButton.addActionListener(e -> movePopup());
add(moveButton, "cell 1 0");
//---- hideButton ----
hideButton.setText("Hide");
hideButton.addActionListener(e -> hidePopup());
add(hideButton, "cell 2 0");
// JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
private JButton resizeButton;
private JButton moveButton;
private JButton hideButton;
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
}
} }

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "8.2.3.0.386" Java: "21" encoding: "UTF-8" JFDML JFormDesigner: "8.3" encoding: "UTF-8"
new FormModel { new FormModel {
contentType: "form/swing" contentType: "form/swing"
@@ -30,6 +30,13 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2" "value": "cell 0 2"
} ) } )
add( new FormComponent( "javax.swing.JButton" ) {
name: "showDirectPopupButton"
"text": "show direct move/resize popup"
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showDirectPopup", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 2 2 1"
} )
add( new FormComponent( "javax.swing.JButton" ) { add( new FormComponent( "javax.swing.JButton" ) {
name: "showLargePopupMenuButton" name: "showLargePopupMenuButton"
"text": "show heavy-weight JPopupMenu" "text": "show heavy-weight JPopupMenu"
@@ -77,7 +84,6 @@ new FormModel {
minimum: 1 minimum: 1
value: 1 value: 1
} }
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "countChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 4" "value": "cell 5 4"
} ) } )
@@ -215,5 +221,39 @@ new FormModel {
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 5, 505 ) "location": new java.awt.Point( 5, 505 )
} ) } )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "hidemode 3"
"$columnConstraints": "[fill][fill][fill]"
"$rowConstraints": "[]"
} ) {
name: "panel1"
auxiliary() {
"JavaCodeGenerator.className": "DirectPopupContent"
}
add( new FormComponent( "javax.swing.JButton" ) {
name: "resizeButton"
"text": "Resize"
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "resizePopup", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "moveButton"
"text": "Move"
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "movePopup", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "hideButton"
"text": "Hide"
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hidePopup", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 180, 395 )
"size": new java.awt.Dimension( 270, 100 )
} )
} }
} }

View File

@@ -37,6 +37,7 @@ import javax.swing.UIManager.LookAndFeelInfo;
import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.metal.MetalLookAndFeel; import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.plaf.nimbus.NimbusLookAndFeel; import javax.swing.plaf.nimbus.NimbusLookAndFeel;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.FlatDarculaLaf; import com.formdev.flatlaf.FlatDarculaLaf;
import com.formdev.flatlaf.FlatDarkLaf; import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.FlatIntelliJLaf; import com.formdev.flatlaf.FlatIntelliJLaf;
@@ -806,7 +807,7 @@ public class FlatTestFrame
buttonBar.add(scaleFactorComboBox, "cell 1 0"); buttonBar.add(scaleFactorComboBox, "cell 1 0");
//---- fontSizeSpinner ---- //---- fontSizeSpinner ----
fontSizeSpinner.putClientProperty("JComponent.minimumWidth", 50); fontSizeSpinner.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 50);
fontSizeSpinner.setModel(new SpinnerNumberModel(0, 0, null, 1)); fontSizeSpinner.setModel(new SpinnerNumberModel(0, 0, null, 1));
fontSizeSpinner.addChangeListener(e -> fontSizeChanged()); fontSizeSpinner.addChangeListener(e -> fontSizeChanged());
buttonBar.add(fontSizeSpinner, "cell 2 0"); buttonBar.add(fontSizeSpinner, "cell 2 0");

View File

@@ -316,13 +316,13 @@ public class FlatTextComponentsTest
//---- textField1 ---- //---- textField1 ----
textField1.setText("editable"); textField1.setText("editable");
textField1.setComponentPopupMenu(popupMenu1); textField1.setComponentPopupMenu(popupMenu1);
textField1.putClientProperty("JTextField.placeholderText", "place"); textField1.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "place");
add(textField1, "cell 1 0,growx"); add(textField1, "cell 1 0,growx");
//---- textField3 ---- //---- textField3 ----
textField3.setText("longer text for testing horizontal scrolling"); textField3.setText("longer text for testing horizontal scrolling");
textField3.setComponentPopupMenu(popupMenu1); textField3.setComponentPopupMenu(popupMenu1);
textField3.putClientProperty("JTextField.placeholderText", "place"); textField3.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "place");
add(textField3, "cell 2 0,growx"); add(textField3, "cell 2 0,growx");
//---- textField2 ---- //---- textField2 ----
@@ -330,7 +330,7 @@ public class FlatTextComponentsTest
textField2.setSelectionStart(1); textField2.setSelectionStart(1);
textField2.setSelectionEnd(4); textField2.setSelectionEnd(4);
textField2.setComponentPopupMenu(popupMenu1); textField2.setComponentPopupMenu(popupMenu1);
textField2.putClientProperty("JTextField.placeholderText", "place"); textField2.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "place");
add(textField2, "cell 3 0"); add(textField2, "cell 3 0");
//---- formattedTextFieldLabel ---- //---- formattedTextFieldLabel ----
@@ -342,13 +342,13 @@ public class FlatTextComponentsTest
//---- formattedTextField1 ---- //---- formattedTextField1 ----
formattedTextField1.setText("editable"); formattedTextField1.setText("editable");
formattedTextField1.setComponentPopupMenu(popupMenu1); formattedTextField1.setComponentPopupMenu(popupMenu1);
formattedTextField1.putClientProperty("JTextField.placeholderText", "place"); formattedTextField1.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "place");
add(formattedTextField1, "cell 1 1,growx"); add(formattedTextField1, "cell 1 1,growx");
//---- formattedTextField3 ---- //---- formattedTextField3 ----
formattedTextField3.setText("longer text for testing horizontal scrolling"); formattedTextField3.setText("longer text for testing horizontal scrolling");
formattedTextField3.setComponentPopupMenu(popupMenu1); formattedTextField3.setComponentPopupMenu(popupMenu1);
formattedTextField3.putClientProperty("JTextField.placeholderText", "place"); formattedTextField3.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "place");
add(formattedTextField3, "cell 2 1,growx"); add(formattedTextField3, "cell 2 1,growx");
//======== panel1 ======== //======== panel1 ========
@@ -539,13 +539,13 @@ public class FlatTextComponentsTest
//---- passwordField1 ---- //---- passwordField1 ----
passwordField1.setText("editable"); passwordField1.setText("editable");
passwordField1.setComponentPopupMenu(popupMenu1); passwordField1.setComponentPopupMenu(popupMenu1);
passwordField1.putClientProperty("JTextField.placeholderText", "place"); passwordField1.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "place");
add(passwordField1, "cell 1 2,growx"); add(passwordField1, "cell 1 2,growx");
//---- passwordField3 ---- //---- passwordField3 ----
passwordField3.setText("longer text for testing horizontal scrolling"); passwordField3.setText("longer text for testing horizontal scrolling");
passwordField3.setComponentPopupMenu(popupMenu1); passwordField3.setComponentPopupMenu(popupMenu1);
passwordField3.putClientProperty("JTextField.placeholderText", "place"); passwordField3.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "place");
add(passwordField3, "cell 2 2,growx"); add(passwordField3, "cell 2 2,growx");
//---- textAreaLabel ---- //---- textAreaLabel ----

View File

@@ -24,6 +24,7 @@ import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import javax.swing.*; import javax.swing.*;
import com.formdev.flatlaf.FlatClientProperties;
import net.miginfocom.swing.*; import net.miginfocom.swing.*;
/** /**
@@ -205,57 +206,57 @@ public class FlatTypographyTest
//---- label54 ---- //---- label54 ----
label54.setText("<html>FlatLaf<br><small>Windows</small></html>"); label54.setText("<html>FlatLaf<br><small>Windows</small></html>");
label54.putClientProperty("FlatLaf.styleClass", "h1"); label54.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1");
add(label54, "cell 0 0"); add(label54, "cell 0 0");
//---- label68 ---- //---- label68 ----
label68.setText("<html>JetBrains<br><small>Windows</small></html>"); label68.setText("<html>JetBrains<br><small>Windows</small></html>");
label68.putClientProperty("FlatLaf.styleClass", "h1"); label68.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1");
add(label68, "cell 1 0"); add(label68, "cell 1 0");
//---- label69 ---- //---- label69 ----
label69.setText("<html>JetBrains<br><small>macOS</small></html>"); label69.setText("<html>JetBrains<br><small>macOS</small></html>");
label69.putClientProperty("FlatLaf.styleClass", "h1"); label69.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1");
add(label69, "cell 2 0"); add(label69, "cell 2 0");
//---- label10 ---- //---- label10 ----
label10.setText("macOS"); label10.setText("macOS");
label10.putClientProperty("FlatLaf.styleClass", "h1"); label10.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1");
add(label10, "cell 3 0"); add(label10, "cell 3 0");
//---- label11 ---- //---- label11 ----
label11.setText("Windows 10/11"); label11.setText("Windows 10/11");
label11.putClientProperty("FlatLaf.styleClass", "h1"); label11.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1");
add(label11, "cell 4 0"); add(label11, "cell 4 0");
//---- label72 ---- //---- label72 ----
label72.setText("<html>GitHub<br>Primer</html>"); label72.setText("<html>GitHub<br>Primer</html>");
label72.putClientProperty("FlatLaf.styleClass", "h1"); label72.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1");
add(label72, "cell 5 0"); add(label72, "cell 5 0");
//---- label28 ---- //---- label28 ----
label28.setText("Material"); label28.setText("Material");
label28.putClientProperty("FlatLaf.styleClass", "h1"); label28.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1");
add(label28, "cell 6 0"); add(label28, "cell 6 0");
//---- label29 ---- //---- label29 ----
label29.setText("Material 3"); label29.setText("Material 3");
label29.putClientProperty("FlatLaf.styleClass", "h1"); label29.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1");
add(label29, "cell 7 0"); add(label29, "cell 7 0");
//---- label1 ---- //---- label1 ----
label1.setText("SAP Fiori"); label1.setText("SAP Fiori");
label1.putClientProperty("FlatLaf.styleClass", "h1"); label1.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1");
add(label1, "cell 8 0"); add(label1, "cell 8 0");
//---- label37 ---- //---- label37 ----
label37.setText("Atlassian"); label37.setText("Atlassian");
label37.putClientProperty("FlatLaf.styleClass", "h1"); label37.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1");
add(label37, "cell 9 0"); add(label37, "cell 9 0");
//---- label46 ---- //---- label46 ----
label46.setText("Iris"); label46.setText("Iris");
label46.putClientProperty("FlatLaf.styleClass", "h1"); label46.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1");
add(label46, "cell 10 0"); add(label46, "cell 10 0");
//---- linkLabel9 ---- //---- linkLabel9 ----
@@ -1147,7 +1148,7 @@ public class FlatTypographyTest
//---- descLabel ---- //---- descLabel ----
descLabel.setText("description"); descLabel.setText("description");
descLabel.putClientProperty("FlatLaf.styleClass", "small"); descLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
descLabel.setEnabled(false); descLabel.setEnabled(false);
add(descLabel, "cell 0 1"); add(descLabel, "cell 0 1");
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents

View File

@@ -241,7 +241,7 @@ public class FlatWindowDecorationsTest
tallCompCheckBox.setSelected( false ); tallCompCheckBox.setSelected( false );
JButton myButton = new JButton( "?" ); JButton myButton = new JButton( "?" );
myButton.putClientProperty( "JButton.buttonType", "toolBarButton" ); myButton.putClientProperty( FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_TOOLBAR_BUTTON );
myButton.setFocusable( false ); myButton.setFocusable( false );
menuBar.add( Box.createGlue() ); menuBar.add( Box.createGlue() );
@@ -499,7 +499,7 @@ debug*/
if( typeUtilityRadioButton.isSelected() ) if( typeUtilityRadioButton.isSelected() )
window.setType( Window.Type.UTILITY ); window.setType( Window.Type.UTILITY );
else if( typeSmallRadioButton.isSelected() ) else if( typeSmallRadioButton.isSelected() )
((RootPaneContainer)window).getRootPane().putClientProperty( "Window.style", "small" ); ((RootPaneContainer)window).getRootPane().putClientProperty( FlatClientProperties.WINDOW_STYLE, FlatClientProperties.WINDOW_STYLE_SMALL );
} }
private void decorationStyleChanged() { private void decorationStyleChanged() {

View File

@@ -28,6 +28,7 @@ import javax.swing.UIDefaults.ActiveValue;
import javax.swing.UIDefaults.LazyValue; import javax.swing.UIDefaults.LazyValue;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.UIDefaultsLoaderAccessor; import com.formdev.flatlaf.UIDefaultsLoaderAccessor;
import com.formdev.flatlaf.extras.components.*; import com.formdev.flatlaf.extras.components.*;
@@ -252,7 +253,7 @@ class FlatThemePreview
//---- previewLabel ---- //---- previewLabel ----
previewLabel.setText(" Preview "); previewLabel.setText(" Preview ");
previewLabel.putClientProperty("FlatLaf.styleClass", "h2"); previewLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h2");
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
} }

View File

@@ -423,7 +423,7 @@ class FlatThemePreviewAll
//---- label1 ---- //---- label1 ----
label1.setText("Some Text"); label1.setText("Some Text");
label1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-label"); label1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-label");
add(label1, "cell 1 1 2 1"); add(label1, "cell 1 1 2 1");
//---- flatButton1 ---- //---- flatButton1 ----
@@ -438,12 +438,12 @@ class FlatThemePreviewAll
//---- button1 ---- //---- button1 ----
button1.setText("OK"); button1.setText("OK");
button1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-button"); button1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-button");
add(button1, "cell 1 2"); add(button1, "cell 1 2");
//---- testDefaultButton1 ---- //---- testDefaultButton1 ----
testDefaultButton1.setText("Default"); testDefaultButton1.setText("Default");
testDefaultButton1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-button"); testDefaultButton1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-button");
add(testDefaultButton1, "cell 2 2"); add(testDefaultButton1, "cell 2 2");
//---- toggleButtonLabel ---- //---- toggleButtonLabel ----
@@ -452,13 +452,13 @@ class FlatThemePreviewAll
//---- toggleButton1 ---- //---- toggleButton1 ----
toggleButton1.setText("Unselected"); toggleButton1.setText("Unselected");
toggleButton1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-togglebutton"); toggleButton1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-togglebutton");
add(toggleButton1, "cell 1 3"); add(toggleButton1, "cell 1 3");
//---- toggleButton3 ---- //---- toggleButton3 ----
toggleButton3.setText("Selected"); toggleButton3.setText("Selected");
toggleButton3.setSelected(true); toggleButton3.setSelected(true);
toggleButton3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-togglebutton"); toggleButton3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-togglebutton");
add(toggleButton3, "cell 2 3"); add(toggleButton3, "cell 2 3");
//---- checkBoxLabel ---- //---- checkBoxLabel ----
@@ -467,13 +467,13 @@ class FlatThemePreviewAll
//---- checkBox1 ---- //---- checkBox1 ----
checkBox1.setText("Unselected"); checkBox1.setText("Unselected");
checkBox1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-checkbox"); checkBox1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-checkbox");
add(checkBox1, "cell 1 4,alignx left,growx 0"); add(checkBox1, "cell 1 4,alignx left,growx 0");
//---- checkBox3 ---- //---- checkBox3 ----
checkBox3.setText("Selected"); checkBox3.setText("Selected");
checkBox3.setSelected(true); checkBox3.setSelected(true);
checkBox3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-checkbox"); checkBox3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-checkbox");
add(checkBox3, "cell 2 4,alignx left,growx 0"); add(checkBox3, "cell 2 4,alignx left,growx 0");
//---- radioButtonLabel ---- //---- radioButtonLabel ----
@@ -482,13 +482,13 @@ class FlatThemePreviewAll
//---- radioButton1 ---- //---- radioButton1 ----
radioButton1.setText("Unselected"); radioButton1.setText("Unselected");
radioButton1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-radiobutton"); radioButton1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-radiobutton");
add(radioButton1, "cell 1 5,alignx left,growx 0"); add(radioButton1, "cell 1 5,alignx left,growx 0");
//---- radioButton3 ---- //---- radioButton3 ----
radioButton3.setText("Selected"); radioButton3.setText("Selected");
radioButton3.setSelected(true); radioButton3.setSelected(true);
radioButton3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-radiobutton"); radioButton3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-radiobutton");
add(radioButton3, "cell 2 5,alignx left,growx 0"); add(radioButton3, "cell 2 5,alignx left,growx 0");
//---- comboBoxLabel ---- //---- comboBoxLabel ----
@@ -513,7 +513,7 @@ class FlatThemePreviewAll
})); }));
comboBox1.setMaximumRowCount(6); comboBox1.setMaximumRowCount(6);
comboBox1.setPlaceholderText("placeholder text"); comboBox1.setPlaceholderText("placeholder text");
comboBox1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-combobox"); comboBox1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-combobox");
add(comboBox1, "cell 1 6"); add(comboBox1, "cell 1 6");
//---- comboBox3 ---- //---- comboBox3 ----
@@ -526,7 +526,7 @@ class FlatThemePreviewAll
"e" "e"
})); }));
comboBox3.setMaximumRowCount(6); comboBox3.setMaximumRowCount(6);
comboBox3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-combobox"); comboBox3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-combobox");
add(comboBox3, "cell 2 6"); add(comboBox3, "cell 2 6");
//---- spinnerLabel ---- //---- spinnerLabel ----
@@ -534,7 +534,7 @@ class FlatThemePreviewAll
add(spinnerLabel, "cell 0 7"); add(spinnerLabel, "cell 0 7");
//---- spinner1 ---- //---- spinner1 ----
spinner1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-spinner"); spinner1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-spinner");
add(spinner1, "cell 1 7 2 1"); add(spinner1, "cell 1 7 2 1");
//---- textFieldLabel ---- //---- textFieldLabel ----
@@ -544,24 +544,24 @@ class FlatThemePreviewAll
//---- textField1 ---- //---- textField1 ----
textField1.setText("Some Text"); textField1.setText("Some Text");
textField1.setPlaceholderText("placeholder text"); textField1.setPlaceholderText("placeholder text");
textField1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-textfield"); textField1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-textfield");
add(textField1, "cell 1 8"); add(textField1, "cell 1 8");
//---- textField2 ---- //---- textField2 ----
textField2.setText("Txt"); textField2.setText("Txt");
textField2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-textfield"); textField2.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-textfield");
add(textField2, "cell 2 8"); add(textField2, "cell 2 8");
//---- formattedTextField1 ---- //---- formattedTextField1 ----
formattedTextField1.setText("Some Text"); formattedTextField1.setText("Some Text");
formattedTextField1.setPlaceholderText("placeholder text"); formattedTextField1.setPlaceholderText("placeholder text");
formattedTextField1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-formattedtextfield"); formattedTextField1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-formattedtextfield");
add(formattedTextField1, "cell 1 9"); add(formattedTextField1, "cell 1 9");
//---- passwordField1 ---- //---- passwordField1 ----
passwordField1.setText("Some Text"); passwordField1.setText("Some Text");
passwordField1.setPlaceholderText("placeholder text"); passwordField1.setPlaceholderText("placeholder text");
passwordField1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-passwordfield"); passwordField1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-passwordfield");
passwordField1.setShowClearButton(true); passwordField1.setShowClearButton(true);
add(passwordField1, "cell 2 9"); add(passwordField1, "cell 2 9");
@@ -577,7 +577,7 @@ class FlatThemePreviewAll
//---- textArea1 ---- //---- textArea1 ----
textArea1.setText("Text"); textArea1.setText("Text");
textArea1.setRows(2); textArea1.setRows(2);
textArea1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-textarea"); textArea1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-textarea");
scrollPane1.setViewportView(textArea1); scrollPane1.setViewportView(textArea1);
} }
add(scrollPane1, "cell 1 10 2 1,width 40"); add(scrollPane1, "cell 1 10 2 1,width 40");
@@ -589,7 +589,7 @@ class FlatThemePreviewAll
//---- editorPane1 ---- //---- editorPane1 ----
editorPane1.setText("Text"); editorPane1.setText("Text");
editorPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-editorpane"); editorPane1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-editorpane");
scrollPane5.setViewportView(editorPane1); scrollPane5.setViewportView(editorPane1);
} }
add(scrollPane5, "cell 1 10 2 1,width 40"); add(scrollPane5, "cell 1 10 2 1,width 40");
@@ -601,7 +601,7 @@ class FlatThemePreviewAll
//---- textPane1 ---- //---- textPane1 ----
textPane1.setText("Text"); textPane1.setText("Text");
textPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-textpane"); textPane1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-textpane");
scrollPane9.setViewportView(textPane1); scrollPane9.setViewportView(textPane1);
} }
add(scrollPane9, "cell 1 10 2 1,width 40"); add(scrollPane9, "cell 1 10 2 1,width 40");
@@ -615,62 +615,62 @@ class FlatThemePreviewAll
menuUnderlineSelectionButton.setButtonType(FlatButton.ButtonType.toolBarButton); menuUnderlineSelectionButton.setButtonType(FlatButton.ButtonType.toolBarButton);
menuUnderlineSelectionButton.setToolTipText("menu underline selection"); menuUnderlineSelectionButton.setToolTipText("menu underline selection");
menuUnderlineSelectionButton.setFocusable(false); menuUnderlineSelectionButton.setFocusable(false);
menuUnderlineSelectionButton.putClientProperty("FlatLaf.styleClass", "small"); menuUnderlineSelectionButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
menuUnderlineSelectionButton.addActionListener(e -> menuUnderlineSelectionChanged()); menuUnderlineSelectionButton.addActionListener(e -> menuUnderlineSelectionChanged());
add(menuUnderlineSelectionButton, "cell 0 11"); add(menuUnderlineSelectionButton, "cell 0 11");
//======== menuBar1 ======== //======== menuBar1 ========
{ {
menuBar1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menubar"); menuBar1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menubar");
//======== menu2 ======== //======== menu2 ========
{ {
menu2.setText("JMenu"); menu2.setText("JMenu");
menu2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menu"); menu2.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menu");
//---- menuItem3 ---- //---- menuItem3 ----
menuItem3.setText("JMenuItem"); menuItem3.setText("JMenuItem");
menuItem3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem"); menuItem3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menuitem");
menu2.add(menuItem3); menu2.add(menuItem3);
//---- menuItem4 ---- //---- menuItem4 ----
menuItem4.setText("JMenuItem"); menuItem4.setText("JMenuItem");
menuItem4.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem"); menuItem4.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menuitem");
menu2.add(menuItem4); menu2.add(menuItem4);
menu2.addSeparator(); menu2.addSeparator();
//---- checkBoxMenuItem2 ---- //---- checkBoxMenuItem2 ----
checkBoxMenuItem2.setText("JCheckBoxMenuItem"); checkBoxMenuItem2.setText("JCheckBoxMenuItem");
checkBoxMenuItem2.setSelected(true); checkBoxMenuItem2.setSelected(true);
checkBoxMenuItem2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-checkboxmenuitem"); checkBoxMenuItem2.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-checkboxmenuitem");
menu2.add(checkBoxMenuItem2); menu2.add(checkBoxMenuItem2);
//---- checkBoxMenuItem3 ---- //---- checkBoxMenuItem3 ----
checkBoxMenuItem3.setText("JCheckBoxMenuItem"); checkBoxMenuItem3.setText("JCheckBoxMenuItem");
checkBoxMenuItem3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-checkboxmenuitem"); checkBoxMenuItem3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-checkboxmenuitem");
menu2.add(checkBoxMenuItem3); menu2.add(checkBoxMenuItem3);
menu2.addSeparator(); menu2.addSeparator();
//---- radioButtonMenuItem4 ---- //---- radioButtonMenuItem4 ----
radioButtonMenuItem4.setText("JRadioButtonMenuItem"); radioButtonMenuItem4.setText("JRadioButtonMenuItem");
radioButtonMenuItem4.setSelected(true); radioButtonMenuItem4.setSelected(true);
radioButtonMenuItem4.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-radiobuttonmenuitem"); radioButtonMenuItem4.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-radiobuttonmenuitem");
menu2.add(radioButtonMenuItem4); menu2.add(radioButtonMenuItem4);
//---- radioButtonMenuItem5 ---- //---- radioButtonMenuItem5 ----
radioButtonMenuItem5.setText("JRadioButtonMenuItem"); radioButtonMenuItem5.setText("JRadioButtonMenuItem");
radioButtonMenuItem5.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-radiobuttonmenuitem"); radioButtonMenuItem5.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-radiobuttonmenuitem");
menu2.add(radioButtonMenuItem5); menu2.add(radioButtonMenuItem5);
menu2.addSeparator(); menu2.addSeparator();
//======== menu4 ======== //======== menu4 ========
{ {
menu4.setText("JMenu"); menu4.setText("JMenu");
menu4.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menu"); menu4.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menu");
//---- menuItem6 ---- //---- menuItem6 ----
menuItem6.setText("JMenuItem"); menuItem6.setText("JMenuItem");
menuItem6.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem"); menuItem6.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menuitem");
menu4.add(menuItem6); menu4.add(menuItem6);
} }
menu2.add(menu4); menu2.add(menu4);
@@ -678,11 +678,11 @@ class FlatThemePreviewAll
//======== menu5 ======== //======== menu5 ========
{ {
menu5.setText("JMenu"); menu5.setText("JMenu");
menu5.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menu"); menu5.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menu");
//---- menuItem7 ---- //---- menuItem7 ----
menuItem7.setText("JMenuItem"); menuItem7.setText("JMenuItem");
menuItem7.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem"); menuItem7.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menuitem");
menu5.add(menuItem7); menu5.add(menuItem7);
} }
menu2.add(menu5); menu2.add(menu5);
@@ -692,22 +692,22 @@ class FlatThemePreviewAll
//======== menu3 ======== //======== menu3 ========
{ {
menu3.setText("JMenu"); menu3.setText("JMenu");
menu3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menu"); menu3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menu");
//---- menuItem5 ---- //---- menuItem5 ----
menuItem5.setText("JMenuItem"); menuItem5.setText("JMenuItem");
menuItem5.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.CTRL_DOWN_MASK|KeyEvent.ALT_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK)); menuItem5.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.CTRL_DOWN_MASK|KeyEvent.ALT_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK));
menuItem5.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem"); menuItem5.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menuitem");
menu3.add(menuItem5); menu3.add(menuItem5);
//---- menuItem8 ---- //---- menuItem8 ----
menuItem8.setText("JMenuItem"); menuItem8.setText("JMenuItem");
menuItem8.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem"); menuItem8.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menuitem");
menu3.add(menuItem8); menu3.add(menuItem8);
//---- menuItem9 ---- //---- menuItem9 ----
menuItem9.setText("JMenuItem"); menuItem9.setText("JMenuItem");
menuItem9.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem"); menuItem9.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menuitem");
menu3.add(menuItem9); menu3.add(menuItem9);
} }
menuBar1.add(menu3); menuBar1.add(menu3);
@@ -720,14 +720,14 @@ class FlatThemePreviewAll
//---- scrollBar1 ---- //---- scrollBar1 ----
scrollBar1.setOrientation(Adjustable.HORIZONTAL); scrollBar1.setOrientation(Adjustable.HORIZONTAL);
scrollBar1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-scrollbar"); scrollBar1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-scrollbar");
scrollBar1.setVisibleAmount(50); scrollBar1.setVisibleAmount(50);
add(scrollBar1, "cell 1 12 2 1"); add(scrollBar1, "cell 1 12 2 1");
//---- scrollBar5 ---- //---- scrollBar5 ----
scrollBar5.setOrientation(Adjustable.HORIZONTAL); scrollBar5.setOrientation(Adjustable.HORIZONTAL);
scrollBar5.setShowButtons(true); scrollBar5.setShowButtons(true);
scrollBar5.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-scrollbar"); scrollBar5.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-scrollbar");
scrollBar5.setVisibleAmount(50); scrollBar5.setVisibleAmount(50);
add(scrollBar5, "cell 1 13 2 1"); add(scrollBar5, "cell 1 13 2 1");
@@ -736,7 +736,7 @@ class FlatThemePreviewAll
add(separatorLabel, "cell 0 14"); add(separatorLabel, "cell 0 14");
//---- separator1 ---- //---- separator1 ----
separator1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-separator"); separator1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-separator");
add(separator1, "cell 1 14 2 1"); add(separator1, "cell 1 14 2 1");
//---- sliderLabel ---- //---- sliderLabel ----
@@ -744,7 +744,7 @@ class FlatThemePreviewAll
add(sliderLabel, "cell 0 15"); add(sliderLabel, "cell 0 15");
//---- slider1 ---- //---- slider1 ----
slider1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-slider"); slider1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-slider");
add(slider1, "cell 1 15 2 1,width 100"); add(slider1, "cell 1 15 2 1,width 100");
//---- slider3 ---- //---- slider3 ----
@@ -752,7 +752,7 @@ class FlatThemePreviewAll
slider3.setPaintTicks(true); slider3.setPaintTicks(true);
slider3.setMajorTickSpacing(50); slider3.setMajorTickSpacing(50);
slider3.setPaintLabels(true); slider3.setPaintLabels(true);
slider3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-slider"); slider3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-slider");
slider3.addChangeListener(e -> changeProgress()); slider3.addChangeListener(e -> changeProgress());
add(slider3, "cell 1 16 2 1,width 100"); add(slider3, "cell 1 16 2 1,width 100");
@@ -762,13 +762,13 @@ class FlatThemePreviewAll
//---- progressBar1 ---- //---- progressBar1 ----
progressBar1.setValue(50); progressBar1.setValue(50);
progressBar1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-progressbar"); progressBar1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-progressbar");
add(progressBar1, "cell 1 17 2 1"); add(progressBar1, "cell 1 17 2 1");
//---- progressBar2 ---- //---- progressBar2 ----
progressBar2.setValue(50); progressBar2.setValue(50);
progressBar2.setStringPainted(true); progressBar2.setStringPainted(true);
progressBar2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-progressbar"); progressBar2.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-progressbar");
add(progressBar2, "cell 1 18 2 1"); add(progressBar2, "cell 1 18 2 1");
//---- toolTipLabel ---- //---- toolTipLabel ----
@@ -777,7 +777,7 @@ class FlatThemePreviewAll
//---- toolTip1 ---- //---- toolTip1 ----
toolTip1.setTipText("Some text in tool tip."); toolTip1.setTipText("Some text in tool tip.");
toolTip1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-tooltip"); toolTip1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-tooltip");
add(toolTip1, "cell 1 19 2 1,alignx left,growx 0"); add(toolTip1, "cell 1 19 2 1,alignx left,growx 0");
//---- toolBarLabel ---- //---- toolBarLabel ----
@@ -786,39 +786,39 @@ class FlatThemePreviewAll
//======== toolBar1 ======== //======== toolBar1 ========
{ {
toolBar1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar"); toolBar1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-toolbar");
//---- button4 ---- //---- button4 ----
button4.setIcon(UIManager.getIcon("Tree.closedIcon")); button4.setIcon(UIManager.getIcon("Tree.closedIcon"));
button4.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-button"); button4.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-toolbar-button");
toolBar1.add(button4); toolBar1.add(button4);
//---- button6 ---- //---- button6 ----
button6.setIcon(UIManager.getIcon("Tree.openIcon")); button6.setIcon(UIManager.getIcon("Tree.openIcon"));
button6.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-button"); button6.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-toolbar-button");
toolBar1.add(button6); toolBar1.add(button6);
toolBar1.addSeparator(); toolBar1.addSeparator();
//---- button7 ---- //---- button7 ----
button7.setIcon(UIManager.getIcon("Tree.leafIcon")); button7.setIcon(UIManager.getIcon("Tree.leafIcon"));
button7.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-togglebutton"); button7.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-toolbar-togglebutton");
toolBar1.add(button7); toolBar1.add(button7);
//---- button8 ---- //---- button8 ----
button8.setIcon(UIManager.getIcon("Tree.leafIcon")); button8.setIcon(UIManager.getIcon("Tree.leafIcon"));
button8.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-togglebutton"); button8.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-toolbar-togglebutton");
toolBar1.add(button8); toolBar1.add(button8);
//---- button9 ---- //---- button9 ----
button9.setIcon(UIManager.getIcon("Tree.leafIcon")); button9.setIcon(UIManager.getIcon("Tree.leafIcon"));
button9.setSelected(true); button9.setSelected(true);
button9.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-togglebutton"); button9.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-toolbar-togglebutton");
toolBar1.add(button9); toolBar1.add(button9);
//---- button10 ---- //---- button10 ----
button10.setIcon(UIManager.getIcon("Tree.leafIcon")); button10.setIcon(UIManager.getIcon("Tree.leafIcon"));
button10.setSelected(true); button10.setSelected(true);
button10.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-togglebutton"); button10.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-toolbar-togglebutton");
toolBar1.add(button10); toolBar1.add(button10);
} }
add(toolBar1, "cell 1 20 2 1"); add(toolBar1, "cell 1 20 2 1");
@@ -829,7 +829,7 @@ class FlatThemePreviewAll
//======== tabbedPane1 ======== //======== tabbedPane1 ========
{ {
tabbedPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-tabbedpane"); tabbedPane1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-tabbedpane");
} }
add(tabbedPane1, "cell 1 21 2 1"); add(tabbedPane1, "cell 1 21 2 1");
@@ -840,7 +840,7 @@ class FlatThemePreviewAll
//======== splitPane1 ======== //======== splitPane1 ========
{ {
splitPane1.setResizeWeight(0.5); splitPane1.setResizeWeight(0.5);
splitPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-splitpane"); splitPane1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-splitpane");
//======== scrollPane2 ======== //======== scrollPane2 ========
{ {
@@ -858,7 +858,7 @@ class FlatThemePreviewAll
@Override @Override
public String getElementAt(int i) { return values[i]; } public String getElementAt(int i) { return values[i]; }
}); });
list1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-list"); list1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-list");
scrollPane2.setViewportView(list1); scrollPane2.setViewportView(list1);
} }
splitPane1.setLeftComponent(scrollPane2); splitPane1.setLeftComponent(scrollPane2);
@@ -879,7 +879,7 @@ class FlatThemePreviewAll
add(node1); add(node1);
} }
})); }));
tree1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-tree"); tree1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-tree");
scrollPane3.setViewportView(tree1); scrollPane3.setViewportView(tree1);
} }
splitPane1.setRightComponent(scrollPane3); splitPane1.setRightComponent(scrollPane3);
@@ -903,7 +903,7 @@ class FlatThemePreviewAll
"Column 1", "Column 2" "Column 1", "Column 2"
} }
)); ));
table1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-table"); table1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-table");
scrollPane4.setViewportView(table1); scrollPane4.setViewportView(table1);
} }
add(scrollPane4, "cell 1 23 2 1,width 100,height 70"); add(scrollPane4, "cell 1 23 2 1,width 100,height 70");
@@ -914,7 +914,7 @@ class FlatThemePreviewAll
//======== desktopPane1 ======== //======== desktopPane1 ========
{ {
desktopPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-desktoppane"); desktopPane1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-desktoppane");
//======== internalFrame1 ======== //======== internalFrame1 ========
{ {
@@ -924,7 +924,7 @@ class FlatThemePreviewAll
internalFrame1.setMaximizable(true); internalFrame1.setMaximizable(true);
internalFrame1.setIconifiable(true); internalFrame1.setIconifiable(true);
internalFrame1.setResizable(true); internalFrame1.setResizable(true);
internalFrame1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-internalframe"); internalFrame1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-internalframe");
Container internalFrame1ContentPane = internalFrame1.getContentPane(); Container internalFrame1ContentPane = internalFrame1.getContentPane();
internalFrame1ContentPane.setLayout(new BorderLayout()); internalFrame1ContentPane.setLayout(new BorderLayout());
} }
@@ -939,7 +939,7 @@ class FlatThemePreviewAll
internalFrame2.setMaximizable(true); internalFrame2.setMaximizable(true);
internalFrame2.setResizable(true); internalFrame2.setResizable(true);
internalFrame2.setTitle("Inactive"); internalFrame2.setTitle("Inactive");
internalFrame2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-internalframe"); internalFrame2.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-internalframe");
Container internalFrame2ContentPane = internalFrame2.getContentPane(); Container internalFrame2ContentPane = internalFrame2.getContentPane();
internalFrame2ContentPane.setLayout(new BorderLayout()); internalFrame2ContentPane.setLayout(new BorderLayout());
} }

View File

@@ -21,6 +21,7 @@ import java.awt.Component;
import java.util.Objects; import java.util.Objects;
import java.util.function.Predicate; import java.util.function.Predicate;
import javax.swing.*; import javax.swing.*;
import com.formdev.flatlaf.FlatClientProperties;
import net.miginfocom.swing.*; import net.miginfocom.swing.*;
/** /**
@@ -232,25 +233,25 @@ class FlatThemePreviewButtons
//---- noneButton ---- //---- noneButton ----
noneButton.setText("none"); noneButton.setText("none");
noneButton.setSelected(true); noneButton.setSelected(true);
noneButton.putClientProperty("FlatLaf.styleClass", "small"); noneButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
noneButton.addActionListener(e -> buttonTypeChanged()); noneButton.addActionListener(e -> buttonTypeChanged());
buttonTypeToolBar1.add(noneButton); buttonTypeToolBar1.add(noneButton);
//---- squareButton ---- //---- squareButton ----
squareButton.setText("square"); squareButton.setText("square");
squareButton.putClientProperty("FlatLaf.styleClass", "small"); squareButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
squareButton.addActionListener(e -> buttonTypeChanged()); squareButton.addActionListener(e -> buttonTypeChanged());
buttonTypeToolBar1.add(squareButton); buttonTypeToolBar1.add(squareButton);
//---- roundRectButton ---- //---- roundRectButton ----
roundRectButton.setText("roundRect"); roundRectButton.setText("roundRect");
roundRectButton.putClientProperty("FlatLaf.styleClass", "small"); roundRectButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
roundRectButton.addActionListener(e -> buttonTypeChanged()); roundRectButton.addActionListener(e -> buttonTypeChanged());
buttonTypeToolBar1.add(roundRectButton); buttonTypeToolBar1.add(roundRectButton);
//---- tabButton ---- //---- tabButton ----
tabButton.setText("tab"); tabButton.setText("tab");
tabButton.putClientProperty("FlatLaf.styleClass", "small"); tabButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
tabButton.addActionListener(e -> buttonTypeChanged()); tabButton.addActionListener(e -> buttonTypeChanged());
buttonTypeToolBar1.add(tabButton); buttonTypeToolBar1.add(tabButton);
} }
@@ -263,13 +264,13 @@ class FlatThemePreviewButtons
//---- toolBarButtonButton ---- //---- toolBarButtonButton ----
toolBarButtonButton.setText("toolBarButton"); toolBarButtonButton.setText("toolBarButton");
toolBarButtonButton.putClientProperty("FlatLaf.styleClass", "small"); toolBarButtonButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
toolBarButtonButton.addActionListener(e -> buttonTypeChanged()); toolBarButtonButton.addActionListener(e -> buttonTypeChanged());
buttonTypeToolBar2.add(toolBarButtonButton); buttonTypeToolBar2.add(toolBarButtonButton);
//---- borderlessButton ---- //---- borderlessButton ----
borderlessButton.setText("borderless"); borderlessButton.setText("borderless");
borderlessButton.putClientProperty("FlatLaf.styleClass", "small"); borderlessButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
borderlessButton.addActionListener(e -> buttonTypeChanged()); borderlessButton.addActionListener(e -> buttonTypeChanged());
buttonTypeToolBar2.add(borderlessButton); buttonTypeToolBar2.add(borderlessButton);
} }
@@ -279,7 +280,7 @@ class FlatThemePreviewButtons
//---- label11 ---- //---- label11 ----
label11.setText("JButton"); label11.setText("JButton");
label11.putClientProperty("FlatLaf.styleClass", "h3"); label11.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
add(label11, "cell 0 1 3 1"); add(label11, "cell 0 1 3 1");
//---- label27 ---- //---- label27 ----
@@ -292,22 +293,22 @@ class FlatThemePreviewButtons
//---- label5 ---- //---- label5 ----
label5.setText("regular"); label5.setText("regular");
label5.putClientProperty("FlatLaf.styleClass", "small"); label5.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label5, "cell 1 3,alignx center,growx 0"); add(label5, "cell 1 3,alignx center,growx 0");
//---- label7 ---- //---- label7 ----
label7.setText("default"); label7.setText("default");
label7.putClientProperty("FlatLaf.styleClass", "small"); label7.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label7, "cell 2 3,alignx center,growx 0"); add(label7, "cell 2 3,alignx center,growx 0");
//---- label6 ---- //---- label6 ----
label6.setText("regular"); label6.setText("regular");
label6.putClientProperty("FlatLaf.styleClass", "small"); label6.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label6, "cell 3 3,alignx center,growx 0"); add(label6, "cell 3 3,alignx center,growx 0");
//---- label8 ---- //---- label8 ----
label8.setText("default"); label8.setText("default");
label8.putClientProperty("FlatLaf.styleClass", "small"); label8.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label8, "cell 4 3,alignx center,growx 0"); add(label8, "cell 4 3,alignx center,growx 0");
//---- label1 ---- //---- label1 ----
@@ -316,26 +317,26 @@ class FlatThemePreviewButtons
//---- testStateButton1 ---- //---- testStateButton1 ----
testStateButton1.setText("OK"); testStateButton1.setText("OK");
testStateButton1.putClientProperty("JComponent.minimumWidth", 0); testStateButton1.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton1, "cell 1 4"); add(testStateButton1, "cell 1 4");
//---- testStateButton7 ---- //---- testStateButton7 ----
testStateButton7.setText("OK"); testStateButton7.setText("OK");
testStateButton7.setStateDefault(true); testStateButton7.setStateDefault(true);
testStateButton7.putClientProperty("JComponent.minimumWidth", 0); testStateButton7.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton7, "cell 2 4"); add(testStateButton7, "cell 2 4");
//---- testStateButton4 ---- //---- testStateButton4 ----
testStateButton4.setText("OK"); testStateButton4.setText("OK");
testStateButton4.setStateFocused(true); testStateButton4.setStateFocused(true);
testStateButton4.putClientProperty("JComponent.minimumWidth", 0); testStateButton4.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton4, "cell 3 4"); add(testStateButton4, "cell 3 4");
//---- testStateButton10 ---- //---- testStateButton10 ----
testStateButton10.setText("OK"); testStateButton10.setText("OK");
testStateButton10.setStateFocused(true); testStateButton10.setStateFocused(true);
testStateButton10.setStateDefault(true); testStateButton10.setStateDefault(true);
testStateButton10.putClientProperty("JComponent.minimumWidth", 0); testStateButton10.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton10, "cell 4 4"); add(testStateButton10, "cell 4 4");
//---- label2 ---- //---- label2 ----
@@ -345,21 +346,21 @@ class FlatThemePreviewButtons
//---- testStateButton2 ---- //---- testStateButton2 ----
testStateButton2.setText("OK"); testStateButton2.setText("OK");
testStateButton2.setStateHover(true); testStateButton2.setStateHover(true);
testStateButton2.putClientProperty("JComponent.minimumWidth", 0); testStateButton2.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton2, "cell 1 5"); add(testStateButton2, "cell 1 5");
//---- testStateButton8 ---- //---- testStateButton8 ----
testStateButton8.setText("OK"); testStateButton8.setText("OK");
testStateButton8.setStateHover(true); testStateButton8.setStateHover(true);
testStateButton8.setStateDefault(true); testStateButton8.setStateDefault(true);
testStateButton8.putClientProperty("JComponent.minimumWidth", 0); testStateButton8.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton8, "cell 2 5"); add(testStateButton8, "cell 2 5");
//---- testStateButton5 ---- //---- testStateButton5 ----
testStateButton5.setText("OK"); testStateButton5.setText("OK");
testStateButton5.setStateHover(true); testStateButton5.setStateHover(true);
testStateButton5.setStateFocused(true); testStateButton5.setStateFocused(true);
testStateButton5.putClientProperty("JComponent.minimumWidth", 0); testStateButton5.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton5, "cell 3 5"); add(testStateButton5, "cell 3 5");
//---- testStateButton11 ---- //---- testStateButton11 ----
@@ -367,7 +368,7 @@ class FlatThemePreviewButtons
testStateButton11.setStateHover(true); testStateButton11.setStateHover(true);
testStateButton11.setStateFocused(true); testStateButton11.setStateFocused(true);
testStateButton11.setStateDefault(true); testStateButton11.setStateDefault(true);
testStateButton11.putClientProperty("JComponent.minimumWidth", 0); testStateButton11.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton11, "cell 4 5"); add(testStateButton11, "cell 4 5");
//---- label3 ---- //---- label3 ----
@@ -377,21 +378,21 @@ class FlatThemePreviewButtons
//---- testStateButton3 ---- //---- testStateButton3 ----
testStateButton3.setText("OK"); testStateButton3.setText("OK");
testStateButton3.setStatePressed(true); testStateButton3.setStatePressed(true);
testStateButton3.putClientProperty("JComponent.minimumWidth", 0); testStateButton3.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton3, "cell 1 6"); add(testStateButton3, "cell 1 6");
//---- testStateButton9 ---- //---- testStateButton9 ----
testStateButton9.setText("OK"); testStateButton9.setText("OK");
testStateButton9.setStatePressed(true); testStateButton9.setStatePressed(true);
testStateButton9.setStateDefault(true); testStateButton9.setStateDefault(true);
testStateButton9.putClientProperty("JComponent.minimumWidth", 0); testStateButton9.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton9, "cell 2 6"); add(testStateButton9, "cell 2 6");
//---- testStateButton6 ---- //---- testStateButton6 ----
testStateButton6.setText("OK"); testStateButton6.setText("OK");
testStateButton6.setStatePressed(true); testStateButton6.setStatePressed(true);
testStateButton6.setStateFocused(true); testStateButton6.setStateFocused(true);
testStateButton6.putClientProperty("JComponent.minimumWidth", 0); testStateButton6.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton6, "cell 3 6"); add(testStateButton6, "cell 3 6");
//---- testStateButton12 ---- //---- testStateButton12 ----
@@ -399,7 +400,7 @@ class FlatThemePreviewButtons
testStateButton12.setStatePressed(true); testStateButton12.setStatePressed(true);
testStateButton12.setStateFocused(true); testStateButton12.setStateFocused(true);
testStateButton12.setStateDefault(true); testStateButton12.setStateDefault(true);
testStateButton12.putClientProperty("JComponent.minimumWidth", 0); testStateButton12.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton12, "cell 4 6"); add(testStateButton12, "cell 4 6");
//---- label4 ---- //---- label4 ----
@@ -409,14 +410,14 @@ class FlatThemePreviewButtons
//---- testStateButton13 ---- //---- testStateButton13 ----
testStateButton13.setText("OK"); testStateButton13.setText("OK");
testStateButton13.setEnabled(false); testStateButton13.setEnabled(false);
testStateButton13.putClientProperty("JComponent.minimumWidth", 0); testStateButton13.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton13, "cell 1 7"); add(testStateButton13, "cell 1 7");
//---- testStateButton14 ---- //---- testStateButton14 ----
testStateButton14.setText("OK"); testStateButton14.setText("OK");
testStateButton14.setEnabled(false); testStateButton14.setEnabled(false);
testStateButton14.setStateDefault(true); testStateButton14.setStateDefault(true);
testStateButton14.putClientProperty("JComponent.minimumWidth", 0); testStateButton14.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testStateButton14, "cell 2 7"); add(testStateButton14, "cell 2 7");
//---- label10 ---- //---- label10 ----
@@ -425,17 +426,17 @@ class FlatThemePreviewButtons
//---- button1 ---- //---- button1 ----
button1.setText("OK"); button1.setText("OK");
button1.putClientProperty("JComponent.minimumWidth", 0); button1.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(button1, "cell 1 8"); add(button1, "cell 1 8");
//---- testDefaultButton1 ---- //---- testDefaultButton1 ----
testDefaultButton1.setText("OK"); testDefaultButton1.setText("OK");
testDefaultButton1.putClientProperty("JComponent.minimumWidth", 0); testDefaultButton1.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
add(testDefaultButton1, "cell 2 8"); add(testDefaultButton1, "cell 2 8");
//---- label12 ---- //---- label12 ----
label12.setText("JToggleButton"); label12.setText("JToggleButton");
label12.putClientProperty("FlatLaf.styleClass", "h3"); label12.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
add(label12, "cell 0 9 3 1"); add(label12, "cell 0 9 3 1");
//---- label29 ---- //---- label29 ----
@@ -448,22 +449,22 @@ class FlatThemePreviewButtons
//---- label13 ---- //---- label13 ----
label13.setText("unsel."); label13.setText("unsel.");
label13.putClientProperty("FlatLaf.styleClass", "small"); label13.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label13, "cell 1 11,alignx center,growx 0"); add(label13, "cell 1 11,alignx center,growx 0");
//---- label14 ---- //---- label14 ----
label14.setText("selected"); label14.setText("selected");
label14.putClientProperty("FlatLaf.styleClass", "small"); label14.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label14, "cell 2 11,alignx center,growx 0"); add(label14, "cell 2 11,alignx center,growx 0");
//---- label15 ---- //---- label15 ----
label15.setText("unsel."); label15.setText("unsel.");
label15.putClientProperty("FlatLaf.styleClass", "small"); label15.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label15, "cell 3 11,alignx center,growx 0"); add(label15, "cell 3 11,alignx center,growx 0");
//---- label16 ---- //---- label16 ----
label16.setText("selected"); label16.setText("selected");
label16.putClientProperty("FlatLaf.styleClass", "small"); label16.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label16, "cell 4 11,alignx center,growx 0"); add(label16, "cell 4 11,alignx center,growx 0");
//---- label17 ---- //---- label17 ----
@@ -576,7 +577,7 @@ class FlatThemePreviewButtons
//---- label32 ---- //---- label32 ----
label32.setText("Help Button"); label32.setText("Help Button");
label32.putClientProperty("FlatLaf.styleClass", "h3"); label32.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
add(label32, "cell 0 17 2 1"); add(label32, "cell 0 17 2 1");
//---- label9 ---- //---- label9 ----
@@ -592,14 +593,14 @@ class FlatThemePreviewButtons
add(label22, "cell 0 19"); add(label22, "cell 0 19");
//---- testStateButton15 ---- //---- testStateButton15 ----
testStateButton15.putClientProperty("JComponent.minimumWidth", 0); testStateButton15.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
testStateButton15.putClientProperty("JButton.buttonType", "help"); testStateButton15.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(testStateButton15, "cell 1 19 2 1,alignx center,growx 0"); add(testStateButton15, "cell 1 19 2 1,alignx center,growx 0");
//---- testStateButton19 ---- //---- testStateButton19 ----
testStateButton19.setStateFocused(true); testStateButton19.setStateFocused(true);
testStateButton19.putClientProperty("JComponent.minimumWidth", 0); testStateButton19.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
testStateButton19.putClientProperty("JButton.buttonType", "help"); testStateButton19.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(testStateButton19, "cell 3 19 2 1,alignx center,growx 0"); add(testStateButton19, "cell 3 19 2 1,alignx center,growx 0");
//---- label23 ---- //---- label23 ----
@@ -608,15 +609,15 @@ class FlatThemePreviewButtons
//---- testStateButton16 ---- //---- testStateButton16 ----
testStateButton16.setStateHover(true); testStateButton16.setStateHover(true);
testStateButton16.putClientProperty("JComponent.minimumWidth", 0); testStateButton16.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
testStateButton16.putClientProperty("JButton.buttonType", "help"); testStateButton16.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(testStateButton16, "cell 1 20 2 1,alignx center,growx 0"); add(testStateButton16, "cell 1 20 2 1,alignx center,growx 0");
//---- testStateButton20 ---- //---- testStateButton20 ----
testStateButton20.setStateHover(true); testStateButton20.setStateHover(true);
testStateButton20.setStateFocused(true); testStateButton20.setStateFocused(true);
testStateButton20.putClientProperty("JComponent.minimumWidth", 0); testStateButton20.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
testStateButton20.putClientProperty("JButton.buttonType", "help"); testStateButton20.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(testStateButton20, "cell 3 20 2 1,alignx center,growx 0"); add(testStateButton20, "cell 3 20 2 1,alignx center,growx 0");
//---- label24 ---- //---- label24 ----
@@ -625,15 +626,15 @@ class FlatThemePreviewButtons
//---- testStateButton17 ---- //---- testStateButton17 ----
testStateButton17.setStatePressed(true); testStateButton17.setStatePressed(true);
testStateButton17.putClientProperty("JComponent.minimumWidth", 0); testStateButton17.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
testStateButton17.putClientProperty("JButton.buttonType", "help"); testStateButton17.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(testStateButton17, "cell 1 21 2 1,alignx center,growx 0"); add(testStateButton17, "cell 1 21 2 1,alignx center,growx 0");
//---- testStateButton21 ---- //---- testStateButton21 ----
testStateButton21.setStatePressed(true); testStateButton21.setStatePressed(true);
testStateButton21.setStateFocused(true); testStateButton21.setStateFocused(true);
testStateButton21.putClientProperty("JComponent.minimumWidth", 0); testStateButton21.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
testStateButton21.putClientProperty("JButton.buttonType", "help"); testStateButton21.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(testStateButton21, "cell 3 21 2 1,alignx center,growx 0"); add(testStateButton21, "cell 3 21 2 1,alignx center,growx 0");
//---- label25 ---- //---- label25 ----
@@ -642,8 +643,8 @@ class FlatThemePreviewButtons
//---- testStateButton18 ---- //---- testStateButton18 ----
testStateButton18.setEnabled(false); testStateButton18.setEnabled(false);
testStateButton18.putClientProperty("JComponent.minimumWidth", 0); testStateButton18.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
testStateButton18.putClientProperty("JButton.buttonType", "help"); testStateButton18.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(testStateButton18, "cell 1 22 2 1,alignx center,growx 0"); add(testStateButton18, "cell 1 22 2 1,alignx center,growx 0");
//---- label26 ---- //---- label26 ----
@@ -651,8 +652,8 @@ class FlatThemePreviewButtons
add(label26, "cell 0 23"); add(label26, "cell 0 23");
//---- button2 ---- //---- button2 ----
button2.putClientProperty("JComponent.minimumWidth", 0); button2.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0);
button2.putClientProperty("JButton.buttonType", "help"); button2.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP);
add(button2, "cell 1 23 2 1,alignx center,growx 0"); add(button2, "cell 1 23 2 1,alignx center,growx 0");
//---- buttonGroup1 ---- //---- buttonGroup1 ----

View File

@@ -85,7 +85,7 @@ public class FlatThemePreviewFonts
//---- headingsLabel ---- //---- headingsLabel ----
headingsLabel.setText("Headings"); headingsLabel.setText("Headings");
headingsLabel.putClientProperty("FlatLaf.styleClass", "h3"); headingsLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
add(headingsLabel, "cell 0 0"); add(headingsLabel, "cell 0 0");
//---- h00Preview ---- //---- h00Preview ----
@@ -123,7 +123,7 @@ public class FlatThemePreviewFonts
//---- textLabel ---- //---- textLabel ----
textLabel.setText("Text"); textLabel.setText("Text");
textLabel.putClientProperty("FlatLaf.styleClass", "h3"); textLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
add(textLabel, "cell 0 7"); add(textLabel, "cell 0 7");
//---- largePreview ---- //---- largePreview ----
@@ -171,7 +171,7 @@ public class FlatThemePreviewFonts
//---- scaleValueLabel ---- //---- scaleValueLabel ----
scaleValueLabel.setText("1x"); scaleValueLabel.setText("1x");
scaleValueLabel.putClientProperty("FlatLaf.styleClass", "h2"); scaleValueLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h2");
add(scaleValueLabel, "cell 0 16"); add(scaleValueLabel, "cell 0 16");
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
} }
@@ -275,7 +275,7 @@ public class FlatThemePreviewFonts
//---- descLabel ---- //---- descLabel ----
descLabel.setText("description"); descLabel.setText("description");
descLabel.putClientProperty("FlatLaf.styleClass", "medium"); descLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "medium");
add(descLabel, "cell 1 0"); add(descLabel, "cell 1 0");
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
} }

View File

@@ -262,25 +262,25 @@ class FlatThemePreviewSwitches
//---- zoom1xButton ---- //---- zoom1xButton ----
zoom1xButton.setText("1x"); zoom1xButton.setText("1x");
zoom1xButton.setSelected(true); zoom1xButton.setSelected(true);
zoom1xButton.putClientProperty("FlatLaf.styleClass", "small"); zoom1xButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
zoom1xButton.addActionListener(e -> zoomChanged()); zoom1xButton.addActionListener(e -> zoomChanged());
zoomToolBar.add(zoom1xButton); zoomToolBar.add(zoom1xButton);
//---- zoom2xButton ---- //---- zoom2xButton ----
zoom2xButton.setText("2x"); zoom2xButton.setText("2x");
zoom2xButton.putClientProperty("FlatLaf.styleClass", "small"); zoom2xButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
zoom2xButton.addActionListener(e -> zoomChanged()); zoom2xButton.addActionListener(e -> zoomChanged());
zoomToolBar.add(zoom2xButton); zoomToolBar.add(zoom2xButton);
//---- zoom3xButton ---- //---- zoom3xButton ----
zoom3xButton.setText("3x"); zoom3xButton.setText("3x");
zoom3xButton.putClientProperty("FlatLaf.styleClass", "small"); zoom3xButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
zoom3xButton.addActionListener(e -> zoomChanged()); zoom3xButton.addActionListener(e -> zoomChanged());
zoomToolBar.add(zoom3xButton); zoomToolBar.add(zoom3xButton);
//---- zoom4xButton ---- //---- zoom4xButton ----
zoom4xButton.setText("4x"); zoom4xButton.setText("4x");
zoom4xButton.putClientProperty("FlatLaf.styleClass", "small"); zoom4xButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
zoom4xButton.addActionListener(e -> zoomChanged()); zoom4xButton.addActionListener(e -> zoomChanged());
zoomToolBar.add(zoom4xButton); zoomToolBar.add(zoom4xButton);
zoomToolBar.addSeparator(); zoomToolBar.addSeparator();
@@ -288,7 +288,7 @@ class FlatThemePreviewSwitches
//---- indeterminateButton ---- //---- indeterminateButton ----
indeterminateButton.setText("indeterminate"); indeterminateButton.setText("indeterminate");
indeterminateButton.setSelected(true); indeterminateButton.setSelected(true);
indeterminateButton.putClientProperty("FlatLaf.styleClass", "small"); indeterminateButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
indeterminateButton.addActionListener(e -> indeterminateChanged()); indeterminateButton.addActionListener(e -> indeterminateChanged());
zoomToolBar.add(indeterminateButton); zoomToolBar.add(indeterminateButton);
} }
@@ -298,7 +298,7 @@ class FlatThemePreviewSwitches
//---- label22 ---- //---- label22 ----
label22.setText("JCheckBox"); label22.setText("JCheckBox");
label22.putClientProperty("FlatLaf.styleClass", "h3"); label22.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
add(label22, "cell 0 1 3 1"); add(label22, "cell 0 1 3 1");
//---- label1 ---- //---- label1 ----
@@ -311,32 +311,32 @@ class FlatThemePreviewSwitches
//---- label23 ---- //---- label23 ----
label23.setText("unsel."); label23.setText("unsel.");
label23.putClientProperty("FlatLaf.styleClass", "small"); label23.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label23, "cell 1 3,alignx center,growx 0"); add(label23, "cell 1 3,alignx center,growx 0");
//---- label28 ---- //---- label28 ----
label28.setText("sel."); label28.setText("sel.");
label28.putClientProperty("FlatLaf.styleClass", "small"); label28.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label28, "cell 2 3,alignx center,growx 0"); add(label28, "cell 2 3,alignx center,growx 0");
//---- label37 ---- //---- label37 ----
label37.setText("ind."); label37.setText("ind.");
label37.putClientProperty("FlatLaf.styleClass", "small"); label37.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label37, "cell 3 3,alignx center,growx 0"); add(label37, "cell 3 3,alignx center,growx 0");
//---- label24 ---- //---- label24 ----
label24.setText("unsel."); label24.setText("unsel.");
label24.putClientProperty("FlatLaf.styleClass", "small"); label24.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label24, "cell 4 3,alignx center,growx 0"); add(label24, "cell 4 3,alignx center,growx 0");
//---- label29 ---- //---- label29 ----
label29.setText("sel."); label29.setText("sel.");
label29.putClientProperty("FlatLaf.styleClass", "small"); label29.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label29, "cell 5 3,alignx center,growx 0"); add(label29, "cell 5 3,alignx center,growx 0");
//---- label38 ---- //---- label38 ----
label38.setText("ind."); label38.setText("ind.");
label38.putClientProperty("FlatLaf.styleClass", "small"); label38.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label38, "cell 6 3,alignx center,growx 0"); add(label38, "cell 6 3,alignx center,growx 0");
//---- label17 ---- //---- label17 ----
@@ -466,7 +466,7 @@ class FlatThemePreviewSwitches
//---- label27 ---- //---- label27 ----
label27.setText("JRadioButton"); label27.setText("JRadioButton");
label27.putClientProperty("FlatLaf.styleClass", "h3"); label27.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3");
add(label27, "cell 0 9 3 1"); add(label27, "cell 0 9 3 1");
//---- label3 ---- //---- label3 ----
@@ -479,22 +479,22 @@ class FlatThemePreviewSwitches
//---- label25 ---- //---- label25 ----
label25.setText("unsel."); label25.setText("unsel.");
label25.putClientProperty("FlatLaf.styleClass", "small"); label25.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label25, "cell 1 11,alignx center,growx 0"); add(label25, "cell 1 11,alignx center,growx 0");
//---- label30 ---- //---- label30 ----
label30.setText("sel."); label30.setText("sel.");
label30.putClientProperty("FlatLaf.styleClass", "small"); label30.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label30, "cell 2 11,alignx center,growx 0"); add(label30, "cell 2 11,alignx center,growx 0");
//---- label26 ---- //---- label26 ----
label26.setText("unsel."); label26.setText("unsel.");
label26.putClientProperty("FlatLaf.styleClass", "small"); label26.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label26, "cell 4 11,alignx center,growx 0"); add(label26, "cell 4 11,alignx center,growx 0");
//---- label31 ---- //---- label31 ----
label31.setText("sel."); label31.setText("sel.");
label31.putClientProperty("FlatLaf.styleClass", "small"); label31.putClientProperty(FlatClientProperties.STYLE_CLASS, "small");
add(label31, "cell 5 11,alignx center,growx 0"); add(label31, "cell 5 11,alignx center,growx 0");
//---- label36 ---- //---- label36 ----
@@ -672,7 +672,7 @@ class FlatThemePreviewSwitches
} }
@Override @Override
public boolean isSelected() { public boolean isSelected() {
return isStateSelected(); return isStateSelected() || isStateIndeterminate();
} }
} ); } );

View File

@@ -98,6 +98,10 @@ CheckBox.icon.checkmarkColor
CheckBox.icon.disabledBackground CheckBox.icon.disabledBackground
CheckBox.icon.disabledBorderColor CheckBox.icon.disabledBorderColor
CheckBox.icon.disabledCheckmarkColor CheckBox.icon.disabledCheckmarkColor
CheckBox.icon.disabledIndeterminateBackground
CheckBox.icon.disabledIndeterminateBorderColor
CheckBox.icon.disabledIndeterminateBorderWidth
CheckBox.icon.disabledIndeterminateCheckmarkColor
CheckBox.icon.disabledSelectedBackground CheckBox.icon.disabledSelectedBackground
CheckBox.icon.disabledSelectedBorderColor CheckBox.icon.disabledSelectedBorderColor
CheckBox.icon.disabledSelectedBorderWidth CheckBox.icon.disabledSelectedBorderWidth
@@ -106,16 +110,29 @@ CheckBox.icon.focusWidth
CheckBox.icon.focusedBackground CheckBox.icon.focusedBackground
CheckBox.icon.focusedBorderColor CheckBox.icon.focusedBorderColor
CheckBox.icon.focusedCheckmarkColor CheckBox.icon.focusedCheckmarkColor
CheckBox.icon.focusedIndeterminateBackground
CheckBox.icon.focusedIndeterminateBorderColor
CheckBox.icon.focusedIndeterminateCheckmarkColor
CheckBox.icon.focusedSelectedBackground CheckBox.icon.focusedSelectedBackground
CheckBox.icon.focusedSelectedBorderColor CheckBox.icon.focusedSelectedBorderColor
CheckBox.icon.hoverBackground CheckBox.icon.hoverBackground
CheckBox.icon.hoverBorderColor CheckBox.icon.hoverBorderColor
CheckBox.icon.hoverCheckmarkColor CheckBox.icon.hoverCheckmarkColor
CheckBox.icon.hoverIndeterminateBackground
CheckBox.icon.hoverIndeterminateBorderColor
CheckBox.icon.hoverIndeterminateCheckmarkColor
CheckBox.icon.hoverSelectedBackground CheckBox.icon.hoverSelectedBackground
CheckBox.icon.hoverSelectedBorderColor CheckBox.icon.hoverSelectedBorderColor
CheckBox.icon.indeterminateBackground
CheckBox.icon.indeterminateBorderColor
CheckBox.icon.indeterminateBorderWidth
CheckBox.icon.indeterminateCheckmarkColor
CheckBox.icon.pressedBackground CheckBox.icon.pressedBackground
CheckBox.icon.pressedBorderColor CheckBox.icon.pressedBorderColor
CheckBox.icon.pressedCheckmarkColor CheckBox.icon.pressedCheckmarkColor
CheckBox.icon.pressedIndeterminateBackground
CheckBox.icon.pressedIndeterminateBorderColor
CheckBox.icon.pressedIndeterminateCheckmarkColor
CheckBox.icon.pressedSelectedBackground CheckBox.icon.pressedSelectedBackground
CheckBox.icon.pressedSelectedBorderColor CheckBox.icon.pressedSelectedBorderColor
CheckBox.icon.selectedBackground CheckBox.icon.selectedBackground
@@ -130,6 +147,10 @@ CheckBox.icon[filled].checkmarkColor
CheckBox.icon[filled].disabledBackground CheckBox.icon[filled].disabledBackground
CheckBox.icon[filled].disabledBorderColor CheckBox.icon[filled].disabledBorderColor
CheckBox.icon[filled].disabledCheckmarkColor CheckBox.icon[filled].disabledCheckmarkColor
CheckBox.icon[filled].disabledIndeterminateBackground
CheckBox.icon[filled].disabledIndeterminateBorderColor
CheckBox.icon[filled].disabledIndeterminateBorderWidth
CheckBox.icon[filled].disabledIndeterminateCheckmarkColor
CheckBox.icon[filled].disabledSelectedBackground CheckBox.icon[filled].disabledSelectedBackground
CheckBox.icon[filled].disabledSelectedBorderColor CheckBox.icon[filled].disabledSelectedBorderColor
CheckBox.icon[filled].disabledSelectedBorderWidth CheckBox.icon[filled].disabledSelectedBorderWidth
@@ -137,16 +158,29 @@ CheckBox.icon[filled].focusWidth
CheckBox.icon[filled].focusedBackground CheckBox.icon[filled].focusedBackground
CheckBox.icon[filled].focusedBorderColor CheckBox.icon[filled].focusedBorderColor
CheckBox.icon[filled].focusedCheckmarkColor CheckBox.icon[filled].focusedCheckmarkColor
CheckBox.icon[filled].focusedIndeterminateBackground
CheckBox.icon[filled].focusedIndeterminateBorderColor
CheckBox.icon[filled].focusedIndeterminateCheckmarkColor
CheckBox.icon[filled].focusedSelectedBackground CheckBox.icon[filled].focusedSelectedBackground
CheckBox.icon[filled].focusedSelectedBorderColor CheckBox.icon[filled].focusedSelectedBorderColor
CheckBox.icon[filled].hoverBackground CheckBox.icon[filled].hoverBackground
CheckBox.icon[filled].hoverBorderColor CheckBox.icon[filled].hoverBorderColor
CheckBox.icon[filled].hoverCheckmarkColor CheckBox.icon[filled].hoverCheckmarkColor
CheckBox.icon[filled].hoverIndeterminateBackground
CheckBox.icon[filled].hoverIndeterminateBorderColor
CheckBox.icon[filled].hoverIndeterminateCheckmarkColor
CheckBox.icon[filled].hoverSelectedBackground CheckBox.icon[filled].hoverSelectedBackground
CheckBox.icon[filled].hoverSelectedBorderColor CheckBox.icon[filled].hoverSelectedBorderColor
CheckBox.icon[filled].indeterminateBackground
CheckBox.icon[filled].indeterminateBorderColor
CheckBox.icon[filled].indeterminateBorderWidth
CheckBox.icon[filled].indeterminateCheckmarkColor
CheckBox.icon[filled].pressedBackground CheckBox.icon[filled].pressedBackground
CheckBox.icon[filled].pressedBorderColor CheckBox.icon[filled].pressedBorderColor
CheckBox.icon[filled].pressedCheckmarkColor CheckBox.icon[filled].pressedCheckmarkColor
CheckBox.icon[filled].pressedIndeterminateBackground
CheckBox.icon[filled].pressedIndeterminateBorderColor
CheckBox.icon[filled].pressedIndeterminateCheckmarkColor
CheckBox.icon[filled].pressedSelectedBackground CheckBox.icon[filled].pressedSelectedBackground
CheckBox.icon[filled].pressedSelectedBorderColor CheckBox.icon[filled].pressedSelectedBorderColor
CheckBox.icon[filled].selectedBackground CheckBox.icon[filled].selectedBackground
@@ -435,6 +469,7 @@ Label.disabledShadow
Label.font Label.font
Label.foreground Label.foreground
LabelUI LabelUI
List.alternateRowColor
List.background List.background
List.border List.border
List.cellFocusColor List.cellFocusColor
@@ -1170,6 +1205,7 @@ ToolTip.foreground
ToolTip.roundedBorderWidth ToolTip.roundedBorderWidth
ToolTipManager.enableToolTipMode ToolTipManager.enableToolTipMode
ToolTipUI ToolTipUI
Tree.alternateRowColor
Tree.ancestorInputMap Tree.ancestorInputMap
Tree.background Tree.background
Tree.border Tree.border
@@ -1216,6 +1252,7 @@ Tree.showDefaultIcons
Tree.textBackground Tree.textBackground
Tree.textForeground Tree.textForeground
Tree.timeFactor Tree.timeFactor
Tree.wideCellRenderer
Tree.wideSelection Tree.wideSelection
TreeUI TreeUI
TristateCheckBox.clearMixed.clientProperty TristateCheckBox.clearMixed.clientProperty

View File

@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
# #
flatlaf.releaseVersion = 3.5.3 flatlaf.releaseVersion = 3.5.4
flatlaf.developmentVersion = 3.6-SNAPSHOT flatlaf.developmentVersion = 3.6-SNAPSHOT
org.gradle.parallel = true org.gradle.parallel = true

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

3
gradlew vendored
View File

@@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum