Compare commits

...

49 Commits

Author SHA1 Message Date
Karl Tauber
df6256d989 release 2.0.1 2022-01-25 18:46:29 +01:00
Karl Tauber
c27db56321 moved module-info.class from META-INF\versions\9\ to root folder of JARs (issue #466) 2022-01-25 16:59:31 +01:00
Karl Tauber
97bed8554a FlatSVGIcon: added copy constructor (issue #465) 2022-01-25 00:47:35 +01:00
Karl Tauber
751c0e16e9 ToolTip: fixed wrong tooltip location if component overrides JComponent.getToolTipLocation() and wants place tooltip under mouse location (issue #468) 2022-01-24 23:24:39 +01:00
Karl Tauber
936de60700 fixed memory leak in Panel, Separator and ToolBarSeparator (issue #471) 2022-01-24 18:28:38 +01:00
Karl Tauber
f6b64d48ec Merge PR #463: Updating MegaMek Suite Information 2022-01-19 17:27:12 +01:00
Justin Bowen
b043da7d4c Updating MegaMek Suite Information 2022-01-13 20:22:30 -05:00
Karl Tauber
7e47cc2443 updated sigtest for FlatLaf 2.0
(generated in clean workspace with gradle task `sigtestGenerate`)
2022-01-13 12:14:51 +01:00
Karl Tauber
b8b45f9442 Theme Editor: added to main readme 2022-01-11 16:17:17 +01:00
Karl Tauber
66337f9af6 release 2.0 2022-01-10 12:25:45 +01:00
Karl Tauber
54646706a0 README.md: added more documentation links 2022-01-10 12:13:30 +01:00
Karl Tauber
e8ee037d09 RootPane: uninstall background, foreground and font because not all Lafs set them 2022-01-10 11:58:49 +01:00
Karl Tauber
6d705e568a Extras: FlatInspector: fixed "NOT SET" for component foreground 2022-01-09 19:40:17 +01:00
Karl Tauber
e768791eba Native window decorations: updated hover and pressed colors of iconify/maximize/close buttons for Windows 11 style 2022-01-09 12:59:08 +01:00
Karl Tauber
2aff7c97f9 Demo: changed theme names from "Flat *" to "FlatLaf *" 2022-01-08 22:56:20 +01:00
Karl Tauber
ca6fc7773e README.md: added MooInfo to applications using FlatLaf (issue #460) 2022-01-06 16:05:28 +01:00
Karl Tauber
a1395a5490 TextField: leading/trailing components (PR #386):
- set cursor only on button and toolbar
- do not replace cursor on if already set (issue #461)
- updated client properties javadoc
2022-01-06 15:17:20 +01:00
Karl Tauber
61dd4d71d6 Theme Editor: added text field leading/trailing buttons/toolbar to preview 2022-01-05 19:43:06 +01:00
Karl Tauber
6beda53238 Button: if boolbar button is in leading/trailing component of a text field, increase toolbar button corner arc to match text field corner arc (issue #451) 2022-01-05 18:46:00 +01:00
Karl Tauber
941441d7e1 TextField: clear button has now component name TextField.clearButton
PasswordField: reveals button has now component name `PasswordField.revealButton` and additional style class `revealButton` (issue #173)
SwingUtils: added `getComponentByName()` for easy getting clear or reveal buttons
2022-01-05 18:32:05 +01:00
Karl Tauber
d10ea41b47 GitHub Actions:
- build on Java 17
- run natives.yml when Gradle version changed
2022-01-04 18:13:12 +01:00
Karl Tauber
9458870f70 update to Gradle 7.3.3
./gradlew wrapper --gradle-version=7.3.3
2022-01-04 16:06:37 +01:00
Karl Tauber
095794bbd1 GitHub Actions:
- use actions/setup-java@v2 (provides caching gradle files)
- use pre-installed Java 8 and 11
- no longer build on Java 9 and 14
- not yet build on Java 17 because used Gradle version 6.8.2 does not support it
  can not yet upgrade to Gradle 7.x because nokee plugins (for C++) does not support it
2022-01-04 12:26:13 +01:00
Karl Tauber
c7fc0aa936 Demo: removed unnecessary setting component name 2022-01-03 23:56:26 +01:00
Karl Tauber
a8d98ced61 Theme Editor:
- support multi-line styles in overlay color preview
- minor preview improvements
2022-01-03 21:51:02 +01:00
Karl Tauber
831b3d851a ColorFunctions: javadoc added; do not mix colors if they are equal 2022-01-03 19:04:28 +01:00
Karl Tauber
8c891c7016 UIDefaultsDump: output base color used for resolving derived color 2022-01-03 18:46:56 +01:00
Karl Tauber
5c4706cbc9 Merge remote-tracking branch 'origin/main' into main 2022-01-03 17:05:37 +01:00
Karl Tauber
db66a6c4f0 Unit tests: re-enable testing scaled UI
avoid using UI_SCALE_ENABLED = false because if this test is executed first, class UIScale does not register listeners to UIManager, which prevents updating user scale factor on font changes and testing scaled UI fails
2022-01-03 16:52:43 +01:00
Karl Tauber
0517e4fc02 Native window decorations: updated maximize and restore icons for Windows 11 style
(requires Java 8u321, 11.0.14, 17.0.2 or 18+)
2021-12-31 17:57:02 +01:00
Karl Tauber
dd7fa4a87d Slider: fixed/improved focused indicator color when changing accent color (PR #375) 2021-12-31 15:33:27 +01:00
Karl Tauber
e5956900ea FileChooser: use Windows system icons in Java 18+ 32bit (issue #403)
only Java 17 32bit does not use Windows system icons because of:
https://bugs.openjdk.java.net/browse/JDK-8277299
2021-12-31 12:59:22 +01:00
Karl Tauber
3755593c14 Windows 11: Native window decorations: do not paint top window border because Windows 11 now paints it (issue #431)
(requires Java 8u321, 11.0.14, 17.0.2 or 18+)
2021-12-31 10:35:19 +01:00
Karl Tauber
8ddd3b6d68 Native window decorations: fixed blurry iconify/maximize/close button hover rectangles at 125%, 150% or 175% scaling (issue #431) 2021-12-31 10:28:34 +01:00
Karl Tauber
840083940d Use FlatLaf native window decorations by default when running in
[JetBrains Runtime](https://github.com/JetBrains/JetBrainsRuntime/wiki)
(instead of using JetBrains custom decorations). System variable
`flatlaf.useJetBrainsCustomDecorations` is now `false` by default (was `true` in FlatLaf 1.x). (issue #454)
2021-12-30 12:04:22 +01:00
Karl Tauber
0cdfd29ecf Extras: fixed concurrent loading of SVG icons on multiple threads (issue #459) 2021-12-30 11:24:48 +01:00
Karl Tauber
bb32c727b6 TextField:
- improved hover/pressed/selected colors of leading/trailing buttons
  (e.g. "reveal" button in password field) (issue #452)
- clear button no longer paints over round border (issue #451)
2021-12-28 20:24:43 +01:00
Karl Tauber
f978c04750 PasswordField: reveal button did not show password if JPasswordField.setEchoChar() was invoked from application (PR #442; issue #173) 2021-12-27 22:53:07 +01:00
Karl Tauber
b6a504e121 Theme Editor: fixed "Pick Color from Screen" on macOS
On macOS Big Sur (and later), to pick colors outside of theme editor window it is necessary to give "Screen Recording" permission to the application (or to the IDE started from).
For the arrow keys, "Accessibility" permission is necessary.
See "System Preferences > Security & Privacy > Privacy".
2021-12-27 21:49:49 +01:00
Karl Tauber
5fae367fab PasswordField: preserve reveal button state when switching theme (issue #173) 2021-12-27 20:07:27 +01:00
Karl Tauber
6e807f44b2 Search/clear icons: fixed colors for some IntelliJ themes (e.g. "Dark Flat") that use translucent color for Actions.GreyInline 2021-12-27 18:22:31 +01:00
Karl Tauber
53ebed7f89 CHANGELOG.md: added changes for #453 and #456 2021-12-26 22:44:55 +01:00
Karl Tauber
1c10c41808 Theme Editor: Preview: added style classes to all preview components (syntax flatlaf-preview-<componenttype>) to allow experimenting with styles in editor 2021-12-26 21:23:42 +01:00
Karl Tauber
01170b669b Theme Editor: Preview:
- reworked disabling to avoid disabling internal components
- do not disable labels
- removed special code for JTextPane and JEditorPane, which seems to be no longer needed
2021-12-26 20:30:36 +01:00
Karl Tauber
b56215e5e3 Demo: moved leading/trailing icons (on text field) code from end of initComponents() to constructor (so that it easier to find) 2021-12-26 19:57:15 +01:00
Karl Tauber
221e801561 support relative path in system property flatlaf.nativeLibraryPath (PR #453) 2021-12-23 22:19:29 +01:00
Karl Tauber
90edbe23d7 Merge PR #453: Add a system property to load pre-extracted native libraries from a directory 2021-12-23 22:10:11 +01:00
Karl Tauber
5b16a814c8 fixed "endless recursion in font" exception in FlatLaf$ActiveFont.createValue() if UIManager.getFont() is invoked from multiple threads (issue #456) 2021-12-23 21:16:07 +01:00
Ingo Kegel
ef01721464 Added the system property flatlaf.nativeLibraryPath to specify a directory where the native libraries have been extracted.
Avoiding extraction at runtime to the temporary directory is useful in order to prevent anti-virus software from blocking the library loading.
2021-12-21 11:13:40 +01:00
77 changed files with 1248 additions and 704 deletions

View File

@@ -19,40 +19,26 @@ jobs:
strategy:
matrix:
# test against
# - Java 1.8 (minimum requirement)
# - Java 9 (first version with JPMS)
# - Java 8 (minimum requirement)
# - Java LTS versions (11, 17, ...)
# - lastest Java version(s)
java:
- 1.8
- 9
- 8
- 11 # LTS
- 14
- 15
- 17 # LTS
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
if: matrix.java == '1.8'
if: matrix.java == '8'
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
- name: Cache Gradle wrapper
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Cache Gradle cache
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle
distribution: adopt # Java 8 and 11 are pre-installed on ubuntu-latest
cache: gradle
- name: Build with Gradle
run: ./gradlew build
@@ -80,22 +66,11 @@ jobs:
- uses: actions/checkout@v2
- name: Setup Java 11
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11
- name: Cache Gradle wrapper
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Cache Gradle cache
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle
distribution: adopt # pre-installed on ubuntu-latest
cache: gradle
- name: Publish snapshot to oss.sonatype.org
run: ./gradlew publish :flatlaf-theme-editor:build -Dorg.gradle.internal.publish.checksums.insecure=true
@@ -127,22 +102,11 @@ jobs:
- uses: actions/checkout@v2
- name: Setup Java 11
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11
- name: Cache Gradle wrapper
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Cache Gradle cache
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle
distribution: adopt # pre-installed on ubuntu-latest
cache: gradle
- name: Release a new stable version to Maven Central
run: ./gradlew publish :flatlaf-demo:build :flatlaf-theme-editor:build -Drelease=true

View File

@@ -11,12 +11,14 @@ on:
paths:
- 'flatlaf-natives/flatlaf-natives-windows/**'
- '.github/workflows/natives.yml'
- 'gradle/wrapper/gradle-wrapper.properties'
pull_request:
branches:
- '*'
paths:
- 'flatlaf-natives/flatlaf-natives-windows/**'
- '.github/workflows/natives.yml'
- 'gradle/wrapper/gradle-wrapper.properties'
jobs:
Windows:
@@ -27,28 +29,17 @@ jobs:
- uses: gradle/wrapper-validation-action@v1
- name: Setup Java 1.8
uses: actions/setup-java@v1
- name: Setup Java 11
uses: actions/setup-java@v2
with:
java-version: 1.8
- name: Cache Gradle wrapper
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Cache Gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
!~/.gradle/caches/modules-2/modules-2.lock
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle
java-version: 11
distribution: adopt
cache: gradle
- name: Build with Gradle
run: ./gradlew :flatlaf-natives-windows:build
# --no-daemon is necessary on Windows otherwise caching Gradle would fail with:
# tar.exe: Couldn't open ~/.gradle/caches/modules-2/modules-2.lock: Permission denied
run: ./gradlew :flatlaf-natives-windows:build --no-daemon
- name: Upload artifacts
uses: actions/upload-artifact@v2

View File

@@ -1,6 +1,52 @@
FlatLaf Change Log
==================
## 2.0.1
- Fixed memory leak in Panel, Separator and ToolBarSeparator. (issue #471;
regression in FlatLaf 2.0)
- ToolTip: Fixed wrong tooltip location if component overrides
`JComponent.getToolTipLocation()` and wants place tooltip under mouse
location. (issue #468)
- Extras: Added copy constructor to `FlatSVGIcon`. (issue #465)
- Moved `module-info.class` from `META-INF\versions\9\` to root folder of JARs.
(issue #466)
## 2.0
- Added system property `flatlaf.nativeLibraryPath` to load native libraries
from a directory. (PR #453)
- Fixed "endless recursion in font" exception in
`FlatLaf$ActiveFont.createValue()` if `UIManager.getFont()` is invoked from
multiple threads. (issue #456)
- PasswordField: Preserve reveal button state when switching theme. (PR #442;
issue #173)
- PasswordField: Reveal button did not show password if
`JPasswordField.setEchoChar()` was invoked from application. (PR #442; issue
#173)
- Slider: Fixed/improved focused indicator color when changing accent color. (PR
#375)
- TextField:
- Improved hover/pressed/selected colors of leading/trailing buttons (e.g.
"reveal" button in password field). (issue #452)
- Clear button no longer paints over round border. (issue #451)
- Extras: Fixed concurrent loading of SVG icons on multiple threads. (issue
#459)
- Use FlatLaf native window decorations by default when running in
[JetBrains Runtime](https://github.com/JetBrains/JetBrainsRuntime/wiki)
(instead of using JetBrains custom decorations). System variable
`flatlaf.useJetBrainsCustomDecorations` is now `false` by default (was `true`
in FlatLaf 1.x). (issue #454)
- Native window decorations:
- Fixed blurry iconify/maximize/close button hover rectangles at 125%, 150% or
175% scaling. (issue #431)
- Updated maximize and restore icons for Windows 11 style. (requires Java
8u321, 11.0.14, 17.0.2 or 18+)
- Updated hover and pressed colors of iconify/maximize/close buttons for
Windows 11 style.
## 2.0-rc1
#### New features and improvements

View File

@@ -11,9 +11,9 @@ scales on **HiDPI** displays and runs on Java 8 or newer.
The look is heavily inspired by **Darcula** and **IntelliJ** themes from
IntelliJ IDEA 2019.2+ and uses almost the same colors and icons.
![Flat Light](images/flat_light.png)
![FlatLaf Light](images/flat_light.png)
![Flat Dark](images/flat_dark.png)
![FlatLaf Dark](images/flat_dark.png)
IntelliJ Platform Themes
@@ -99,10 +99,22 @@ For more information and documentation visit
- [Customizing](https://www.formdev.com/flatlaf/customizing/)
- [How to Customize](https://www.formdev.com/flatlaf/how-to-customize/)
- [Properties Files](https://www.formdev.com/flatlaf/properties-files/)
- [Components UI Properties](https://www.formdev.com/flatlaf/components/)
- [Typography](https://www.formdev.com/flatlaf/typography/)
- [Client Properties](https://www.formdev.com/flatlaf/client-properties/)
- [System Properties](https://www.formdev.com/flatlaf/system-properties/)
Theme Editor
------------
The Theme Editor that supports editing FlatLaf theme properties files. See
[Theme Editor documentation](https://www.formdev.com/flatlaf/theme-editor/) for
details and downloads.
![Theme Editor](images/theme-editor@1.5x.png)
Buzz
----
@@ -114,6 +126,9 @@ Buzz
Applications using FlatLaf
--------------------------
- ![New](images/new.svg) [MooInfo](https://github.com/rememberber/MooInfo) -
visual implementation of OSHI, to view information about the system and
hardware
- ![New](images/new.svg) [Jailer](https://github.com/Wisser/Jailer) 11.2 -
database subsetting and relational data browsing tool
- [Apache NetBeans](https://netbeans.apache.org/) 11.3 - IDE for Java, PHP, HTML
@@ -149,9 +164,10 @@ Applications using FlatLaf
- [Total Validator](https://www.totalvalidator.com/) 15 (**commercial**) -
checks your website
- [j-lawyer](https://github.com/jlawyerorg/j-lawyer-org) - Kanzleisoftware
- [MegaMek](https://github.com/MegaMek/megamek) v0.47.4 and
[MekHQ](https://github.com/MegaMek/mekhq) v0.47.5 - a turn-based sci-fi board
game
- [MegaMek](https://github.com/MegaMek/megamek),
[MegaMekLab](https://github.com/MegaMek/megameklab) and
[MekHQ](https://github.com/MegaMek/mekhq) v0.47.5+ - a sci-fi tabletop
BattleTech simulator suite handling battles, unit building, and campaigns
- [GUIslice Builder](https://github.com/ImpulseAdventure/GUIslice-Builder)
0.13.b024 - GUI builder for
[GUIslice](https://github.com/ImpulseAdventure/GUIslice), a lightweight GUI

View File

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

View File

@@ -28,7 +28,7 @@ if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
}
dependencies {
add( "java9Compile", sourceSets.main.get().output )
add( "java9Implementation", sourceSets.main.get().output )
}
tasks {

View File

@@ -63,10 +63,8 @@ if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
jar {
manifest.attributes( "Multi-Release" to "true" )
into( "META-INF/versions/9" ) {
from( sourceSets["module-info"].output ) {
include( "module-info.class" )
}
from( sourceSets["module-info"].output ) {
include( "module-info.class" )
}
}
}

View File

@@ -1,5 +1,5 @@
#Signature file v4.1
#Version 1.6
#Version 2.0
CLSS public abstract interface com.formdev.flatlaf.FlatClientProperties
fld public final static java.lang.String BUTTON_TYPE = "JButton.buttonType"
@@ -31,6 +31,8 @@ fld public final static java.lang.String SELECT_ALL_ON_FOCUS_POLICY_ALWAYS = "al
fld public final static java.lang.String SELECT_ALL_ON_FOCUS_POLICY_NEVER = "never"
fld public final static java.lang.String SELECT_ALL_ON_FOCUS_POLICY_ONCE = "once"
fld public final static java.lang.String SQUARE_SIZE = "JButton.squareSize"
fld public final static java.lang.String STYLE = "FlatLaf.style"
fld public final static java.lang.String STYLE_CLASS = "FlatLaf.styleClass"
fld public final static java.lang.String TABBED_PANE_ALIGN_CENTER = "center"
fld public final static java.lang.String TABBED_PANE_ALIGN_FILL = "fill"
fld public final static java.lang.String TABBED_PANE_ALIGN_LEADING = "leading"
@@ -59,6 +61,9 @@ fld public final static java.lang.String TABBED_PANE_TAB_CLOSE_TOOLTIPTEXT = "JT
fld public final static java.lang.String TABBED_PANE_TAB_HEIGHT = "JTabbedPane.tabHeight"
fld public final static java.lang.String TABBED_PANE_TAB_ICON_PLACEMENT = "JTabbedPane.tabIconPlacement"
fld public final static java.lang.String TABBED_PANE_TAB_INSETS = "JTabbedPane.tabInsets"
fld public final static java.lang.String TABBED_PANE_TAB_TYPE = "JTabbedPane.tabType"
fld public final static java.lang.String TABBED_PANE_TAB_TYPE_CARD = "card"
fld public final static java.lang.String TABBED_PANE_TAB_TYPE_UNDERLINED = "underlined"
fld public final static java.lang.String TABBED_PANE_TAB_WIDTH_MODE = "JTabbedPane.tabWidthMode"
fld public final static java.lang.String TABBED_PANE_TAB_WIDTH_MODE_COMPACT = "compact"
fld public final static java.lang.String TABBED_PANE_TAB_WIDTH_MODE_EQUAL = "equal"
@@ -67,12 +72,20 @@ fld public final static java.lang.String TABBED_PANE_TRAILING_COMPONENT = "JTabb
fld public final static java.lang.String TAB_BUTTON_SELECTED_BACKGROUND = "JToggleButton.tab.selectedBackground"
fld public final static java.lang.String TAB_BUTTON_UNDERLINE_COLOR = "JToggleButton.tab.underlineColor"
fld public final static java.lang.String TAB_BUTTON_UNDERLINE_HEIGHT = "JToggleButton.tab.underlineHeight"
fld public final static java.lang.String TEXT_FIELD_CLEAR_CALLBACK = "JTextField.clearCallback"
fld public final static java.lang.String TEXT_FIELD_LEADING_COMPONENT = "JTextField.leadingComponent"
fld public final static java.lang.String TEXT_FIELD_LEADING_ICON = "JTextField.leadingIcon"
fld public final static java.lang.String TEXT_FIELD_PADDING = "JTextField.padding"
fld public final static java.lang.String TEXT_FIELD_SHOW_CLEAR_BUTTON = "JTextField.showClearButton"
fld public final static java.lang.String TEXT_FIELD_TRAILING_COMPONENT = "JTextField.trailingComponent"
fld public final static java.lang.String TEXT_FIELD_TRAILING_ICON = "JTextField.trailingIcon"
fld public final static java.lang.String TITLE_BAR_BACKGROUND = "JRootPane.titleBarBackground"
fld public final static java.lang.String TITLE_BAR_FOREGROUND = "JRootPane.titleBarForeground"
fld public final static java.lang.String TITLE_BAR_SHOW_ICON = "JRootPane.titleBarShowIcon"
fld public final static java.lang.String TREE_PAINT_SELECTION = "JTree.paintSelection"
fld public final static java.lang.String TREE_WIDE_SELECTION = "JTree.wideSelection"
fld public final static java.lang.String USE_WINDOW_DECORATIONS = "JRootPane.useWindowDecorations"
meth public static <%0 extends java.lang.Object> {%%0} clientProperty(javax.swing.JComponent,java.lang.String,{%%0},java.lang.Class<{%%0}>)
meth public static boolean clientPropertyBoolean(javax.swing.JComponent,java.lang.String,boolean)
meth public static boolean clientPropertyEquals(javax.swing.JComponent,java.lang.String,java.lang.Object)
meth public static int clientPropertyInt(javax.swing.JComponent,java.lang.String,int)
@@ -165,6 +178,7 @@ meth public boolean isSupportedLookAndFeel()
meth public final boolean equals(java.lang.Object)
meth public final int hashCode()
meth public java.lang.String getID()
meth public java.util.Map<java.lang.String,java.lang.String> getExtraDefaults()
meth public javax.swing.Icon getDisabledIcon(javax.swing.JComponent,javax.swing.Icon)
meth public javax.swing.UIDefaults getDefaults()
meth public static boolean install(javax.swing.LookAndFeel)
@@ -174,6 +188,8 @@ meth public static boolean isShowMnemonics()
meth public static boolean isUseNativeWindowDecorations()
meth public static boolean setup(javax.swing.LookAndFeel)
meth public static boolean supportsNativeWindowDecorations()
meth public static java.lang.Object parseDefaultsValue(java.lang.String,java.lang.String,java.lang.Class<?>)
meth public static java.util.Map<java.lang.String,java.lang.String> getGlobalExtraDefaults()
meth public static javax.swing.UIDefaults$ActiveValue createActiveFontValue(float)
meth public static void hideMnemonics()
meth public static void initIconColors(javax.swing.UIDefaults,boolean)
@@ -181,22 +197,26 @@ meth public static void installLafInfo(java.lang.String,java.lang.Class<? extend
meth public static void registerCustomDefaultsSource(java.io.File)
meth public static void registerCustomDefaultsSource(java.lang.String)
meth public static void registerCustomDefaultsSource(java.lang.String,java.lang.ClassLoader)
meth public static void registerCustomDefaultsSource(java.net.URL)
meth public static void repaintAllFramesAndDialogs()
meth public static void revalidateAndRepaintAllFramesAndDialogs()
meth public static void runWithUIDefaultsGetter(java.util.function.Function<java.lang.Object,java.lang.Object>,java.lang.Runnable)
meth public static void setGlobalExtraDefaults(java.util.Map<java.lang.String,java.lang.String>)
meth public static void setUseNativeWindowDecorations(boolean)
meth public static void showMnemonics(java.awt.Component)
meth public static void unregisterCustomDefaultsSource(java.io.File)
meth public static void unregisterCustomDefaultsSource(java.lang.String)
meth public static void unregisterCustomDefaultsSource(java.lang.String,java.lang.ClassLoader)
meth public static void unregisterCustomDefaultsSource(java.net.URL)
meth public static void updateUI()
meth public static void updateUILater()
meth public void initialize()
meth public void registerUIDefaultsGetter(java.util.function.Function<java.lang.Object,java.lang.Object>)
meth public void setExtraDefaults(java.util.Map<java.lang.String,java.lang.String>)
meth public void uninitialize()
meth public void unregisterUIDefaultsGetter(java.util.function.Function<java.lang.Object,java.lang.Object>)
supr javax.swing.plaf.basic.BasicLookAndFeel
hfds DESKTOPFONTHINTS,aquaLoaded,customDefaultsSources,desktopPropertyListener,desktopPropertyName,desktopPropertyName2,mnemonicHandler,oldPopupFactory,postInitialization,uiDefaultsGetters,updateUIPending
hfds DESKTOPFONTHINTS,aquaLoaded,customDefaultsSources,desktopPropertyListener,desktopPropertyName,desktopPropertyName2,extraDefaults,globalExtraDefaults,mnemonicHandler,oldPopupFactory,postInitialization,uiDefaultsGetters,updateUIPending
hcls ActiveFont,FlatUIDefaults,ImageIconUIResource
CLSS public abstract interface static com.formdev.flatlaf.FlatLaf$DisabledIconProvider
@@ -231,6 +251,7 @@ hfds baseTheme,dark,name,properties
CLSS public abstract interface com.formdev.flatlaf.FlatSystemProperties
fld public final static java.lang.String ANIMATION = "flatlaf.animation"
fld public final static java.lang.String MENUBAR_EMBEDDED = "flatlaf.menuBarEmbedded"
fld public final static java.lang.String NATIVE_LIBRARY_PATH = "flatlaf.nativeLibraryPath"
fld public final static java.lang.String UI_SCALE = "flatlaf.uiScale"
fld public final static java.lang.String UI_SCALE_ALLOW_SCALE_DOWN = "flatlaf.uiScale.allowScaleDown"
fld public final static java.lang.String UI_SCALE_ENABLED = "flatlaf.uiScale.enabled"
@@ -330,7 +351,15 @@ innr public static HSLIncreaseDecrease
innr public static Mix
meth public !varargs static java.awt.Color applyFunctions(java.awt.Color,com.formdev.flatlaf.util.ColorFunctions$ColorFunction[])
meth public static float clamp(float)
meth public static float luma(java.awt.Color)
meth public static java.awt.Color darken(java.awt.Color,float)
meth public static java.awt.Color desaturate(java.awt.Color,float)
meth public static java.awt.Color lighten(java.awt.Color,float)
meth public static java.awt.Color mix(java.awt.Color,java.awt.Color,float)
meth public static java.awt.Color saturate(java.awt.Color,float)
meth public static java.awt.Color shade(java.awt.Color,float)
meth public static java.awt.Color spin(java.awt.Color,float)
meth public static java.awt.Color tint(java.awt.Color,float)
supr java.lang.Object
CLSS public abstract interface static com.formdev.flatlaf.util.ColorFunctions$ColorFunction
@@ -566,6 +595,7 @@ meth public static java.util.List<java.awt.Image> getResolutionVariants(java.awt
supr java.lang.Object
CLSS public com.formdev.flatlaf.util.NativeLibrary
cons public init(java.io.File,boolean)
cons public init(java.lang.String,java.lang.ClassLoader,boolean)
meth public boolean isLoaded()
supr java.lang.Object
@@ -589,18 +619,52 @@ meth public void paintIcon(java.awt.Component,java.awt.Graphics,int,int)
supr java.lang.Object
hfds iconHeight,iconWidth,imageIcon,lastImage,lastSystemScaleFactor,lastUserScaleFactor
CLSS public com.formdev.flatlaf.util.SoftCache<%0 extends java.lang.Object, %1 extends java.lang.Object>
cons public init()
cons public init(int)
intf java.util.Map<{com.formdev.flatlaf.util.SoftCache%0},{com.formdev.flatlaf.util.SoftCache%1}>
meth public boolean containsKey(java.lang.Object)
meth public boolean containsValue(java.lang.Object)
meth public boolean isEmpty()
meth public int size()
meth public java.util.Collection<{com.formdev.flatlaf.util.SoftCache%1}> values()
meth public java.util.Set<java.util.Map$Entry<{com.formdev.flatlaf.util.SoftCache%0},{com.formdev.flatlaf.util.SoftCache%1}>> entrySet()
meth public java.util.Set<{com.formdev.flatlaf.util.SoftCache%0}> keySet()
meth public void clear()
meth public void forEach(java.util.function.BiConsumer<? super {com.formdev.flatlaf.util.SoftCache%0},? super {com.formdev.flatlaf.util.SoftCache%1}>)
meth public void putAll(java.util.Map<? extends {com.formdev.flatlaf.util.SoftCache%0},? extends {com.formdev.flatlaf.util.SoftCache%1}>)
meth public void replaceAll(java.util.function.BiFunction<? super {com.formdev.flatlaf.util.SoftCache%0},? super {com.formdev.flatlaf.util.SoftCache%1},? extends {com.formdev.flatlaf.util.SoftCache%1}>)
meth public {com.formdev.flatlaf.util.SoftCache%1} get(java.lang.Object)
meth public {com.formdev.flatlaf.util.SoftCache%1} put({com.formdev.flatlaf.util.SoftCache%0},{com.formdev.flatlaf.util.SoftCache%1})
meth public {com.formdev.flatlaf.util.SoftCache%1} remove(java.lang.Object)
supr java.lang.Object
hfds map,queue
hcls CacheReference
CLSS public com.formdev.flatlaf.util.StringUtils
cons public init()
meth public static boolean isEmpty(java.lang.String)
meth public static boolean isTrimmedEmpty(java.lang.String)
meth public static java.lang.String removeLeading(java.lang.String,java.lang.String)
meth public static java.lang.String removeTrailing(java.lang.String,java.lang.String)
meth public static java.lang.String substringTrimmed(java.lang.String,int)
meth public static java.lang.String substringTrimmed(java.lang.String,int,int)
meth public static java.util.List<java.lang.String> split(java.lang.String,char)
meth public static java.util.List<java.lang.String> split(java.lang.String,char,boolean,boolean)
supr java.lang.Object
CLSS public com.formdev.flatlaf.util.SwingUtils
cons public init()
meth public static <%0 extends java.awt.Component> {%%0} getComponentByName(java.awt.Container,java.lang.String)
supr java.lang.Object
CLSS public com.formdev.flatlaf.util.SystemInfo
cons public init()
fld public final static boolean isAARCH64
fld public final static boolean isJava_11_orLater
fld public final static boolean isJava_15_orLater
fld public final static boolean isJava_17_orLater
fld public final static boolean isJava_18_orLater
fld public final static boolean isJava_9_orLater
fld public final static boolean isJetBrainsJVM
fld public final static boolean isJetBrainsJVM_11_orLater
@@ -615,6 +679,8 @@ fld public final static boolean isWebswing
fld public final static boolean isWinPE
fld public final static boolean isWindows
fld public final static boolean isWindows_10_orLater
fld public final static boolean isWindows_11_orLater
fld public final static boolean isX86
fld public final static boolean isX86_64
fld public final static long javaVersion
fld public final static long osVersion
@@ -627,6 +693,7 @@ cons public init()
meth public static boolean isSystemScalingEnabled()
meth public static double getSystemScaleFactor(java.awt.Graphics2D)
meth public static double getSystemScaleFactor(java.awt.GraphicsConfiguration)
meth public static float computeFontScaleFactor(java.awt.Font)
meth public static float getUserScaleFactor()
meth public static float scale(float)
meth public static float unscale(float)
@@ -933,6 +1000,34 @@ CLSS public abstract interface !annotation java.lang.annotation.Target
intf java.lang.annotation.Annotation
meth public abstract java.lang.annotation.ElementType[] value()
CLSS public abstract interface java.util.Map<%0 extends java.lang.Object, %1 extends java.lang.Object>
innr public abstract interface static Entry
meth public abstract boolean containsKey(java.lang.Object)
meth public abstract boolean containsValue(java.lang.Object)
meth public abstract boolean equals(java.lang.Object)
meth public abstract boolean isEmpty()
meth public abstract int hashCode()
meth public abstract int size()
meth public abstract java.util.Collection<{java.util.Map%1}> values()
meth public abstract java.util.Set<java.util.Map$Entry<{java.util.Map%0},{java.util.Map%1}>> entrySet()
meth public abstract java.util.Set<{java.util.Map%0}> keySet()
meth public abstract void clear()
meth public abstract void putAll(java.util.Map<? extends {java.util.Map%0},? extends {java.util.Map%1}>)
meth public abstract {java.util.Map%1} get(java.lang.Object)
meth public abstract {java.util.Map%1} put({java.util.Map%0},{java.util.Map%1})
meth public abstract {java.util.Map%1} remove(java.lang.Object)
meth public boolean remove(java.lang.Object,java.lang.Object)
meth public boolean replace({java.util.Map%0},{java.util.Map%1},{java.util.Map%1})
meth public void forEach(java.util.function.BiConsumer<? super {java.util.Map%0},? super {java.util.Map%1}>)
meth public void replaceAll(java.util.function.BiFunction<? super {java.util.Map%0},? super {java.util.Map%1},? extends {java.util.Map%1}>)
meth public {java.util.Map%1} compute({java.util.Map%0},java.util.function.BiFunction<? super {java.util.Map%0},? super {java.util.Map%1},? extends {java.util.Map%1}>)
meth public {java.util.Map%1} computeIfAbsent({java.util.Map%0},java.util.function.Function<? super {java.util.Map%0},? extends {java.util.Map%1}>)
meth public {java.util.Map%1} computeIfPresent({java.util.Map%0},java.util.function.BiFunction<? super {java.util.Map%0},? super {java.util.Map%1},? extends {java.util.Map%1}>)
meth public {java.util.Map%1} getOrDefault(java.lang.Object,{java.util.Map%1})
meth public {java.util.Map%1} merge({java.util.Map%0},{java.util.Map%1},java.util.function.BiFunction<? super {java.util.Map%1},? super {java.util.Map%1},? extends {java.util.Map%1}>)
meth public {java.util.Map%1} putIfAbsent({java.util.Map%0},{java.util.Map%1})
meth public {java.util.Map%1} replace({java.util.Map%0},{java.util.Map%1})
CLSS public abstract interface javax.swing.Icon
meth public abstract int getIconHeight()
meth public abstract int getIconWidth()

View File

@@ -874,7 +874,26 @@ public interface FlatClientProperties
* The component should be not opaque because the text field border is painted
* slightly inside the usually visible border in some cases.
* E.g. when focused (in some themes) or when an outline color is specified
* (see {@link #OUTLINE}.
* (see {@link #OUTLINE}).
* <p>
* The component is prepared in the following way:
* <ul>
* <li>Component client property {@link #STYLE_CLASS} is set to {@code inTextField}.
* <li>If component is a button or toggle button, client property {@link #BUTTON_TYPE}
* is set to {@link #BUTTON_TYPE_TOOLBAR_BUTTON}
* and button cursor is set to default cursor (if not set).
* <li>If component is a toolbar, client property {@link #STYLE_CLASS}
* is set to {@code inTextField} on all toolbar children
* and toolbar cursor is set to default cursor (if not set).
* </ul>
* Because text fields use the text cursor by default and the cursor is inherited by child components,
* it may be necessary to explicitly set component cursor if you e.g. need the default arrow cursor.
* E.g. {@code comp.setCursor( Cursor.getDefaultCursor() )}.
* <p>
* Styling is used to modify insets/margins and appearance of buttons and toolbars
* so that they fit nicely into the text field and do not increase text field height.
* See styles {@code [style]Button.inTextField} and {@code [style]ToolBar.inTextField}
* in {@code Flat[Light|Dark]Laf.properties}.
* <p>
* <strong>Component</strong> {@link javax.swing.JTextField} (and subclasses)<br>
* <strong>Value type</strong> {@link javax.swing.JComponent}
@@ -886,15 +905,7 @@ public interface FlatClientProperties
/**
* Specifies a component that will be placed at the trailing edge of the text field.
* <p>
* The component will be positioned inside and aligned to the visible text field border.
* There is no gap between the visible border and the component.
* The laid out component size will be the preferred component width
* and the inner text field height.
* <p>
* The component should be not opaque because the text field border is painted
* slightly inside the usually visible border in some cases.
* E.g. when focused (in some themes) or when an outline color is specified
* (see {@link #OUTLINE}.
* See {@link #TEXT_FIELD_LEADING_COMPONENT} for details.
* <p>
* <strong>Component</strong> {@link javax.swing.JTextField} (and subclasses)<br>
* <strong>Value type</strong> {@link javax.swing.JComponent}

View File

@@ -1223,6 +1223,9 @@ public abstract class FlatLaf
}
private Object getValue( Object key ) {
// use local variable for getters to avoid potential multi-threading issues
List<Function<Object, Object>> uiDefaultsGetters = FlatLaf.this.uiDefaultsGetters;
if( uiDefaultsGetters == null )
return null;
@@ -1276,8 +1279,9 @@ public abstract class FlatLaf
this.scaleSize = scaleSize;
}
// using synchronized to avoid exception if invoked at the same time on multiple threads
@Override
public Object createValue( UIDefaults table ) {
public synchronized Object createValue( UIDefaults table ) {
if( inCreateValue )
throw new IllegalStateException( "FlatLaf: endless recursion in font" );

View File

@@ -81,7 +81,7 @@ public interface FlatSystemProperties
* {@link FlatClientProperties#USE_WINDOW_DECORATIONS} and
* UI default {@code TitlePane.useWindowDecorations}.
* <p>
* (requires Window 10)
* (requires Window 10/11)
* <p>
* <strong>Allowed Values</strong> {@code false} and {@code true}<br>
* <strong>Default</strong> none
@@ -92,16 +92,16 @@ public interface FlatSystemProperties
* Specifies whether JetBrains Runtime custom window decorations should be used
* when creating {@code JFrame} or {@code JDialog}.
* Requires that the application runs in a
* <a href="https://confluence.jetbrains.com/display/JBR/JetBrains+Runtime">JetBrains Runtime</a>
* <a href="https://github.com/JetBrains/JetBrainsRuntime/wiki">JetBrains Runtime</a>
* (based on OpenJDK).
* <p>
* Setting this to {@code false} disables using JetBrains Runtime custom window decorations.
* Then FlatLaf native window decorations are used.
* <p>
* (requires Window 10)
* (requires Window 10/11)
* <p>
* <strong>Allowed Values</strong> {@code false} and {@code true}<br>
* <strong>Default</strong> {@code true}
* <strong>Default</strong> {@code false} (since v2; was {@code true} in v1)
*/
String USE_JETBRAINS_CUSTOM_DECORATIONS = "flatlaf.useJetBrainsCustomDecorations";
@@ -116,7 +116,7 @@ public interface FlatSystemProperties
* {@link FlatClientProperties#MENU_BAR_EMBEDDED} and
* UI default {@code TitlePane.menuBarEmbedded}.
* <p>
* (requires Window 10)
* (requires Window 10/11)
* <p>
* <strong>Allowed Values</strong> {@code false} and {@code true}<br>
* <strong>Default</strong> none
@@ -139,6 +139,15 @@ public interface FlatSystemProperties
*/
String USE_TEXT_Y_CORRECTION = "flatlaf.useTextYCorrection";
/**
* Specifies a directory in which the native FlatLaf library have been extracted.
* The path can be absolute or relative to current application working directory.
* This can be used to avoid extraction of the native libraries to the temporary directory at runtime.
*
* @since 2
*/
String NATIVE_LIBRARY_PATH = "flatlaf.nativeLibraryPath";
/**
* Checks whether a system property is set and returns {@code true} if its value
* is {@code "true"} (case-insensitive), otherwise it returns {@code false}.

View File

@@ -902,21 +902,32 @@ class UIDefaultsLoader
* Syntax: fade(color,amount[,options])
* - color: a color (e.g. #f00) or a color function
* - amount: percentage 0-100%
* - options: [derived]
* - options: [derived] [lazy]
*/
private static Object parseColorFade( List<String> params, Function<String, String> resolver, boolean reportError ) {
String colorStr = params.get( 0 );
int amount = parsePercentage( params.get( 1 ) );
boolean derived = false;
boolean lazy = false;
if( params.size() > 2 ) {
String options = params.get( 2 );
derived = options.contains( "derived" );
lazy = options.contains( "lazy" );
}
// create function
ColorFunction function = new ColorFunctions.Fade( amount );
if( lazy ) {
return (LazyValue) t -> {
Object color = lazyUIManagerGet( colorStr );
return (color instanceof Color)
? new ColorUIResource( ColorFunctions.applyFunctions( (Color) color, function ) )
: null;
};
}
// parse base color, apply function and create derived color
return parseFunctionBaseColor( colorStr, function, derived, resolver, reportError );
}

View File

@@ -20,6 +20,7 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.swing.UIManager;
import com.formdev.flatlaf.ui.FlatButtonUI;
import com.formdev.flatlaf.ui.FlatUIUtils;
@@ -65,8 +66,14 @@ public abstract class FlatWindowAbstractIcon
protected void paintBackground( Component c, Graphics2D g ) {
Color background = FlatButtonUI.buttonStateColor( c, null, null, null, hoverBackground, pressedBackground );
if( background != null ) {
// disable antialiasing for background rectangle painting to avoid blury edges when scaled (e.g. at 125% or 175%)
Object oldHint = g.getRenderingHint( RenderingHints.KEY_ANTIALIASING );
g.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF );
g.setColor( FlatUIUtils.deriveColor( background, c.getBackground() ) );
g.fillRect( 0, 0, width, height );
g.setRenderingHint( RenderingHints.KEY_ANTIALIASING, oldHint );
}
}

View File

@@ -24,6 +24,7 @@ import java.awt.geom.Line2D;
import java.awt.geom.Path2D;
import javax.swing.UIManager;
import com.formdev.flatlaf.ui.FlatButtonUI;
import com.formdev.flatlaf.util.SystemInfo;
/**
* "close" icon for windows (frames and dialogs).
@@ -54,7 +55,7 @@ public class FlatWindowCloseIcon
int iy = y + ((height - iwh) / 2);
int ix2 = ix + iwh - 1;
int iy2 = iy + iwh - 1;
int thickness = (int) scaleFactor;
float thickness = SystemInfo.isWindows_11_orLater ? (float) scaleFactor : (int) scaleFactor;
Path2D path = new Path2D.Float( Path2D.WIND_EVEN_ODD );
path.append( new Line2D.Float( ix, iy, ix2, iy2 ), false );

View File

@@ -18,6 +18,7 @@ package com.formdev.flatlaf.icons;
import java.awt.Graphics2D;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.SystemInfo;
/**
* "maximize" icon for windows (frames and dialogs).
@@ -35,8 +36,11 @@ public class FlatWindowMaximizeIcon
int iwh = (int) (10 * scaleFactor);
int ix = x + ((width - iwh) / 2);
int iy = y + ((height - iwh) / 2);
int thickness = (int) scaleFactor;
float thickness = SystemInfo.isWindows_11_orLater ? (float) scaleFactor : (int) scaleFactor;
int arc = Math.max( (int) (1.5 * scaleFactor), 2 );
g.fill( FlatUIUtils.createRectangle( ix, iy, iwh, iwh, thickness ) );
g.fill( SystemInfo.isWindows_11_orLater
? FlatUIUtils.createRoundRectangle( ix, iy, iwh, iwh, thickness, arc, arc, arc, arc )
: FlatUIUtils.createRectangle( ix, iy, iwh, iwh, thickness ) );
}
}

View File

@@ -21,6 +21,7 @@ import java.awt.geom.Area;
import java.awt.geom.Path2D;
import java.awt.geom.Rectangle2D;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.SystemInfo;
/**
* "restore" icon for windows (frames and dialogs).
@@ -38,18 +39,33 @@ public class FlatWindowRestoreIcon
int iwh = (int) (10 * scaleFactor);
int ix = x + ((width - iwh) / 2);
int iy = y + ((height - iwh) / 2);
int thickness = (int) scaleFactor;
float thickness = SystemInfo.isWindows_11_orLater ? (float) scaleFactor : (int) scaleFactor;
int arc = Math.max( (int) (1.5 * scaleFactor), 2 );
int arcOuter = (int) (arc + (1.5 * scaleFactor));
int rwh = (int) (8 * scaleFactor);
int ro2 = iwh - rwh;
Path2D r1 = FlatUIUtils.createRectangle( ix + ro2, iy, rwh, rwh, thickness );
Path2D r2 = FlatUIUtils.createRectangle( ix, iy + ro2, rwh, rwh, thickness );
// upper-right rectangle
Path2D r1 = SystemInfo.isWindows_11_orLater
? FlatUIUtils.createRoundRectangle( ix + ro2, iy, rwh, rwh, thickness, arc, arcOuter, arc, arc )
: FlatUIUtils.createRectangle( ix + ro2, iy, rwh, rwh, thickness );
// lower-left rectangle
Path2D r2 = SystemInfo.isWindows_11_orLater
? FlatUIUtils.createRoundRectangle( ix, iy + ro2, rwh, rwh, thickness, arc, arc, arc, arc )
: FlatUIUtils.createRectangle( ix, iy + ro2, rwh, rwh, thickness );
// paint upper-right rectangle
Area area = new Area( r1 );
area.subtract( new Area( new Rectangle2D.Float( ix, iy + ro2, rwh, rwh ) ) );
if( SystemInfo.isWindows_11_orLater ) {
area.subtract( new Area( new Rectangle2D.Float( ix, (float) (iy + scaleFactor), rwh, rwh ) ) );
area.subtract( new Area( new Rectangle2D.Float( (float) (ix + scaleFactor), iy + ro2, rwh, rwh ) ) );
} else
area.subtract( new Area( new Rectangle2D.Float( ix, iy + ro2, rwh, rwh ) ) );
g.fill( area );
// paint lower-left rectangle
g.fill( r2 );
}
}

View File

@@ -38,15 +38,18 @@ import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.JToolBar;
import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.ButtonUI;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicButtonListener;
import javax.swing.plaf.basic.BasicButtonUI;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.icons.FlatHelpButtonIcon;
import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable;
@@ -420,11 +423,21 @@ public class FlatButtonUI
try {
FlatUIUtils.setRenderingHints( g2 );
boolean def = isDefaultButton( c );
boolean isToolBarButton = isToolBarButton( c );
float focusWidth = isToolBarButton ? 0 : FlatUIUtils.getBorderFocusWidth( c );
float arc = FlatUIUtils.getBorderArc( c );
float textFieldArc = 0;
boolean def = isDefaultButton( c );
// if toolbar button is in leading/trailing component of a text field,
// increase toolbar button arc to match text field arc (if necessary)
if( isToolBarButton &&
FlatClientProperties.clientProperty( c, STYLE_CLASS, "", String.class ).contains( "inTextField" ) )
{
JTextField textField = (JTextField) SwingUtilities.getAncestorOfClass( JTextField.class, c );
if( textField != null )
textFieldArc = FlatUIUtils.getBorderArc( textField );
}
int x = 0;
int y = 0;
@@ -437,8 +450,15 @@ public class FlatButtonUI
y += spacing.top;
width -= spacing.left + spacing.right;
height -= spacing.top + spacing.bottom;
// reduce text field arc
textFieldArc -= spacing.top + spacing.bottom;
}
// increase toolbar button arc to match text field arc (if necessary)
if( arc < textFieldArc )
arc = textFieldArc;
// paint shadow
Color shadowColor = def ? defaultShadowColor : this.shadowColor;
if( paintShadow &&

View File

@@ -275,7 +275,10 @@ public class FlatFileChooserUI
private boolean doNotUseSystemIcons() {
// Java 17 32bit craches on Windows when using system icons
return SystemInfo.isWindows && SystemInfo.isJava_17_orLater && !SystemInfo.isX86_64;
// fixed in Java 18+ (see https://bugs.openjdk.java.net/browse/JDK-8277299)
return SystemInfo.isWindows &&
SystemInfo.isX86 &&
(SystemInfo.isJava_17_orLater && !SystemInfo.isJava_18_orLater);
}
//---- class FlatFileView -------------------------------------------------

View File

@@ -56,7 +56,7 @@ public class FlatNativeWindowBorder
private static final boolean canUseJBRCustomDecorations =
canUseWindowDecorations &&
SystemInfo.isJetBrainsJVM_11_orLater &&
FlatSystemProperties.getBoolean( FlatSystemProperties.USE_JETBRAINS_CUSTOM_DECORATIONS, true );
FlatSystemProperties.getBoolean( FlatSystemProperties.USE_JETBRAINS_CUSTOM_DECORATIONS, false );
private static Boolean supported;
private static Provider nativeProvider;
@@ -313,6 +313,10 @@ public class FlatNativeWindowBorder
//---- class WindowTopBorder -------------------------------------------
/**
* Window top border used on Windows 10.
* No longer needed since Windows 11.
*/
static class WindowTopBorder
extends JBRCustomDecorations.JBRWindowTopBorder
{

View File

@@ -36,6 +36,7 @@ import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.plaf.basic.BasicOptionPaneUI;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.util.SwingUtils;
import com.formdev.flatlaf.util.UIScale;
/**
@@ -156,7 +157,7 @@ public class FlatOptionPaneUI
// set icon-message gap
if( iconMessageGap > 0 ) {
Component iconMessageSeparator = findByName( messageArea, "OptionPane.separator" );
Component iconMessageSeparator = SwingUtils.getComponentByName( messageArea, "OptionPane.separator" );
if( iconMessageSeparator != null )
iconMessageSeparator.setPreferredSize( new Dimension( UIScale.scale( iconMessageGap ), 1 ) );
}
@@ -236,20 +237,6 @@ public class FlatOptionPaneUI
}
}
private Component findByName( Container c, String name ) {
for( Component child : c.getComponents() ) {
if( name.equals( child.getName() ) )
return child;
if( child instanceof Container ) {
Component c2 = findByName( (Container) child, name );
if( c2 != null )
return c2;
}
}
return null;
}
@Override
protected boolean getSizeButtonsToSameWidth() {
return sameSizeButtons;

View File

@@ -18,12 +18,14 @@ package com.formdev.flatlaf.ui;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Map;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicPanelUI;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable;
import com.formdev.flatlaf.ui.FlatStylingSupport.StyleableUI;
import com.formdev.flatlaf.util.LoggingFacade;
@@ -43,13 +45,12 @@ import com.formdev.flatlaf.util.UIScale;
*/
public class FlatPanelUI
extends BasicPanelUI
implements StyleableUI
implements StyleableUI, PropertyChangeListener
{
// only used via styling (not in UI defaults)
/** @since 2 */ @Styleable protected int arc = -1;
private final boolean shared;
private PropertyChangeListener propertyChangeListener;
private Map<String, Object> oldStyleValues;
public static ComponentUI createUI( JComponent c ) {
@@ -67,9 +68,7 @@ public class FlatPanelUI
public void installUI( JComponent c ) {
super.installUI( c );
propertyChangeListener = FlatStylingSupport.createPropertyChangeListener(
c, () -> stylePropertyChange( (JPanel) c ), null );
c.addPropertyChangeListener( propertyChangeListener );
c.addPropertyChangeListener( this );
installStyle( (JPanel) c );
}
@@ -78,21 +77,28 @@ public class FlatPanelUI
public void uninstallUI( JComponent c ) {
super.uninstallUI( c );
c.removePropertyChangeListener( propertyChangeListener );
propertyChangeListener = null;
c.removePropertyChangeListener( this );
oldStyleValues = null;
}
private void stylePropertyChange( JPanel c ) {
if( shared && FlatStylingSupport.hasStyleProperty( c ) ) {
// unshare component UI if necessary
// updateUI() invokes installStyle() from installUI()
c.updateUI();
} else
installStyle( c );
c.revalidate();
c.repaint();
/** @since 2.0.1 */
@Override
public void propertyChange( PropertyChangeEvent e ) {
switch( e.getPropertyName() ) {
case FlatClientProperties.STYLE:
case FlatClientProperties.STYLE_CLASS:
JPanel c = (JPanel) e.getSource();
if( shared && FlatStylingSupport.hasStyleProperty( c ) ) {
// unshare component UI if necessary
// updateUI() invokes installStyle() from installUI()
c.updateUI();
} else
installStyle( c );
c.revalidate();
c.repaint();
break;
}
}
/** @since 2 */

View File

@@ -28,6 +28,7 @@ import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPasswordField;
import javax.swing.JToggleButton;
import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
@@ -38,6 +39,7 @@ import javax.swing.text.Element;
import javax.swing.text.JTextComponent;
import javax.swing.text.PasswordView;
import javax.swing.text.View;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.icons.FlatCapsLockIcon;
import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable;
import com.formdev.flatlaf.util.UIScale;
@@ -83,6 +85,9 @@ import com.formdev.flatlaf.util.UIScale;
public class FlatPasswordFieldUI
extends FlatTextFieldUI
{
// used to preserve reveal button state when switching theme
private static final String KEY_REVEAL_SELECTED = "FlatLaf.internal.FlatPasswordFieldUI.revealSelected";
private Character echoChar;
@Styleable protected boolean showCapsLock;
@@ -93,6 +98,7 @@ public class FlatPasswordFieldUI
private KeyListener capsLockListener;
private boolean capsLockIconShared = true;
private JToggleButton revealButton;
private boolean uninstallEchoChar;
public static ComponentUI createUI( JComponent c ) {
return new FlatPasswordFieldUI();
@@ -269,36 +275,65 @@ public class FlatPasswordFieldUI
if( !showCapsLock )
return false;
JTextComponent c = getComponent();
return FlatUIUtils.isPermanentFocusOwner( c ) &&
return FlatUIUtils.isPermanentFocusOwner( getComponent() ) &&
Toolkit.getDefaultToolkit().getLockingKeyState( KeyEvent.VK_CAPS_LOCK );
}
/** @since 2 */
protected void installRevealButton() {
JTextComponent c = getComponent();
if( showRevealButton ) {
revealButton = createRevealButton();
installLayout();
c.add( revealButton );
getComponent().add( revealButton );
}
}
/** @since 2 */
protected JToggleButton createRevealButton() {
JToggleButton button = new JToggleButton( revealIcon );
button.setName( "PasswordField.revealButton" );
prepareLeadingOrTrailingComponent( button );
button.putClientProperty( FlatClientProperties.STYLE_CLASS, "inTextField revealButton" );
if( FlatClientProperties.clientPropertyBoolean( getComponent(), KEY_REVEAL_SELECTED, false ) ) {
button.setSelected( true );
updateEchoChar( true );
}
button.addActionListener( e -> {
LookAndFeel.installProperty( getComponent(), "echoChar", button.isSelected()
? '\0'
: (echoChar != null ? echoChar : '*'));
boolean selected = button.isSelected();
updateEchoChar( selected );
getComponent().putClientProperty( KEY_REVEAL_SELECTED, selected );
} );
return button;
}
private void updateEchoChar( boolean selected ) {
char newEchoChar = selected
? 0
: (echoChar != null ? echoChar : '*');
JPasswordField c = (JPasswordField) getComponent();
LookAndFeel.installProperty( c, "echoChar", newEchoChar );
// check whether was able to set echo char via LookAndFeel.installProperty()
// if not, then echo char was explicitly changed via JPasswordField.setEchoChar()
char actualEchoChar = c.getEchoChar();
if( actualEchoChar != newEchoChar ) {
if( selected && actualEchoChar != 0 ) {
// use explicitly set echo char
echoChar = actualEchoChar;
uninstallEchoChar = true;
}
c.setEchoChar( newEchoChar );
}
}
/** @since 2 */
protected void uninstallRevealButton() {
if( revealButton != null ) {
if( uninstallEchoChar && revealButton.isSelected() )
((JPasswordField)getComponent()).setEchoChar( echoChar );
getComponent().remove( revealButton );
revealButton = null;
}

View File

@@ -16,10 +16,12 @@
package com.formdev.flatlaf.ui;
import java.awt.AWTEvent;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
@@ -33,6 +35,7 @@ import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.MouseEvent;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.swing.JComponent;
@@ -219,7 +222,7 @@ public class FlatPopupFactory
* and corrects the y-location so that the tooltip is placed above the mouse location.
*/
private Point fixToolTipLocation( Component owner, Component contents, int x, int y ) {
if( !(contents instanceof JToolTip) || !wasInvokedFromToolTipManager() )
if( !(contents instanceof JToolTip) || !wasInvokedFromToolTipManager() || hasTipLocation( owner ) )
return null;
PointerInfo pointerInfo = MouseInfo.getPointerInfo();
@@ -264,6 +267,35 @@ public class FlatPopupFactory
return StackUtils.wasInvokedFrom( ToolTipManager.class.getName(), "showTipWindow", 8 );
}
/**
* Checks whether the owner component returns a tooltip location in
* JComponent.getToolTipLocation(MouseEvent).
*/
private boolean hasTipLocation( Component owner ) {
if( !(owner instanceof JComponent) )
return false;
AWTEvent e = EventQueue.getCurrentEvent();
MouseEvent me;
if( e instanceof MouseEvent )
me = (MouseEvent) e;
else {
// no mouse event available because a timer is used to show the tooltip
// --> create mouse event from current mouse location
PointerInfo pointerInfo = MouseInfo.getPointerInfo();
if( pointerInfo == null )
return false;
Point location = new Point( pointerInfo.getLocation());
SwingUtilities.convertPointFromScreen( location, owner );
me = new MouseEvent( owner, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(),
0, location.x, location.y, 0, false );
}
return me.getSource() == owner &&
((JComponent)owner).getToolTipLocation( me ) != null;
}
//---- class NonFlashingPopup ---------------------------------------------
private class NonFlashingPopup

View File

@@ -161,6 +161,19 @@ public class FlatRootPaneUI
c.putClientProperty( "jetbrains.awt.windowDarkAppearance", FlatLaf.isLafDark() );
}
@Override
protected void uninstallDefaults( JRootPane c ) {
super.uninstallDefaults( c );
// uninstall background, foreground and font because not all Lafs set them
if( c.isBackgroundSet() && c.getBackground() instanceof UIResource )
c.setBackground( null );
if( c.isForegroundSet() && c.getForeground() instanceof UIResource )
c.setForeground( null );
if( c.isFontSet() && c.getFont() instanceof UIResource )
c.setFont( null );
}
@Override
protected void installListeners( JRootPane root ) {
super.installListeners( root );

View File

@@ -21,6 +21,7 @@ import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Map;
import javax.swing.JComponent;
@@ -28,6 +29,7 @@ import javax.swing.JSeparator;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicSeparatorUI;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable;
import com.formdev.flatlaf.ui.FlatStylingSupport.StyleableUI;
import com.formdev.flatlaf.util.LoggingFacade;
@@ -50,7 +52,7 @@ import com.formdev.flatlaf.util.LoggingFacade;
*/
public class FlatSeparatorUI
extends BasicSeparatorUI
implements StyleableUI
implements StyleableUI, PropertyChangeListener
{
@Styleable protected int height;
@Styleable protected int stripeWidth;
@@ -58,7 +60,6 @@ public class FlatSeparatorUI
private final boolean shared;
private boolean defaults_initialized = false;
private PropertyChangeListener propertyChangeListener;
private Map<String, Object> oldStyleValues;
public static ComponentUI createUI( JComponent c ) {
@@ -109,28 +110,33 @@ public class FlatSeparatorUI
protected void installListeners( JSeparator s ) {
super.installListeners( s );
propertyChangeListener = FlatStylingSupport.createPropertyChangeListener(
s, () -> stylePropertyChange( s ), null );
s.addPropertyChangeListener( propertyChangeListener );
s.addPropertyChangeListener( this );
}
@Override
protected void uninstallListeners( JSeparator s ) {
super.uninstallListeners( s );
s.removePropertyChangeListener( propertyChangeListener );
propertyChangeListener = null;
s.removePropertyChangeListener( this );
}
private void stylePropertyChange( JSeparator s ) {
if( shared && FlatStylingSupport.hasStyleProperty( s ) ) {
// unshare component UI if necessary
// updateUI() invokes installStyle() from installUI()
s.updateUI();
} else
installStyle( s );
s.revalidate();
s.repaint();
/** @since 2.0.1 */
@Override
public void propertyChange( PropertyChangeEvent e ) {
switch( e.getPropertyName() ) {
case FlatClientProperties.STYLE:
case FlatClientProperties.STYLE_CLASS:
JSeparator s = (JSeparator) e.getSource();
if( shared && FlatStylingSupport.hasStyleProperty( s ) ) {
// unshare component UI if necessary
// updateUI() invokes installStyle() from installUI()
s.updateUI();
} else
installStyle( s );
s.revalidate();
s.repaint();
break;
}
}
/** @since 2 */

View File

@@ -764,6 +764,7 @@ debug*/
/** @since 2 */
protected JComponent createClearButton() {
JButton button = new JButton();
button.setName( "TextField.clearButton" );
button.putClientProperty( STYLE_CLASS, "clearButton" );
button.putClientProperty( BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON );
button.setCursor( Cursor.getDefaultCursor() );
@@ -825,15 +826,20 @@ debug*/
/** @since 2 */
protected void prepareLeadingOrTrailingComponent( JComponent c ) {
c.putClientProperty( STYLE_CLASS, "inTextField" );
c.setCursor( Cursor.getDefaultCursor() );
if( c instanceof JButton || c instanceof JToggleButton )
if( c instanceof JButton || c instanceof JToggleButton ) {
c.putClientProperty( BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON );
else if( c instanceof JToolBar ) {
if( !c.isCursorSet() )
c.setCursor( Cursor.getDefaultCursor() );
} else if( c instanceof JToolBar ) {
for( Component child : c.getComponents() ) {
if( child instanceof JComponent )
((JComponent)child).putClientProperty( STYLE_CLASS, "inTextField" );
}
if( !c.isCursorSet() )
c.setCursor( Cursor.getDefaultCursor() );
}
}
@@ -937,6 +943,7 @@ debug*/
((LayoutManager2)delegate).invalidateLayout( target );
}
}
//---- class FlatDocumentListener -----------------------------------------
private class FlatDocumentListener

View File

@@ -854,7 +854,7 @@ debug*/
} else if( borderColor != null && (rootPane.getJMenuBar() == null || !rootPane.getJMenuBar().isVisible()) )
insets.bottom += UIScale.scale( 1 );
if( hasNativeCustomDecoration() && !isWindowMaximized( c ) )
if( !SystemInfo.isWindows_11_orLater && hasNativeCustomDecoration() && !isWindowMaximized( c ) )
insets = FlatUIUtils.addInsets( insets, WindowTopBorder.getInstance().getBorderInsets() );
return insets;
@@ -873,7 +873,7 @@ debug*/
FlatUIUtils.paintFilledRectangle( g, borderColor, x, y + height - lineHeight, width, lineHeight );
}
if( hasNativeCustomDecoration() && !isWindowMaximized( c ) )
if( !SystemInfo.isWindows_11_orLater && hasNativeCustomDecoration() && !isWindowMaximized( c ) )
WindowTopBorder.getInstance().paintBorder( c, g, x, y, width, height );
}
@@ -966,7 +966,7 @@ debug*/
activeChanged( true );
updateNativeTitleBarHeightAndHitTestSpots();
if( hasNativeCustomDecoration() )
if( !SystemInfo.isWindows_11_orLater && hasNativeCustomDecoration() )
WindowTopBorder.getInstance().repaintBorder( FlatTitlePane.this );
repaintWindowBorder();
@@ -977,7 +977,7 @@ debug*/
activeChanged( false );
updateNativeTitleBarHeightAndHitTestSpots();
if( hasNativeCustomDecoration() )
if( !SystemInfo.isWindows_11_orLater && hasNativeCustomDecoration() )
WindowTopBorder.getInstance().repaintBorder( FlatTitlePane.this );
repaintWindowBorder();

View File

@@ -22,6 +22,7 @@ import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Map;
import javax.swing.JComponent;
@@ -31,6 +32,7 @@ import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicToolBarSeparatorUI;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable;
import com.formdev.flatlaf.ui.FlatStylingSupport.StyleableUI;
import com.formdev.flatlaf.util.LoggingFacade;
@@ -47,7 +49,7 @@ import com.formdev.flatlaf.util.LoggingFacade;
*/
public class FlatToolBarSeparatorUI
extends BasicToolBarSeparatorUI
implements StyleableUI
implements StyleableUI, PropertyChangeListener
{
private static final int LINE_WIDTH = 1;
@@ -56,7 +58,6 @@ public class FlatToolBarSeparatorUI
private final boolean shared;
private boolean defaults_initialized = false;
private PropertyChangeListener propertyChangeListener;
private Map<String, Object> oldStyleValues;
public static ComponentUI createUI( JComponent c ) {
@@ -105,28 +106,33 @@ public class FlatToolBarSeparatorUI
protected void installListeners( JSeparator s ) {
super.installListeners( s );
propertyChangeListener = FlatStylingSupport.createPropertyChangeListener(
s, () -> stylePropertyChange( s ), null );
s.addPropertyChangeListener( propertyChangeListener );
s.addPropertyChangeListener( this );
}
@Override
protected void uninstallListeners( JSeparator s ) {
super.uninstallListeners( s );
s.removePropertyChangeListener( propertyChangeListener );
propertyChangeListener = null;
s.removePropertyChangeListener( this );
}
private void stylePropertyChange( JSeparator s ) {
if( shared && FlatStylingSupport.hasStyleProperty( s ) ) {
// unshare component UI if necessary
// updateUI() invokes installStyle() from installUI()
s.updateUI();
} else
installStyle( s );
s.revalidate();
s.repaint();
/** @since 2.0.1 */
@Override
public void propertyChange( PropertyChangeEvent e ) {
switch( e.getPropertyName() ) {
case FlatClientProperties.STYLE:
case FlatClientProperties.STYLE_CLASS:
JSeparator s = (JSeparator) e.getSource();
if( shared && FlatStylingSupport.hasStyleProperty( s ) ) {
// unshare component UI if necessary
// updateUI() invokes installStyle() from installUI()
s.updateUI();
} else
installStyle( s );
s.revalidate();
s.repaint();
break;
}
}
/** @since 2 */

View File

@@ -21,6 +21,7 @@ import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.List;
import javax.swing.JComponent;
@@ -49,9 +50,8 @@ import com.formdev.flatlaf.util.StringUtils;
*/
public class FlatToolTipUI
extends BasicToolTipUI
implements PropertyChangeListener
{
private static PropertyChangeListener sharedPropertyChangedListener;
public static ComponentUI createUI( JComponent c ) {
return FlatUIUtils.createSharedUI( FlatToolTipUI.class, FlatToolTipUI::new );
}
@@ -68,24 +68,24 @@ public class FlatToolTipUI
protected void installListeners( JComponent c ) {
super.installListeners( c );
if( sharedPropertyChangedListener == null ) {
sharedPropertyChangedListener = e -> {
String name = e.getPropertyName();
if( name == "tiptext" || name == "font" || name == "foreground" ) {
JToolTip toolTip = (JToolTip) e.getSource();
FlatLabelUI.updateHTMLRenderer( toolTip, toolTip.getTipText(), false );
}
};
}
c.addPropertyChangeListener( sharedPropertyChangedListener );
c.addPropertyChangeListener( this );
}
@Override
protected void uninstallListeners( JComponent c ) {
super.uninstallListeners( c );
c.removePropertyChangeListener( sharedPropertyChangedListener );
c.removePropertyChangeListener( this );
}
/** @since 2.0.1 */
@Override
public void propertyChange( PropertyChangeEvent e ) {
String name = e.getPropertyName();
if( name == "tiptext" || name == "font" || name == "foreground" ) {
JToolTip toolTip = (JToolTip) e.getSource();
FlatLabelUI.updateHTMLRenderer( toolTip, toolTip.getTipText(), false );
}
}
@Override

View File

@@ -27,6 +27,7 @@ import java.awt.Window;
import java.awt.geom.AffineTransform;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.List;
@@ -37,6 +38,7 @@ import javax.swing.Timer;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
import com.formdev.flatlaf.FlatSystemProperties;
import com.formdev.flatlaf.util.LoggingFacade;
import com.formdev.flatlaf.util.NativeLibrary;
import com.formdev.flatlaf.util.SystemInfo;
@@ -114,11 +116,7 @@ class FlatWindowsNativeWindowBorder
}
}
String libraryName = "com/formdev/flatlaf/natives/flatlaf-windows-x86";
if( SystemInfo.isX86_64 )
libraryName += "_64";
nativeLibrary = new NativeLibrary( libraryName, null, true );
nativeLibrary = createNativeLibrary();
}
// check whether native library was successfully loaded
@@ -131,6 +129,23 @@ class FlatWindowsNativeWindowBorder
return instance;
}
private static NativeLibrary createNativeLibrary() {
String libraryName = "flatlaf-windows-x86";
if( SystemInfo.isX86_64 )
libraryName += "_64";
String libraryPath = System.getProperty( FlatSystemProperties.NATIVE_LIBRARY_PATH );
if( libraryPath != null ) {
File libraryFile = new File( libraryPath, libraryName + ".dll" );
if( libraryFile.exists() )
return new NativeLibrary( libraryFile, true );
else
LoggingFacade.INSTANCE.logSevere( "Did not find external library " + libraryFile + ", using extracted library instead", null );
}
return new NativeLibrary( "com/formdev/flatlaf/natives/" + libraryName, null, true );
}
private FlatWindowsNativeWindowBorder() {
}

View File

@@ -298,7 +298,7 @@ public class JBRCustomDecorations
}
private void paintImpl( Graphics2D g, int x, int y, int width, int height, double scaleFactor ) {
g.drawRect( x, y, width - 1, 0 );
g.fillRect( x, y, width, 1 );
}
void repaintBorder( Component c ) {

View File

@@ -122,6 +122,8 @@ public class ColorFunctions
return color1;
if( weight <= 0 )
return color2;
if( color1.equals( color2 ) )
return color1;
int r1 = color1.getRed();
int g1 = color1.getGreen();
@@ -196,6 +198,9 @@ public class ColorFunctions
: (float) Math.pow( (value + 0.055) / 1.055, 2.4 );
}
/**
* Applies the given color functions to the given color and returns the new color.
*/
public static Color applyFunctions( Color color, ColorFunction... functions ) {
// if having only a single function of type Mix, then avoid four unnecessary conversions:
// 1. RGB to HSL in this method
@@ -221,6 +226,9 @@ public class ColorFunctions
return HSLColor.toRGB( hsla[0], hsla[1], hsla[2], hsla[3] / 100 );
}
/**
* Clamps the given value between 0 and 100.
*/
public static float clamp( float value ) {
return (value < 0)
? 0

View File

@@ -60,6 +60,19 @@ public class NativeLibrary
: false;
}
/**
* Load native library from given file.
*
* @param libraryFile the file of the native library
* @param supported whether the native library is supported on the current platform
* @since 2
*/
public NativeLibrary( File libraryFile, boolean supported ) {
this.loaded = supported
? loadLibraryFromFile( libraryFile )
: false;
}
/**
* Returns whether the native library is loaded.
* <p>
@@ -120,6 +133,16 @@ public class NativeLibrary
}
}
private boolean loadLibraryFromFile( File libraryFile ) {
try {
System.load( libraryFile.getAbsolutePath() );
return true;
} catch( Throwable ex ) {
log( null, ex );
return false;
}
}
private static String decorateLibraryName( String libraryName ) {
if( SystemInfo.isWindows )
return libraryName.concat( ".dll" );

View File

@@ -0,0 +1,50 @@
/*
* Copyright 2022 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formdev.flatlaf.util;
import java.awt.Component;
import java.awt.Container;
/**
* Utility methods for Swing.
*
* @author Karl Tauber
* @since 2
*/
public class SwingUtils
{
/**
* Search for a (grand) child component with the given name.
*
* @return a component; or {@code null}
*/
@SuppressWarnings( "unchecked" )
public static <T extends Component> T getComponentByName( Container parent, String name ) {
for( Component child : parent.getComponents() ) {
if( name.equals( child.getName() ) )
return (T) child;
if( child instanceof Container ) {
T c = getComponentByName( (Container) child, name );
if( c != null )
return c;
}
}
return null;
}
}

View File

@@ -34,6 +34,9 @@ public class SystemInfo
// OS versions
public static final long osVersion;
public static final boolean isWindows_10_orLater;
/** <strong>Note</strong>: This requires Java 8u321, 11.0.14, 17.0.2 or 18 (or later).
* (see https://bugs.openjdk.java.net/browse/JDK-8274840)
* @since 2 */ public static final boolean isWindows_11_orLater;
public static final boolean isMacOS_10_11_ElCapitan_orLater;
public static final boolean isMacOS_10_14_Mojave_orLater;
public static final boolean isMacOS_10_15_Catalina_orLater;
@@ -49,6 +52,7 @@ public class SystemInfo
public static final boolean isJava_11_orLater;
public static final boolean isJava_15_orLater;
/** @since 2 */ public static final boolean isJava_17_orLater;
/** @since 2 */ public static final boolean isJava_18_orLater;
// Java VMs
public static final boolean isJetBrainsJVM;
@@ -72,6 +76,8 @@ public class SystemInfo
// OS versions
osVersion = scanVersion( System.getProperty( "os.version" ) );
isWindows_10_orLater = (isWindows && osVersion >= toVersion( 10, 0, 0, 0 ));
isWindows_11_orLater = (isWindows_10_orLater && osName.length() > "windows ".length() &&
scanVersion( osName.substring( "windows ".length() ) ) >= toVersion( 11, 0, 0, 0 ));
isMacOS_10_11_ElCapitan_orLater = (isMacOS && osVersion >= toVersion( 10, 11, 0, 0 ));
isMacOS_10_14_Mojave_orLater = (isMacOS && osVersion >= toVersion( 10, 14, 0, 0 ));
isMacOS_10_15_Catalina_orLater = (isMacOS && osVersion >= toVersion( 10, 15, 0, 0 ));
@@ -88,6 +94,7 @@ public class SystemInfo
isJava_11_orLater = (javaVersion >= toVersion( 11, 0, 0, 0 ));
isJava_15_orLater = (javaVersion >= toVersion( 15, 0, 0, 0 ));
isJava_17_orLater = (javaVersion >= toVersion( 17, 0, 0, 0 ));
isJava_18_orLater = (javaVersion >= toVersion( 18, 0, 0, 0 ));
// Java VMs
isJetBrainsJVM = System.getProperty( "java.vm.vendor", "Unknown" )

View File

@@ -289,7 +289,7 @@ Slider.trackValueColor = @accentSliderColor
Slider.trackColor = lighten(@background,15%)
Slider.thumbColor = $Slider.trackValueColor
Slider.tickColor = @disabledForeground
Slider.focusedColor = fade($Component.focusColor,70%,derived)
Slider.focusedColor = fade(changeLightness($Component.focusColor,60%,derived),30%,derived)
Slider.hoverThumbColor = lighten($Slider.thumbColor,5%,derived)
Slider.pressedThumbColor = lighten($Slider.thumbColor,8%,derived)
Slider.disabledTrackColor = lighten(@background,10%)
@@ -334,8 +334,8 @@ TableHeader.bottomSeparatorColor = $TableHeader.separatorColor
#---- TitlePane ----
TitlePane.embeddedForeground = darken($TitlePane.foreground,15%)
TitlePane.buttonHoverBackground = lighten($TitlePane.background,10%,derived)
TitlePane.buttonPressedBackground = lighten($TitlePane.background,20%,derived)
TitlePane.buttonHoverBackground = lighten($TitlePane.background,15%,derived)
TitlePane.buttonPressedBackground = lighten($TitlePane.background,10%,derived)
#---- ToggleButton ----
@@ -367,7 +367,6 @@ Tree.hash = lighten($Tree.background,5%)
focusable: false; \
toolbar.margin: 1,1,1,1; \
toolbar.spacingInsets: 1,1,1,1; \
background: $TextField.background; \
toolbar.hoverBackground: lighten($TextField.background,4%,derived); \
toolbar.pressedBackground: lighten($TextField.background,6%,derived); \
toolbar.selectedBackground: lighten($TextField.background,12%,derived)
toolbar.hoverBackground: fade(Actions.GreyInline,30%,lazy); \
toolbar.pressedBackground: fade(Actions.GreyInline,40%,lazy); \
toolbar.selectedBackground: fade(Actions.GreyInline,50%,lazy)

View File

@@ -589,13 +589,13 @@ ScrollPane.smoothScrolling = true
#---- SearchField ----
SearchField.searchIconColor = fadeout(Actions.GreyInline,10%,lazy)
SearchField.searchIconHoverColor = fadeout(Actions.GreyInline,30%,lazy)
SearchField.searchIconPressedColor = fadeout(Actions.GreyInline,50%,lazy)
SearchField.searchIconColor = fade(Actions.GreyInline,90%,lazy)
SearchField.searchIconHoverColor = fade(Actions.GreyInline,70%,lazy)
SearchField.searchIconPressedColor = fade(Actions.GreyInline,50%,lazy)
SearchField.clearIconColor = fadeout(Actions.GreyInline,50%,lazy)
SearchField.clearIconColor = fade(Actions.GreyInline,50%,lazy)
SearchField.clearIconHoverColor = $SearchField.clearIconColor
SearchField.clearIconPressedColor = fadeout(Actions.GreyInline,20%,lazy)
SearchField.clearIconPressedColor = fade(Actions.GreyInline,80%,lazy)
#---- Separator ----
@@ -802,8 +802,8 @@ TitlePane.inactiveBackground = $TitlePane.background
TitlePane.foreground = @foreground
TitlePane.inactiveForeground = @disabledForeground
TitlePane.closeHoverBackground = #e81123
TitlePane.closePressedBackground = fade($TitlePane.closeHoverBackground,60%)
TitlePane.closeHoverBackground = #c42b1c
TitlePane.closePressedBackground = fade($TitlePane.closeHoverBackground,90%)
TitlePane.closeHoverForeground = #fff
TitlePane.closePressedForeground = #fff
@@ -920,6 +920,5 @@ Tree.icon.openColor = @icon
focusable: false; \
toolbar.margin: 1,1,1,1; \
toolbar.spacingInsets: 1,1,1,1; \
background: $TextField.background; \
toolbar.hoverBackground: $TextField.background; \
toolbar.pressedBackground: $TextField.background
toolbar.hoverBackground: null; \
toolbar.pressedBackground: null

View File

@@ -296,7 +296,7 @@ Slider.trackValueColor = @accentSliderColor
Slider.trackColor = darken(@background,18%)
Slider.thumbColor = $Slider.trackValueColor
Slider.tickColor = @disabledForeground
Slider.focusedColor = fade($Component.focusColor,50%,derived)
Slider.focusedColor = fade(changeLightness($Component.focusColor,75%,derived),50%,derived)
Slider.hoverThumbColor = darken($Slider.thumbColor,5%,derived)
Slider.pressedThumbColor = darken($Slider.thumbColor,8%,derived)
Slider.disabledTrackColor = darken(@background,13%)
@@ -342,7 +342,7 @@ TableHeader.bottomSeparatorColor = $TableHeader.separatorColor
TitlePane.embeddedForeground = lighten($TitlePane.foreground,35%)
TitlePane.buttonHoverBackground = darken($TitlePane.background,10%,derived)
TitlePane.buttonPressedBackground = darken($TitlePane.background,20%,derived)
TitlePane.buttonPressedBackground = darken($TitlePane.background,8%,derived)
#---- ToggleButton ----
@@ -374,7 +374,6 @@ Tree.hash = darken($Tree.background,10%)
focusable: false; \
toolbar.margin: 1,1,1,1; \
toolbar.spacingInsets: 1,1,1,1; \
background: $TextField.background; \
toolbar.hoverBackground: darken($TextField.background,4%,derived); \
toolbar.pressedBackground: darken($TextField.background,8%,derived); \
toolbar.selectedBackground: darken($TextField.background,12%,derived)
toolbar.hoverBackground: fade(Actions.GreyInline,10%,lazy); \
toolbar.pressedBackground: fade(Actions.GreyInline,20%,lazy); \
toolbar.selectedBackground: fade(Actions.GreyInline,30%,lazy)

View File

@@ -40,7 +40,7 @@ public class TestFlatStyleClasses
@BeforeAll
static void setup() {
System.setProperty( FlatSystemProperties.UI_SCALE_ENABLED, "false" );
System.setProperty( FlatSystemProperties.UI_SCALE, "1x" );
TestUtils.setup( false );
UIManager.put( "[style]Button.primary", BUTTON_PRIMARY );
@@ -100,7 +100,7 @@ public class TestFlatStyleClasses
@AfterAll
static void cleanup() {
TestUtils.cleanup();
System.clearProperty( FlatSystemProperties.UI_SCALE_ENABLED );
System.clearProperty( FlatSystemProperties.UI_SCALE );
}
@Test

View File

@@ -30,7 +30,7 @@ import com.formdev.flatlaf.FlatSystemProperties;
*/
public class TestUtils
{
public static final float[] FACTORS = new float[] { 1f }; //, 1.25f, 1.5f, 1.75f, 2f, 2.25f, 2.5f, 2.75f, 3f, 3.25f, 3.5f, 3.75f, 4f, 5f, 6f };
public static final float[] FACTORS = new float[] { 1f, 1.25f, 1.5f, 1.75f, 2f, 2.25f, 2.5f, 2.75f, 3f, 3.25f, 3.5f, 3.75f, 4f, 5f, 6f };
public static void setup( boolean withFocus ) {
System.setProperty( FlatSystemProperties.UI_SCALE, "1x" );

View File

@@ -43,6 +43,17 @@ class BasicComponentsPanel
// UIManager.put( "PasswordField.showRevealButton", true );
passwordField1.putClientProperty( FlatClientProperties.STYLE, "showRevealButton: true" );
// add leading/trailing icons to text fields
leadingIconTextField.putClientProperty( FlatClientProperties.PLACEHOLDER_TEXT, "Search" );
leadingIconTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_LEADING_ICON,
new FlatSearchIcon() );
trailingIconTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_TRAILING_ICON,
new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/DataTables.svg" ) );
iconsTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_LEADING_ICON,
new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/user.svg" ) );
iconsTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_TRAILING_ICON,
new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/bookmarkGroup.svg" ) );
// search history button
JButton searchHistoryButton = new JButton( new FlatSearchWithHistoryIcon( true ) );
searchHistoryButton.setToolTipText( "Search History" );
@@ -177,9 +188,9 @@ class BasicComponentsPanel
JComboBox<String> warningHintsComboBox = new JComboBox<>();
JSpinner warningHintsSpinner = new JSpinner();
JLabel iconsLabel = new JLabel();
JTextField leadingIconTextField = new JTextField();
JTextField trailingIconTextField = new JTextField();
JTextField iconsTextField = new JTextField();
leadingIconTextField = new JTextField();
trailingIconTextField = new JTextField();
iconsTextField = new JTextField();
JLabel compsLabel = new JLabel();
compsTextField = new JTextField();
clearTextField = new JTextField();
@@ -851,17 +862,6 @@ class BasicComponentsPanel
copyMenuItem.addActionListener( new DefaultEditorKit.CopyAction() );
pasteMenuItem.addActionListener( new DefaultEditorKit.PasteAction() );
// add leading/trailing icons to text fields
leadingIconTextField.putClientProperty( FlatClientProperties.PLACEHOLDER_TEXT, "Search" );
leadingIconTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_LEADING_ICON,
new FlatSearchIcon() );
trailingIconTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_TRAILING_ICON,
new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/DataTables.svg" ) );
iconsTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_LEADING_ICON,
new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/user.svg" ) );
iconsTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_TRAILING_ICON,
new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/bookmarkGroup.svg" ) );
if( FlatLafDemo.screenshotsMode ) {
// hide some components
Component[] hiddenComponents = {
@@ -919,6 +919,9 @@ class BasicComponentsPanel
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JPasswordField passwordField1;
private JTextField leadingIconTextField;
private JTextField trailingIconTextField;
private JTextField iconsTextField;
private JTextField compsTextField;
private JTextField clearTextField;
// JFormDesigner - End of variables declaration //GEN-END:variables

View File

@@ -659,18 +659,27 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "leadingIconTextField"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 14,growx"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "trailingIconTextField"
"text": "text"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 14,growx"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "iconsTextField"
"text": "text"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 14,growx"
} )

View File

@@ -62,10 +62,10 @@ class ControlBar
// initialize look and feels combo box
DefaultComboBoxModel<LookAndFeelInfo> lafModel = new DefaultComboBoxModel<>();
lafModel.addElement( new LookAndFeelInfo( "Flat Light (F1)", FlatLightLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "Flat Dark (F2)", FlatDarkLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "Flat IntelliJ (F3)", FlatIntelliJLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "Flat Darcula (F4)", FlatDarculaLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "FlatLaf Light (F1)", FlatLightLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "FlatLaf Dark (F2)", FlatDarkLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "FlatLaf IntelliJ (F3)", FlatIntelliJLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "FlatLaf Darcula (F4)", FlatDarculaLaf.class.getName() ) );
UIManager.LookAndFeelInfo[] lookAndFeels = UIManager.getInstalledLookAndFeels();
for( UIManager.LookAndFeelInfo lookAndFeel : lookAndFeels ) {

View File

@@ -412,7 +412,6 @@ class TabsPanel
cardTabTypeButton = new JToggleButton();
//======== this ========
setName("this");
setLayout(new MigLayout(
"insets dialog,hidemode 3",
// columns
@@ -426,7 +425,6 @@ class TabsPanel
//======== panel1 ========
{
panel1.setName("panel1");
panel1.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns
@@ -445,41 +443,35 @@ class TabsPanel
//---- tabPlacementLabel ----
tabPlacementLabel.setText("Tab placement");
tabPlacementLabel.putClientProperty("FlatLaf.styleClass", "h3");
tabPlacementLabel.setName("tabPlacementLabel");
panel1.add(tabPlacementLabel, "cell 0 0");
//======== tabPlacementToolBar ========
{
tabPlacementToolBar.setFloatable(false);
tabPlacementToolBar.setBorder(BorderFactory.createEmptyBorder());
tabPlacementToolBar.setName("tabPlacementToolBar");
//---- topPlacementButton ----
topPlacementButton.setText("top");
topPlacementButton.setSelected(true);
topPlacementButton.putClientProperty("FlatLaf.styleClass", "small");
topPlacementButton.setName("topPlacementButton");
topPlacementButton.addActionListener(e -> tabPlacementChanged());
tabPlacementToolBar.add(topPlacementButton);
//---- bottomPlacementButton ----
bottomPlacementButton.setText("bottom");
bottomPlacementButton.putClientProperty("FlatLaf.styleClass", "small");
bottomPlacementButton.setName("bottomPlacementButton");
bottomPlacementButton.addActionListener(e -> tabPlacementChanged());
tabPlacementToolBar.add(bottomPlacementButton);
//---- leftPlacementButton ----
leftPlacementButton.setText("left");
leftPlacementButton.putClientProperty("FlatLaf.styleClass", "small");
leftPlacementButton.setName("leftPlacementButton");
leftPlacementButton.addActionListener(e -> tabPlacementChanged());
tabPlacementToolBar.add(leftPlacementButton);
//---- rightPlacementButton ----
rightPlacementButton.setText("right");
rightPlacementButton.putClientProperty("FlatLaf.styleClass", "small");
rightPlacementButton.setName("rightPlacementButton");
rightPlacementButton.addActionListener(e -> tabPlacementChanged());
tabPlacementToolBar.add(rightPlacementButton);
tabPlacementToolBar.addSeparator();
@@ -487,49 +479,38 @@ class TabsPanel
//---- scrollButton ----
scrollButton.setText("scroll");
scrollButton.putClientProperty("FlatLaf.styleClass", "small");
scrollButton.setName("scrollButton");
scrollButton.addActionListener(e -> scrollChanged());
tabPlacementToolBar.add(scrollButton);
//---- borderButton ----
borderButton.setText("border");
borderButton.putClientProperty("FlatLaf.styleClass", "small");
borderButton.setName("borderButton");
borderButton.addActionListener(e -> borderChanged());
tabPlacementToolBar.add(borderButton);
}
panel1.add(tabPlacementToolBar, "cell 0 0,alignx right,growx 0");
//======== tabPlacementTabbedPane ========
{
tabPlacementTabbedPane.setName("tabPlacementTabbedPane");
}
panel1.add(tabPlacementTabbedPane, "cell 0 1,width 300:300,height 100:100");
//---- tabLayoutLabel ----
tabLayoutLabel.setText("Tab layout");
tabLayoutLabel.putClientProperty("FlatLaf.styleClass", "h3");
tabLayoutLabel.setName("tabLayoutLabel");
panel1.add(tabLayoutLabel, "cell 0 2");
//======== tabLayoutToolBar ========
{
tabLayoutToolBar.setFloatable(false);
tabLayoutToolBar.setBorder(BorderFactory.createEmptyBorder());
tabLayoutToolBar.setName("tabLayoutToolBar");
//---- scrollTabLayoutButton ----
scrollTabLayoutButton.setText("scroll");
scrollTabLayoutButton.setSelected(true);
scrollTabLayoutButton.putClientProperty("FlatLaf.styleClass", "small");
scrollTabLayoutButton.setName("scrollTabLayoutButton");
scrollTabLayoutButton.addActionListener(e -> tabLayoutChanged());
tabLayoutToolBar.add(scrollTabLayoutButton);
//---- wrapTabLayoutButton ----
wrapTabLayoutButton.setText("wrap");
wrapTabLayoutButton.putClientProperty("FlatLaf.styleClass", "small");
wrapTabLayoutButton.setName("wrapTabLayoutButton");
wrapTabLayoutButton.addActionListener(e -> tabLayoutChanged());
tabLayoutToolBar.add(wrapTabLayoutButton);
}
@@ -539,87 +520,62 @@ class TabsPanel
scrollLayoutNoteLabel.setText("(use mouse wheel to scroll; arrow button shows hidden tabs)");
scrollLayoutNoteLabel.setEnabled(false);
scrollLayoutNoteLabel.putClientProperty("FlatLaf.styleClass", "small");
scrollLayoutNoteLabel.setName("scrollLayoutNoteLabel");
panel1.add(scrollLayoutNoteLabel, "cell 0 3");
//---- wrapLayoutNoteLabel ----
wrapLayoutNoteLabel.setText("(probably better to use scroll layout?)");
wrapLayoutNoteLabel.setEnabled(false);
wrapLayoutNoteLabel.putClientProperty("FlatLaf.styleClass", "small");
wrapLayoutNoteLabel.setName("wrapLayoutNoteLabel");
panel1.add(wrapLayoutNoteLabel, "cell 0 3");
//======== scrollLayoutTabbedPane ========
{
scrollLayoutTabbedPane.setName("scrollLayoutTabbedPane");
}
panel1.add(scrollLayoutTabbedPane, "cell 0 4");
//======== wrapLayoutTabbedPane ========
{
wrapLayoutTabbedPane.setName("wrapLayoutTabbedPane");
}
panel1.add(wrapLayoutTabbedPane, "cell 0 4,width 100:100,height pref*2px");
//---- closableTabsLabel ----
closableTabsLabel.setText("Closable tabs");
closableTabsLabel.putClientProperty("FlatLaf.styleClass", "h3");
closableTabsLabel.setName("closableTabsLabel");
panel1.add(closableTabsLabel, "cell 0 5");
//======== closableTabsToolBar ========
{
closableTabsToolBar.setFloatable(false);
closableTabsToolBar.setBorder(BorderFactory.createEmptyBorder());
closableTabsToolBar.setName("closableTabsToolBar");
//---- squareCloseButton ----
squareCloseButton.setText("square");
squareCloseButton.setSelected(true);
squareCloseButton.putClientProperty("FlatLaf.styleClass", "small");
squareCloseButton.setName("squareCloseButton");
squareCloseButton.addActionListener(e -> closeButtonStyleChanged());
closableTabsToolBar.add(squareCloseButton);
//---- circleCloseButton ----
circleCloseButton.setText("circle");
circleCloseButton.putClientProperty("FlatLaf.styleClass", "small");
circleCloseButton.setName("circleCloseButton");
circleCloseButton.addActionListener(e -> closeButtonStyleChanged());
closableTabsToolBar.add(circleCloseButton);
//---- redCrossCloseButton ----
redCrossCloseButton.setText("red cross");
redCrossCloseButton.putClientProperty("FlatLaf.styleClass", "small");
redCrossCloseButton.setName("redCrossCloseButton");
redCrossCloseButton.addActionListener(e -> closeButtonStyleChanged());
closableTabsToolBar.add(redCrossCloseButton);
}
panel1.add(closableTabsToolBar, "cell 0 5,alignx right,growx 0");
//======== closableTabsTabbedPane ========
{
closableTabsTabbedPane.setName("closableTabsTabbedPane");
}
panel1.add(closableTabsTabbedPane, "cell 0 6");
//---- tabAreaComponentsLabel ----
tabAreaComponentsLabel.setText("Custom tab area components");
tabAreaComponentsLabel.putClientProperty("FlatLaf.styleClass", "h3");
tabAreaComponentsLabel.setName("tabAreaComponentsLabel");
panel1.add(tabAreaComponentsLabel, "cell 0 7");
//======== tabAreaComponentsToolBar ========
{
tabAreaComponentsToolBar.setFloatable(false);
tabAreaComponentsToolBar.setBorder(BorderFactory.createEmptyBorder());
tabAreaComponentsToolBar.setName("tabAreaComponentsToolBar");
//---- leadingComponentButton ----
leadingComponentButton.setText("leading");
leadingComponentButton.setSelected(true);
leadingComponentButton.putClientProperty("FlatLaf.styleClass", "small");
leadingComponentButton.setName("leadingComponentButton");
leadingComponentButton.addActionListener(e -> customComponentsChanged());
tabAreaComponentsToolBar.add(leadingComponentButton);
@@ -627,23 +583,16 @@ class TabsPanel
trailingComponentButton.setText("trailing");
trailingComponentButton.setSelected(true);
trailingComponentButton.putClientProperty("FlatLaf.styleClass", "small");
trailingComponentButton.setName("trailingComponentButton");
trailingComponentButton.addActionListener(e -> customComponentsChanged());
tabAreaComponentsToolBar.add(trailingComponentButton);
}
panel1.add(tabAreaComponentsToolBar, "cell 0 7,alignx right,growx 0");
//======== customComponentsTabbedPane ========
{
customComponentsTabbedPane.setName("customComponentsTabbedPane");
}
panel1.add(customComponentsTabbedPane, "cell 0 8");
}
add(panel1, "cell 0 0");
//======== panel2 ========
{
panel2.setName("panel2");
panel2.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns
@@ -665,82 +614,37 @@ class TabsPanel
//---- tabIconPlacementLabel ----
tabIconPlacementLabel.setText("Tab icon placement");
tabIconPlacementLabel.putClientProperty("FlatLaf.styleClass", "h3");
tabIconPlacementLabel.setName("tabIconPlacementLabel");
panel2.add(tabIconPlacementLabel, "cell 0 0");
//---- tabIconPlacementNodeLabel ----
tabIconPlacementNodeLabel.setText("(top/bottom/leading/trailing)");
tabIconPlacementNodeLabel.setEnabled(false);
tabIconPlacementNodeLabel.putClientProperty("FlatLaf.styleClass", "small");
tabIconPlacementNodeLabel.setName("tabIconPlacementNodeLabel");
panel2.add(tabIconPlacementNodeLabel, "cell 0 1");
//======== iconTopTabbedPane ========
{
iconTopTabbedPane.setName("iconTopTabbedPane");
}
panel2.add(iconTopTabbedPane, "cell 0 2");
//======== iconBottomTabbedPane ========
{
iconBottomTabbedPane.setName("iconBottomTabbedPane");
}
panel2.add(iconBottomTabbedPane, "cell 0 3");
//======== iconLeadingTabbedPane ========
{
iconLeadingTabbedPane.setName("iconLeadingTabbedPane");
}
panel2.add(iconLeadingTabbedPane, "cell 0 4");
//======== iconTrailingTabbedPane ========
{
iconTrailingTabbedPane.setName("iconTrailingTabbedPane");
}
panel2.add(iconTrailingTabbedPane, "cell 0 5");
//---- tabAreaAlignmentLabel ----
tabAreaAlignmentLabel.setText("Tab area alignment");
tabAreaAlignmentLabel.putClientProperty("FlatLaf.styleClass", "h3");
tabAreaAlignmentLabel.setName("tabAreaAlignmentLabel");
panel2.add(tabAreaAlignmentLabel, "cell 0 6");
//---- tabAreaAlignmentNoteLabel ----
tabAreaAlignmentNoteLabel.setText("(leading/center/trailing/fill)");
tabAreaAlignmentNoteLabel.setEnabled(false);
tabAreaAlignmentNoteLabel.putClientProperty("FlatLaf.styleClass", "small");
tabAreaAlignmentNoteLabel.setName("tabAreaAlignmentNoteLabel");
panel2.add(tabAreaAlignmentNoteLabel, "cell 0 7");
//======== alignLeadingTabbedPane ========
{
alignLeadingTabbedPane.setName("alignLeadingTabbedPane");
}
panel2.add(alignLeadingTabbedPane, "cell 0 8");
//======== alignCenterTabbedPane ========
{
alignCenterTabbedPane.setName("alignCenterTabbedPane");
}
panel2.add(alignCenterTabbedPane, "cell 0 9");
//======== alignTrailingTabbedPane ========
{
alignTrailingTabbedPane.setName("alignTrailingTabbedPane");
}
panel2.add(alignTrailingTabbedPane, "cell 0 10");
//======== alignFillTabbedPane ========
{
alignFillTabbedPane.setName("alignFillTabbedPane");
}
panel2.add(alignFillTabbedPane, "cell 0 11");
}
add(panel2, "cell 1 0,growy");
//======== panel3 ========
{
panel3.setName("panel3");
panel3.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns
@@ -760,61 +664,31 @@ class TabsPanel
//---- tabWidthModeLabel ----
tabWidthModeLabel.setText("Tab width mode");
tabWidthModeLabel.putClientProperty("FlatLaf.styleClass", "h3");
tabWidthModeLabel.setName("tabWidthModeLabel");
panel3.add(tabWidthModeLabel, "cell 0 0");
//---- tabWidthModeNoteLabel ----
tabWidthModeNoteLabel.setText("(preferred/equal/compact)");
tabWidthModeNoteLabel.setEnabled(false);
tabWidthModeNoteLabel.putClientProperty("FlatLaf.styleClass", "small");
tabWidthModeNoteLabel.setName("tabWidthModeNoteLabel");
panel3.add(tabWidthModeNoteLabel, "cell 0 1");
//======== widthPreferredTabbedPane ========
{
widthPreferredTabbedPane.setName("widthPreferredTabbedPane");
}
panel3.add(widthPreferredTabbedPane, "cell 0 2");
//======== widthEqualTabbedPane ========
{
widthEqualTabbedPane.setName("widthEqualTabbedPane");
}
panel3.add(widthEqualTabbedPane, "cell 0 3");
//======== widthCompactTabbedPane ========
{
widthCompactTabbedPane.setName("widthCompactTabbedPane");
}
panel3.add(widthCompactTabbedPane, "cell 0 4");
//---- minMaxTabWidthLabel ----
minMaxTabWidthLabel.setText("Minimum/maximum tab width");
minMaxTabWidthLabel.putClientProperty("FlatLaf.styleClass", "h3");
minMaxTabWidthLabel.setName("minMaxTabWidthLabel");
panel3.add(minMaxTabWidthLabel, "cell 0 5");
//======== minimumTabWidthTabbedPane ========
{
minimumTabWidthTabbedPane.setName("minimumTabWidthTabbedPane");
}
panel3.add(minimumTabWidthTabbedPane, "cell 0 6");
//======== maximumTabWidthTabbedPane ========
{
maximumTabWidthTabbedPane.setName("maximumTabWidthTabbedPane");
}
panel3.add(maximumTabWidthTabbedPane, "cell 0 7");
//---- tabAlignmentLabel ----
tabAlignmentLabel.setText("Tab title alignment");
tabAlignmentLabel.putClientProperty("FlatLaf.styleClass", "h3");
tabAlignmentLabel.setName("tabAlignmentLabel");
panel3.add(tabAlignmentLabel, "cell 0 8");
//======== panel5 ========
{
panel5.setName("panel5");
panel5.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns
@@ -830,52 +704,30 @@ class TabsPanel
tabAlignmentNoteLabel.setText("(leading/center/trailing)");
tabAlignmentNoteLabel.setEnabled(false);
tabAlignmentNoteLabel.putClientProperty("FlatLaf.styleClass", "small");
tabAlignmentNoteLabel.setName("tabAlignmentNoteLabel");
panel5.add(tabAlignmentNoteLabel, "cell 0 0");
//---- tabAlignmentNoteLabel2 ----
tabAlignmentNoteLabel2.setText("(trailing)");
tabAlignmentNoteLabel2.setEnabled(false);
tabAlignmentNoteLabel2.putClientProperty("FlatLaf.styleClass", "small");
tabAlignmentNoteLabel2.setName("tabAlignmentNoteLabel2");
panel5.add(tabAlignmentNoteLabel2, "cell 1 0,alignx right,growx 0");
//======== tabAlignLeadingTabbedPane ========
{
tabAlignLeadingTabbedPane.setName("tabAlignLeadingTabbedPane");
}
panel5.add(tabAlignLeadingTabbedPane, "cell 0 1");
//======== tabAlignVerticalTabbedPane ========
{
tabAlignVerticalTabbedPane.setTabPlacement(SwingConstants.LEFT);
tabAlignVerticalTabbedPane.setName("tabAlignVerticalTabbedPane");
}
panel5.add(tabAlignVerticalTabbedPane, "cell 1 1 1 3,growy");
//======== tabAlignCenterTabbedPane ========
{
tabAlignCenterTabbedPane.setName("tabAlignCenterTabbedPane");
}
panel5.add(tabAlignCenterTabbedPane, "cell 0 2");
//======== tabAlignTrailingTabbedPane ========
{
tabAlignTrailingTabbedPane.setName("tabAlignTrailingTabbedPane");
}
panel5.add(tabAlignTrailingTabbedPane, "cell 0 3");
}
panel3.add(panel5, "cell 0 9");
}
add(panel3, "cell 2 0");
//---- separator2 ----
separator2.setName("separator2");
add(separator2, "cell 0 1 3 1");
//======== panel4 ========
{
panel4.setName("panel4");
panel4.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns
@@ -890,34 +742,29 @@ class TabsPanel
//---- scrollButtonsPolicyLabel ----
scrollButtonsPolicyLabel.setText("Scroll buttons policy:");
scrollButtonsPolicyLabel.setName("scrollButtonsPolicyLabel");
panel4.add(scrollButtonsPolicyLabel, "cell 0 0");
//======== scrollButtonsPolicyToolBar ========
{
scrollButtonsPolicyToolBar.setFloatable(false);
scrollButtonsPolicyToolBar.setBorder(BorderFactory.createEmptyBorder());
scrollButtonsPolicyToolBar.setName("scrollButtonsPolicyToolBar");
//---- scrollAsNeededSingleButton ----
scrollAsNeededSingleButton.setText("asNeededSingle");
scrollAsNeededSingleButton.setSelected(true);
scrollAsNeededSingleButton.putClientProperty("FlatLaf.styleClass", "small");
scrollAsNeededSingleButton.setName("scrollAsNeededSingleButton");
scrollAsNeededSingleButton.addActionListener(e -> scrollButtonsPolicyChanged());
scrollButtonsPolicyToolBar.add(scrollAsNeededSingleButton);
//---- scrollAsNeededButton ----
scrollAsNeededButton.setText("asNeeded");
scrollAsNeededButton.putClientProperty("FlatLaf.styleClass", "small");
scrollAsNeededButton.setName("scrollAsNeededButton");
scrollAsNeededButton.addActionListener(e -> scrollButtonsPolicyChanged());
scrollButtonsPolicyToolBar.add(scrollAsNeededButton);
//---- scrollNeverButton ----
scrollNeverButton.setText("never");
scrollNeverButton.putClientProperty("FlatLaf.styleClass", "small");
scrollNeverButton.setName("scrollNeverButton");
scrollNeverButton.addActionListener(e -> scrollButtonsPolicyChanged());
scrollButtonsPolicyToolBar.add(scrollNeverButton);
}
@@ -925,27 +772,23 @@ class TabsPanel
//---- scrollButtonsPlacementLabel ----
scrollButtonsPlacementLabel.setText("Scroll buttons placement:");
scrollButtonsPlacementLabel.setName("scrollButtonsPlacementLabel");
panel4.add(scrollButtonsPlacementLabel, "cell 2 0");
//======== scrollButtonsPlacementToolBar ========
{
scrollButtonsPlacementToolBar.setFloatable(false);
scrollButtonsPlacementToolBar.setBorder(BorderFactory.createEmptyBorder());
scrollButtonsPlacementToolBar.setName("scrollButtonsPlacementToolBar");
//---- scrollBothButton ----
scrollBothButton.setText("both");
scrollBothButton.setSelected(true);
scrollBothButton.putClientProperty("FlatLaf.styleClass", "small");
scrollBothButton.setName("scrollBothButton");
scrollBothButton.addActionListener(e -> scrollButtonsPlacementChanged());
scrollButtonsPlacementToolBar.add(scrollBothButton);
//---- scrollTrailingButton ----
scrollTrailingButton.setText("trailing");
scrollTrailingButton.putClientProperty("FlatLaf.styleClass", "small");
scrollTrailingButton.setName("scrollTrailingButton");
scrollTrailingButton.addActionListener(e -> scrollButtonsPlacementChanged());
scrollButtonsPlacementToolBar.add(scrollTrailingButton);
}
@@ -953,33 +796,28 @@ class TabsPanel
//---- showTabSeparatorsCheckBox ----
showTabSeparatorsCheckBox.setText("Show tab separators");
showTabSeparatorsCheckBox.setName("showTabSeparatorsCheckBox");
showTabSeparatorsCheckBox.addActionListener(e -> showTabSeparatorsChanged());
panel4.add(showTabSeparatorsCheckBox, "cell 4 0");
//---- tabsPopupPolicyLabel ----
tabsPopupPolicyLabel.setText("Tabs popup policy:");
tabsPopupPolicyLabel.setName("tabsPopupPolicyLabel");
panel4.add(tabsPopupPolicyLabel, "cell 0 1");
//======== tabsPopupPolicyToolBar ========
{
tabsPopupPolicyToolBar.setFloatable(false);
tabsPopupPolicyToolBar.setBorder(BorderFactory.createEmptyBorder());
tabsPopupPolicyToolBar.setName("tabsPopupPolicyToolBar");
//---- popupAsNeededButton ----
popupAsNeededButton.setText("asNeeded");
popupAsNeededButton.setSelected(true);
popupAsNeededButton.putClientProperty("FlatLaf.styleClass", "small");
popupAsNeededButton.setName("popupAsNeededButton");
popupAsNeededButton.addActionListener(e -> tabsPopupPolicyChanged());
tabsPopupPolicyToolBar.add(popupAsNeededButton);
//---- popupNeverButton ----
popupNeverButton.setText("never");
popupNeverButton.putClientProperty("FlatLaf.styleClass", "small");
popupNeverButton.setName("popupNeverButton");
popupNeverButton.addActionListener(e -> tabsPopupPolicyChanged());
tabsPopupPolicyToolBar.add(popupNeverButton);
}
@@ -987,26 +825,22 @@ class TabsPanel
//---- tabTypeLabel ----
tabTypeLabel.setText("Tab type:");
tabTypeLabel.setName("tabTypeLabel");
panel4.add(tabTypeLabel, "cell 2 1");
//======== tabTypeToolBar ========
{
tabTypeToolBar.setFloatable(false);
tabTypeToolBar.setName("tabTypeToolBar");
//---- underlinedTabTypeButton ----
underlinedTabTypeButton.setText("underlined");
underlinedTabTypeButton.setSelected(true);
underlinedTabTypeButton.putClientProperty("FlatLaf.styleClass", "small");
underlinedTabTypeButton.setName("underlinedTabTypeButton");
underlinedTabTypeButton.addActionListener(e -> tabTypeChanged());
tabTypeToolBar.add(underlinedTabTypeButton);
//---- cardTabTypeButton ----
cardTabTypeButton.setText("card");
cardTabTypeButton.putClientProperty("FlatLaf.styleClass", "small");
cardTabTypeButton.setName("cardTabTypeButton");
cardTabTypeButton.addActionListener(e -> tabTypeChanged());
tabTypeToolBar.add(cardTabTypeButton);
}

View File

@@ -1,9 +1,8 @@
JFDML JFormDesigner: "7.0.5.0.382" Java: "16" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.5.0.404" Java: "17" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
root: new FormRoot {
"$setComponentNames": true
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets dialog,hidemode 3"
"$columnConstraints": "[grow,fill]para[fill]para[fill]"

View File

@@ -144,13 +144,13 @@ public class IJThemesPanel
// add core themes at beginning
categories.put( themes.size(), "Core Themes" );
if( showLight )
themes.add( new IJThemeInfo( "Flat Light", null, false, null, null, null, null, null, FlatLightLaf.class.getName() ) );
themes.add( new IJThemeInfo( "FlatLaf Light", null, false, null, null, null, null, null, FlatLightLaf.class.getName() ) );
if( showDark )
themes.add( new IJThemeInfo( "Flat Dark", null, true, null, null, null, null, null, FlatDarkLaf.class.getName() ) );
themes.add( new IJThemeInfo( "FlatLaf Dark", null, true, null, null, null, null, null, FlatDarkLaf.class.getName() ) );
if( showLight )
themes.add( new IJThemeInfo( "Flat IntelliJ", null, false, null, null, null, null, null, FlatIntelliJLaf.class.getName() ) );
themes.add( new IJThemeInfo( "FlatLaf IntelliJ", null, false, null, null, null, null, null, FlatIntelliJLaf.class.getName() ) );
if( showDark )
themes.add( new IJThemeInfo( "Flat Darcula", null, true, null, null, null, null, null, FlatDarculaLaf.class.getName() ) );
themes.add( new IJThemeInfo( "FlatLaf Darcula", null, true, null, null, null, null, null, FlatDarculaLaf.class.getName() ) );
// add themes from directory
categories.put( themes.size(), "Current Directory" );

View File

@@ -475,7 +475,7 @@ public class FlatInspector
appendRow( buf, "Border", toString( ((JComponent)c).getBorder(), classHierarchy ) );
appendRow( buf, "Background", toString( c.getBackground() ) + (c.isBackgroundSet() ? "" : " NOT SET") );
appendRow( buf, "Foreground", toString( c.getForeground() ) + (c.isBackgroundSet() ? "" : " NOT SET") );
appendRow( buf, "Foreground", toString( c.getForeground() ) + (c.isForegroundSet() ? "" : " NOT SET") );
appendRow( buf, "Font", toString( c.getFont() ) + (c.isFontSet() ? "" : " NOT SET") );
if( c instanceof JComponent ) {

View File

@@ -273,15 +273,31 @@ public class FlatSVGIcon
// since the input stream is already loaded and parsed,
// get diagram here and remove it from cache
update();
svgCache.remove( uri );
synchronized( FlatSVGIcon.class ) {
svgCache.remove( uri );
}
}
private static URI loadFromStream( InputStream in ) throws IOException {
private static synchronized URI loadFromStream( InputStream in ) throws IOException {
try( InputStream in2 = in ) {
return svgUniverse.loadSVG( in2, "/flatlaf-stream-" + (streamNumber++) );
}
}
/**
* Creates a copy of the given icon.
* <p>
* If the icon has a color filter, then it is shared with the new icon.
*
* @since 2.0.1
*/
public FlatSVGIcon( FlatSVGIcon icon ) {
this( icon.name, icon.width, icon.height, icon.scale, icon.disabled, icon.classLoader, icon.uri );
colorFilter = icon.colorFilter;
diagram = icon.diagram;
dark = icon.dark;
}
protected FlatSVGIcon( String name, int width, int height, float scale, boolean disabled, ClassLoader classLoader, URI uri ) {
this.name = name;
this.width = width;
@@ -475,7 +491,7 @@ public class FlatSVGIcon
loadFailed = (diagram == null);
}
static SVGDiagram loadSVG( URI uri ) {
static synchronized SVGDiagram loadSVG( URI uri ) {
// get from our cache
SVGDiagram diagram = svgCache.get( uri );
if( diagram != null )

View File

@@ -21,8 +21,9 @@
# a variable base color (usually the current background color of a component).
# This works only for a limited set of UI keys.
#
# The property key is the UI key of a color, which is computed at runtime.
# The property value is the UI key of the base color.
# In this properties file:
# - The property key is the UI key of a color, which is computed at runtime.
# - The property value is the UI key of the base color.
#
# This file is not used at runtime.
# It is only used in tooling (e.g. UI Defaults Inspector or UIDefaultsDump).

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@@ -932,7 +932,7 @@ Slider.disabledTrackColor #54595c HSL 203 5 35 javax.swing.plaf.Colo
Slider.focus #7a7d7f HSL 204 2 49 javax.swing.plaf.ColorUIResource [UI]
Slider.focusInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI]
Slider.focusWidth 4
Slider.focusedColor #3c628cb3 70% HSLA 212 40 39 70 com.formdev.flatlaf.util.DerivedColor [UI] fade(70%)
Slider.focusedColor #7097c24d 30% HSLA 211 40 60 30 com.formdev.flatlaf.util.DerivedColor [UI] changeLightness(60%) fade(30%)
Slider.font [active] $defaultFont [UI]
Slider.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
Slider.highlight #232324 HSL 240 1 14 javax.swing.plaf.ColorUIResource [UI]
@@ -1207,16 +1207,16 @@ TextPaneUI com.formdev.flatlaf.ui.FlatTextPaneUI
#---- TitlePane ----
TitlePane.background #303234 HSL 210 4 20 javax.swing.plaf.ColorUIResource [UI]
TitlePane.buttonHoverBackground #484c4f HSL 206 5 30 com.formdev.flatlaf.util.DerivedColor [UI] lighten(10% autoInverse)
TitlePane.buttonHoverBackground #55585c HSL 214 4 35 com.formdev.flatlaf.util.DerivedColor [UI] lighten(15% autoInverse)
TitlePane.buttonMaximizedHeight 22
TitlePane.buttonPressedBackground #616569 HSL 210 4 40 com.formdev.flatlaf.util.DerivedColor [UI] lighten(20% autoInverse)
TitlePane.buttonPressedBackground #484c4f HSL 206 5 30 com.formdev.flatlaf.util.DerivedColor [UI] lighten(10% autoInverse)
TitlePane.buttonSize 44,30 javax.swing.plaf.DimensionUIResource [UI]
TitlePane.centerTitle false
TitlePane.centerTitleIfMenuBarEmbedded true
TitlePane.closeHoverBackground #e81123 HSL 355 86 49 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closeHoverBackground #c42b1c HSL 5 75 44 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closeHoverForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closeIcon [lazy] 44,30 com.formdev.flatlaf.icons.FlatWindowCloseIcon [UI]
TitlePane.closePressedBackground #e8112399 60% HSLA 355 86 49 60 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closePressedBackground #c42b1ce6 90% HSLA 5 75 44 90 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closePressedForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
TitlePane.embeddedForeground #959595 HSL 0 0 58 javax.swing.plaf.ColorUIResource [UI]
TitlePane.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
@@ -1424,13 +1424,13 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI
#---- [style]Button ----
[style]Button.clearButton icon: com.formdev.flatlaf.icons.FlatClearIcon; focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1; background: $TextField.background; toolbar.hoverBackground: $TextField.background; toolbar.pressedBackground: $TextField.background
[style]Button.inTextField focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1; background: $TextField.background; toolbar.hoverBackground: lighten($TextField.background,4%,derived); toolbar.pressedBackground: lighten($TextField.background,6%,derived); toolbar.selectedBackground: lighten($TextField.background,12%,derived)
[style]Button.clearButton icon: com.formdev.flatlaf.icons.FlatClearIcon; focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1; toolbar.hoverBackground: null; toolbar.pressedBackground: null
[style]Button.inTextField focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1; toolbar.hoverBackground: fade(Actions.GreyInline,30%,lazy); toolbar.pressedBackground: fade(Actions.GreyInline,40%,lazy); toolbar.selectedBackground: fade(Actions.GreyInline,50%,lazy)
#---- [style]ToggleButton ----
[style]ToggleButton.inTextField focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1; background: $TextField.background; toolbar.hoverBackground: lighten($TextField.background,4%,derived); toolbar.pressedBackground: lighten($TextField.background,6%,derived); toolbar.selectedBackground: lighten($TextField.background,12%,derived)
[style]ToggleButton.inTextField focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1; toolbar.hoverBackground: fade(Actions.GreyInline,30%,lazy); toolbar.pressedBackground: fade(Actions.GreyInline,40%,lazy); toolbar.selectedBackground: fade(Actions.GreyInline,50%,lazy)
#---- [style]ToolBar ----

View File

@@ -937,7 +937,7 @@ Slider.disabledTrackColor #d1d1d1 HSL 0 0 82 javax.swing.plaf.Colo
Slider.focus #9c9c9c HSL 0 0 61 javax.swing.plaf.ColorUIResource [UI]
Slider.focusInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI]
Slider.focusWidth 4
Slider.focusedColor #98c3eb80 50% HSLA 209 67 76 50 com.formdev.flatlaf.util.DerivedColor [UI] fade(50%)
Slider.focusedColor #94c1ea80 50% HSLA 209 67 75 50 com.formdev.flatlaf.util.DerivedColor [UI] changeLightness(75%) fade(50%)
Slider.font [active] $defaultFont [UI]
Slider.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
Slider.highlight #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
@@ -1214,14 +1214,14 @@ TextPaneUI com.formdev.flatlaf.ui.FlatTextPaneUI
TitlePane.background #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
TitlePane.buttonHoverBackground #e6e6e6 HSL 0 0 90 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
TitlePane.buttonMaximizedHeight 22
TitlePane.buttonPressedBackground #cccccc HSL 0 0 80 com.formdev.flatlaf.util.DerivedColor [UI] darken(20% autoInverse)
TitlePane.buttonPressedBackground #ebebeb HSL 0 0 92 com.formdev.flatlaf.util.DerivedColor [UI] darken(8% autoInverse)
TitlePane.buttonSize 44,30 javax.swing.plaf.DimensionUIResource [UI]
TitlePane.centerTitle false
TitlePane.centerTitleIfMenuBarEmbedded true
TitlePane.closeHoverBackground #e81123 HSL 355 86 49 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closeHoverBackground #c42b1c HSL 5 75 44 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closeHoverForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closeIcon [lazy] 44,30 com.formdev.flatlaf.icons.FlatWindowCloseIcon [UI]
TitlePane.closePressedBackground #e8112399 60% HSLA 355 86 49 60 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closePressedBackground #c42b1ce6 90% HSLA 5 75 44 90 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closePressedForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
TitlePane.embeddedForeground #595959 HSL 0 0 35 javax.swing.plaf.ColorUIResource [UI]
TitlePane.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
@@ -1429,13 +1429,13 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI
#---- [style]Button ----
[style]Button.clearButton icon: com.formdev.flatlaf.icons.FlatClearIcon; focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1; background: $TextField.background; toolbar.hoverBackground: $TextField.background; toolbar.pressedBackground: $TextField.background
[style]Button.inTextField focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1; background: $TextField.background; toolbar.hoverBackground: darken($TextField.background,4%,derived); toolbar.pressedBackground: darken($TextField.background,8%,derived); toolbar.selectedBackground: darken($TextField.background,12%,derived)
[style]Button.clearButton icon: com.formdev.flatlaf.icons.FlatClearIcon; focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1; toolbar.hoverBackground: null; toolbar.pressedBackground: null
[style]Button.inTextField focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1; toolbar.hoverBackground: fade(Actions.GreyInline,10%,lazy); toolbar.pressedBackground: fade(Actions.GreyInline,20%,lazy); toolbar.selectedBackground: fade(Actions.GreyInline,30%,lazy)
#---- [style]ToggleButton ----
[style]ToggleButton.inTextField focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1; background: $TextField.background; toolbar.hoverBackground: darken($TextField.background,4%,derived); toolbar.pressedBackground: darken($TextField.background,8%,derived); toolbar.selectedBackground: darken($TextField.background,12%,derived)
[style]ToggleButton.inTextField focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1; toolbar.hoverBackground: fade(Actions.GreyInline,10%,lazy); toolbar.pressedBackground: fade(Actions.GreyInline,20%,lazy); toolbar.selectedBackground: fade(Actions.GreyInline,30%,lazy)
#---- [style]ToolBar ----

View File

@@ -1,6 +1,6 @@
Class com.formdev.flatlaf.testing.FlatTestLaf
ID FlatLaf - Flat Test
Name Flat Test
ID FlatLaf - FlatLaf Test
Name FlatLaf Test
Java 1.8.0_202
OS Windows 10
@@ -1233,10 +1233,10 @@ TitlePane.buttonMaximizedHeight 22
TitlePane.buttonSize 44,30 javax.swing.plaf.DimensionUIResource [UI]
TitlePane.centerTitle false
TitlePane.centerTitleIfMenuBarEmbedded true
TitlePane.closeHoverBackground #e81123 HSL 355 86 49 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closeHoverBackground #c42b1c HSL 5 75 44 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closeHoverForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closeIcon [lazy] 44,30 com.formdev.flatlaf.icons.FlatWindowCloseIcon [UI]
TitlePane.closePressedBackground #e8112399 60% HSLA 355 86 49 60 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closePressedBackground #c42b1ce6 90% HSLA 5 75 44 90 javax.swing.plaf.ColorUIResource [UI]
TitlePane.closePressedForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
TitlePane.foreground #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI]
TitlePane.icon [lazy] 16,16 sun.swing.ImageIconUIResource [UI] (sun.awt.image.ToolkitImage)
@@ -1442,7 +1442,7 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI
#---- [style]Button ----
[style]Button.clearButton icon: com.formdev.flatlaf.icons.FlatClearIcon; focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1; background: $TextField.background; toolbar.hoverBackground: $TextField.background; toolbar.pressedBackground: $TextField.background
[style]Button.clearButton icon: com.formdev.flatlaf.icons.FlatClearIcon; focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1; toolbar.hoverBackground: null; toolbar.pressedBackground: null
[style]Button.inTextField focusable: false; toolbar.margin: 1,1,1,1; toolbar.spacingInsets: 1,1,1,1

View File

@@ -22,9 +22,12 @@ import java.util.Random;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.FlatLightLaf;
import com.formdev.flatlaf.extras.FlatSVGIcon;
/**
* @author Karl Tauber
@@ -54,6 +57,8 @@ public class FlatStressTest
private JComponent createStressTest() {
return createComboBoxStressTest();
// return createGetFontStressTest();
// return createSVGIconTest();
}
// for https://github.com/JFormDesigner/FlatLaf/issues/432
@@ -80,4 +85,57 @@ public class FlatStressTest
return comboBox;
}
// for https://github.com/JFormDesigner/FlatLaf/issues/456
@SuppressWarnings( "unused" )
private JComponent createGetFontStressTest() {
JLabel label = new JLabel( "test" );
Runnable runnable = () -> {
for(;;) {
UIManager.getFont( "Label.font" );
}
};
Thread thread1 = new Thread( runnable);
thread1.setDaemon( true );
thread1.start();
Thread thread2 = new Thread( runnable);
thread2.setDaemon( true );
thread2.start();
Thread thread3 = new Thread( runnable);
thread3.setDaemon( true );
thread3.start();
return label;
}
// for https://github.com/JFormDesigner/FlatLaf/issues/459
@SuppressWarnings( "unused" )
private JComponent createSVGIconTest() {
JLabel label = new JLabel( "test" );
Runnable runnable = () -> {
for(;;) {
FlatSVGIcon icon = new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/back.svg" );
icon.getIconHeight();
}
};
Thread thread1 = new Thread( runnable);
thread1.setDaemon( true );
thread1.start();
Thread thread2 = new Thread( runnable);
thread2.setDaemon( true );
thread2.start();
Thread thread3 = new Thread( runnable);
thread3.setDaemon( true );
thread3.start();
return label;
}
}

View File

@@ -111,11 +111,11 @@ public class FlatTestFrame
// initialize look and feels combo box
DefaultComboBoxModel<LookAndFeelInfo> lafModel = new DefaultComboBoxModel<>();
lafModel.addElement( new LookAndFeelInfo( "Flat Light (F1)", FlatLightLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "Flat Dark (F2)", FlatDarkLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "Flat IntelliJ (F3)", FlatIntelliJLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "Flat Darcula (F4)", FlatDarculaLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "Flat Test (F8)", FlatTestLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "FlatLaf Light (F1)", FlatLightLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "FlatLaf Dark (F2)", FlatDarkLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "FlatLaf IntelliJ (F3)", FlatIntelliJLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "FlatLaf Darcula (F4)", FlatDarculaLaf.class.getName() ) );
lafModel.addElement( new LookAndFeelInfo( "FlatLaf Test (F8)", FlatTestLaf.class.getName() ) );
UIManager.LookAndFeelInfo[] lookAndFeels = UIManager.getInstalledLookAndFeels();
for( UIManager.LookAndFeelInfo lookAndFeel : lookAndFeels ) {

View File

@@ -32,12 +32,12 @@ public class FlatTestLaf
{
@Override
public String getName() {
return "Flat Test";
return "FlatLaf Test";
}
@Override
public String getDescription() {
return "Flat Test Look and Feel";
return "FlatLaf Test Look and Feel";
}
@Override

View File

@@ -234,7 +234,6 @@ public class FlatTextComponentsTest
JMenuItem pasteMenuItem = new JMenuItem();
//======== this ========
setName("this");
setLayout(new MigLayout(
"ltr,insets dialog,hidemode 3",
// columns
@@ -267,21 +266,18 @@ public class FlatTextComponentsTest
textFieldLabel.setText("JTextField:");
textFieldLabel.setDisplayedMnemonic('T');
textFieldLabel.setLabelFor(textField1);
textFieldLabel.setName("textFieldLabel");
add(textFieldLabel, "cell 0 0");
//---- textField1 ----
textField1.setText("editable");
textField1.setComponentPopupMenu(popupMenu1);
textField1.putClientProperty("JTextField.placeholderText", "place");
textField1.setName("textField1");
add(textField1, "cell 1 0,growx");
//---- textField3 ----
textField3.setText("longer text for testing horizontal scrolling");
textField3.setComponentPopupMenu(popupMenu1);
textField3.putClientProperty("JTextField.placeholderText", "place");
textField3.setName("textField3");
add(textField3, "cell 2 0,growx");
//---- textField2 ----
@@ -290,34 +286,29 @@ public class FlatTextComponentsTest
textField2.setSelectionEnd(4);
textField2.setComponentPopupMenu(popupMenu1);
textField2.putClientProperty("JTextField.placeholderText", "place");
textField2.setName("textField2");
add(textField2, "cell 3 0");
//---- formattedTextFieldLabel ----
formattedTextFieldLabel.setText("JFormattedTextField:");
formattedTextFieldLabel.setDisplayedMnemonic('F');
formattedTextFieldLabel.setLabelFor(formattedTextField1);
formattedTextFieldLabel.setName("formattedTextFieldLabel");
add(formattedTextFieldLabel, "cell 0 1");
//---- formattedTextField1 ----
formattedTextField1.setText("editable");
formattedTextField1.setComponentPopupMenu(popupMenu1);
formattedTextField1.putClientProperty("JTextField.placeholderText", "place");
formattedTextField1.setName("formattedTextField1");
add(formattedTextField1, "cell 1 1,growx");
//---- formattedTextField3 ----
formattedTextField3.setText("longer text for testing horizontal scrolling");
formattedTextField3.setComponentPopupMenu(popupMenu1);
formattedTextField3.putClientProperty("JTextField.placeholderText", "place");
formattedTextField3.setName("formattedTextField3");
add(formattedTextField3, "cell 2 1,growx");
//======== panel1 ========
{
panel1.setBorder(new TitledBorder("Control"));
panel1.setName("panel1");
panel1.setLayout(new MigLayout(
"hidemode 3",
// columns
@@ -340,97 +331,80 @@ public class FlatTextComponentsTest
//---- button1 ----
button1.setText("change text");
button1.setName("button1");
button1.addActionListener(e -> changeText());
panel1.add(button1, "cell 0 0 2 1,alignx left,growx 0");
//---- leftPaddingLabel ----
leftPaddingLabel.setText("Left padding:");
leftPaddingLabel.setName("leftPaddingLabel");
panel1.add(leftPaddingLabel, "cell 0 1");
//---- leftPaddingField ----
leftPaddingField.setName("leftPaddingField");
leftPaddingField.addChangeListener(e -> paddingChanged());
panel1.add(leftPaddingField, "cell 1 1");
//---- rightPaddingLabel ----
rightPaddingLabel.setText("Right padding:");
rightPaddingLabel.setName("rightPaddingLabel");
panel1.add(rightPaddingLabel, "cell 0 2");
//---- rightPaddingField ----
rightPaddingField.setName("rightPaddingField");
rightPaddingField.addChangeListener(e -> paddingChanged());
panel1.add(rightPaddingField, "cell 1 2");
//---- topPaddingLabel ----
topPaddingLabel.setText("Top padding:");
topPaddingLabel.setName("topPaddingLabel");
panel1.add(topPaddingLabel, "cell 0 3");
//---- topPaddingField ----
topPaddingField.setName("topPaddingField");
topPaddingField.addChangeListener(e -> paddingChanged());
panel1.add(topPaddingField, "cell 1 3");
//---- bottomPaddingLabel ----
bottomPaddingLabel.setText("Bottom padding:");
bottomPaddingLabel.setName("bottomPaddingLabel");
panel1.add(bottomPaddingLabel, "cell 0 4");
//---- bottomPaddingField ----
bottomPaddingField.setName("bottomPaddingField");
bottomPaddingField.addChangeListener(e -> paddingChanged());
panel1.add(bottomPaddingField, "cell 1 4");
//---- leadingIconCheckBox ----
leadingIconCheckBox.setText("leading icon");
leadingIconCheckBox.setName("leadingIconCheckBox");
leadingIconCheckBox.addActionListener(e -> leadingIcon());
panel1.add(leadingIconCheckBox, "cell 0 5 2 1,alignx left,growx 0");
//---- trailingIconCheckBox ----
trailingIconCheckBox.setText("trailing icon");
trailingIconCheckBox.setName("trailingIconCheckBox");
trailingIconCheckBox.addActionListener(e -> trailingIcon());
panel1.add(trailingIconCheckBox, "cell 0 6 2 1,alignx left,growx 0");
//---- leadingComponentCheckBox ----
leadingComponentCheckBox.setText("leading component");
leadingComponentCheckBox.setName("leadingComponentCheckBox");
leadingComponentCheckBox.addActionListener(e -> leadingComponent());
panel1.add(leadingComponentCheckBox, "cell 0 7 2 1,alignx left,growx 0");
//---- trailingComponentCheckBox ----
trailingComponentCheckBox.setText("trailing component");
trailingComponentCheckBox.setName("trailingComponentCheckBox");
trailingComponentCheckBox.addActionListener(e -> trailingComponent());
panel1.add(trailingComponentCheckBox, "cell 0 8 2 1,alignx left,growx 0");
//---- leadingComponentVisibleCheckBox ----
leadingComponentVisibleCheckBox.setText("leading component visible");
leadingComponentVisibleCheckBox.setSelected(true);
leadingComponentVisibleCheckBox.setName("leadingComponentVisibleCheckBox");
leadingComponentVisibleCheckBox.addActionListener(e -> leadingComponentVisible());
panel1.add(leadingComponentVisibleCheckBox, "cell 0 9 2 1,alignx left,growx 0");
//---- trailingComponentVisibleCheckBox ----
trailingComponentVisibleCheckBox.setText("trailing component visible");
trailingComponentVisibleCheckBox.setSelected(true);
trailingComponentVisibleCheckBox.setName("trailingComponentVisibleCheckBox");
trailingComponentVisibleCheckBox.addActionListener(e -> trailingComponentVisible());
panel1.add(trailingComponentVisibleCheckBox, "cell 0 10 2 1,alignx left,growx 0");
//---- showClearButtonCheckBox ----
showClearButtonCheckBox.setText("clear button");
showClearButtonCheckBox.setName("showClearButtonCheckBox");
showClearButtonCheckBox.addActionListener(e -> showClearButton());
panel1.add(showClearButtonCheckBox, "cell 0 11 2 1,alignx left,growx 0");
//---- showRevealButtonCheckBox ----
showRevealButtonCheckBox.setText("password reveal button");
showRevealButtonCheckBox.setName("showRevealButtonCheckBox");
showRevealButtonCheckBox.addActionListener(e -> showRevealButton());
panel1.add(showRevealButtonCheckBox, "cell 0 12 2 1,alignx left,growx 0");
}
@@ -440,50 +414,42 @@ public class FlatTextComponentsTest
passwordFieldLabel.setText("JPasswordField:");
passwordFieldLabel.setDisplayedMnemonic('P');
passwordFieldLabel.setLabelFor(passwordField1);
passwordFieldLabel.setName("passwordFieldLabel");
add(passwordFieldLabel, "cell 0 2");
//---- passwordField1 ----
passwordField1.setText("editable");
passwordField1.setComponentPopupMenu(popupMenu1);
passwordField1.putClientProperty("JTextField.placeholderText", "place");
passwordField1.setName("passwordField1");
add(passwordField1, "cell 1 2,growx");
//---- passwordField3 ----
passwordField3.setText("longer text for testing horizontal scrolling");
passwordField3.setComponentPopupMenu(popupMenu1);
passwordField3.putClientProperty("JTextField.placeholderText", "place");
passwordField3.setName("passwordField3");
add(passwordField3, "cell 2 2,growx");
//---- textAreaLabel ----
textAreaLabel.setText("JTextArea:");
textAreaLabel.setDisplayedMnemonic('A');
textAreaLabel.setLabelFor(textArea1);
textAreaLabel.setName("textAreaLabel");
add(textAreaLabel, "cell 0 3");
//======== scrollPane1 ========
{
scrollPane1.setName("scrollPane1");
//---- textArea1 ----
textArea1.setText("editable");
textArea1.setComponentPopupMenu(popupMenu1);
textArea1.setName("textArea1");
scrollPane1.setViewportView(textArea1);
}
add(scrollPane1, "cell 1 3,growx");
//======== scrollPane3 ========
{
scrollPane3.setName("scrollPane3");
//---- textArea3 ----
textArea3.setText("longer text for testing horizontal scrolling");
textArea3.setComponentPopupMenu(popupMenu1);
textArea3.setName("textArea3");
scrollPane3.setViewportView(textArea3);
}
add(scrollPane3, "cell 2 3,growx");
@@ -492,29 +458,24 @@ public class FlatTextComponentsTest
editorPaneLabel.setText("JEditorPane");
editorPaneLabel.setDisplayedMnemonic('J');
editorPaneLabel.setLabelFor(editorPane1);
editorPaneLabel.setName("editorPaneLabel");
add(editorPaneLabel, "cell 0 4");
//======== scrollPane5 ========
{
scrollPane5.setName("scrollPane5");
//---- editorPane1 ----
editorPane1.setText("editable");
editorPane1.setComponentPopupMenu(popupMenu1);
editorPane1.setName("editorPane1");
scrollPane5.setViewportView(editorPane1);
}
add(scrollPane5, "cell 1 4,growx");
//======== scrollPane7 ========
{
scrollPane7.setName("scrollPane7");
//---- editorPane3 ----
editorPane3.setText("longer text for testing horizontal scrolling");
editorPane3.setComponentPopupMenu(popupMenu1);
editorPane3.setName("editorPane3");
scrollPane7.setViewportView(editorPane3);
}
add(scrollPane7, "cell 2 4,growx");
@@ -523,29 +484,24 @@ public class FlatTextComponentsTest
textPaneLabel.setText("JTextPane:");
textPaneLabel.setDisplayedMnemonic('N');
textPaneLabel.setLabelFor(textPane1);
textPaneLabel.setName("textPaneLabel");
add(textPaneLabel, "cell 0 5");
//======== scrollPane9 ========
{
scrollPane9.setName("scrollPane9");
//---- textPane1 ----
textPane1.setText("editable");
textPane1.setComponentPopupMenu(popupMenu1);
textPane1.setName("textPane1");
scrollPane9.setViewportView(textPane1);
}
add(scrollPane9, "cell 1 5,growx");
//======== scrollPane11 ========
{
scrollPane11.setName("scrollPane11");
//---- textPane3 ----
textPane3.setText("longer text for testing horizontal scrolling");
textPane3.setComponentPopupMenu(popupMenu1);
textPane3.setName("textPane3");
scrollPane11.setViewportView(textPane3);
}
add(scrollPane11, "cell 2 5,growx");
@@ -554,7 +510,6 @@ public class FlatTextComponentsTest
comboBoxLabel.setText("JComboBox:");
comboBoxLabel.setDisplayedMnemonic('C');
comboBoxLabel.setLabelFor(comboBox1);
comboBoxLabel.setName("comboBoxLabel");
add(comboBoxLabel, "cell 0 6");
//---- comboBox1 ----
@@ -566,7 +521,6 @@ public class FlatTextComponentsTest
"ccc"
}));
comboBox1.setComponentPopupMenu(popupMenu1);
comboBox1.setName("comboBox1");
add(comboBox1, "cell 1 6,growx");
//---- comboBox3 ----
@@ -579,154 +533,121 @@ public class FlatTextComponentsTest
comboBox3.setEditable(true);
comboBox3.setPrototypeDisplayValue("12345");
comboBox3.setComponentPopupMenu(popupMenu1);
comboBox3.setName("comboBox3");
add(comboBox3, "cell 2 6,growx,wmin 50");
//---- spinnerLabel ----
spinnerLabel.setText("JSpinner:");
spinnerLabel.setDisplayedMnemonic('S');
spinnerLabel.setLabelFor(spinner1);
spinnerLabel.setName("spinnerLabel");
add(spinnerLabel, "cell 0 7");
//---- spinner1 ----
spinner1.setComponentPopupMenu(popupMenu1);
spinner1.setName("spinner1");
add(spinner1, "cell 1 7,growx");
//---- label2 ----
label2.setText("<html>Large row height:<br>(default pref height)</html>");
label2.setName("label2");
add(label2, "cell 0 8,aligny top,growy 0");
//---- comboBox2 ----
comboBox2.setEditable(true);
comboBox2.setName("comboBox2");
add(comboBox2, "cell 1 8,grow");
//---- spinner2 ----
spinner2.setName("spinner2");
add(spinner2, "cell 1 9,grow");
//---- label1 ----
label1.setText("Large pref height:");
label1.setName("label1");
add(label1, "cell 0 10,aligny top,growy 0");
//---- comboBox5 ----
comboBox5.setPreferredSize(new Dimension(60, 40));
comboBox5.setEditable(true);
comboBox5.setName("comboBox5");
add(comboBox5, "cell 1 10,growx");
//---- spinner4 ----
spinner4.setPreferredSize(new Dimension(60, 40));
spinner4.setName("spinner4");
add(spinner4, "cell 1 11,growx");
//---- label3 ----
label3.setText("<html>Small row height:<br>(default pref height)</html>");
label3.setName("label3");
add(label3, "cell 0 12 1 2,aligny top,growy 0");
//---- comboBox4 ----
comboBox4.setEditable(true);
comboBox4.setName("comboBox4");
add(comboBox4, "cell 1 12,growx");
//---- spinner3 ----
spinner3.setName("spinner3");
add(spinner3, "cell 1 13,growx");
//---- label4 ----
label4.setText("Small pref height:");
label4.setName("label4");
add(label4, "cell 0 14 1 2,aligny top,growy 0");
//---- comboBox6 ----
comboBox6.setEditable(true);
comboBox6.setPreferredSize(new Dimension(60, 14));
comboBox6.setMinimumSize(new Dimension(60, 14));
comboBox6.setName("comboBox6");
add(comboBox6, "cell 1 14,growx");
//---- spinner5 ----
spinner5.setMinimumSize(new Dimension(60, 14));
spinner5.setPreferredSize(new Dimension(60, 14));
spinner5.setName("spinner5");
add(spinner5, "cell 1 15,growx,hmax 14");
//---- label5 ----
label5.setText("Double-click-and-drag:");
label5.setName("label5");
add(label5, "cell 0 16");
//---- textField ----
textField.setText("123 456 789 abc def");
textField.setName("textField");
add(textField, "cell 1 16 2 1,growx");
//---- dragEnabledCheckBox ----
dragEnabledCheckBox.setText("Drag enabled");
dragEnabledCheckBox.setName("dragEnabledCheckBox");
dragEnabledCheckBox.addActionListener(e -> dragEnabledChanged());
add(dragEnabledCheckBox, "cell 3 16 2 1,alignx left,growx 0");
//---- label6 ----
label6.setText("<html>JTextArea<br>JTextPane<br>JEditorPane</html>");
label6.setName("label6");
add(label6, "cell 0 17,align right top,grow 0 0");
//======== scrollPane2 ========
{
scrollPane2.setName("scrollPane2");
//---- textArea ----
textArea.setText("1 123 456 789 abc def\n2 123 456 789 abc def\n3 123 456 789 abc def\n4 123 456 789 abc def\n5 123 456 789 abc def\n6 123 456 789 abc def\n7 123 456 789 abc def\n8 123 456 789 abc def");
textArea.setName("textArea");
scrollPane2.setViewportView(textArea);
}
add(scrollPane2, "cell 1 17 4 1,growx");
//======== scrollPane4 ========
{
scrollPane4.setName("scrollPane4");
//---- textPane ----
textPane.setText("1 123 456 789 abc def\n2 123 456 789 abc def\n3 123 456 789 abc def\n4 123 456 789 abc def\n5 123 456 789 abc def\n6 123 456 789 abc def\n7 123 456 789 abc def\n8 123 456 789 abc def");
textPane.setName("textPane");
scrollPane4.setViewportView(textPane);
}
add(scrollPane4, "cell 1 17 4 1,growx");
//======== scrollPane6 ========
{
scrollPane6.setName("scrollPane6");
//---- editorPane ----
editorPane.setText("1 123 456 789 abc def\n2 123 456 789 abc def\n3 123 456 789 abc def\n4 123 456 789 abc def\n5 123 456 789 abc def\n6 123 456 789 abc def\n7 123 456 789 abc def\n8 123 456 789 abc def");
editorPane.setName("editorPane");
scrollPane6.setViewportView(editorPane);
}
add(scrollPane6, "cell 1 17 4 1,growx");
//======== popupMenu1 ========
{
popupMenu1.setName("popupMenu1");
//---- cutMenuItem ----
cutMenuItem.setText("Cut");
cutMenuItem.setName("cutMenuItem");
popupMenu1.add(cutMenuItem);
//---- copyMenuItem ----
copyMenuItem.setText("Copy");
copyMenuItem.setName("copyMenuItem");
popupMenu1.add(copyMenuItem);
//---- pasteMenuItem ----
pasteMenuItem.setText("Paste");
pasteMenuItem.setName("pasteMenuItem");
popupMenu1.add(pasteMenuItem);
}
// JFormDesigner - End of component initialization //GEN-END:initComponents

View File

@@ -1,9 +1,8 @@
JFDML JFormDesigner: "7.0.4.0.360" Java: "17" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.5.0.404" Java: "17" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
root: new FormRoot {
"$setComponentNames": true
auxiliary() {
"JavaCodeGenerator.defaultVariableLocal": true
}

View File

@@ -458,12 +458,14 @@ public class UIDefaultsDump
}
private void dumpColor( PrintWriter out, String key, Color color ) {
Color resolvedColor = resolveDerivedColor( key, color );
Color[] retBaseColor = new Color[1];
Color resolvedColor = resolveDerivedColor( key, color, retBaseColor );
if( resolvedColor != color && resolvedColor.getRGB() != color.getRGB() ) {
if( !isIntelliJTheme ) {
System.err.println( "Key '" + key + "': derived colors not equal" );
System.err.println( " Default color: " + dumpColorHexAndHSL( color ) );
System.err.println( " Resolved color: " + dumpColorHexAndHSL( resolvedColor ) );
System.err.println( " Default color: " + dumpColorHexAndHSL( color ) );
System.err.println( " Resolved color: " + dumpColorHexAndHSL( resolvedColor ) );
System.err.println( " Base of resolved color: " + dumpColorHexAndHSL( retBaseColor[0] ) );
}
out.printf( "%s / ",
@@ -672,7 +674,7 @@ public class UIDefaultsDump
return properties;
}
private Color resolveDerivedColor( String key, Color color ) {
private Color resolveDerivedColor( String key, Color color, Color[] retBaseColor ) {
if( !(color instanceof DerivedColor) )
return color;
@@ -693,7 +695,9 @@ public class UIDefaultsDump
throw new IllegalStateException( "Missing base color '" + baseKey + "' for key '" + key + "'." );
if( baseColor instanceof DerivedColor )
baseColor = resolveDerivedColor( (String) baseKey, baseColor );
baseColor = resolveDerivedColor( (String) baseKey, baseColor, retBaseColor );
retBaseColor[0] = baseColor;
Color newColor = FlatUIUtils.deriveColor( color, baseColor );

View File

@@ -2,15 +2,23 @@ FlatLaf Theme Editor
====================
This sub-project contains the FlatLaf Theme Editor that supports editing FlatLaf
theme properties files.
theme properties files. See
[Theme Editor documentation](https://www.formdev.com/flatlaf/theme-editor/) for
details and downloads.
![Theme Editor](../images/theme-editor@1.5x.png)
Download
--------
[![Download Demo](https://download.formdev.com/flatlaf/images/download-theme-editor.svg)](https://download.formdev.com/flatlaf/flatlaf-theme-editor-latest.jar)
Run with `java -jar flatlaf-theme-editor-<version>.jar` (or double-click it).
Requires Java 8 or newer.
### Snapshot
[![Download Demo](https://download.formdev.com/flatlaf/images/download-theme-editor-snapshot.svg)](https://download.formdev.com/flatlaf/snapshots/flatlaf-theme-editor-latest.jar)
Run with `java -jar flatlaf-theme-editor-<version>.jar` (or double-click it).
Requires Java 8 or newer.

View File

@@ -44,6 +44,7 @@ import com.formdev.flatlaf.icons.FlatAbstractIcon;
import com.formdev.flatlaf.ui.FlatEmptyBorder;
import com.formdev.flatlaf.ui.FlatLineBorder;
import com.formdev.flatlaf.util.HSLColor;
import com.formdev.flatlaf.util.SystemInfo;
import com.formdev.flatlaf.util.UIScale;
/**
@@ -93,7 +94,9 @@ class FlatColorPipette
setAlwaysOnTop( true );
setUndecorated( true );
setOpacity( 0.005f );
// macOS: windows with opacity smaller than 0.05 does not receive
// mouse clicked/pressed/released events (but mouse moved events)
setOpacity( SystemInfo.isMacOS ? 0.05f : 0.005f );
setBounds( owner.getGraphicsConfiguration().getBounds() );
robot = new Robot( owner.getGraphicsConfiguration().getDevice() );
@@ -109,6 +112,8 @@ class FlatColorPipette
// (temporary change opacity to zero to get correct color from robot)
float oldOpacity = getOpacity();
setOpacity( 0 );
if( SystemInfo.isMacOS )
robot.delay( 20 ); // give macOS some time to update the opacity
Color color = robot.getPixelColor( lastX, lastY );
setOpacity( oldOpacity );
@@ -120,10 +125,17 @@ class FlatColorPipette
public void mouseClicked( MouseEvent e ) {
dispose();
if( SwingUtilities.isLeftMouseButton( e ) )
pick( robot.getPixelColor( e.getX(), e.getY() ) );
else
pick( null );
Color color = null;
if( SwingUtilities.isLeftMouseButton( e ) ) {
// on macOS, robot not always returns correct color
// in mouse clicked event (sometimes black; sometimes
// includes opacity of disposed window)
// --> use last hover color on macOS
color = SystemInfo.isMacOS
? lastHoverColor
: robot.getPixelColor( e.getX(), e.getY() );
}
pick( color );
}
};

View File

@@ -31,7 +31,9 @@ import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.extras.FlatSVGIcon;
import com.formdev.flatlaf.extras.components.*;
import com.formdev.flatlaf.icons.FlatSearchWithHistoryIcon;
import com.formdev.flatlaf.ui.FlatTabbedPaneUI;
import net.miginfocom.swing.*;
@@ -53,6 +55,28 @@ class FlatThemePreviewAll
initComponents();
textField2.setLeadingComponent( new JButton( new FlatSearchWithHistoryIcon( true ) ) );
// whole words button
JToggleButton wordsButton = new JToggleButton( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/preview/words.svg" ) );
wordsButton.setRolloverIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/preview/wordsHovered.svg" ) );
wordsButton.setSelectedIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/preview/wordsSelected.svg" ) );
wordsButton.setToolTipText( "Whole Words" );
// regex button
JToggleButton regexButton = new JToggleButton( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/preview/regex.svg" ) );
regexButton.setRolloverIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/preview/regexHovered.svg" ) );
regexButton.setSelectedIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/preview/regexSelected.svg" ) );
regexButton.setSelected( true );
regexButton.setToolTipText( "Regular Expression" );
// search toolbar
JToolBar searchToolbar = new JToolBar();
searchToolbar.add( wordsButton );
searchToolbar.addSeparator();
searchToolbar.add( regexButton );
textField2.setTrailingComponent( searchToolbar );
tabbedPane1.uiDefaultsGetter = preview::getUIDefaultProperty;
tabbedPane1.setTabLayoutPolicy( JTabbedPane.SCROLL_TAB_LAYOUT );
tabbedPane1.addTab( "Tab 1", null );
@@ -128,26 +152,25 @@ class FlatThemePreviewAll
}
private void enableDisable( Component comp, boolean enabled ) {
if( !isControlComponent( comp ) )
comp.setEnabled( enabled );
if( comp instanceof JScrollPane )
comp = ((JScrollPane)comp).getViewport().getView();
if( !(comp instanceof Container) || comp instanceof JInternalFrame )
if( comp == null || (comp instanceof JLabel && comp != label1) )
return;
for( Component c : ((Container)comp).getComponents() ) {
if( c instanceof JScrollPane )
c = ((JScrollPane)c).getViewport().getView();
// enable/disable component
if( !isControlComponent( comp ) && comp != menu2 )
comp.setEnabled( enabled );
// make sure that background is updated correctly in BasicTextUI.updateBackground()
if( c instanceof JTextPane )
c.setBackground( UIManager.getColor( "TextPane.background" ) );
else if( c instanceof JEditorPane )
c.setBackground( UIManager.getColor( "EditorPane.background" ) );
enableDisable( c, enabled );
}
if( comp instanceof JMenu ) {
// enable/disable children
if( comp instanceof JPanel || comp instanceof JToolBar || comp instanceof JMenuBar ) {
for( Component c : ((Container)comp).getComponents() )
enableDisable( c, enabled );
} else if( comp instanceof JSplitPane ) {
JSplitPane splitPane = (JSplitPane) comp;
enableDisable( splitPane.getLeftComponent(), enabled );
enableDisable( splitPane.getRightComponent(), enabled );
} else if( comp instanceof JMenu ) {
JMenu menu = (JMenu) comp;
int count = menu.getMenuComponentCount();
for( int i = 0; i < count; i++ )
@@ -160,14 +183,12 @@ class FlatThemePreviewAll
preview.runWithUIDefaultsGetter( () -> {
textField1.setEditable( editable );
textField2.setEditable( editable );
formattedTextField1.setEditable( editable );
passwordField1.setEditable( editable );
textArea1.setEditable( editable );
editorPane1.setEditable( editable );
textPane1.setEditable( editable );
editorPane1.updateUI();
textPane1.updateUI();
} );
FlatThemeFileEditor.putPrefsBoolean( preview.state, KEY_EDITABLE, editable, true );
@@ -186,20 +207,24 @@ class FlatThemePreviewAll
}
private void focusComponent( Component comp, Object value ) {
if( comp instanceof JScrollPane )
comp = ((JScrollPane)comp).getViewport().getView();
if( comp == null )
return;
// focus component
if( !isControlComponent( comp ) && comp instanceof JComponent )
((JComponent)comp).putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER, value );
if( !(comp instanceof Container) ||
comp instanceof JComboBox ||
comp instanceof JSpinner ||
comp instanceof JInternalFrame )
return;
for( Component c : ((Container)comp).getComponents() ) {
if( c instanceof JScrollPane )
c = ((JScrollPane)c).getViewport().getView();
focusComponent( c, value );
// focus children
if( comp instanceof JPanel || comp instanceof JToolBar ) {
for( Component c : ((Container)comp).getComponents() )
focusComponent( c, value );
} else if( comp instanceof JSplitPane ) {
JSplitPane splitPane = (JSplitPane) comp;
focusComponent( splitPane.getLeftComponent(), value );
focusComponent( splitPane.getRightComponent(), value );
}
}
@@ -207,8 +232,7 @@ class FlatThemePreviewAll
return c == enabledCheckBox ||
c == editableCheckBox ||
c == focusedCheckBox ||
c == menuUnderlineSelectionButton ||
c == menu2;
c == menuUnderlineSelectionButton;
}
private void menuUnderlineSelectionChanged() {
@@ -246,7 +270,7 @@ class FlatThemePreviewAll
editableCheckBox = new JCheckBox();
focusedCheckBox = new JCheckBox();
JLabel labelLabel = new JLabel();
JLabel label1 = new JLabel();
label1 = new JLabel();
FlatButton flatButton1 = new FlatButton();
JLabel buttonLabel = new JLabel();
JButton button1 = new JButton();
@@ -267,6 +291,7 @@ class FlatThemePreviewAll
JSpinner spinner1 = new JSpinner();
JLabel textFieldLabel = new JLabel();
textField1 = new FlatTextField();
textField2 = new FlatTextField();
formattedTextField1 = new FlatFormattedTextField();
passwordField1 = new FlatPasswordField();
JLabel textAreaLabel = new JLabel();
@@ -389,6 +414,7 @@ class FlatThemePreviewAll
//---- label1 ----
label1.setText("Some Text");
label1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-label");
add(label1, "cell 1 1 2 1");
//---- flatButton1 ----
@@ -403,10 +429,12 @@ class FlatThemePreviewAll
//---- button1 ----
button1.setText("OK");
button1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-button");
add(button1, "cell 1 2");
//---- testDefaultButton1 ----
testDefaultButton1.setText("Default");
testDefaultButton1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-button");
add(testDefaultButton1, "cell 2 2");
//---- toggleButtonLabel ----
@@ -415,11 +443,13 @@ class FlatThemePreviewAll
//---- toggleButton1 ----
toggleButton1.setText("Unselected");
toggleButton1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-togglebutton");
add(toggleButton1, "cell 1 3");
//---- toggleButton3 ----
toggleButton3.setText("Selected");
toggleButton3.setSelected(true);
toggleButton3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-togglebutton");
add(toggleButton3, "cell 2 3");
//---- checkBoxLabel ----
@@ -428,11 +458,13 @@ class FlatThemePreviewAll
//---- checkBox1 ----
checkBox1.setText("Unselected");
checkBox1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-checkbox");
add(checkBox1, "cell 1 4,alignx left,growx 0");
//---- checkBox3 ----
checkBox3.setText("Selected");
checkBox3.setSelected(true);
checkBox3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-checkbox");
add(checkBox3, "cell 2 4,alignx left,growx 0");
//---- radioButtonLabel ----
@@ -441,11 +473,13 @@ class FlatThemePreviewAll
//---- radioButton1 ----
radioButton1.setText("Unselected");
radioButton1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-radiobutton");
add(radioButton1, "cell 1 5,alignx left,growx 0");
//---- radioButton3 ----
radioButton3.setText("Selected");
radioButton3.setSelected(true);
radioButton3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-radiobutton");
add(radioButton3, "cell 2 5,alignx left,growx 0");
//---- comboBoxLabel ----
@@ -470,6 +504,7 @@ class FlatThemePreviewAll
}));
comboBox1.setMaximumRowCount(6);
comboBox1.setPlaceholderText("placeholder text");
comboBox1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-combobox");
add(comboBox1, "cell 1 6");
//---- comboBox3 ----
@@ -488,11 +523,15 @@ class FlatThemePreviewAll
"kkk"
}));
comboBox3.setMaximumRowCount(6);
comboBox3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-combobox");
add(comboBox3, "cell 2 6");
//---- spinnerLabel ----
spinnerLabel.setText("JSpinner:");
add(spinnerLabel, "cell 0 7");
//---- spinner1 ----
spinner1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-spinner");
add(spinner1, "cell 1 7 2 1");
//---- textFieldLabel ----
@@ -502,16 +541,25 @@ class FlatThemePreviewAll
//---- textField1 ----
textField1.setText("Some Text");
textField1.setPlaceholderText("placeholder text");
add(textField1, "cell 1 8 2 1");
textField1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-textfield");
add(textField1, "cell 1 8");
//---- textField2 ----
textField2.setText("Txt");
textField2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-textfield");
add(textField2, "cell 2 8");
//---- formattedTextField1 ----
formattedTextField1.setText("Some Text");
formattedTextField1.setPlaceholderText("placeholder text");
formattedTextField1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-formattedtextfield");
add(formattedTextField1, "cell 1 9");
//---- passwordField1 ----
passwordField1.setText("Some Text");
passwordField1.setPlaceholderText("placeholder text");
passwordField1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-passwordfield");
passwordField1.setShowClearButton(true);
add(passwordField1, "cell 2 9");
//---- textAreaLabel ----
@@ -526,6 +574,7 @@ class FlatThemePreviewAll
//---- textArea1 ----
textArea1.setText("Text");
textArea1.setRows(2);
textArea1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-textarea");
scrollPane1.setViewportView(textArea1);
}
add(scrollPane1, "cell 1 10 2 1,width 40");
@@ -537,6 +586,7 @@ class FlatThemePreviewAll
//---- editorPane1 ----
editorPane1.setText("Text");
editorPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-editorpane");
scrollPane5.setViewportView(editorPane1);
}
add(scrollPane5, "cell 1 10 2 1,width 40");
@@ -548,6 +598,7 @@ class FlatThemePreviewAll
//---- textPane1 ----
textPane1.setText("Text");
textPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-textpane");
scrollPane9.setViewportView(textPane1);
}
add(scrollPane9, "cell 1 10 2 1,width 40");
@@ -567,46 +618,56 @@ class FlatThemePreviewAll
//======== menuBar1 ========
{
menuBar1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menubar");
//======== menu2 ========
{
menu2.setText("JMenu");
menu2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menu");
//---- menuItem3 ----
menuItem3.setText("JMenuItem");
menuItem3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem");
menu2.add(menuItem3);
//---- menuItem4 ----
menuItem4.setText("JMenuItem");
menuItem4.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem");
menu2.add(menuItem4);
menu2.addSeparator();
//---- checkBoxMenuItem2 ----
checkBoxMenuItem2.setText("JCheckBoxMenuItem");
checkBoxMenuItem2.setSelected(true);
checkBoxMenuItem2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-checkboxmenuitem");
menu2.add(checkBoxMenuItem2);
//---- checkBoxMenuItem3 ----
checkBoxMenuItem3.setText("JCheckBoxMenuItem");
checkBoxMenuItem3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-checkboxmenuitem");
menu2.add(checkBoxMenuItem3);
menu2.addSeparator();
//---- radioButtonMenuItem4 ----
radioButtonMenuItem4.setText("JRadioButtonMenuItem");
radioButtonMenuItem4.setSelected(true);
radioButtonMenuItem4.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-radiobuttonmenuitem");
menu2.add(radioButtonMenuItem4);
//---- radioButtonMenuItem5 ----
radioButtonMenuItem5.setText("JRadioButtonMenuItem");
radioButtonMenuItem5.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-radiobuttonmenuitem");
menu2.add(radioButtonMenuItem5);
menu2.addSeparator();
//======== menu4 ========
{
menu4.setText("JMenu");
menu4.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menu");
//---- menuItem6 ----
menuItem6.setText("JMenuItem");
menuItem6.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem");
menu4.add(menuItem6);
}
menu2.add(menu4);
@@ -614,9 +675,11 @@ class FlatThemePreviewAll
//======== menu5 ========
{
menu5.setText("JMenu");
menu5.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menu");
//---- menuItem7 ----
menuItem7.setText("JMenuItem");
menuItem7.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem");
menu5.add(menuItem7);
}
menu2.add(menu5);
@@ -626,18 +689,22 @@ class FlatThemePreviewAll
//======== menu3 ========
{
menu3.setText("JMenu");
menu3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menu");
//---- menuItem5 ----
menuItem5.setText("JMenuItem");
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");
menu3.add(menuItem5);
//---- menuItem8 ----
menuItem8.setText("JMenuItem");
menuItem8.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem");
menu3.add(menuItem8);
//---- menuItem9 ----
menuItem9.setText("JMenuItem");
menuItem9.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem");
menu3.add(menuItem9);
}
menuBar1.add(menu3);
@@ -650,16 +717,23 @@ class FlatThemePreviewAll
//---- scrollBar1 ----
scrollBar1.setOrientation(Adjustable.HORIZONTAL);
scrollBar1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-scrollbar");
scrollBar1.setVisibleAmount(50);
add(scrollBar1, "cell 1 12 2 1");
//---- scrollBar5 ----
scrollBar5.setOrientation(Adjustable.HORIZONTAL);
scrollBar5.setShowButtons(true);
scrollBar5.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-scrollbar");
scrollBar5.setVisibleAmount(50);
add(scrollBar5, "cell 1 13 2 1");
//---- separatorLabel ----
separatorLabel.setText("JSeparator:");
add(separatorLabel, "cell 0 14");
//---- separator1 ----
separator1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-separator");
add(separator1, "cell 1 14 2 1");
//---- sliderLabel ----
@@ -667,7 +741,7 @@ class FlatThemePreviewAll
add(sliderLabel, "cell 0 15");
//---- slider1 ----
slider1.setValue(30);
slider1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-slider");
add(slider1, "cell 1 15 2 1,width 100");
//---- slider3 ----
@@ -675,7 +749,7 @@ class FlatThemePreviewAll
slider3.setPaintTicks(true);
slider3.setMajorTickSpacing(50);
slider3.setPaintLabels(true);
slider3.setValue(30);
slider3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-slider");
slider3.addChangeListener(e -> changeProgress());
add(slider3, "cell 1 16 2 1,width 100");
@@ -684,12 +758,14 @@ class FlatThemePreviewAll
add(progressBarLabel, "cell 0 17");
//---- progressBar1 ----
progressBar1.setValue(60);
progressBar1.setValue(50);
progressBar1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-progressbar");
add(progressBar1, "cell 1 17 2 1");
//---- progressBar2 ----
progressBar2.setValue(50);
progressBar2.setStringPainted(true);
progressBar2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-progressbar");
add(progressBar2, "cell 1 18 2 1");
//---- toolTipLabel ----
@@ -698,6 +774,7 @@ class FlatThemePreviewAll
//---- toolTip1 ----
toolTip1.setTipText("Some text in tool tip.");
toolTip1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-tooltip");
add(toolTip1, "cell 1 19 2 1,alignx left,growx 0");
//---- toolBarLabel ----
@@ -706,28 +783,34 @@ class FlatThemePreviewAll
//======== toolBar1 ========
{
toolBar1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar");
//---- button4 ----
button4.setIcon(UIManager.getIcon("Tree.closedIcon"));
button4.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-button");
toolBar1.add(button4);
//---- button6 ----
button6.setIcon(UIManager.getIcon("Tree.openIcon"));
button6.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-button");
toolBar1.add(button6);
toolBar1.addSeparator();
//---- button7 ----
button7.setIcon(UIManager.getIcon("Tree.leafIcon"));
button7.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-togglebutton");
toolBar1.add(button7);
//---- button8 ----
button8.setIcon(UIManager.getIcon("Tree.leafIcon"));
button8.setSelected(true);
button8.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-togglebutton");
toolBar1.add(button8);
//---- button9 ----
button9.setIcon(UIManager.getIcon("Tree.leafIcon"));
button9.setSelected(true);
button9.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-togglebutton");
toolBar1.add(button9);
}
add(toolBar1, "cell 1 20 2 1");
@@ -735,6 +818,11 @@ class FlatThemePreviewAll
//---- tabbedPaneLabel ----
tabbedPaneLabel.setText("JTabbedPane:");
add(tabbedPaneLabel, "cell 0 21");
//======== tabbedPane1 ========
{
tabbedPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-tabbedpane");
}
add(tabbedPane1, "cell 1 21 2 1");
//---- listTreeLabel ----
@@ -744,6 +832,7 @@ class FlatThemePreviewAll
//======== splitPane1 ========
{
splitPane1.setResizeWeight(0.5);
splitPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-splitpane");
//======== scrollPane2 ========
{
@@ -761,6 +850,7 @@ class FlatThemePreviewAll
@Override
public String getElementAt(int i) { return values[i]; }
});
list1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-list");
scrollPane2.setViewportView(list1);
}
splitPane1.setLeftComponent(scrollPane2);
@@ -781,6 +871,7 @@ class FlatThemePreviewAll
add(node1);
}
}));
tree1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-tree");
scrollPane3.setViewportView(tree1);
}
splitPane1.setRightComponent(scrollPane3);
@@ -804,6 +895,7 @@ class FlatThemePreviewAll
"Column 1", "Column 2"
}
));
table1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-table");
scrollPane4.setViewportView(table1);
}
add(scrollPane4, "cell 1 23 2 1,width 100,height 70");
@@ -814,6 +906,7 @@ class FlatThemePreviewAll
//======== desktopPane1 ========
{
desktopPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-desktoppane");
//======== internalFrame1 ========
{
@@ -823,6 +916,7 @@ class FlatThemePreviewAll
internalFrame1.setMaximizable(true);
internalFrame1.setIconifiable(true);
internalFrame1.setResizable(true);
internalFrame1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-internalframe");
Container internalFrame1ContentPane = internalFrame1.getContentPane();
internalFrame1ContentPane.setLayout(new BorderLayout());
}
@@ -837,6 +931,7 @@ class FlatThemePreviewAll
internalFrame2.setMaximizable(true);
internalFrame2.setResizable(true);
internalFrame2.setTitle("Inactive");
internalFrame2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-internalframe");
Container internalFrame2ContentPane = internalFrame2.getContentPane();
internalFrame2ContentPane.setLayout(new BorderLayout());
}
@@ -861,7 +956,9 @@ class FlatThemePreviewAll
private JCheckBox enabledCheckBox;
private JCheckBox editableCheckBox;
private JCheckBox focusedCheckBox;
private JLabel label1;
private FlatTextField textField1;
private FlatTextField textField2;
private FlatFormattedTextField formattedTextField1;
private FlatPasswordField passwordField1;
private JTextArea textArea1;

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "999.9.9.9.9999" Java: "1.8.0_202" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.5.0.404" Java: "17" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
@@ -58,6 +58,10 @@ new FormModel {
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label1"
"text": "Some Text"
"$client.FlatLaf.styleClass": "flatlaf-preview-label"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1 2 1"
} )
@@ -78,12 +82,14 @@ new FormModel {
add( new FormComponent( "javax.swing.JButton" ) {
name: "button1"
"text": "OK"
"$client.FlatLaf.styleClass": "flatlaf-preview-button"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewAll$PreviewDefaultButton" ) {
name: "testDefaultButton1"
"text": "Default"
"$client.FlatLaf.styleClass": "flatlaf-preview-button"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 2"
} )
@@ -96,6 +102,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton1"
"text": "Unselected"
"$client.FlatLaf.styleClass": "flatlaf-preview-togglebutton"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3"
} )
@@ -103,6 +110,7 @@ new FormModel {
name: "toggleButton3"
"text": "Selected"
"selected": true
"$client.FlatLaf.styleClass": "flatlaf-preview-togglebutton"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 3"
} )
@@ -115,6 +123,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "checkBox1"
"text": "Unselected"
"$client.FlatLaf.styleClass": "flatlaf-preview-checkbox"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4,alignx left,growx 0"
} )
@@ -122,6 +131,7 @@ new FormModel {
name: "checkBox3"
"text": "Selected"
"selected": true
"$client.FlatLaf.styleClass": "flatlaf-preview-checkbox"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 4,alignx left,growx 0"
} )
@@ -135,6 +145,7 @@ new FormModel {
name: "radioButton1"
"text": "Unselected"
"$buttonGroup": new FormReference( "buttonGroup1" )
"$client.FlatLaf.styleClass": "flatlaf-preview-radiobutton"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 5,alignx left,growx 0"
} )
@@ -143,6 +154,7 @@ new FormModel {
"text": "Selected"
"selected": true
"$buttonGroup": new FormReference( "buttonGroup1" )
"$client.FlatLaf.styleClass": "flatlaf-preview-radiobutton"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 5,alignx left,growx 0"
} )
@@ -172,6 +184,7 @@ new FormModel {
}
"maximumRowCount": 6
"placeholderText": "placeholder text"
"$client.FlatLaf.styleClass": "flatlaf-preview-combobox"
auxiliary() {
"JavaCodeGenerator.typeParameters": "String"
}
@@ -196,6 +209,7 @@ new FormModel {
addElement( "kkk" )
}
"maximumRowCount": 6
"$client.FlatLaf.styleClass": "flatlaf-preview-combobox"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 6"
} )
@@ -207,6 +221,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JSpinner" ) {
name: "spinner1"
"$client.FlatLaf.styleClass": "flatlaf-preview-spinner"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 7 2 1"
} )
@@ -220,16 +235,28 @@ new FormModel {
name: "textField1"
"text": "Some Text"
"placeholderText": "placeholder text"
"$client.FlatLaf.styleClass": "flatlaf-preview-textfield"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 8 2 1"
"value": "cell 1 8"
} )
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTextField" ) {
name: "textField2"
"text": "Txt"
"$client.FlatLaf.styleClass": "flatlaf-preview-textfield"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 8"
} )
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatFormattedTextField" ) {
name: "formattedTextField1"
"text": "Some Text"
"placeholderText": "placeholder text"
"$client.FlatLaf.styleClass": "flatlaf-preview-formattedtextfield"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -240,6 +267,8 @@ new FormModel {
name: "passwordField1"
"text": "Some Text"
"placeholderText": "placeholder text"
"$client.FlatLaf.styleClass": "flatlaf-preview-passwordfield"
"showClearButton": true
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -260,6 +289,7 @@ new FormModel {
name: "textArea1"
"text": "Text"
"rows": 2
"$client.FlatLaf.styleClass": "flatlaf-preview-textarea"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -274,6 +304,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JEditorPane" ) {
name: "editorPane1"
"text": "Text"
"$client.FlatLaf.styleClass": "flatlaf-preview-editorpane"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -288,6 +319,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JTextPane" ) {
name: "textPane1"
"text": "Text"
"$client.FlatLaf.styleClass": "flatlaf-preview-textpane"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -317,19 +349,23 @@ new FormModel {
} )
add( new FormContainer( "javax.swing.JMenuBar", new FormLayoutManager( class javax.swing.JMenuBar ) ) {
name: "menuBar1"
"$client.FlatLaf.styleClass": "flatlaf-preview-menubar"
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menu2"
"text": "JMenu"
"$client.FlatLaf.styleClass": "flatlaf-preview-menu"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem3"
"text": "JMenuItem"
"$client.FlatLaf.styleClass": "flatlaf-preview-menuitem"
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem4"
"text": "JMenuItem"
"$client.FlatLaf.styleClass": "flatlaf-preview-menuitem"
} )
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
name: "separator7"
@@ -338,10 +374,12 @@ new FormModel {
name: "checkBoxMenuItem2"
"text": "JCheckBoxMenuItem"
"selected": true
"$client.FlatLaf.styleClass": "flatlaf-preview-checkboxmenuitem"
} )
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
name: "checkBoxMenuItem3"
"text": "JCheckBoxMenuItem"
"$client.FlatLaf.styleClass": "flatlaf-preview-checkboxmenuitem"
} )
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
name: "separator9"
@@ -351,11 +389,13 @@ new FormModel {
"text": "JRadioButtonMenuItem"
"$buttonGroup": new FormReference( "buttonGroup2" )
"selected": true
"$client.FlatLaf.styleClass": "flatlaf-preview-radiobuttonmenuitem"
} )
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
name: "radioButtonMenuItem5"
"text": "JRadioButtonMenuItem"
"$buttonGroup": new FormReference( "buttonGroup2" )
"$client.FlatLaf.styleClass": "flatlaf-preview-radiobuttonmenuitem"
} )
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
name: "separator3"
@@ -363,35 +403,43 @@ new FormModel {
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menu4"
"text": "JMenu"
"$client.FlatLaf.styleClass": "flatlaf-preview-menu"
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem6"
"text": "JMenuItem"
"$client.FlatLaf.styleClass": "flatlaf-preview-menuitem"
} )
} )
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menu5"
"text": "JMenu"
"$client.FlatLaf.styleClass": "flatlaf-preview-menu"
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem7"
"text": "JMenuItem"
"$client.FlatLaf.styleClass": "flatlaf-preview-menuitem"
} )
} )
} )
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menu3"
"text": "JMenu"
"$client.FlatLaf.styleClass": "flatlaf-preview-menu"
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem5"
"text": "JMenuItem"
"accelerator": static javax.swing.KeyStroke getKeyStroke( 80, 715, false )
"$client.FlatLaf.styleClass": "flatlaf-preview-menuitem"
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem8"
"text": "JMenuItem"
"$client.FlatLaf.styleClass": "flatlaf-preview-menuitem"
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem9"
"text": "JMenuItem"
"$client.FlatLaf.styleClass": "flatlaf-preview-menuitem"
} )
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -406,6 +454,8 @@ new FormModel {
add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar1"
"orientation": 0
"$client.FlatLaf.styleClass": "flatlaf-preview-scrollbar"
"visibleAmount": 50
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 12 2 1"
} )
@@ -413,6 +463,8 @@ new FormModel {
name: "scrollBar5"
"orientation": 0
"showButtons": true
"$client.FlatLaf.styleClass": "flatlaf-preview-scrollbar"
"visibleAmount": 50
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 13 2 1"
} )
@@ -424,6 +476,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JSeparator" ) {
name: "separator1"
"$client.FlatLaf.styleClass": "flatlaf-preview-separator"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 14 2 1"
} )
@@ -435,7 +488,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider1"
"value": 30
"$client.FlatLaf.styleClass": "flatlaf-preview-slider"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -448,7 +501,7 @@ new FormModel {
"paintTicks": true
"majorTickSpacing": 50
"paintLabels": true
"value": 30
"$client.FlatLaf.styleClass": "flatlaf-preview-slider"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -464,7 +517,8 @@ new FormModel {
} )
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) {
name: "progressBar1"
"value": 60
"value": 50
"$client.FlatLaf.styleClass": "flatlaf-preview-progressbar"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -475,6 +529,7 @@ new FormModel {
name: "progressBar2"
"value": 50
"stringPainted": true
"$client.FlatLaf.styleClass": "flatlaf-preview-progressbar"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -490,6 +545,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JToolTip" ) {
name: "toolTip1"
"tipText": "Some text in tool tip."
"$client.FlatLaf.styleClass": "flatlaf-preview-tooltip"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 19 2 1,alignx left,growx 0"
} )
@@ -501,16 +557,19 @@ new FormModel {
} )
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
name: "toolBar1"
"$client.FlatLaf.styleClass": "flatlaf-preview-toolbar"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
add( new FormComponent( "javax.swing.JButton" ) {
name: "button4"
"icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" )
"$client.FlatLaf.styleClass": "flatlaf-preview-toolbar-button"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button6"
"icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.openIcon" )
"$client.FlatLaf.styleClass": "flatlaf-preview-toolbar-button"
} )
add( new FormComponent( "javax.swing.JToolBar$Separator" ) {
name: "separator4"
@@ -518,16 +577,19 @@ new FormModel {
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "button7"
"icon": &SwingIcon0 new com.jformdesigner.model.SwingIcon( 2, "Tree.leafIcon" )
"$client.FlatLaf.styleClass": "flatlaf-preview-toolbar-togglebutton"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "button8"
"icon": #SwingIcon0
"selected": true
"$client.FlatLaf.styleClass": "flatlaf-preview-toolbar-togglebutton"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "button9"
"icon": #SwingIcon0
"selected": true
"$client.FlatLaf.styleClass": "flatlaf-preview-toolbar-togglebutton"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 20 2 1"
@@ -540,6 +602,7 @@ new FormModel {
} )
add( new FormContainer( "com.formdev.flatlaf.themeeditor.FlatThemePreviewAll$PreviewTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
name: "tabbedPane1"
"$client.FlatLaf.styleClass": "flatlaf-preview-tabbedpane"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -555,6 +618,7 @@ new FormModel {
add( new FormContainer( "javax.swing.JSplitPane", new FormLayoutManager( class javax.swing.JSplitPane ) ) {
name: "splitPane1"
"resizeWeight": 0.5
"$client.FlatLaf.styleClass": "flatlaf-preview-splitpane"
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "scrollPane2"
"preferredSize": new java.awt.Dimension( 50, 50 )
@@ -565,6 +629,7 @@ new FormModel {
addElement( "Item 2" )
addElement( "Item 3" )
}
"$client.FlatLaf.styleClass": "flatlaf-preview-list"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -593,6 +658,7 @@ new FormModel {
} )
} )
} )
"$client.FlatLaf.styleClass": "flatlaf-preview-tree"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -635,6 +701,7 @@ new FormModel {
add( null )
add( null )
} )
"$client.FlatLaf.styleClass": "flatlaf-preview-table"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -650,6 +717,7 @@ new FormModel {
} )
add( new FormContainer( "javax.swing.JDesktopPane", new FormLayoutManager( class javax.swing.JDesktopPane ) ) {
name: "desktopPane1"
"$client.FlatLaf.styleClass": "flatlaf-preview-desktoppane"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -661,6 +729,7 @@ new FormModel {
"maximizable": true
"iconifiable": true
"resizable": true
"$client.FlatLaf.styleClass": "flatlaf-preview-internalframe"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -676,6 +745,7 @@ new FormModel {
"maximizable": true
"resizable": true
"title": "Inactive"
"$client.FlatLaf.styleClass": "flatlaf-preview-internalframe"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -688,7 +758,7 @@ new FormModel {
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 400, 1070 )
"size": new java.awt.Dimension( 430, 1070 )
} )
add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
name: "buttonGroup1"

View File

@@ -591,6 +591,11 @@ class FlatThemePreviewSwitches
buttonGroup1.add(zoom2xButton);
buttonGroup1.add(zoom3xButton);
buttonGroup1.add(zoom4xButton);
//---- buttonGroup2 ----
ButtonGroup buttonGroup2 = new ButtonGroup();
buttonGroup2.add(radioButton1);
buttonGroup2.add(radioButton2);
// JFormDesigner - End of component initialization //GEN-END:initComponents
}

View File

@@ -510,12 +510,14 @@ new FormModel {
} )
add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$ZoomRadioButton" ) {
name: "radioButton1"
"$buttonGroup": new FormReference( "buttonGroup2" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 16"
} )
add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$ZoomRadioButton" ) {
name: "radioButton2"
"selected": true
"$buttonGroup": new FormReference( "buttonGroup2" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 16"
} )
@@ -528,5 +530,10 @@ new FormModel {
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 580 )
} )
add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
name: "buttonGroup2"
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 634 )
} )
}
}

View File

@@ -117,6 +117,21 @@ class FlatThemePropertiesSupport
int endOffset = textArea.getLineEndOffset( line );
String text = textArea.getText( startOffset, endOffset - startOffset );
// remove trailing backslash from multi-line properties usually used for styles
if( text.endsWith( "\\\n" ) )
text = text.substring( 0, text.length() - 2 ).trim();
// remove trailing semicolon from styles
if( text.endsWith( ";" ) )
text = text.substring( 0, text.length() - 1 ).trim();
// remove key starting with "[style]" so that first property name
// in CSS styled value is used as key to detect value type
if( text.startsWith( "[style]" ) ) {
int sepIndex = text.indexOf( '=' );
if( sepIndex >= 0 )
text = text.substring( sepIndex + 1 );
}
Properties properties = new Properties();
properties.load( new StringReader( text ) );
if( properties.isEmpty() )

View File

@@ -0,0 +1,7 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-opacity=".5" fill-rule="evenodd">
<rect width="2" height="2" x="3" y="11" fill="#7F8B91"/>
<path fill="#7F8B91" d="M9.8339746,5.61435935 L12.0980762,4.30717968 L12.8980762,5.69282032 L10.6339746,7 L12.8980762,8.30717968 L12.0980762,9.69282032 L9.8339746,8.38564065 L9.8339746,11 L8.2339746,11 L8.2339746,8.38564065 L5.96987298,9.69282032 L5.16987298,8.30717968 L7.4339746,7 L5.16987298,5.69282032 L5.96987298,4.30717968 L8.2339746,5.61435935 L8.2339746,3 L9.8339746,3 L9.8339746,5.61435935 Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 770 B

View File

@@ -0,0 +1,7 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-opacity=".9" fill-rule="evenodd">
<rect width="2" height="2" x="3" y="11" fill="#7F8B91"/>
<path fill="#7F8B91" d="M9.8339746,5.61435935 L12.0980762,4.30717968 L12.8980762,5.69282032 L10.6339746,7 L12.8980762,8.30717968 L12.0980762,9.69282032 L9.8339746,8.38564065 L9.8339746,11 L8.2339746,11 L8.2339746,8.38564065 L5.96987298,9.69282032 L5.16987298,8.30717968 L7.4339746,7 L5.16987298,5.69282032 L5.96987298,4.30717968 L8.2339746,5.61435935 L8.2339746,3 L9.8339746,3 L9.8339746,5.61435935 Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 770 B

View File

@@ -0,0 +1,7 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<rect width="2" height="2" x="3" y="11" fill="#40B6E0"/>
<path fill="#40B6E0" d="M9.8339746,5.61435935 L12.0980762,4.30717968 L12.8980762,5.69282032 L10.6339746,7 L12.8980762,8.30717968 L12.0980762,9.69282032 L9.8339746,8.38564065 L9.8339746,11 L8.2339746,11 L8.2339746,8.38564065 L5.96987298,9.69282032 L5.16987298,8.30717968 L7.4339746,7 L5.16987298,5.69282032 L5.96987298,4.30717968 L8.2339746,5.61435935 L8.2339746,3 L9.8339746,3 L9.8339746,5.61435935 Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 752 B

View File

@@ -0,0 +1,6 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="words">
<path id="W" d="M14.5213 3.01418L11.6986 13H9.82624L8.01064 6.68794L6.19504 13H4.3227L1.5 3.01418H3.67021L5.3156 9.53901L7.14539 3H8.93262L10.7482 9.53901L12.4078 3.01418H14.5213Z" fill="#7F8B91" fill-opacity="0.5"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 487 B

View File

@@ -0,0 +1,6 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="wordsHovered">
<path id="W" d="M14.5213 3.01418L11.6986 13H9.82624L8.01064 6.68794L6.19504 13H4.3227L1.5 3.01418H3.67021L5.3156 9.53901L7.14539 3H8.93262L10.7482 9.53901L12.4078 3.01418H14.5213Z" fill="#7F8B91" fill-opacity="0.9"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 494 B

View File

@@ -0,0 +1,6 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="wordsSelected">
<path id="W" d="M14.5213 3.01418L11.6986 13H9.82624L8.01064 6.68794L6.19504 13H4.3227L1.5 3.01418H3.67021L5.3156 9.53901L7.14539 3H8.93262L10.7482 9.53901L12.4078 3.01418H14.5213Z" fill="#40B6E0"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 476 B

View File

@@ -122,3 +122,9 @@ Prop.7.selectionForeground = contrast($Prop.7.selectionBackground,#000,#fff)
@varStyle1 = #f0f
[style].style1 = background: @varStyle1
[style].style2 = background: darken(#f00,10%); \
foreground: #0f0; \
foreground: darken(@background,30%); \
toolbar.hoverBackground: fade(Actions.GreyInline,30%,lazy); \
toolbar.selectedBackground: fade(Actions.GreyInline,50%,lazy)

Binary file not shown.

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

269
gradlew vendored
View File

@@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright 2015 the original author or authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,67 +17,101 @@
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
@@ -106,80 +140,95 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB