Compare commits

..

55 Commits
0.34 ... 0.35

Author SHA1 Message Date
Karl Tauber
ddf9ed06ab release 0.35 2020-05-18 21:22:31 +02:00
Karl Tauber
1907f80024 Demo: fixed compiler warnings and improved error/warning hints 2020-05-18 21:07:11 +02:00
Karl Tauber
8c0ccdd227 Drop shadows on Windows: support medium-weight popups (issue #94) 2020-05-18 13:13:57 +02:00
Karl Tauber
dc098025b6 FileChooser: make top-right buttons look like toolbar buttons 2020-05-18 10:51:23 +02:00
Karl Tauber
c11222b5c7 FlatHtmlTest: added more HTML samples 2020-05-17 22:50:40 +02:00
Karl Tauber
03bc6eb69b FlatTestFrame: '2.0' --> '2' 2020-05-17 18:46:21 +02:00
Karl Tauber
1aa339de02 make component outline border wider if focus width is zero 2020-05-17 17:59:26 +02:00
Karl Tauber
531bb2a968 UIDefaultsDump: dump only differences for macOS
(to avoid the need for updating multiple dumps when changing UI defaults)
2020-05-17 17:52:12 +02:00
Karl Tauber
800dbf3ba9 support different component border colors to indicate errors, warnings or custom state (set client property JComponent.outline to error, warning or any java.awt.Color) 2020-05-17 13:43:19 +02:00
Karl Tauber
ff545e6ecd UIDefaultsLoader: support using a derived color function within another derived color function and create a derived color that joins the color functions 2020-05-17 12:14:14 +02:00
Karl Tauber
961fe38c7e UIDefaultsDump: dump color functions 2020-05-16 22:25:23 +02:00
Karl Tauber
19426394e2 UIDefaultsLoader: added saturate() and desaturate() color functions 2020-05-16 18:59:05 +02:00
Karl Tauber
069a4e8f0b ToolTip: fixed left/right insets of multi-line tooltips so that they are the same as in single-line tooltips (BasicToolTipUI adds 3 to the left and right) 2020-05-16 14:33:55 +02:00
Karl Tauber
a76b02b828 fixed broken FlatTestLaf.properties 2020-05-16 14:19:41 +02:00
Karl Tauber
fbb9bf5f0c Extras: TriStateCheckBox: fixed painting third state in LaFs that do not support third state 2020-05-16 12:29:35 +02:00
Karl Tauber
f632c355e8 FileChooser: scale file icons (issue #100) 2020-05-16 11:03:40 +02:00
Karl Tauber
e75caf5833 FileChooser: use system icons (issue #100) 2020-05-15 17:20:52 +02:00
Karl Tauber
b0c8f2cefd TextComponents: reduced duplicate code; fixed parameter order 2020-05-15 15:00:32 +02:00
Karl Tauber
2136d9f13d PasswordField: do not apply minimum width if columns property > 0 2020-05-15 14:06:33 +02:00
Karl Tauber
83fdeb7e0c ComboBox, Spinner and TextField: support round border style (set client property JComponent.roundRect to true) 2020-05-15 13:38:45 +02:00
Karl Tauber
26c77b3118 Button, ComboBox, TextField and DatePicker UI delegates now get Component.focusWidth and Button.arc/Component.arc/TextComponent.arc from component border 2020-05-15 11:32:53 +02:00
Karl Tauber
578d445ecb FlatBorder: moved scaling from getter methods to paintBorder() and getBorderInsets() 2020-05-14 23:35:11 +02:00
Karl Tauber
3bbc9517af Popup: fixed background flashing effect when drop shadows are disabled (issue #94) 2020-05-14 14:48:12 +02:00
Karl Tauber
a4d7f278cf Drop shadows on Windows: fix location of light weight popup in case it has left or top drop shadow (issue #94) 2020-05-14 11:44:00 +02:00
Karl Tauber
bf0ffc6ac2 Drop shadows: support enabling/disabling drop shadows per component (issue #94) 2020-05-14 11:39:09 +02:00
Karl Tauber
ace07cd9cb Drop shadows on Windows: fixed sub-pixel text rendering issue for heavy weight popups (issue #94) 2020-05-14 11:11:11 +02:00
Karl T
a341179426 Merge pull request #101 from cristatus/patch-2
Fix menu background flashing effect
2020-05-14 10:46:15 +02:00
Amit Mendapara
298f0dfd63 Fix menu background flashing effect
When using dark theme on light platform theme, there was a
background flashing effect on popups.

See #94
2020-05-14 11:43:59 +05:30
Karl Tauber
b8f953cd26 Drop shadows on Windows: use light weight popups by default (issue #94)
this fixes the sub-pixel text rendering issue (on Windows) for popups that fit into the owner window
2020-05-13 18:41:26 +02:00
Karl Tauber
a9cfe69ba7 FileChooser: fixed missing labels in file chooser when running on Java 9 or later (issue #98) 2020-05-13 12:50:41 +02:00
Karl Tauber
b3e0b99e8d Button and ToggleButton: support round button style (set client property JButton.buttonType to roundRect) 2020-05-13 11:45:01 +02:00
Karl Tauber
5bd40baed2 Extras: TriStateCheckBox: paint magenta rectangle when used in LaFs that do not support third state 2020-05-12 23:26:52 +02:00
Karl Tauber
d3a70b8bb2 CheckBox and RadioButton: Opaque flag is no longer ignored when checkbox is used as table cell renderer (issue #77)
this fix replaces/improves fix made in commit 3ba8133890
2020-05-12 22:35:05 +02:00
Karl Tauber
71e698603d ComboBox: fixed painting background outside of border if Component.arc is set to a large value 2020-05-12 22:29:59 +02:00
Karl Tauber
659ead903c TextField: avoid garbage in corners if TextComponent.arc is set to a large value 2020-05-12 18:58:17 +02:00
Karl Tauber
070c435f40 paint nicely rounded buttons, comboboxes, spinners and text fields when setting Button.arc, Component.arc or TextComponent.arc to a large value (e.g. 1000) 2020-05-12 17:48:35 +02:00
Karl Tauber
b668a526e3 changed "Flat" to "FlatLaf" in look and feel names and descriptions 2020-05-12 16:47:46 +02:00
Karl Tauber
01287d0669 Popup: allow disabling native drop shadows for popups on macOS 2020-05-12 16:42:55 +02:00
Karl T
ff481d759f Merge pull request #99 from cristatus/patch-1
Fix popup shadow issue on Linux

https://github.com/JFormDesigner/FlatLaf/issues/94#issuecomment-626344149
2020-05-10 19:25:17 +02:00
Amit Mendapara
71248f1708 Fix popup shadow issue on Linux
Linux adds drop shadow to heavy weight popups. So there is no
need to draw shadow manually.
2020-05-10 22:46:57 +05:30
Karl Tauber
0a0f834f23 Drop shadows:
- reworked drop shadows implementation to support 4-sided shadows
- use 4-sided shadow for internal frames
- made shadows configurable in UI defaults
- made shadows dark in dark themes

(issue #94)
2020-05-10 15:38:50 +02:00
Karl Tauber
06cad7ecd8 Popup: make sure that popup background is filled (issue #94) 2020-05-09 23:50:48 +02:00
Karl Tauber
ceba3e2f95 CHANGELOG.md: added Java 9 module descriptor to extras and swingx JARs 2020-05-09 15:59:29 +02:00
Karl Tauber
61c2fd8794 build.gradle.kts: use MigLayout 5.3-SNAPSHOT for better scaling
Demo: exclude module-info.class from fat JAR
2020-05-09 15:42:18 +02:00
Karl Tauber
db933fee4f build.gradle.kts: flatlaf-extras and flatlaf-swingx are now Java modules
flatlaf-jide-oss is not a Java module because jide-oss.jar does not run on the module path (tries to access private Windows LaF classes)
2020-05-09 15:32:25 +02:00
Karl Tauber
2656c2dc40 build.gradle.kts: moved publishing related configuration to precompiled script plugin 2020-05-09 13:54:16 +02:00
Karl Tauber
01cfe33865 build.gradle.kts: moved module-info and java9 related configuration to precompiled script plugins 2020-05-09 11:16:40 +02:00
Karl Tauber
d79a31cc79 build.gradle.kts: use withSourcesJar() and withJavadocJar()
this adds resources to sources.jar
2020-05-09 02:09:03 +02:00
Karl Tauber
9efab8b892 travis: added openjdk14 and removed openjdk13 2020-05-09 00:30:38 +02:00
Karl Tauber
aae845247a update to Gradle 6.4
./gradlew wrapper --gradle-version=6.4
2020-05-09 00:16:07 +02:00
Karl Tauber
3f45a9a75f Merge remote-tracking branch 'origin/drop-shadows' into master 2020-05-08 19:02:13 +02:00
Karl Tauber
c9016155ae Demo: added "Options > Always show mnemonics" to menu 2020-05-08 18:58:02 +02:00
Karl Tauber
1019e8f4af Extras: added FlatSVGIcon and download section 2020-05-08 18:50:02 +02:00
Karl Tauber
465dc8a66c Popup: added drop shadows to all popups (menu, combobox and tooltip) on all platforms (issue #94) 2020-05-08 11:02:20 +02:00
Karl Tauber
0a181f6407 InternalFrame: added drop shadows (issue #94)
also made borders of internal frames in dark themes darker
2020-05-07 00:07:02 +02:00
92 changed files with 3015 additions and 3385 deletions

View File

@@ -5,7 +5,7 @@ jdk:
- openjdk8
- openjdk9
- openjdk11
- openjdk13
- openjdk14
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock

View File

@@ -1,6 +1,31 @@
FlatLaf Change Log
==================
## 0.35
- Added drop shadows to popup menus, combobox popups, tooltips and internal
frames. (issue #94)
- Support different component border colors to indicate errors, warnings or
custom state (set client property `JComponent.outline` to `error`, `warning`
or any `java.awt.Color`).
- Button and ToggleButton: Support round button style (set client property
`JButton.buttonType` to `roundRect`).
- ComboBox, Spinner and TextField: Support round border style (set client
property `JComponent.roundRect` to `true`).
- Paint nicely rounded buttons, comboboxes, spinners and text fields when
setting `Button.arc`, `Component.arc` or `TextComponent.arc` to a large value
(e.g. 1000).
- Added Java 9 module descriptor to `flatlaf-extras-<version>.jar` and
`flatlaf-swingx-<version>.jar`.
- CheckBox and RadioButton: Flag `opaque` is no longer ignored when checkbox or
radio button is used as table cell renderer. (issue #77)
- FileChooser: Use system icons. (issue #100)
- FileChooser: Fixed missing labels in file chooser when running on Java 9 or
later. (issue #98)
- PasswordField: Do not apply minimum width if `columns` property is greater
than zero.
## 0.34
- Menus: New menu item renderer brings stable left margins, right aligned

View File

@@ -69,9 +69,10 @@ docs).
Addons
------
- [IntelliJ Themes Pack](flatlaf-intellij-themes)
- [Extras](flatlaf-extras)
- [SwingX](flatlaf-swingx)
- [JIDE Common Layer](flatlaf-jide-oss)
- [IntelliJ Themes Pack](flatlaf-intellij-themes)
Projects using FlatLaf

View File

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

34
buildSrc/build.gradle.kts Normal file
View File

@@ -0,0 +1,34 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
`kotlin-dsl`
}
// required for kotlin-dsl or embedded-kotlin plugins
repositories {
jcenter()
}
dependencies {
// NOTE: keep plugin versions in sync with settings.gradle.kts
// "com.jfrog.bintray" plugin
implementation( "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4" )
// "com.jfrog.artifactory" plugin
implementation( "org.jfrog.buildinfo:build-info-extractor-gradle:4.13.0" )
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
java
}
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
sourceSets {
create( "java9" ) {
java {
setSrcDirs( listOf( "src/main/java9" ) )
}
}
}
tasks {
named<JavaCompile>( "compileJava9Java" ) {
sourceCompatibility = "9"
targetCompatibility = "9"
}
jar {
manifest.attributes( "Multi-Release" to "true" )
into( "META-INF/versions/9" ) {
from( sourceSets["java9"].output )
}
}
}
}

View File

@@ -0,0 +1,64 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
open class ModuleInfoExtension {
var paths: ArrayList<String> = ArrayList()
fun dependsOn( vararg paths: String ) {
this.paths.addAll( paths )
}
}
val extension = project.extensions.create<ModuleInfoExtension>( "flatlafModuleInfo" )
plugins {
java
}
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
sourceSets {
create( "module-info" ) {
java {
// include "src/main/java" here to get compile errors if classes are
// used from other modules that are not specified in module dependencies
setSrcDirs( listOf( "src/main/module-info", "src/main/java" ) )
}
}
}
tasks {
named<JavaCompile>( "compileModuleInfoJava" ) {
sourceCompatibility = "9"
targetCompatibility = "9"
dependsOn( extension.paths )
options.compilerArgs.add( "--module-path" )
options.compilerArgs.add( configurations.runtimeClasspath.get().asPath )
}
jar {
manifest.attributes( "Multi-Release" to "true" )
into( "META-INF/versions/9" ) {
from( sourceSets["module-info"].output ) {
include( "module-info.class" )
}
}
}
}
}

View File

@@ -0,0 +1,116 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
open class PublishExtension {
var artifactId: String? = null
var name: String? = null
var description: String? = null
}
val extension = project.extensions.create<PublishExtension>( "flatlafPublish" )
plugins {
`maven-publish`
id( "com.jfrog.bintray" )
id( "com.jfrog.artifactory" )
}
publishing {
publications {
create<MavenPublication>( "maven" ) {
afterEvaluate {
artifactId = extension.artifactId
}
groupId = "com.formdev"
from( components["java"] )
pom {
afterEvaluate {
this@pom.name.set( extension.name )
this@pom.description.set( extension.description )
}
url.set( "https://github.com/JFormDesigner/FlatLaf" )
licenses {
license {
name.set( "The Apache License, Version 2.0" )
url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" )
}
}
developers {
developer {
name.set( "Karl Tauber" )
organization.set( "FormDev Software GmbH" )
organizationUrl.set( "https://www.formdev.com/" )
}
}
scm {
url.set( "https://github.com/JFormDesigner/FlatLaf" )
}
}
}
}
}
bintray {
user = rootProject.extra["bintray.user"] as String?
key = rootProject.extra["bintray.key"] as String?
setPublications( "maven" )
with( pkg ) {
repo = "flatlaf"
afterEvaluate {
this@with.name = extension.artifactId
}
setLicenses( "Apache-2.0" )
vcsUrl = "https://github.com/JFormDesigner/FlatLaf"
with( version ) {
name = project.version.toString()
}
publish = rootProject.extra["bintray.publish"] as Boolean
dryRun = rootProject.extra["bintray.dryRun"] as Boolean
}
}
artifactory {
setContextUrl( "https://oss.jfrog.org" )
publish( closureOf<org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig> {
repository( delegateClosureOf<groovy.lang.GroovyObject> {
setProperty( "repoKey", "oss-snapshot-local" )
setProperty( "username", rootProject.extra["bintray.user"] as String? )
setProperty( "password", rootProject.extra["bintray.key"] as String? )
} )
defaults( delegateClosureOf<groovy.lang.GroovyObject> {
invokeMethod( "publications", "maven" )
setProperty( "publishArtifacts", true )
setProperty( "publishPom", true )
} )
} )
resolve( delegateClosureOf<org.jfrog.gradle.plugin.artifactory.dsl.ResolverConfig> {
setProperty( "repoKey", "jcenter" )
} )
}

View File

@@ -16,58 +16,20 @@
plugins {
`java-library`
`maven-publish`
id( "com.jfrog.bintray" )
id( "com.jfrog.artifactory" )
`flatlaf-module-info`
`flatlaf-java9`
`flatlaf-publish`
}
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
sourceSets {
create( "java9" ) {
java {
setSrcDirs( listOf( "src/main/java9" ) )
}
}
create( "module-info" ) {
java {
// include "src/main/java" here to get compile errors if classes are
// used from other modules that are not specified in module dependencies
setSrcDirs( listOf( "src/main/module-info", "src/main/java" ) )
}
}
}
java {
withSourcesJar()
withJavadocJar()
}
tasks {
assemble {
dependsOn(
"sourcesJar",
"javadocJar"
)
}
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
named<JavaCompile>( "compileModuleInfoJava" ) {
sourceCompatibility = "9"
targetCompatibility = "9"
}
}
jar {
archiveBaseName.set( "flatlaf" )
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
manifest.attributes( "Multi-Release" to "true" )
into( "META-INF/versions/9" ) {
from( sourceSets["java9"].output )
}
from( sourceSets["module-info"].output ) {
include( "module-info.class" )
}
}
doLast {
ReorderJarEntries.reorderJarEntries( outputs.files.singleFile );
}
@@ -82,99 +44,17 @@ tasks {
isFailOnError = false
}
register( "sourcesJar", Jar::class ) {
named<Jar>("sourcesJar" ) {
archiveBaseName.set( "flatlaf" )
archiveClassifier.set( "sources" )
from( sourceSets.main.get().allJava )
}
register( "javadocJar", Jar::class ) {
named<Jar>("javadocJar" ) {
archiveBaseName.set( "flatlaf" )
archiveClassifier.set( "javadoc" )
from( javadoc )
}
}
publishing {
publications {
create<MavenPublication>( "maven" ) {
artifactId = "flatlaf"
groupId = "com.formdev"
from( components["java"] )
artifact( tasks["sourcesJar"] )
artifact( tasks["javadocJar"] )
pom {
name.set( "FlatLaf" )
description.set( "Flat Look and Feel" )
url.set( "https://github.com/JFormDesigner/FlatLaf" )
licenses {
license {
name.set( "The Apache License, Version 2.0" )
url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" )
}
}
developers {
developer {
name.set( "Karl Tauber" )
organization.set( "FormDev Software GmbH" )
organizationUrl.set( "https://www.formdev.com/" )
}
}
scm {
url.set( "https://github.com/JFormDesigner/FlatLaf" )
}
}
}
}
}
bintray {
user = rootProject.extra["bintray.user"] as String?
key = rootProject.extra["bintray.key"] as String?
setPublications( "maven" )
with( pkg ) {
repo = "flatlaf"
name = "flatlaf"
setLicenses( "Apache-2.0" )
vcsUrl = "https://github.com/JFormDesigner/FlatLaf"
with( version ) {
name = project.version.toString()
}
publish = rootProject.extra["bintray.publish"] as Boolean
dryRun = rootProject.extra["bintray.dryRun"] as Boolean
}
}
artifactory {
setContextUrl( "https://oss.jfrog.org" )
publish( closureOf<org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig> {
repository( delegateClosureOf<groovy.lang.GroovyObject> {
setProperty( "repoKey", "oss-snapshot-local" )
setProperty( "username", rootProject.extra["bintray.user"] as String? )
setProperty( "password", rootProject.extra["bintray.key"] as String? )
} )
defaults( delegateClosureOf<groovy.lang.GroovyObject> {
invokeMethod( "publications", "maven" )
setProperty( "publishArtifacts", true )
setProperty( "publishPom", true )
} )
} )
resolve( delegateClosureOf<org.jfrog.gradle.plugin.artifactory.dsl.ResolverConfig> {
setProperty( "repoKey", "jcenter" )
} )
flatlafPublish {
artifactId = "flatlaf"
name = "FlatLaf"
description = "Flat Look and Feel"
}

View File

@@ -30,7 +30,8 @@ public interface FlatClientProperties
* <p>
* <strong>Components</strong> {@link javax.swing.JButton} and {@link javax.swing.JToggleButton}<br>
* <strong>Value type</strong> {@link java.lang.String}<br>
* <strong>Allowed Values</strong> {@link #BUTTON_TYPE_SQUARE} and {@link #BUTTON_TYPE_HELP}
* <strong>Allowed Values</strong> {@link #BUTTON_TYPE_SQUARE}, {@link #BUTTON_TYPE_ROUND_RECT},
* {@link #BUTTON_TYPE_TAB}, {@link #BUTTON_TYPE_HELP} and {@link BUTTON_TYPE_TOOLBAR_BUTTON}
*/
String BUTTON_TYPE = "JButton.buttonType";
@@ -43,6 +44,15 @@ public interface FlatClientProperties
*/
String BUTTON_TYPE_SQUARE = "square";
/**
* Paint the button with round edges.
* <p>
* <strong>Components</strong> {@link javax.swing.JButton} and {@link javax.swing.JToggleButton}
*
* @see #BUTTON_TYPE
*/
String BUTTON_TYPE_ROUND_RECT = "roundRect";
/**
* Paint the toggle button in tab style.
* <p>
@@ -61,6 +71,15 @@ public interface FlatClientProperties
*/
String BUTTON_TYPE_HELP = "help";
/**
* Paint the button in toolbar style.
* <p>
* <strong>Components</strong> {@link javax.swing.JButton} and {@link javax.swing.JToggleButton}
*
* @see #BUTTON_TYPE
*/
String BUTTON_TYPE_TOOLBAR_BUTTON = "toolBarButton";
/**
* Specifies selected state of a checkbox.
* <p>
@@ -93,6 +112,52 @@ public interface FlatClientProperties
*/
String MINIMUM_HEIGHT = "JComponent.minimumHeight";
/**
* Specifies the outline color of the component border.
* <p>
* <strong>Components</strong> {@link javax.swing.JButton}, {@link javax.swing.JComboBox},
* {@link javax.swing.JFormattedTextField}, {@link javax.swing.JPasswordField},
* {@link javax.swing.JScrollPane}, {@link javax.swing.JSpinner},
* {@link javax.swing.JTextField} and {@link javax.swing.JToggleButton}<br>
* <strong>Value type</strong> {@link java.lang.String} or {@link java.awt.Color} or {@link java.awt.Color}[2]<br>
* <strong>Allowed Values</strong> {@link #OUTLINE_ERROR}, {@link #OUTLINE_WARNING},
* any color (type {@link java.awt.Color}) or an array of two colors (type {@link java.awt.Color}[2])
* where the first color is for focused state and the second for unfocused state
*/
String OUTLINE = "JComponent.outline";
/**
* Paint the component border in another color (usually reddish) to indicate an error.
*
* @see #OUTLINE
*/
String OUTLINE_ERROR = "error";
/**
* Paint the component border in another color (usually yellowish) to indicate a warning.
*
* @see #OUTLINE
*/
String OUTLINE_WARNING = "warning";
/**
* Paint the component with round edges.
* <p>
* <strong>Components</strong> {@link javax.swing.JComboBox}, {@link javax.swing.JSpinner},
* {@link javax.swing.JTextField}, {@link javax.swing.JFormattedTextField} and {@link javax.swing.JPasswordField}
* <strong>Value type</strong> {@link java.lang.Boolean}
*/
String COMPONENT_ROUND_RECT = "JComponent.roundRect";
/**
* Specifies whether a drop shadow is painted if the component is shown in a popup
* or if the component is the owner of another component that is shown in a popup.
* <p>
* <strong>Component</strong> {@link javax.swing.JComponent}<br>
* <strong>Value type</strong> {@link java.lang.Boolean}
*/
String POPUP_DROP_SHADOW_PAINTED = "Popup.dropShadowPainted";
/**
* Specifies whether the progress bar has always the larger height even if no string is painted.
* <p>
@@ -240,4 +305,14 @@ public interface FlatClientProperties
Object value = c.getClientProperty( key );
return (value instanceof Color) ? (Color) value : defaultValue;
}
static int clientPropertyChoice( JComponent c, String key, String... choices ) {
Object value = c.getClientProperty( key );
for( int i = 0; i < choices.length; i++ ) {
if( choices[i].equals( value ) )
return i;
}
return -1;
}
}

View File

@@ -32,11 +32,11 @@ public class FlatDarculaLaf
@Override
public String getName() {
return "Flat Darcula";
return "FlatLaf Darcula";
}
@Override
public String getDescription() {
return "Flat Darcula Look and Feel";
return "FlatLaf Darcula Look and Feel";
}
}

View File

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

View File

@@ -32,11 +32,11 @@ public class FlatIntelliJLaf
@Override
public String getName() {
return "Flat IntelliJ";
return "FlatLaf IntelliJ";
}
@Override
public String getDescription() {
return "Flat IntelliJ Look and Feel";
return "FlatLaf IntelliJ Look and Feel";
}
}

View File

@@ -56,6 +56,7 @@ import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicLookAndFeel;
import javax.swing.text.StyleContext;
import javax.swing.text.html.HTMLEditorKit;
import com.formdev.flatlaf.ui.FlatPopupFactory;
import com.formdev.flatlaf.util.GrayFilter;
import com.formdev.flatlaf.util.MultiResolutionImageSupport;
import com.formdev.flatlaf.util.SystemInfo;
@@ -78,6 +79,7 @@ public abstract class FlatLaf
private static boolean aquaLoaded;
private static boolean updateUIPending;
private PopupFactory oldPopupFactory;
private MnemonicHandler mnemonicHandler;
private Consumer<UIDefaults> postInitialization;
@@ -144,6 +146,10 @@ public abstract class FlatLaf
super.initialize();
// install popup factory
oldPopupFactory = PopupFactory.getSharedInstance();
PopupFactory.setSharedInstance( new FlatPopupFactory() );
// install mnemonic handler
mnemonicHandler = new MnemonicHandler();
mnemonicHandler.install();
@@ -200,6 +206,12 @@ public abstract class FlatLaf
desktopPropertyListener = null;
}
// uninstall popup factory
if( oldPopupFactory != null ) {
PopupFactory.setSharedInstance( oldPopupFactory );
oldPopupFactory = null;
}
// uninstall mnemonic handler
if( mnemonicHandler != null ) {
mnemonicHandler.uninstall();
@@ -256,8 +268,8 @@ public abstract class FlatLaf
public UIDefaults getDefaults() {
UIDefaults defaults = super.getDefaults();
// add Metal resource bundle, which is required for FlatFileChooserUI
defaults.addResourceBundle( "com.sun.swing.internal.plaf.metal.resources.metal" );
// add resource bundle for localized texts
defaults.addResourceBundle( "com.formdev.flatlaf.resources.Bundle" );
// initialize some defaults (for overriding) that are used in UI delegates,
// but are not set in BasicLookAndFeel

View File

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

View File

@@ -467,6 +467,12 @@ public class IntelliJTheme
uiKeyMapping.put( "ComboBox.ArrowButton.iconColor", "ComboBox.buttonArrowColor" );
uiKeyMapping.put( "ComboBox.ArrowButton.nonEditableBackground", "ComboBox.buttonBackground" );
// Component
uiKeyMapping.put( "Component.inactiveErrorFocusColor", "Component.error.borderColor" );
uiKeyMapping.put( "Component.errorFocusColor", "Component.error.focusedBorderColor" );
uiKeyMapping.put( "Component.inactiveWarningFocusColor", "Component.warning.borderColor" );
uiKeyMapping.put( "Component.warningFocusColor", "Component.warning.focusedBorderColor" );
// Link
uiKeyMapping.put( "Link.activeForeground", "Component.linkColor" );

View File

@@ -40,6 +40,7 @@ import javax.swing.plaf.InsetsUIResource;
import com.formdev.flatlaf.ui.FlatEmptyBorder;
import com.formdev.flatlaf.ui.FlatLineBorder;
import com.formdev.flatlaf.util.ColorFunctions;
import com.formdev.flatlaf.util.ColorFunctions.ColorFunction;
import com.formdev.flatlaf.util.DerivedColor;
import com.formdev.flatlaf.util.GrayFilter;
import com.formdev.flatlaf.util.HSLColor;
@@ -511,8 +512,10 @@ class UIDefaultsLoader
case "rgba": return parseColorRgbOrRgba( true, params, resolver, reportError );
case "hsl": return parseColorHslOrHsla( false, params );
case "hsla": return parseColorHslOrHsla( true, params );
case "lighten": return parseColorLightenOrDarken( true, params, resolver, reportError );
case "darken": return parseColorLightenOrDarken( false, params, resolver, reportError );
case "lighten": return parseColorHSLIncreaseDecrease( 2, true, params, resolver, reportError );
case "darken": return parseColorHSLIncreaseDecrease( 2, false, params, resolver, reportError );
case "saturate": return parseColorHSLIncreaseDecrease( 1, true, params, resolver, reportError );
case "desaturate": return parseColorHSLIncreaseDecrease( 1, false, params, resolver, reportError );
}
throw new IllegalArgumentException( "unknown color function '" + value + "'" );
@@ -565,13 +568,14 @@ class UIDefaultsLoader
}
/**
* Syntax: lighten(color,amount[,options]) or darken(color,amount[,options])
* Syntax: lighten(color,amount[,options]) or darken(color,amount[,options]) or
* saturate(color,amount[,options]) or desaturate(color,amount[,options])
* - color: a color (e.g. #f00) or a color function
* - amount: percentage 0-100%
* - options: [relative] [autoInverse] [lazy] [derived]
*/
private static Object parseColorLightenOrDarken( boolean lighten, List<String> params,
Function<String, String> resolver, boolean reportError )
private static Object parseColorHSLIncreaseDecrease( int hslIndex, boolean increase,
List<String> params, Function<String, String> resolver, boolean reportError )
{
String colorStr = params.get( 0 );
int amount = parsePercentage( params.get( 1 ) );
@@ -588,14 +592,9 @@ class UIDefaultsLoader
derived = options.contains( "derived" );
}
ColorFunctions.ColorFunction function = lighten
? new ColorFunctions.Lighten( amount, relative, autoInverse )
: new ColorFunctions.Darken( amount, relative, autoInverse );
if( derived ) {
ColorUIResource color = (ColorUIResource) parseColorOrFunction( resolver.apply( colorStr ), resolver, reportError );
return new DerivedColor( ColorFunctions.applyFunctions( color, function ), function );
}
// create function
ColorFunction function = new ColorFunctions.HSLIncreaseDecrease(
hslIndex, increase, amount, relative, autoInverse );
if( lazy ) {
return (LazyValue) t -> {
@@ -606,8 +605,27 @@ class UIDefaultsLoader
};
}
ColorUIResource color = (ColorUIResource) parseColorOrFunction( resolver.apply( colorStr ), resolver, reportError );
return new ColorUIResource( ColorFunctions.applyFunctions( color, function ) );
// parse base color
ColorUIResource baseColor = (ColorUIResource) parseColorOrFunction( resolver.apply( colorStr ), resolver, reportError );
// apply this function to base color
Color newColor = ColorFunctions.applyFunctions( baseColor, function );
if( derived ) {
ColorFunction[] functions;
if( baseColor instanceof DerivedColor ) {
// if the base color is also derived, join the color functions
ColorFunction[] baseFunctions = ((DerivedColor)baseColor).getFunctions();
functions = new ColorFunction[baseFunctions.length + 1];
System.arraycopy( baseFunctions, 0, functions, 0, baseFunctions.length );
functions[baseFunctions.length] = function;
} else
functions = new ColorFunction[] { function };
return new DerivedColor( newColor, functions );
}
return new ColorUIResource( newColor );
}
private static int parsePercentage( String value ) {

View File

@@ -36,6 +36,8 @@ import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicBorders;
import javax.swing.text.JTextComponent;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.util.DerivedColor;
/**
* Border for various components (e.g. {@link javax.swing.JTextField}).
@@ -54,6 +56,12 @@ import javax.swing.text.JTextComponent;
* @uiDefault Component.disabledBorderColor Color
* @uiDefault Component.focusedBorderColor Color
*
* @uiDefault Component.error.borderColor Color
* @uiDefault Component.error.focusedBorderColor Color
* @uiDefault Component.warning.borderColor Color
* @uiDefault Component.warning.focusedBorderColor Color
* @uiDefault Component.custom.borderColor Color
*
* @author Karl Tauber
*/
public class FlatBorder
@@ -61,11 +69,18 @@ public class FlatBorder
{
protected final int focusWidth = UIManager.getInt( "Component.focusWidth" );
protected final float innerFocusWidth = FlatUIUtils.getUIFloat( "Component.innerFocusWidth", 0 );
protected final float innerOutlineWidth = FlatUIUtils.getUIFloat( "Component.innerOutlineWidth", 0 );
protected final Color focusColor = UIManager.getColor( "Component.focusColor" );
protected final Color borderColor = UIManager.getColor( "Component.borderColor" );
protected final Color disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" );
protected final Color focusedBorderColor = UIManager.getColor( "Component.focusedBorderColor" );
protected final Color errorBorderColor = UIManager.getColor( "Component.error.borderColor" );
protected final Color errorFocusedBorderColor = UIManager.getColor( "Component.error.focusedBorderColor" );
protected final Color warningBorderColor = UIManager.getColor( "Component.warning.borderColor" );
protected final Color warningFocusedBorderColor = UIManager.getColor( "Component.warning.focusedBorderColor" );
protected final Color customBorderColor = UIManager.getColor( "Component.custom.borderColor" );
@Override
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
Graphics2D g2 = (Graphics2D) g.create();
@@ -73,25 +88,53 @@ public class FlatBorder
FlatUIUtils.setRenderingHints( g2 );
boolean isCellEditor = isTableCellEditor( c );
float focusWidth = isCellEditor ? 0 : getFocusWidth( c );
float borderWidth = getBorderWidth( c );
float arc = isCellEditor ? 0 : getArc( c );
float focusWidth = isCellEditor ? 0 : scale( (float) getFocusWidth( c ) );
float borderWidth = scale( (float) getBorderWidth( c ) );
float arc = isCellEditor ? 0 : scale( (float) getArc( c ) );
Color outlineColor = getOutlineColor( c );
if( isFocused( c ) ) {
float innerFocusWidth = !(c instanceof JScrollPane) ? this.innerFocusWidth : 0;
if( outlineColor != null || isFocused( c ) ) {
float innerFocusWidth = !(c instanceof JScrollPane)
? (outlineColor != null ? innerOutlineWidth : this.innerFocusWidth)
: 0;
g2.setColor( getFocusColor( c ) );
g2.setColor( (outlineColor != null) ? outlineColor : getFocusColor( c ) );
FlatUIUtils.paintComponentOuterBorder( g2, x, y, width, height, focusWidth,
getLineWidth( c ) + scale( innerFocusWidth ), arc );
scale( (float) getLineWidth( c ) ) + scale( innerFocusWidth ), arc );
}
g2.setPaint( getBorderColor( c ) );
g2.setPaint( (outlineColor != null) ? outlineColor : getBorderColor( c ) );
FlatUIUtils.paintComponentBorder( g2, x, y, width, height, focusWidth, borderWidth, arc );
} finally {
g2.dispose();
}
}
protected Color getOutlineColor( Component c ) {
if( !(c instanceof JComponent) )
return null;
Object outline = ((JComponent)c).getClientProperty( FlatClientProperties.OUTLINE );
if( outline instanceof String ) {
switch( (String) outline ) {
case FlatClientProperties.OUTLINE_ERROR:
return isFocused( c ) ? errorFocusedBorderColor : errorBorderColor;
case FlatClientProperties.OUTLINE_WARNING:
return isFocused( c ) ? warningFocusedBorderColor : warningBorderColor;
}
} else if( outline instanceof Color ) {
Color color = (Color) outline;
// use color functions to compute color for unfocused state
if( !isFocused( c ) && customBorderColor instanceof DerivedColor )
color = ((DerivedColor)customBorderColor).derive( color );
return color;
} else if( outline instanceof Color[] && ((Color[])outline).length >= 2 )
return ((Color[])outline)[isFocused( c ) ? 0 : 1];
return null;
}
protected Color getFocusColor( Component c ) {
return focusColor;
}
@@ -153,7 +196,8 @@ public class FlatBorder
@Override
public Insets getBorderInsets( Component c, Insets insets ) {
boolean isCellEditor = isTableCellEditor( c );
float ow = (isCellEditor ? 0 : getFocusWidth( c )) + getLineWidth( c );
float focusWidth = isCellEditor ? 0 : scale( (float) getFocusWidth( c ) );
float ow = focusWidth + scale( (float) getLineWidth( c ) );
insets = super.getBorderInsets( c, insets );
insets.top = Math.round( scale( (float) insets.top ) + ow );
@@ -163,19 +207,33 @@ public class FlatBorder
return insets;
}
protected float getFocusWidth( Component c ) {
return scale( (float) focusWidth );
/**
* Returns the (unscaled) thickness of the outer focus border.
*/
protected int getFocusWidth( Component c ) {
return focusWidth;
}
protected float getLineWidth( Component c ) {
return scale( 1f );
/**
* Returns the (unscaled) line thickness used to compute the border insets.
* This may be different to {@link #getBorderWidth}.
*/
protected int getLineWidth( Component c ) {
return 1;
}
protected float getBorderWidth( Component c ) {
/**
* Returns the (unscaled) line thickness used to paint the border.
* This may be different to {@link #getLineWidth}.
*/
protected int getBorderWidth( Component c ) {
return getLineWidth( c );
}
protected float getArc( Component c ) {
/**
* Returns the (unscaled) arc diameter of the border.
*/
protected int getArc( Component c ) {
return 0;
}
}

View File

@@ -16,7 +16,6 @@
package com.formdev.flatlaf.ui;
import static com.formdev.flatlaf.util.UIScale.scale;
import java.awt.Color;
import java.awt.Component;
import java.awt.GradientPaint;
@@ -124,17 +123,21 @@ public class FlatButtonBorder
}
@Override
protected float getFocusWidth( Component c ) {
return FlatToggleButtonUI.isTabButton( c ) ? 0 : super.getFocusWidth(c );
protected int getFocusWidth( Component c ) {
return FlatToggleButtonUI.isTabButton( c ) ? 0 : super.getFocusWidth( c );
}
@Override
protected float getBorderWidth( Component c ) {
return FlatButtonUI.isDefaultButton( c ) ? scale( (float) defaultBorderWidth ) : super.getBorderWidth( c );
protected int getBorderWidth( Component c ) {
return FlatButtonUI.isDefaultButton( c ) ? defaultBorderWidth : super.getBorderWidth( c );
}
@Override
protected float getArc( Component c ) {
return FlatButtonUI.isSquareButton( c ) ? 0 : scale( (float) arc );
protected int getArc( Component c ) {
switch( FlatButtonUI.getButtonType( c ) ) {
case FlatButtonUI.TYPE_SQUARE: return 0;
case FlatButtonUI.TYPE_ROUND_RECT: return Short.MAX_VALUE;
default: return arc;
}
}
}

View File

@@ -39,7 +39,6 @@ import javax.swing.JToggleButton;
import javax.swing.JToolBar;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicButtonListener;
@@ -61,8 +60,6 @@ import com.formdev.flatlaf.util.UIScale;
*
* <!-- FlatButtonUI -->
*
* @uiDefault Component.focusWidth int
* @uiDefault Button.arc int
* @uiDefault Button.minimumWidth int
* @uiDefault Button.iconTextGap int
* @uiDefault Button.startBackground Color optional; if set, a gradient paint is used and Button.background is ignored
@@ -92,8 +89,6 @@ import com.formdev.flatlaf.util.UIScale;
public class FlatButtonUI
extends BasicButtonUI
{
protected int focusWidth;
protected int arc;
protected int minimumWidth;
protected int iconTextGap;
@@ -139,8 +134,6 @@ public class FlatButtonUI
if( !defaults_initialized ) {
String prefix = getPropertyPrefix();
focusWidth = UIManager.getInt( "Component.focusWidth" );
arc = UIManager.getInt( "Button.arc" );
minimumWidth = UIManager.getInt( prefix + "minimumWidth" );
iconTextGap = FlatUIUtils.getUIInt( prefix + "iconTextGap", 4 );
@@ -187,7 +180,7 @@ public class FlatButtonUI
LookAndFeel.installProperty( b, "opaque", false );
LookAndFeel.installProperty( b, "iconTextGap", scale( iconTextGap ) );
MigLayoutVisualPadding.install( b, getFocusWidth( b ) );
MigLayoutVisualPadding.install( b );
}
@Override
@@ -215,6 +208,10 @@ public class FlatButtonUI
case MINIMUM_HEIGHT:
b.revalidate();
break;
case BUTTON_TYPE:
b.repaint();
break;
}
}
@@ -236,8 +233,15 @@ public class FlatButtonUI
(icon == null && text != null && ("...".equals( text ) || text.length() == 1));
}
static boolean isSquareButton( Component c ) {
return c instanceof AbstractButton && clientPropertyEquals( (AbstractButton) c, BUTTON_TYPE, BUTTON_TYPE_SQUARE );
// same indices as in parameters to clientPropertyChoice()
static final int TYPE_OTHER = -1;
static final int TYPE_SQUARE = 0;
static final int TYPE_ROUND_RECT = 1;
static int getButtonType( Component c ) {
return (c instanceof AbstractButton)
? clientPropertyChoice( (AbstractButton) c, BUTTON_TYPE, BUTTON_TYPE_SQUARE, BUTTON_TYPE_ROUND_RECT )
: TYPE_OTHER;
}
static boolean isHelpButton( Component c ) {
@@ -245,7 +249,8 @@ public class FlatButtonUI
}
static boolean isToolBarButton( Component c ) {
return c.getParent() instanceof JToolBar;
return c.getParent() instanceof JToolBar ||
(c instanceof AbstractButton && clientPropertyEquals( (AbstractButton) c, BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON ));
}
@Override
@@ -272,11 +277,10 @@ public class FlatButtonUI
try {
FlatUIUtils.setRenderingHints( g2 );
Border border = c.getBorder();
boolean isToolBarButton = isToolBarButton( c );
float focusWidth = (border instanceof FlatBorder && !isToolBarButton) ? scale( (float) getFocusWidth( c ) ) : 0;
float arc = ((border instanceof FlatButtonBorder && !isSquareButton( c )) || isToolBarButton)
? scale( (float) this.arc ) : 0;
float focusWidth = isToolBarButton ? 0 : FlatUIUtils.getBorderFocusWidth( c );
float arc = FlatUIUtils.getBorderArc( c );
boolean def = isDefaultButton( c );
int x = 0;
@@ -401,7 +405,7 @@ public class FlatButtonUI
return new Dimension( helpButtonIcon.getIconWidth(), helpButtonIcon.getIconHeight() );
Dimension prefSize = super.getPreferredSize( c );
if ( prefSize == null )
if( prefSize == null )
return null;
// make button square if it is a icon-only button
@@ -409,15 +413,11 @@ public class FlatButtonUI
if( isIconOnlyButton( c ) )
prefSize.width = Math.max( prefSize.width, prefSize.height );
else if( !isToolBarButton( c ) && c.getBorder() instanceof FlatButtonBorder ) {
int focusWidth = getFocusWidth( c );
prefSize.width = Math.max( prefSize.width, scale( FlatUIUtils.minimumWidth( c, minimumWidth ) + (focusWidth * 2) ) );
prefSize.height = Math.max( prefSize.height, scale( FlatUIUtils.minimumHeight( c, 0 ) + (focusWidth * 2) ) );
float focusWidth = FlatUIUtils.getBorderFocusWidth( c );
prefSize.width = Math.max( prefSize.width, scale( FlatUIUtils.minimumWidth( c, minimumWidth ) ) + Math.round( focusWidth * 2 ) );
prefSize.height = Math.max( prefSize.height, scale( FlatUIUtils.minimumHeight( c, 0 ) ) + Math.round( focusWidth * 2 ) );
}
return prefSize;
}
protected int getFocusWidth( JComponent c ) {
return focusWidth;
}
}

View File

@@ -76,8 +76,6 @@ import com.formdev.flatlaf.util.UIScale;
*
* <!-- FlatComboBoxUI -->
*
* @uiDefault Component.focusWidth int
* @uiDefault Component.arc int
* @uiDefault Component.arrowType String triangle (default) or chevron
* @uiDefault Component.isIntelliJTheme boolean
* @uiDefault Component.borderColor Color
@@ -96,8 +94,6 @@ import com.formdev.flatlaf.util.UIScale;
public class FlatComboBoxUI
extends BasicComboBoxUI
{
protected int focusWidth;
protected int arc;
protected String arrowType;
protected boolean isIntelliJTheme;
protected Color borderColor;
@@ -150,8 +146,6 @@ public class FlatComboBoxUI
LookAndFeel.installProperty( comboBox, "opaque", false );
focusWidth = UIManager.getInt( "Component.focusWidth" );
arc = UIManager.getInt( "Component.arc" );
arrowType = UIManager.getString( "Component.arrowType" );
isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
borderColor = UIManager.getColor( "Component.borderColor" );
@@ -170,7 +164,7 @@ public class FlatComboBoxUI
// scale
padding = UIScale.scale( padding );
MigLayoutVisualPadding.install( comboBox, focusWidth );
MigLayoutVisualPadding.install( comboBox );
}
@Override
@@ -249,6 +243,8 @@ public class FlatComboBoxUI
editor.applyComponentOrientation( o );
} else if( editor != null && FlatClientProperties.PLACEHOLDER_TEXT.equals( propertyName ) )
editor.repaint();
else if( FlatClientProperties.COMPONENT_ROUND_RECT.equals( propertyName ) )
comboBox.repaint();
}
};
}
@@ -318,8 +314,11 @@ public class FlatComboBoxUI
@Override
public void update( Graphics g, JComponent c ) {
float focusWidth = FlatUIUtils.getBorderFocusWidth( c );
float arc = FlatUIUtils.getBorderArc( c );
// fill background if opaque to avoid garbage if user sets opaque to true
if( c.isOpaque() && (focusWidth > 0 || arc != 0) )
if( c.isOpaque() && (focusWidth > 0 || arc > 0) )
FlatUIUtils.paintParentBackground( g, c );
Graphics2D g2 = (Graphics2D) g;
@@ -327,8 +326,6 @@ public class FlatComboBoxUI
int width = c.getWidth();
int height = c.getHeight();
float focusWidth = (c.getBorder() instanceof FlatBorder) ? scale( (float) this.focusWidth ) : 0;
float arc = (c.getBorder() instanceof FlatRoundBorder) ? scale( (float) this.arc ) : 0;
int arrowX = arrowButton.getX();
int arrowWidth = arrowButton.getWidth();
boolean enabled = comboBox.isEnabled();
@@ -394,8 +391,7 @@ public class FlatComboBoxUI
@Override
public void paintCurrentValueBackground( Graphics g, Rectangle bounds, boolean hasFocus ) {
g.setColor( comboBox.isEnabled() ? comboBox.getBackground() : getDisabledBackground( comboBox ) );
g.fillRect( bounds.x, bounds.y, bounds.width, bounds.height );
// not necessary because already painted in update()
}
private Color getDisabledBackground( JComponent c ) {

View File

@@ -0,0 +1,223 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formdev.flatlaf.ui;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Insets;
import java.awt.RadialGradientPaint;
import java.awt.image.BufferedImage;
import com.formdev.flatlaf.util.HiDPIUtils;
import com.formdev.flatlaf.util.UIScale;
/**
* Paints a drop shadow border around the component.
* Supports 1-sided, 2-side, 3-sided or 4-sided drop shadows.
* <p>
* The shadow insets allow specifying drop shadow thickness for each side.
* A zero or negative value hides the drop shadow on that side.
* A negative value can be used to indent the drop shadow on corners.
* E.g. -4 on left indents drop shadow at top-left and bottom-left corners by 4 pixels.
*
* @author Karl Tauber
*/
public class FlatDropShadowBorder
extends FlatEmptyBorder
{
private final Color shadowColor;
private final Insets shadowInsets;
private final float shadowOpacity;
private final int shadowSize;
private Image shadowImage;
private Color lastShadowColor;
private double lastSystemScaleFactor;
private float lastUserScaleFactor;
public FlatDropShadowBorder() {
this( null );
}
public FlatDropShadowBorder( Color shadowColor ) {
this( shadowColor, 4, 0.5f );
}
public FlatDropShadowBorder( Color shadowColor, int shadowSize, float shadowOpacity ) {
this( shadowColor, new Insets( -shadowSize, -shadowSize, shadowSize, shadowSize ), shadowOpacity );
}
public FlatDropShadowBorder( Color shadowColor, Insets shadowInsets, float shadowOpacity ) {
super( Math.max( shadowInsets.top, 0 ), Math.max( shadowInsets.left, 0 ),
Math.max( shadowInsets.bottom, 0 ), Math.max( shadowInsets.right, 0 ) );
this.shadowColor = shadowColor;
this.shadowInsets = shadowInsets;
this.shadowOpacity = shadowOpacity;
shadowSize = Math.max(
Math.max( shadowInsets.left, shadowInsets.right ),
Math.max( shadowInsets.top, shadowInsets.bottom ) );
}
@Override
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
if( shadowSize <= 0 )
return;
HiDPIUtils.paintAtScale1x( (Graphics2D) g, x, y, width, height, this::paintImpl );
}
private void paintImpl( Graphics2D g, int x, int y, int width, int height, double scaleFactor ) {
Color shadowColor = (this.shadowColor != null) ? this.shadowColor : g.getColor();
int shadowSize = scale( this.shadowSize, scaleFactor );
// create and cache shadow image
float userScaleFactor = UIScale.getUserScaleFactor();
if( shadowImage == null ||
!shadowColor.equals( lastShadowColor ) ||
lastSystemScaleFactor != scaleFactor ||
lastUserScaleFactor != userScaleFactor )
{
shadowImage = createShadowImage( shadowColor, shadowSize, shadowOpacity,
(float) (scaleFactor * userScaleFactor) );
lastShadowColor = shadowColor;
lastSystemScaleFactor = scaleFactor;
lastUserScaleFactor = userScaleFactor;
}
/*debug
int m = shadowImage.getWidth( null );
Color oldColor = g.getColor();
g.setColor( Color.lightGray );
g.drawRect( x - m - 1, y - m - 1, m + 1, m + 1 );
g.setColor( Color.white );
g.fillRect( x - m, y - m, m, m );
g.drawImage( shadowImage, x - m, y - m, null );
g.setColor( oldColor );
debug*/
int left = scale( shadowInsets.left, scaleFactor );
int right = scale( shadowInsets.right, scaleFactor );
int top = scale( shadowInsets.top, scaleFactor );
int bottom = scale( shadowInsets.bottom, scaleFactor );
// shadow outer coordinates
int x1o = x - Math.min( left, 0 );
int y1o = y - Math.min( top, 0 );
int x2o = x + width + Math.min( right, 0 );
int y2o = y + height + Math.min( bottom, 0 );
// shadow inner coordinates
int x1i = x1o + shadowSize;
int y1i = y1o + shadowSize;
int x2i = x2o - shadowSize;
int y2i = y2o - shadowSize;
int wh = (shadowSize * 2) - 1;
int center = shadowSize - 1;
// left-top edge
if( left > 0 || top > 0 ) {
g.drawImage( shadowImage, x1o, y1o, x1i, y1i,
0, 0, center, center, null );
}
// top shadow
if( top > 0 ) {
g.drawImage( shadowImage, x1i, y1o, x2i, y1i,
center, 0, center + 1, center, null );
}
// right-top edge
if( right > 0 || top > 0 ) {
g.drawImage( shadowImage, x2i, y1o, x2o, y1i,
center, 0, wh, center, null );
}
// left shadow
if( left > 0 ) {
g.drawImage( shadowImage, x1o, y1i, x1i, y2i,
0, center, center, center + 1, null );
}
// right shadow
if( right > 0 ) {
g.drawImage( shadowImage, x2i, y1i, x2o, y2i,
center, center, wh, center + 1, null );
}
// left-bottom edge
if( left > 0 || bottom > 0 ) {
g.drawImage( shadowImage, x1o, y2i, x1i, y2o,
0, center, center, wh, null );
}
// bottom shadow
if( bottom > 0 ) {
g.drawImage( shadowImage, x1i, y2i, x2i, y2o,
center, center, center + 1, wh, null );
}
// right-bottom edge
if( right > 0 || bottom > 0 ) {
g.drawImage( shadowImage, x2i, y2i, x2o, y2o,
center, center, wh, wh, null );
}
}
private int scale( int value, double scaleFactor ) {
return (int) Math.ceil( UIScale.scale( value ) * scaleFactor );
}
private static BufferedImage createShadowImage( Color shadowColor, int shadowSize,
float shadowOpacity, float scaleFactor )
{
int shadowRGB = shadowColor.getRGB() & 0xffffff;
int shadowAlpha = (int) (255 * shadowOpacity);
Color startColor = new Color( shadowRGB | ((shadowAlpha & 0xff) << 24), true );
Color midColor = new Color( shadowRGB | (((shadowAlpha / 2) & 0xff) << 24), true );
Color endColor = new Color( shadowRGB, true );
/*debug
startColor = Color.red;
midColor = Color.green;
endColor = Color.blue;
debug*/
int wh = (shadowSize * 2) - 1;
int center = shadowSize - 1;
RadialGradientPaint p = new RadialGradientPaint( center, center,
shadowSize - (0.75f * scaleFactor),
new float[] { 0, 0.35f, 1 },
new Color[] { startColor, midColor, endColor } );
BufferedImage image = new BufferedImage( wh, wh, BufferedImage.TYPE_INT_ARGB );
Graphics2D g = image.createGraphics();
try {
g.setPaint( p );
g.fillRect( 0, 0, wh, wh );
} finally {
g.dispose();
}
return image;
}
}

View File

@@ -85,20 +85,20 @@ public class FlatEditorPaneUI
@Override
public Dimension getPreferredSize( JComponent c ) {
return applyMinimumWidth( super.getPreferredSize( c ) );
return applyMinimumWidth( c, super.getPreferredSize( c ), minimumWidth );
}
@Override
public Dimension getMinimumSize( JComponent c ) {
return applyMinimumWidth( super.getMinimumSize( c ) );
return applyMinimumWidth( c, super.getMinimumSize( c ), minimumWidth );
}
private Dimension applyMinimumWidth( Dimension size ) {
static Dimension applyMinimumWidth( JComponent c, Dimension size, int minimumWidth ) {
// Assume that text area is in a scroll pane (that displays the border)
// and subtract 1px border line width.
// Using "(scale( 1 ) * 2)" instead of "scale( 2 )" to deal with rounding
// issues. E.g. at scale factor 1.5 the first returns 4, but the second 3.
int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth );
minimumWidth = FlatUIUtils.minimumWidth( c, minimumWidth );
size.width = Math.max( size.width, scale( minimumWidth ) - (scale( 1 ) * 2) );
return size;
}

View File

@@ -16,11 +16,27 @@
package com.formdev.flatlaf.ui;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Insets;
import java.io.File;
import javax.swing.AbstractButton;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
import javax.swing.UIManager;
import javax.swing.filechooser.FileView;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.metal.MetalFileChooserUI;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.util.ScaledImageIcon;
import com.formdev.flatlaf.util.UIScale;
/**
@@ -86,6 +102,7 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault FileChooser.folderNameLabelText String
* @uiDefault FileChooser.filesOfTypeLabelMnemonic String
* @uiDefault FileChooser.filesOfTypeLabelText String
*
* @uiDefault FileChooser.upFolderToolTipText String
* @uiDefault FileChooser.upFolderAccessibleName String
* @uiDefault FileChooser.homeFolderToolTipText String
@@ -97,11 +114,27 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault FileChooser.detailsViewButtonToolTipText String
* @uiDefault FileChooser.detailsViewButtonAccessibleName String
*
* <!-- FilePane -->
*
* @uiDefault FileChooser.fileNameHeaderText String
* @uiDefault FileChooser.fileSizeHeaderText String
* @uiDefault FileChooser.fileTypeHeaderText String
* @uiDefault FileChooser.fileDateHeaderText String
* @uiDefault FileChooser.fileAttrHeaderText String
*
* @uiDefault FileChooser.viewMenuLabelText String
* @uiDefault FileChooser.refreshActionLabelText String
* @uiDefault FileChooser.newFolderActionLabelText String
* @uiDefault FileChooser.listViewActionLabelText String
* @uiDefault FileChooser.detailsViewActionLabelText String
*
* @author Karl Tauber
*/
public class FlatFileChooserUI
extends MetalFileChooserUI
{
private final FlatFileView fileView = new FlatFileView();
public static ComponentUI createUI( JComponent c ) {
return new FlatFileChooserUI( (JFileChooser) c );
}
@@ -110,6 +143,40 @@ public class FlatFileChooserUI
super( filechooser );
}
@Override
public void installComponents( JFileChooser fc ) {
super.installComponents( fc );
patchUI( fc );
}
private void patchUI( JFileChooser fc ) {
// turn top-right buttons into toolbar buttons
Component topPanel = fc.getComponent( 0 );
if( (topPanel instanceof JPanel) &&
(((JPanel)topPanel).getLayout() instanceof BorderLayout) )
{
Component topButtonPanel = ((JPanel)topPanel).getComponent( 0 );
if( (topButtonPanel instanceof JPanel) &&
(((JPanel)topButtonPanel).getLayout() instanceof BoxLayout) )
{
Insets margin = UIManager.getInsets( "Button.margin" );
Component[] comps = ((JPanel)topButtonPanel).getComponents();
for( int i = comps.length - 1; i >= 0; i-- ) {
Component c = comps[i];
if( c instanceof JButton || c instanceof JToggleButton ) {
AbstractButton b = (AbstractButton)c;
b.putClientProperty( FlatClientProperties.BUTTON_TYPE,
FlatClientProperties.BUTTON_TYPE_TOOLBAR_BUTTON );
b.setMargin( margin );
b.setFocusable( false );
} else if( c instanceof Box.Filler )
((JPanel)topButtonPanel).remove( i );
}
}
}
}
@Override
public Dimension getPreferredSize( JComponent c ) {
return UIScale.scale( super.getPreferredSize( c ) );
@@ -119,4 +186,50 @@ public class FlatFileChooserUI
public Dimension getMinimumSize( JComponent c ) {
return UIScale.scale( super.getMinimumSize( c ) );
}
@Override
public FileView getFileView( JFileChooser fc ) {
return fileView;
}
@Override
public void clearIconCache() {
fileView.clearIconCache();
}
//---- class FlatFileView -------------------------------------------------
private class FlatFileView
extends BasicFileView
{
@Override
public Icon getIcon( File f ) {
// get cached icon
Icon icon = getCachedIcon( f );
if( icon != null )
return icon;
// get system icon
if( f != null ) {
icon = getFileChooser().getFileSystemView().getSystemIcon( f );
if( icon != null ) {
if( icon instanceof ImageIcon )
icon = new ScaledImageIcon( (ImageIcon) icon );
cacheIcon( f, icon );
return icon;
}
}
// get default icon
icon = super.getIcon( f );
if( icon instanceof ImageIcon ) {
icon = new ScaledImageIcon( (ImageIcon) icon );
cacheIcon( f, icon );
}
return icon;
}
}
}

View File

@@ -112,6 +112,16 @@ public class FlatInternalFrameUI
private final Color activeBorderColor = UIManager.getColor( "InternalFrame.activeBorderColor" );
private final Color inactiveBorderColor = UIManager.getColor( "InternalFrame.inactiveBorderColor" );
private final int borderLineWidth = FlatUIUtils.getUIInt( "InternalFrame.borderLineWidth", 1 );
private final boolean dropShadowPainted = UIManager.getBoolean( "InternalFrame.dropShadowPainted" );
private final FlatDropShadowBorder activeDropShadowBorder = new FlatDropShadowBorder(
UIManager.getColor( "InternalFrame.activeDropShadowColor" ),
UIManager.getInsets( "InternalFrame.activeDropShadowInsets" ),
FlatUIUtils.getUIFloat( "InternalFrame.activeDropShadowOpacity", 0.5f ) );
private final FlatDropShadowBorder inactiveDropShadowBorder = new FlatDropShadowBorder(
UIManager.getColor( "InternalFrame.inactiveDropShadowColor" ),
UIManager.getInsets( "InternalFrame.inactiveDropShadowInsets" ),
FlatUIUtils.getUIFloat( "InternalFrame.inactiveDropShadowOpacity", 0.5f ) );
public FlatInternalFrameBorder() {
super( UIManager.getInsets( "InternalFrame.borderMargins" ) );
@@ -137,16 +147,31 @@ public class FlatInternalFrameUI
Insets insets = getBorderInsets( c );
float lineWidth = scale( (float) borderLineWidth );
float rx = x + insets.left - lineWidth;
float ry = y + insets.top - lineWidth;
float rwidth = width - insets.left - insets.right + (lineWidth * 2);
float rheight = height - insets.top - insets.bottom + (lineWidth * 2);
Graphics2D g2 = (Graphics2D) g.create();
try {
FlatUIUtils.setRenderingHints( g2 );
g2.setColor( f.isSelected() ? activeBorderColor : inactiveBorderColor );
g2.fill( FlatUIUtils.createRectangle(
x + insets.left - lineWidth,
y + insets.top - lineWidth,
width - insets.left - insets.right + (lineWidth * 2),
height - insets.top - insets.bottom + (lineWidth * 2),
lineWidth ) );
// paint drop shadow
if( dropShadowPainted ) {
FlatDropShadowBorder dropShadowBorder = f.isSelected()
? activeDropShadowBorder : inactiveDropShadowBorder;
Insets dropShadowInsets = dropShadowBorder.getBorderInsets();
dropShadowBorder.paintBorder( c, g2,
(int) rx - dropShadowInsets.left,
(int) ry - dropShadowInsets.top,
(int) rwidth + dropShadowInsets.left + dropShadowInsets.right,
(int) rheight + dropShadowInsets.top + dropShadowInsets.bottom );
}
// paint border
g2.fill( FlatUIUtils.createRectangle( rx, ry, rwidth, rheight, lineWidth ) );
} finally {
g2.dispose();
}

View File

@@ -16,7 +16,6 @@
package com.formdev.flatlaf.ui;
import static com.formdev.flatlaf.util.UIScale.scale;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
@@ -34,7 +33,6 @@ import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicPasswordFieldUI;
import javax.swing.text.Caret;
import javax.swing.text.JTextComponent;
import com.formdev.flatlaf.FlatClientProperties;
/**
* Provides the Flat LaF UI delegate for {@link javax.swing.JPasswordField}.
@@ -57,8 +55,6 @@ import com.formdev.flatlaf.FlatClientProperties;
*
* <!-- FlatPasswordFieldUI -->
*
* @uiDefault TextComponent.arc int
* @uiDefault Component.focusWidth int
* @uiDefault Component.minimumWidth int
* @uiDefault Component.isIntelliJTheme boolean
* @uiDefault PasswordField.placeholderForeground Color
@@ -70,8 +66,6 @@ import com.formdev.flatlaf.FlatClientProperties;
public class FlatPasswordFieldUI
extends BasicPasswordFieldUI
{
protected int arc;
protected int focusWidth;
protected int minimumWidth;
protected boolean isIntelliJTheme;
protected Color placeholderForeground;
@@ -89,16 +83,14 @@ public class FlatPasswordFieldUI
super.installDefaults();
String prefix = getPropertyPrefix();
arc = UIManager.getInt( "TextComponent.arc" );
focusWidth = UIManager.getInt( "Component.focusWidth" );
minimumWidth = UIManager.getInt( "Component.minimumWidth" );
isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
placeholderForeground = UIManager.getColor( prefix + ".placeholderForeground" );
capsLockIcon = UIManager.getIcon( "PasswordField.capsLockIcon" );
LookAndFeel.installProperty( getComponent(), "opaque", focusWidth == 0 );
LookAndFeel.installProperty( getComponent(), "opaque", false );
MigLayoutVisualPadding.install( getComponent(), focusWidth );
MigLayoutVisualPadding.install( getComponent() );
}
@Override
@@ -153,14 +145,12 @@ public class FlatPasswordFieldUI
@Override
protected void propertyChange( PropertyChangeEvent e ) {
super.propertyChange( e );
if( FlatClientProperties.PLACEHOLDER_TEXT.equals( e.getPropertyName() ) )
getComponent().repaint();
FlatTextFieldUI.propertyChange( getComponent(), e );
}
@Override
protected void paintSafely( Graphics g ) {
FlatTextFieldUI.paintBackground( g, getComponent(), focusWidth, arc, isIntelliJTheme );
FlatTextFieldUI.paintBackground( g, getComponent(), isIntelliJTheme );
FlatTextFieldUI.paintPlaceholder( g, getComponent(), placeholderForeground );
paintCapsLock( g );
super.paintSafely( g );
@@ -184,18 +174,11 @@ public class FlatPasswordFieldUI
@Override
public Dimension getPreferredSize( JComponent c ) {
return applyMinimumWidth( super.getPreferredSize( c ), c );
return FlatTextFieldUI.applyMinimumWidth( c, super.getPreferredSize( c ), minimumWidth );
}
@Override
public Dimension getMinimumSize( JComponent c ) {
return applyMinimumWidth( super.getMinimumSize( c ), c );
}
private Dimension applyMinimumWidth( Dimension size, JComponent c ) {
int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth );
int focusWidth = (c.getBorder() instanceof FlatBorder) ? this.focusWidth : 0;
size.width = Math.max( size.width, scale( minimumWidth + (focusWidth * 2) ) );
return size;
return FlatTextFieldUI.applyMinimumWidth( c, super.getMinimumSize( c ), minimumWidth );
}
}

View File

@@ -0,0 +1,363 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formdev.flatlaf.ui;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Panel;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Window;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.swing.JComponent;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.Popup;
import javax.swing.PopupFactory;
import javax.swing.RootPaneContainer;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.border.Border;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.util.SystemInfo;
/**
* A popup factory that adds drop shadows to popups on Windows.
* On macOS and Linux, heavy weight popups (without drop shadow) are produced and the
* operating system automatically adds drop shadows.
*
* @author Karl Tauber
*/
public class FlatPopupFactory
extends PopupFactory
{
private Method java8getPopupMethod;
private Method java9getPopupMethod;
@Override
public Popup getPopup( Component owner, Component contents, int x, int y )
throws IllegalArgumentException
{
if( !isDropShadowPainted( owner, contents ) )
return new NonFlashingPopup( super.getPopup( owner, contents, x, y ), contents );
// macOS and Linux adds drop shadow to heavy weight popups
if( SystemInfo.IS_MAC || SystemInfo.IS_LINUX ) {
Popup popup = getHeavyWeightPopup( owner, contents, x, y );
if( popup == null )
popup = super.getPopup( owner, contents, x, y );
return new NonFlashingPopup( popup, contents );
}
// create drop shadow popup
return new DropShadowPopup( super.getPopup( owner, contents, x, y ), owner, contents );
}
private boolean isDropShadowPainted( Component owner, Component contents ) {
Boolean b = isDropShadowPainted( owner );
if( b != null )
return b;
b = isDropShadowPainted( contents );
if( b != null )
return b;
return UIManager.getBoolean( "Popup.dropShadowPainted" );
}
private Boolean isDropShadowPainted( Component c ) {
if( !(c instanceof JComponent) )
return null;
Object value = ((JComponent)c).getClientProperty( FlatClientProperties.POPUP_DROP_SHADOW_PAINTED );
return (value instanceof Boolean ) ? (Boolean) value : null;
}
/**
* There is no API in Java 8 to force creation of heavy weight popups,
* but it is possible with reflection. Java 9 provides a new method.
*
* When changing FlatLaf system requirements to Java 9+,
* then this method can be replaced with:
* return getPopup( owner, contents, x, y, true );
*/
private Popup getHeavyWeightPopup( Component owner, Component contents, int x, int y )
throws IllegalArgumentException
{
try {
if( SystemInfo.IS_JAVA_9_OR_LATER ) {
if( java9getPopupMethod == null ) {
java9getPopupMethod = PopupFactory.class.getDeclaredMethod(
"getPopup", Component.class, Component.class, int.class, int.class, boolean.class );
}
return (Popup) java9getPopupMethod.invoke( this, owner, contents, x, y, true );
} else {
// Java 8
if( java8getPopupMethod == null ) {
java8getPopupMethod = PopupFactory.class.getDeclaredMethod(
"getPopup", Component.class, Component.class, int.class, int.class, int.class );
java8getPopupMethod.setAccessible( true );
}
return (Popup) java8getPopupMethod.invoke( this, owner, contents, x, y, /*HEAVY_WEIGHT_POPUP*/ 2 );
}
} catch( NoSuchMethodException | SecurityException | IllegalAccessException | InvocationTargetException ex ) {
// ignore
return null;
}
}
//---- class NonFlashingPopup ---------------------------------------------
private class NonFlashingPopup
extends Popup
{
private Popup delegate;
// heavy weight
protected Window popupWindow;
private Color oldPopupWindowBackground;
NonFlashingPopup( Popup delegate, Component contents ) {
this.delegate = delegate;
popupWindow = SwingUtilities.windowForComponent( contents );
if( popupWindow != null ) {
// heavy weight popup
// fix background flashing which may occur on some platforms
// (e.g. macOS and Linux) when using dark theme
oldPopupWindowBackground = popupWindow.getBackground();
popupWindow.setBackground( contents.getBackground() );
}
}
@Override
public void show() {
delegate.show();
}
@Override
public void hide() {
if( delegate != null ) {
delegate.hide();
delegate = null;
}
if( popupWindow != null ) {
// restore background so that it can not affect other LaFs (when switching)
// because popup windows are cached and reused
popupWindow.setBackground( oldPopupWindowBackground );
popupWindow = null;
}
}
}
//---- class DropShadowPopup ----------------------------------------------
private class DropShadowPopup
extends NonFlashingPopup
{
private final Component owner;
// light weight
private JComponent lightComp;
private Border oldBorder;
private boolean oldOpaque;
// medium weight
private Panel mediumWeightPanel;
private JPanel dropShadowPanel;
private ComponentListener mediumPanelListener;
// heavy weight
private Popup dropShadowDelegate;
private Window dropShadowWindow;
private Color oldDropShadowWindowBackground;
DropShadowPopup( Popup delegate, Component owner, Component contents ) {
super( delegate, contents );
this.owner = owner;
Dimension size = contents.getPreferredSize();
if( size.width <= 0 || size.height <= 0 )
return;
if( popupWindow != null ) {
// heavy weight popup
// Since Java has a problem with sub-pixel text rendering on translucent
// windows, we can not make the popup window translucent for the drop shadow.
// (see https://bugs.openjdk.java.net/browse/JDK-8215980)
// The solution is to create a second translucent window that paints
// the drop shadow and is positioned behind the popup window.
// create panel that paints the drop shadow
JPanel dropShadowPanel = new JPanel();
dropShadowPanel.setBorder( createDropShadowBorder() );
dropShadowPanel.setOpaque( false );
// set preferred size of drop shadow panel
Dimension prefSize = popupWindow.getPreferredSize();
Insets insets = dropShadowPanel.getInsets();
dropShadowPanel.setPreferredSize( new Dimension(
prefSize.width + insets.left + insets.right,
prefSize.height + insets.top + insets.bottom ) );
// create heavy weight popup for drop shadow
int x = popupWindow.getX() - insets.left;
int y = popupWindow.getY() - insets.top;
dropShadowDelegate = getHeavyWeightPopup( owner, dropShadowPanel, x, y );
// make drop shadow popup window translucent
dropShadowWindow = SwingUtilities.windowForComponent( dropShadowPanel );
if( dropShadowWindow != null ) {
oldDropShadowWindowBackground = dropShadowWindow.getBackground();
dropShadowWindow.setBackground( new Color( 0, true ) );
}
} else {
mediumWeightPanel = (Panel) SwingUtilities.getAncestorOfClass( Panel.class, contents );
if( mediumWeightPanel != null ) {
// medium weight popup
dropShadowPanel = new JPanel();
dropShadowPanel.setBorder( createDropShadowBorder() );
dropShadowPanel.setOpaque( false );
dropShadowPanel.setSize( FlatUIUtils.addInsets( mediumWeightPanel.getSize(), dropShadowPanel.getInsets() ) );
} else {
// light weight popup
Container p = contents.getParent();
if( !(p instanceof JComponent) )
return;
lightComp = (JComponent) p;
oldBorder = lightComp.getBorder();
oldOpaque = lightComp.isOpaque();
lightComp.setBorder( createDropShadowBorder() );
lightComp.setOpaque( false );
lightComp.setSize( lightComp.getPreferredSize() );
}
}
}
private Border createDropShadowBorder() {
return new FlatDropShadowBorder(
UIManager.getColor( "Popup.dropShadowColor" ),
UIManager.getInsets( "Popup.dropShadowInsets" ),
FlatUIUtils.getUIFloat( "Popup.dropShadowOpacity", 0.5f ) );
}
@Override
public void show() {
if( dropShadowDelegate != null )
dropShadowDelegate.show();
if( mediumWeightPanel != null )
showMediumWeightDropShadow();
super.show();
// fix location of light weight popup in case it has left or top drop shadow
if( lightComp != null ) {
Insets insets = lightComp.getInsets();
if( insets.left != 0 || insets.top != 0 )
lightComp.setLocation( lightComp.getX() - insets.left, lightComp.getY() - insets.top );
}
}
@Override
public void hide() {
if( dropShadowDelegate != null ) {
dropShadowDelegate.hide();
dropShadowDelegate = null;
}
if( mediumWeightPanel != null ) {
hideMediumWeightDropShadow();
dropShadowPanel = null;
mediumWeightPanel = null;
}
super.hide();
if( dropShadowWindow != null ) {
dropShadowWindow.setBackground( oldDropShadowWindowBackground );
dropShadowWindow = null;
}
if( lightComp != null ) {
lightComp.setBorder( oldBorder );
lightComp.setOpaque( oldOpaque );
lightComp = null;
}
}
private void showMediumWeightDropShadow() {
Window window = SwingUtilities.windowForComponent( owner );
if( window == null )
return;
if( !(window instanceof RootPaneContainer) )
return;
dropShadowPanel.setVisible( false );
JLayeredPane layeredPane = ((RootPaneContainer)window).getLayeredPane();
layeredPane.add( dropShadowPanel, JLayeredPane.POPUP_LAYER, 0 );
mediumPanelListener = new ComponentListener() {
@Override
public void componentShown( ComponentEvent e ) {
dropShadowPanel.setVisible( true );
}
@Override
public void componentHidden( ComponentEvent e ) {
dropShadowPanel.setVisible( false );
}
@Override
public void componentMoved( ComponentEvent e ) {
Point location = mediumWeightPanel.getLocation();
Insets insets = dropShadowPanel.getInsets();
dropShadowPanel.setLocation( location.x - insets.left, location.y - insets.top );
}
@Override
public void componentResized( ComponentEvent e ) {
dropShadowPanel.setSize( FlatUIUtils.addInsets( mediumWeightPanel.getSize(), dropShadowPanel.getInsets() ) );
}
};
mediumWeightPanel.addComponentListener( mediumPanelListener );
}
private void hideMediumWeightDropShadow() {
mediumWeightPanel.removeComponentListener( mediumPanelListener );
Container parent = dropShadowPanel.getParent();
if( parent != null ) {
Rectangle bounds = dropShadowPanel.getBounds();
parent.remove( dropShadowPanel );
parent.repaint( bounds.x, bounds.y, bounds.width, bounds.height );
}
}
}
}

View File

@@ -19,7 +19,6 @@ package com.formdev.flatlaf.ui;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicPopupMenuUI;
import com.formdev.flatlaf.util.SystemInfo;
/**
* Provides the Flat LaF UI delegate for {@link javax.swing.JPopupMenu}.
@@ -36,28 +35,7 @@ import com.formdev.flatlaf.util.SystemInfo;
public class FlatPopupMenuUI
extends BasicPopupMenuUI
{
private boolean oldLightWeightPopupEnabled;
public static ComponentUI createUI( JComponent c ) {
return new FlatPopupMenuUI();
}
@Override
public void installDefaults() {
super.installDefaults();
// use heavy-weight popups on macOS to get nice drop shadow from OS
if( SystemInfo.IS_MAC ) {
oldLightWeightPopupEnabled = popupMenu.isLightWeightPopupEnabled();
popupMenu.setLightWeightPopupEnabled( false );
}
}
@Override
protected void uninstallDefaults() {
super.uninstallDefaults();
if( SystemInfo.IS_MAC )
popupMenu.setLightWeightPopupEnabled( oldLightWeightPopupEnabled );
}
}

View File

@@ -23,7 +23,6 @@ import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
import javax.swing.AbstractButton;
import javax.swing.CellRendererPane;
import javax.swing.JComponent;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
@@ -122,11 +121,10 @@ public class FlatRadioButtonUI
public void paint( Graphics g, JComponent c ) {
// fill background even if not opaque if
// - contentAreaFilled is true and
// - used as cell renderer (because of selection background)
// - or if background was explicitly set to a non-UIResource color
// - if background was explicitly set to a non-UIResource color
if( !c.isOpaque() &&
((AbstractButton)c).isContentAreaFilled() &&
(c.getParent() instanceof CellRendererPane || !(c.getBackground() instanceof UIResource)))
!(c.getBackground() instanceof UIResource) )
{
g.setColor( c.getBackground() );
g.fillRect( 0, 0, c.getWidth(), c.getHeight() );

View File

@@ -16,7 +16,6 @@
package com.formdev.flatlaf.ui;
import static com.formdev.flatlaf.util.UIScale.scale;
import java.awt.Component;
import javax.swing.UIManager;
@@ -33,7 +32,7 @@ public class FlatRoundBorder
protected final int arc = UIManager.getInt( "Component.arc" );
@Override
protected float getArc( Component c ) {
return scale( (float) arc );
protected int getArc( Component c ) {
return FlatUIUtils.isRoundRect( c ) ? Short.MAX_VALUE : arc;
}
}

View File

@@ -83,7 +83,7 @@ public class FlatScrollPaneUI
int focusWidth = UIManager.getInt( "Component.focusWidth" );
LookAndFeel.installProperty( c, "opaque", focusWidth == 0 );
MigLayoutVisualPadding.install( scrollpane, focusWidth );
MigLayoutVisualPadding.install( scrollpane );
}
@Override

View File

@@ -40,6 +40,7 @@ import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicSpinnerUI;
import com.formdev.flatlaf.FlatClientProperties;
/**
* Provides the Flat LaF UI delegate for {@link javax.swing.JSpinner}.
@@ -56,8 +57,6 @@ import javax.swing.plaf.basic.BasicSpinnerUI;
*
* <!-- FlatSpinnerUI -->
*
* @uiDefault Component.focusWidth int
* @uiDefault Component.arc int
* @uiDefault Component.minimumWidth int
* @uiDefault Component.arrowType String triangle (default) or chevron
* @uiDefault Component.isIntelliJTheme boolean
@@ -78,8 +77,6 @@ public class FlatSpinnerUI
{
private Handler handler;
protected int focusWidth;
protected int arc;
protected int minimumWidth;
protected String arrowType;
protected boolean isIntelliJTheme;
@@ -103,8 +100,6 @@ public class FlatSpinnerUI
LookAndFeel.installProperty( spinner, "opaque", false );
focusWidth = UIManager.getInt( "Component.focusWidth" );
arc = UIManager.getInt( "Component.arc" );
minimumWidth = UIManager.getInt( "Component.minimumWidth" );
arrowType = UIManager.getString( "Component.arrowType" );
isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
@@ -121,7 +116,7 @@ public class FlatSpinnerUI
// scale
padding = scale( padding );
MigLayoutVisualPadding.install( spinner, focusWidth );
MigLayoutVisualPadding.install( spinner );
}
@Override
@@ -246,8 +241,11 @@ public class FlatSpinnerUI
@Override
public void update( Graphics g, JComponent c ) {
float focusWidth = FlatUIUtils.getBorderFocusWidth( c );
float arc = FlatUIUtils.getBorderArc( c );
// fill background if opaque to avoid garbage if user sets opaque to true
if( c.isOpaque() && (focusWidth > 0 || arc != 0) )
if( c.isOpaque() && (focusWidth > 0 || arc > 0) )
FlatUIUtils.paintParentBackground( g, c );
Graphics2D g2 = (Graphics2D) g;
@@ -255,8 +253,6 @@ public class FlatSpinnerUI
int width = c.getWidth();
int height = c.getHeight();
float focusWidth = (c.getBorder() instanceof FlatBorder) ? scale( (float) this.focusWidth ) : 0;
float arc = (c.getBorder() instanceof FlatRoundBorder) ? scale( (float) this.arc ) : 0;
Component nextButton = getHandler().nextButton;
int arrowX = nextButton.getX();
int arrowWidth = nextButton.getWidth();
@@ -328,8 +324,9 @@ public class FlatSpinnerUI
// the arrows width is the same as the inner height so that the arrows area is square
int minimumWidth = FlatUIUtils.minimumWidth( spinner, FlatSpinnerUI.this.minimumWidth );
int innerHeight = editorSize.height + padding.top + padding.bottom;
float focusWidth = FlatUIUtils.getBorderFocusWidth( spinner );
return new Dimension(
Math.max( insets.left + insets.right + editorSize.width + padding.left + padding.right + innerHeight, scale( minimumWidth + (focusWidth * 2) ) ),
Math.max( insets.left + insets.right + editorSize.width + padding.left + padding.right + innerHeight, scale( minimumWidth ) + Math.round( focusWidth * 2 ) ),
insets.top + insets.bottom + innerHeight );
}
@@ -398,6 +395,10 @@ public class FlatSpinnerUI
case "enabled":
updateEditorColors();
break;
case FlatClientProperties.COMPONENT_ROUND_RECT:
spinner.repaint();
break;
}
}
}

View File

@@ -20,11 +20,13 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicTableUI;
import javax.swing.table.TableCellRenderer;
import com.formdev.flatlaf.util.UIScale;
/**
@@ -132,6 +134,12 @@ public class FlatTableUI
oldIntercellSpacing = table.getIntercellSpacing();
table.setIntercellSpacing( intercellSpacing );
}
// checkbox is non-opaque in FlatLaf and therefore would not paint selection
// --> make checkbox renderer opaque (but opaque in Metal or Windows LaF)
TableCellRenderer booleanRenderer = table.getDefaultRenderer( Boolean.class );
if( booleanRenderer instanceof JCheckBox )
((JCheckBox)booleanRenderer).setOpaque( true );
}
@Override

View File

@@ -16,7 +16,6 @@
package com.formdev.flatlaf.ui;
import static com.formdev.flatlaf.util.UIScale.scale;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
@@ -100,25 +99,19 @@ public class FlatTextAreaUI
@Override
public Dimension getPreferredSize( JComponent c ) {
return applyMinimumWidth( super.getPreferredSize( c ), c );
return applyMinimumWidth( c, super.getPreferredSize( c ) );
}
@Override
public Dimension getMinimumSize( JComponent c ) {
return applyMinimumWidth( super.getMinimumSize( c ), c );
return applyMinimumWidth( c, super.getMinimumSize( c ) );
}
private Dimension applyMinimumWidth( Dimension size, JComponent c ) {
private Dimension applyMinimumWidth( JComponent c, Dimension size ) {
// do not apply minimum width if JTextArea.columns is set
if( c instanceof JTextArea && ((JTextArea)c).getColumns() > 0 )
return size;
// Assume that text area is in a scroll pane (that displays the border)
// and subtract 1px border line width.
// Using "(scale( 1 ) * 2)" instead of "scale( 2 )" to deal with rounding
// issues. E.g. at scale factor 1.5 the first returns 4, but the second 3.
int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth );
size.width = Math.max( size.width, scale( minimumWidth ) - (scale( 1 ) * 2) );
return size;
return FlatEditorPaneUI.applyMinimumWidth( c, size, minimumWidth );
}
}

View File

@@ -16,14 +16,13 @@
package com.formdev.flatlaf.ui;
import static com.formdev.flatlaf.util.UIScale.scale;
import java.awt.Component;
import javax.swing.UIManager;
/**
* Border for various text components (e.g. {@link javax.swing.JTextField}).
*
* @uiDefault Component.arc int
* @uiDefault TextComponent.arc int
*
* @author Karl Tauber
*/
@@ -33,7 +32,7 @@ public class FlatTextBorder
protected final int arc = UIManager.getInt( "TextComponent.arc" );
@Override
protected float getArc( Component c ) {
return scale( (float) arc );
protected int getArc( Component c ) {
return FlatUIUtils.isRoundRect( c ) ? Short.MAX_VALUE : arc;
}
}

View File

@@ -60,8 +60,6 @@ import com.formdev.flatlaf.FlatClientProperties;
*
* <!-- FlatTextFieldUI -->
*
* @uiDefault TextComponent.arc int
* @uiDefault Component.focusWidth int
* @uiDefault Component.minimumWidth int
* @uiDefault Component.isIntelliJTheme boolean
* @uiDefault TextField.placeholderForeground Color
@@ -72,8 +70,6 @@ import com.formdev.flatlaf.FlatClientProperties;
public class FlatTextFieldUI
extends BasicTextFieldUI
{
protected int arc;
protected int focusWidth;
protected int minimumWidth;
protected boolean isIntelliJTheme;
protected Color placeholderForeground;
@@ -89,15 +85,13 @@ public class FlatTextFieldUI
super.installDefaults();
String prefix = getPropertyPrefix();
arc = UIManager.getInt( "TextComponent.arc" );
focusWidth = UIManager.getInt( "Component.focusWidth" );
minimumWidth = UIManager.getInt( "Component.minimumWidth" );
isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
placeholderForeground = UIManager.getColor( prefix + ".placeholderForeground" );
LookAndFeel.installProperty( getComponent(), "opaque", focusWidth == 0 );
LookAndFeel.installProperty( getComponent(), "opaque", false );
MigLayoutVisualPadding.install( getComponent(), focusWidth );
MigLayoutVisualPadding.install( getComponent() );
}
@Override
@@ -133,14 +127,21 @@ public class FlatTextFieldUI
@Override
protected void propertyChange( PropertyChangeEvent e ) {
super.propertyChange( e );
propertyChange( getComponent(), e );
}
if( FlatClientProperties.PLACEHOLDER_TEXT.equals( e.getPropertyName() ) )
getComponent().repaint();
static void propertyChange( JTextComponent c, PropertyChangeEvent e ) {
switch( e.getPropertyName() ) {
case FlatClientProperties.PLACEHOLDER_TEXT:
case FlatClientProperties.COMPONENT_ROUND_RECT:
c.repaint();
break;
}
}
@Override
protected void paintSafely( Graphics g ) {
paintBackground( g, getComponent(), focusWidth, arc, isIntelliJTheme );
paintBackground( g, getComponent(), isIntelliJTheme );
paintPlaceholder( g, getComponent(), placeholderForeground );
super.paintSafely( g );
}
@@ -150,7 +151,7 @@ public class FlatTextFieldUI
// background is painted elsewhere
}
static void paintBackground( Graphics g, JTextComponent c, int focusWidth, int arc, boolean isIntelliJTheme ) {
static void paintBackground( Graphics g, JTextComponent c, boolean isIntelliJTheme ) {
Border border = c.getBorder();
// do not paint background if:
@@ -161,8 +162,11 @@ public class FlatTextFieldUI
if( !c.isOpaque() && !(border instanceof FlatBorder) && FlatUIUtils.hasOpaqueBeenExplicitlySet( c ) )
return;
float focusWidth = FlatUIUtils.getBorderFocusWidth( c );
float arc = FlatUIUtils.getBorderArc( c );
// fill background if opaque to avoid garbage if user sets opaque to true
if( c.isOpaque() && focusWidth > 0 )
if( c.isOpaque() && (focusWidth > 0 || arc > 0) )
FlatUIUtils.paintParentBackground( g, c );
// paint background
@@ -170,16 +174,13 @@ public class FlatTextFieldUI
try {
FlatUIUtils.setRenderingHints( g2 );
float fFocusWidth = (border instanceof FlatBorder) ? scale( (float) focusWidth ) : 0;
float fArc = (border instanceof FlatTextBorder) ? scale( (float) arc ) : 0;
Color background = c.getBackground();
g2.setColor( !(background instanceof UIResource)
? background
: (isIntelliJTheme && (!c.isEnabled() || !c.isEditable())
? FlatUIUtils.getParentBackground( c )
: background) );
FlatUIUtils.paintComponentBackground( g2, 0, 0, c.getWidth(), c.getHeight(), fFocusWidth, fArc );
FlatUIUtils.paintComponentBackground( g2, 0, 0, c.getWidth(), c.getHeight(), focusWidth, arc );
} finally {
g2.dispose();
}
@@ -212,28 +213,29 @@ public class FlatTextFieldUI
@Override
public Dimension getPreferredSize( JComponent c ) {
return applyMinimumWidth( super.getPreferredSize( c ), c );
return applyMinimumWidth( c, super.getPreferredSize( c ), minimumWidth );
}
@Override
public Dimension getMinimumSize( JComponent c ) {
return applyMinimumWidth( super.getMinimumSize( c ), c );
return applyMinimumWidth( c, super.getMinimumSize( c ), minimumWidth );
}
private Dimension applyMinimumWidth( Dimension size, JComponent c ) {
static Dimension applyMinimumWidth( JComponent c, Dimension size, int minimumWidth ) {
// do not apply minimum width if JTextField.columns is set
if( c instanceof JTextField && ((JTextField)c).getColumns() > 0 )
return size;
// do not apply minimum width if used in combobox or spinner
Container parent = c.getParent();
if( parent instanceof JComboBox ||
parent instanceof JSpinner ||
(parent != null && parent.getParent() instanceof JSpinner) )
return size;
int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth );
int focusWidth = (c.getBorder() instanceof FlatBorder) ? this.focusWidth : 0;
size.width = Math.max( size.width, scale( minimumWidth + (focusWidth * 2) ) );
minimumWidth = FlatUIUtils.minimumWidth( c, minimumWidth );
float focusWidth = FlatUIUtils.getBorderFocusWidth( c );
size.width = Math.max( size.width, scale( minimumWidth ) + Math.round( focusWidth * 2 ) );
return size;
}
}

View File

@@ -16,7 +16,6 @@
package com.formdev.flatlaf.ui;
import static com.formdev.flatlaf.util.UIScale.scale;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JComponent;
@@ -85,22 +84,12 @@ public class FlatTextPaneUI
@Override
public Dimension getPreferredSize( JComponent c ) {
return applyMinimumWidth( super.getPreferredSize( c ) );
return FlatEditorPaneUI.applyMinimumWidth( c, super.getPreferredSize( c ), minimumWidth );
}
@Override
public Dimension getMinimumSize( JComponent c ) {
return applyMinimumWidth( super.getMinimumSize( c ) );
}
private Dimension applyMinimumWidth( Dimension size ) {
// Assume that text area is in a scroll pane (that displays the border)
// and subtract 1px border line width.
// Using "(scale( 1 ) * 2)" instead of "scale( 2 )" to deal with rounding
// issues. E.g. at scale factor 1.5 the first returns 4, but the second 3.
int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth );
size.width = Math.max( size.width, scale( minimumWidth ) - (scale( 1 ) * 2) );
return size;
return FlatEditorPaneUI.applyMinimumWidth( c, super.getMinimumSize( c ), minimumWidth );
}
@Override

View File

@@ -138,7 +138,7 @@ public class FlatToggleButtonUI
case BUTTON_TYPE:
if( BUTTON_TYPE_TAB.equals( e.getOldValue() ) || BUTTON_TYPE_TAB.equals( e.getNewValue() ) ) {
MigLayoutVisualPadding.uninstall( b );
MigLayoutVisualPadding.install( b, getFocusWidth( b ) );
MigLayoutVisualPadding.install( b );
b.revalidate();
}
@@ -212,9 +212,4 @@ public class FlatToggleButtonUI
return super.getForeground( c );
}
@Override
protected int getFocusWidth( JComponent c ) {
return isTabButton( c ) ? 0 : super.getFocusWidth( c );
}
}

View File

@@ -103,7 +103,7 @@ public class FlatToolTipUI
for( String line : lines )
width = Math.max( width, SwingUtilities.computeStringWidth( fm, line ) );
return new Dimension( insets.left + width + insets.right, insets.top + height + insets.bottom );
return new Dimension( insets.left + width + insets.right + 6, insets.top + height + insets.bottom );
} else
return super.getPreferredSize( c );
}
@@ -119,8 +119,8 @@ public class FlatToolTipUI
List<String> lines = StringUtils.split( ((JToolTip)c).getTipText(), '\n' );
int x = insets.left;
int x2 = c.getWidth() - insets.right;
int x = insets.left + 3;
int x2 = c.getWidth() - insets.right - 3;
int y = insets.top - fm.getDescent();
int lineHeight = fm.getHeight();
JComponent comp = ((JToolTip)c).getComponent();

View File

@@ -39,6 +39,7 @@ import java.util.function.Consumer;
import javax.swing.JComponent;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.plaf.UIResource;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.util.DerivedColor;
@@ -142,6 +143,31 @@ public class FlatUIUtils
return (KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner() == c);
}
public static boolean isRoundRect( Component c ) {
return c instanceof JComponent && FlatClientProperties.clientPropertyBoolean(
(JComponent) c, FlatClientProperties.COMPONENT_ROUND_RECT, false );
}
/**
* Returns the scaled thickness of the outer focus border for the given component.
*/
public static float getBorderFocusWidth( JComponent c ) {
Border border = c.getBorder();
return (border instanceof FlatBorder)
? UIScale.scale( (float) ((FlatBorder)border).getFocusWidth( c ) )
: 0;
}
/**
* Returns the scaled arc diameter of the border for the given component.
*/
public static float getBorderArc( JComponent c ) {
Border border = c.getBorder();
return (border instanceof FlatBorder)
? UIScale.scale( (float) ((FlatBorder)border).getArc( c ) )
: 0;
}
/**
* Sets rendering hints used for painting.
*/
@@ -195,14 +221,9 @@ public class FlatUIUtils
if( arc > 0 && arc < UIScale.scale( 10 ) )
outerArc -= UIScale.scale( 2f );
if( outerArc < 0 )
outerArc = 0;
if( innerArc < 0 )
innerArc = 0;
Path2D path = new Path2D.Float( Path2D.WIND_EVEN_ODD );
path.append( new RoundRectangle2D.Float( x, y, width, height, outerArc, outerArc ), false );
path.append( new RoundRectangle2D.Float( x + ow, y + ow, width - (ow * 2), height - (ow * 2), innerArc, innerArc ), false );
path.append( createComponentRectangle( x, y, width, height, outerArc ), false );
path.append( createComponentRectangle( x + ow, y + ow, width - (ow * 2), height - (ow * 2), innerArc ), false );
g.fill( path );
}
@@ -236,19 +257,16 @@ public class FlatUIUtils
private static void paintComponentBorderImpl( Graphics2D g, int x, int y, int width, int height,
float focusWidth, float lineWidth, float arc )
{
float x1 = x + focusWidth;
float y1 = y + focusWidth;
float width1 = width - focusWidth * 2;
float height1 = height - focusWidth * 2;
float arc2 = arc - (lineWidth * 2);
if( arc < 0 )
arc = 0;
if( arc2 < 0 )
arc2 = 0;
RoundRectangle2D.Float r1 = new RoundRectangle2D.Float(
x + focusWidth, y + focusWidth,
width - focusWidth * 2, height - focusWidth * 2, arc, arc );
RoundRectangle2D.Float r2 = new RoundRectangle2D.Float(
r1.x + lineWidth, r1.y + lineWidth,
r1.width - lineWidth * 2, r1.height - lineWidth * 2, arc2, arc2 );
Shape r1 = createComponentRectangle( x1, y1, width1, height1, arc );
Shape r2 = createComponentRectangle(
x1 + lineWidth, y1 + lineWidth,
width1 - lineWidth * 2, height1 - lineWidth * 2, arc2 );
Path2D border = new Path2D.Float( Path2D.WIND_EVEN_ODD );
border.append( r1, false );
@@ -286,12 +304,21 @@ public class FlatUIUtils
private static void paintComponentBackgroundImpl( Graphics2D g, int x, int y, int width, int height,
float focusWidth, float arc )
{
if( arc < 0 )
arc = 0;
g.fill( new RoundRectangle2D.Float(
g.fill( createComponentRectangle(
x + focusWidth, y + focusWidth,
width - focusWidth * 2, height - focusWidth * 2, arc, arc ) );
width - focusWidth * 2, height - focusWidth * 2, arc ) );
}
/**
* Creates a (rounded) rectangle used to paint components (border, background, etc).
* The given arc diameter is limited to min(width,height).
*/
public static Shape createComponentRectangle( float x, float y, float w, float h, float arc ) {
if( arc <= 0 )
return new Rectangle2D.Float( x, y, w, h );
arc = Math.min( arc, Math.min( w, h ) );
return new RoundRectangle2D.Float( x, y, w, h, arc, arc );
}
/**
@@ -360,14 +387,12 @@ public class FlatUIUtils
if( arcTopLeft <= 0 && arcTopRight <= 0 && arcBottomLeft <= 0 && arcBottomRight <= 0 )
return new Rectangle2D.Float( x, y, width, height );
if( arcTopLeft < 0 )
arcTopLeft = 0;
if( arcTopRight < 0 )
arcTopRight = 0;
if( arcBottomLeft < 0 )
arcBottomLeft = 0;
if( arcBottomRight < 0 )
arcBottomRight = 0;
// limit arcs to min(width,height)
float maxArc = Math.min( width, height ) / 2;
arcTopLeft = (arcTopLeft > 0) ? Math.min( arcTopLeft, maxArc ) : 0;
arcTopRight = (arcTopRight > 0) ? Math.min( arcTopRight, maxArc ) : 0;
arcBottomLeft = (arcBottomLeft > 0) ? Math.min( arcBottomLeft, maxArc ) : 0;
arcBottomRight = (arcBottomRight > 0) ? Math.min( arcBottomRight, maxArc ) : 0;
float x2 = x + width;
float y2 = y + height;

View File

@@ -21,6 +21,7 @@ import java.awt.Insets;
import java.beans.PropertyChangeListener;
import java.util.function.Function;
import javax.swing.JComponent;
import javax.swing.border.Border;
/**
* Support for MigLayout visual paddings.
@@ -69,14 +70,17 @@ public class MigLayoutVisualPadding
/**
* Convenience method that checks whether component border is a FlatBorder.
*/
public static void install( JComponent c, int focusWidth ) {
public static void install( JComponent c ) {
if( !migLayoutAvailable )
return;
install( c, c2 -> {
return (c2.getBorder() instanceof FlatBorder)
? new Insets( focusWidth, focusWidth, focusWidth, focusWidth )
: null;
Border border = c2.getBorder();
if( border instanceof FlatBorder ) {
int focusWidth = ((FlatBorder)border).getFocusWidth( c2 );
return new Insets( focusWidth, focusWidth, focusWidth, focusWidth );
} else
return null;
}, "border" );
}

View File

@@ -49,20 +49,26 @@ public class ColorFunctions
void apply( float[] hsl );
}
//---- class Lighten ------------------------------------------------------
//---- class HSLIncreaseDecrease ------------------------------------------
/**
* Increase the lightness of a color in the HSL color space by an absolute
* or relative amount.
* Increase or decrease hue, saturation or luminance of a color in the HSL color space
* by an absolute or relative amount.
*/
public static class Lighten
public static class HSLIncreaseDecrease
implements ColorFunction
{
private final float amount;
private final boolean relative;
private final boolean autoInverse;
public final int hslIndex;
public final boolean increase;
public final float amount;
public final boolean relative;
public final boolean autoInverse;
public Lighten( float amount, boolean relative, boolean autoInverse ) {
public HSLIncreaseDecrease( int hslIndex, boolean increase,
float amount, boolean relative, boolean autoInverse )
{
this.hslIndex = hslIndex;
this.increase = increase;
this.amount = amount;
this.relative = relative;
this.autoInverse = autoInverse;
@@ -70,33 +76,17 @@ public class ColorFunctions
@Override
public void apply( float[] hsl ) {
float amount2 = autoInverse && shouldInverse( hsl ) ? -amount : amount;
hsl[2] = clamp( relative
? (hsl[2] * ((100 + amount2) / 100))
: (hsl[2] + amount2) );
float amount2 = increase ? amount : -amount;
amount2 = autoInverse && shouldInverse( hsl ) ? -amount2 : amount2;
hsl[hslIndex] = clamp( relative
? (hsl[hslIndex] * ((100 + amount2) / 100))
: (hsl[hslIndex] + amount2) );
}
protected boolean shouldInverse( float[] hsl ) {
return hsl[2] >= 50;
}
}
//---- class Darken -------------------------------------------------------
/**
* Decrease the lightness of a color in the HSL color space by an absolute
* or relative amount.
*/
public static class Darken
extends Lighten
{
public Darken( float amount, boolean relative, boolean autoInverse ) {
super( -amount, relative, autoInverse );
}
@Override
protected boolean shouldInverse( float[] hsl ) {
return hsl[2] < 50;
return increase
? hsl[hslIndex] >= 50
: hsl[hslIndex] < 50;
}
}
}

View File

@@ -40,4 +40,8 @@ public class DerivedColor
public Color derive( Color baseColor ) {
return ColorFunctions.applyFunctions( baseColor, functions );
}
public ColorFunction[] getFunctions() {
return functions;
}
}

View File

@@ -17,6 +17,8 @@
package com.formdev.flatlaf.util;
import java.awt.Image;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
/**
@@ -41,4 +43,12 @@ public class MultiResolutionImageSupport
public static Image map( Image image, Function<Image, Image> mapper ) {
return mapper.apply( image );
}
public static Image getResolutionVariant( Image image, int destImageWidth, int destImageHeight ) {
return image;
}
public static List<Image> getResolutionVariants( Image image ) {
return Collections.singletonList( image );
}
}

View File

@@ -0,0 +1,172 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formdev.flatlaf.util;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import javax.swing.Icon;
import javax.swing.ImageIcon;
/**
* Scales the given image icon using the system and user scale factors and
* paints the icon at system scale factor 1x. This gives best scaling quality.
* If the given image icon supports multiple resolutions, the best resolution
* variant is used. The last scaled image is cached for faster repainting.
*
* @author Karl Tauber
*/
public class ScaledImageIcon
implements Icon
{
private final ImageIcon imageIcon;
private double lastSystemScaleFactor;
private float lastUserScaleFactor;
private Image lastImage;
public ScaledImageIcon( ImageIcon imageIcon ) {
this.imageIcon = imageIcon;
}
@Override
public int getIconWidth() {
return UIScale.scale( imageIcon.getIconWidth() );
}
@Override
public int getIconHeight() {
return UIScale.scale( imageIcon.getIconHeight() );
}
@Override
public void paintIcon( Component c, Graphics g, int x, int y ) {
/*debug
g.setColor( Color.red );
g.drawRect( x, y, getIconWidth(), getIconHeight() );
debug*/
// scale factor
double systemScaleFactor = UIScale.getSystemScaleFactor( (Graphics2D) g );
float userScaleFactor = UIScale.getUserScaleFactor();
double scaleFactor = systemScaleFactor * userScaleFactor;
// paint input image icon if not necessary to scale
if( scaleFactor == 1 ) {
imageIcon.paintIcon( c, g, x, y );
return;
}
// paint cached scaled icon
if( systemScaleFactor == lastSystemScaleFactor &&
userScaleFactor == lastUserScaleFactor &&
lastImage != null )
{
paintLastImage( g, x, y );
return;
}
// destination image size
int destImageWidth = (int) Math.round( imageIcon.getIconWidth() * scaleFactor );
int destImageHeight = (int) Math.round( imageIcon.getIconHeight() * scaleFactor );
// get resolution variant of image if it is a multi-resolution image
Image image = MultiResolutionImageSupport.getResolutionVariant(
imageIcon.getImage(), destImageWidth, destImageHeight );
// size of image
int imageWidth = image.getWidth( null );
int imageHeight = image.getHeight( null );
// scale image if necessary to destination size
if( imageWidth != destImageWidth || imageHeight != destImageHeight ) {
// determine scaling method; default is "quality"
Object scalingInterpolation = RenderingHints.VALUE_INTERPOLATION_BICUBIC;
float imageScaleFactor = (float) destImageWidth / (float) imageWidth;
if( ((int) imageScaleFactor) == imageScaleFactor &&
imageScaleFactor > 1f &&
imageWidth <= 16 &&
imageHeight <= 16 )
{
// use "speed" scaling for small icons if the scale factor is an integer
// to avoid blurred icons
scalingInterpolation = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
}
// scale image
BufferedImage bufferedImage = image2bufferedImage( image );
image = scaleImage( bufferedImage, destImageWidth, destImageHeight, scalingInterpolation );
}
// cache image
lastSystemScaleFactor = systemScaleFactor;
lastUserScaleFactor = userScaleFactor;
lastImage = image;
// paint image
paintLastImage( g, x, y );
}
private void paintLastImage( Graphics g, int x, int y ) {
if( lastSystemScaleFactor > 1 ) {
HiDPIUtils.paintAtScale1x( (Graphics2D) g, x, y, 100, 100, // width and height are not used
(g2, x2, y2, width2, height2, scaleFactor2) -> {
g2.drawImage( lastImage, x2, y2, null );
} );
} else
g.drawImage( lastImage, x, y, null );
}
/**
* Scales the given image to the target dimensions.
*
* This is the same what imgscalr library (https://github.com/rkalla/imgscalr)
* would do when invoking Scalr.resize().
*/
private BufferedImage scaleImage( BufferedImage image, int targetWidth, int targetHeight,
Object scalingInterpolation )
{
BufferedImage bufferedImage = new BufferedImage( targetWidth, targetHeight, BufferedImage.TYPE_INT_ARGB );
Graphics2D g = bufferedImage.createGraphics();
try {
g.setRenderingHint( RenderingHints.KEY_INTERPOLATION, scalingInterpolation );
g.drawImage( image, 0, 0, targetWidth, targetHeight, null );
} finally {
g.dispose();
}
return bufferedImage;
}
private BufferedImage image2bufferedImage( Image image ) {
if( image instanceof BufferedImage )
return (BufferedImage) image;
BufferedImage bufferedImage = new BufferedImage( image.getWidth( null ),
image.getHeight( null ), BufferedImage.TYPE_INT_ARGB );
Graphics2D g = bufferedImage.createGraphics();
try {
g.drawImage( image, 0, 0, null );
} finally {
g.dispose();
}
return bufferedImage;
}
}

View File

@@ -21,6 +21,7 @@ import java.awt.image.AbstractMultiResolutionImage;
import java.awt.image.BaseMultiResolutionImage;
import java.awt.image.MultiResolutionImage;
import java.util.ArrayList;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.function.Function;
@@ -51,6 +52,18 @@ public class MultiResolutionImageSupport
: mapper.apply( image );
}
public static Image getResolutionVariant( Image image, int destImageWidth, int destImageHeight ) {
return (image instanceof MultiResolutionImage)
? ((MultiResolutionImage)image).getResolutionVariant( destImageWidth, destImageHeight )
: image;
}
public static List<Image> getResolutionVariants( Image image ) {
return (image instanceof MultiResolutionImage)
? ((MultiResolutionImage)image).getResolutionVariants()
: Collections.singletonList( image );
}
//---- class MappedMultiResolutionImage -----------------------------------
private static class MappedMultiResolutionImage

View File

@@ -26,5 +26,7 @@ module com.formdev.flatlaf {
exports com.formdev.flatlaf.ui;
exports com.formdev.flatlaf.util;
opens com.formdev.flatlaf.resources;
uses com.formdev.flatlaf.FlatDefaultsAddon;
}

View File

@@ -27,6 +27,7 @@ Button.default.boldText=true
Component.focusWidth=2
Component.innerFocusWidth=0
Component.innerOutlineWidth=0
Component.arrowType=triangle

View File

@@ -130,6 +130,12 @@ Component.focusColor=#3d6185
Component.linkColor=#589df6
Component.grayFilter=-20,-70,100
Component.error.borderColor=desaturate($Component.error.focusedBorderColor,25%)
Component.error.focusedBorderColor=#8b3c3c
Component.warning.borderColor=darken(desaturate($Component.warning.focusedBorderColor,20%),10%)
Component.warning.focusedBorderColor=#ac7920
Component.custom.borderColor=desaturate(#f00,50%,relative derived)
#---- Desktop ----
@@ -148,8 +154,8 @@ InternalFrame.activeTitleForeground=@foreground
InternalFrame.inactiveTitleBackground=darken(@background,5%)
InternalFrame.inactiveTitleForeground=@disabledText
InternalFrame.activeBorderColor=lighten($Component.borderColor,10%)
InternalFrame.inactiveBorderColor=$Component.borderColor
InternalFrame.activeBorderColor=darken(@background,7%)
InternalFrame.inactiveBorderColor=darken(@background,3%)
InternalFrame.buttonHoverBackground=lighten($InternalFrame.activeTitleBackground,10%,derived autoInverse)
InternalFrame.buttonPressedBackground=lighten($InternalFrame.activeTitleBackground,20%,derived autoInverse)
@@ -158,6 +164,9 @@ InternalFrame.closePressedBackground=darken(Actions.Red,10%,lazy)
InternalFrame.closeHoverForeground=#fff
InternalFrame.closePressedForeground=#fff
InternalFrame.activeDropShadowOpacity=0.5
InternalFrame.inactiveDropShadowOpacity=0.75
#---- List ----
@@ -187,6 +196,12 @@ MenuItemCheckBox.icon.disabledCheckmarkColor=#606060
PasswordField.capsLockIconColor=#ffffff64
#---- Popup ----
Popup.dropShadowColor=#000
Popup.dropShadowOpacity=0.25
#---- PopupMenu ----
PopupMenu.borderColor=#5e5e5e

View File

@@ -48,6 +48,7 @@ CheckBox.icon.selectedPressedBackground=#72A1D4
Component.focusWidth=2
Component.innerFocusWidth=0
Component.innerOutlineWidth=0
Component.arrowType=triangle

View File

@@ -185,6 +185,7 @@ ComboBox.padding=2,6,2,6
Component.focusWidth=0
Component.innerFocusWidth={float}0.5
Component.innerOutlineWidth={float}1
Component.arc=5
Component.minimumWidth=64
Component.arrowType=chevron
@@ -261,6 +262,13 @@ InternalFrame.maximizeIcon=com.formdev.flatlaf.icons.FlatInternalFrameMaximizeIc
InternalFrame.minimizeIcon=com.formdev.flatlaf.icons.FlatInternalFrameMinimizeIcon
InternalFrame.windowBindings=null
# drop shadow
InternalFrame.dropShadowPainted=true
InternalFrame.activeDropShadowColor=null
InternalFrame.activeDropShadowInsets=5,5,6,6
InternalFrame.inactiveDropShadowColor=null
InternalFrame.inactiveDropShadowInsets=3,3,4,4
#---- InternalFrameTitlePane ----
@@ -362,6 +370,12 @@ PasswordField.echoChar=\u2022
PasswordField.capsLockIcon=com.formdev.flatlaf.icons.FlatCapsLockIcon
#---- Popup ----
Popup.dropShadowPainted=true
Popup.dropShadowInsets=-4,-4,4,4
#---- PopupMenu ----
PopupMenu.border=com.formdev.flatlaf.ui.FlatPopupMenuBorder

View File

@@ -132,6 +132,12 @@ Component.focusColor=#97c3f3
Component.linkColor=#2470B3
Component.grayFilter=25,-25,100
Component.error.borderColor=lighten(desaturate($Component.error.focusedBorderColor,20%),25%)
Component.error.focusedBorderColor=#e53e4d
Component.warning.borderColor=lighten(saturate($Component.warning.focusedBorderColor,25%),20%)
Component.warning.focusedBorderColor=#e2a53a
Component.custom.borderColor=lighten(desaturate(#f00,20%,derived),25%,derived)
#---- Desktop ----
@@ -165,6 +171,9 @@ InternalFrame.closePressedBackground=darken(Actions.Red,10%,lazy)
InternalFrame.closeHoverForeground=#fff
InternalFrame.closePressedForeground=#fff
InternalFrame.activeDropShadowOpacity=0.25
InternalFrame.inactiveDropShadowOpacity=0.5
#---- List ----
@@ -194,6 +203,12 @@ MenuItemCheckBox.icon.disabledCheckmarkColor=#ABABAB
PasswordField.capsLockIconColor=#00000064
#---- Popup ----
Popup.dropShadowColor=#000
Popup.dropShadowOpacity=0.15
#---- PopupMenu ----
PopupMenu.borderColor=#adadad

View File

@@ -0,0 +1,48 @@
#
# 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.
#
#---- FileChooser ----
#fields
FileChooser.lookInLabel.textAndMnemonic=Look &In:
FileChooser.saveInLabelText=Save In:
FileChooser.fileNameLabel.textAndMnemonic=File &Name:
FileChooser.folderNameLabel.textAndMnemonic=Folder &name:
FileChooser.filesOfTypeLabel.textAndMnemonic=Files of &Type:
# toolbar
FileChooser.upFolderToolTipText=Up One Level
FileChooser.upFolderAccessibleName=Up
FileChooser.homeFolderToolTipText=Home
FileChooser.homeFolderAccessibleName=Home
FileChooser.newFolderToolTipText=Create New Folder
FileChooser.newFolderAccessibleName=New Folder
FileChooser.listViewButtonToolTipText=List
FileChooser.listViewButtonAccessibleName=List
FileChooser.detailsViewButtonToolTipText=Details
FileChooser.detailsViewButtonAccessibleName=Details
# details table header
FileChooser.fileNameHeaderText=Name
FileChooser.fileSizeHeaderText=Size
FileChooser.fileTypeHeaderText=Type
FileChooser.fileDateHeaderText=Modified
FileChooser.fileAttrHeaderText=Attributes
# popup menu
FileChooser.viewMenuLabelText=View
FileChooser.refreshActionLabelText=Refresh
FileChooser.newFolderActionLabelText=New Folder
FileChooser.listViewActionLabelText=List
FileChooser.detailsViewActionLabelText=Details

View File

@@ -0,0 +1,48 @@
#
# 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.
#
#---- FileChooser ----
#fields
FileChooser.lookInLabel.textAndMnemonic=Suchen &in:
FileChooser.saveInLabelText=Speichern in:
FileChooser.fileNameLabel.textAndMnemonic=&Dateiname:
FileChooser.folderNameLabel.textAndMnemonic=Ordner&name:
FileChooser.filesOfTypeLabel.textAndMnemonic=Datei&typ:
# toolbar
FileChooser.upFolderToolTipText=Eine Ebene h\u00F6her
FileChooser.upFolderAccessibleName=Nach oben
FileChooser.homeFolderToolTipText=Home
FileChooser.homeFolderAccessibleName=Home
FileChooser.newFolderToolTipText=Neuen Ordner erstellen
FileChooser.newFolderAccessibleName=Neuer Ordner
FileChooser.listViewButtonToolTipText=Liste
FileChooser.listViewButtonAccessibleName=Liste
FileChooser.detailsViewButtonToolTipText=Details
FileChooser.detailsViewButtonAccessibleName=Details
# details table header
FileChooser.fileNameHeaderText=Name
FileChooser.fileSizeHeaderText=Gr\u00F6\u00DFe
FileChooser.fileTypeHeaderText=Typ
FileChooser.fileDateHeaderText=\u00C4nderungsdatum
FileChooser.fileAttrHeaderText=Attribute
# popup menu
FileChooser.viewMenuLabelText=Ansicht
FileChooser.refreshActionLabelText=Aktualisieren
FileChooser.newFolderActionLabelText=Neuer Ordner
FileChooser.listViewActionLabelText=Liste
FileChooser.detailsViewActionLabelText=Details

View File

@@ -0,0 +1,48 @@
#
# 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.
#
#---- FileChooser ----
#fields
FileChooser.lookInLabel.textAndMnemonic=Rechercher &dans:
FileChooser.saveInLabelText=Enregistrer dans:
FileChooser.fileNameLabel.textAndMnemonic=&Nom du fichier:
FileChooser.folderNameLabel.textAndMnemonic=&Nom du dossier:
FileChooser.filesOfTypeLabel.textAndMnemonic=&Type de fichier:
# toolbar
FileChooser.upFolderToolTipText=Remonte d'un niveau
FileChooser.upFolderAccessibleName=Monter
FileChooser.homeFolderToolTipText=R\u00E9pertoire de base
FileChooser.homeFolderAccessibleName=R\u00E9pertoire de base
FileChooser.newFolderToolTipText=Cr\u00E9e un dossier
FileChooser.newFolderAccessibleName=Nouveau dossier
FileChooser.listViewButtonToolTipText=Liste
FileChooser.listViewButtonAccessibleName=Liste
FileChooser.detailsViewButtonToolTipText=D\u00E9tails
FileChooser.detailsViewButtonAccessibleName=D\u00E9tails
# details table header
FileChooser.fileNameHeaderText=Nom
FileChooser.fileSizeHeaderText=Taille
FileChooser.fileTypeHeaderText=Type
FileChooser.fileDateHeaderText=Modifi\u00E9
FileChooser.fileAttrHeaderText=Attributs
# popup menu
FileChooser.viewMenuLabelText=Affichage
FileChooser.refreshActionLabelText=Actualiser
FileChooser.newFolderActionLabelText=Nouveau dossier
FileChooser.listViewActionLabelText=Liste
FileChooser.detailsViewActionLabelText=D\u00E9tails

View File

@@ -27,11 +27,18 @@ plugins {
id( "com.jfrog.artifactory" )
}
repositories {
maven {
// for using MigLayout snapshot
url = uri( "https://oss.sonatype.org/content/repositories/snapshots/" )
}
}
dependencies {
implementation( project( ":flatlaf-core" ) )
implementation( project( ":flatlaf-extras" ) )
implementation( project( ":flatlaf-intellij-themes" ) )
implementation( "com.miglayout:miglayout-swing:5.2" )
implementation( "com.miglayout:miglayout-swing:5.3-SNAPSHOT" )
implementation( "com.jgoodies:jgoodies-forms:1.9.0" )
}
@@ -49,6 +56,7 @@ tasks {
}
exclude( "module-info.class" )
exclude( "META-INF/versions/*/module-info.class" )
// include all dependencies in jar
from( {

View File

@@ -114,6 +114,14 @@ class BasicComponentsPanel
JScrollPane scrollPane12 = new JScrollPane();
JTextPane textPane4 = new JTextPane();
JTextPane textPane5 = new JTextPane();
JLabel label3 = new JLabel();
JTextField textField5 = new JTextField();
JComboBox<String> comboBox7 = new JComboBox<>();
JSpinner spinner3 = new JSpinner();
JLabel label4 = new JLabel();
JTextField textField7 = new JTextField();
JComboBox<String> comboBox8 = new JComboBox<>();
JSpinner spinner4 = new JSpinner();
JPopupMenu popupMenu1 = new JPopupMenu();
JMenuItem cutMenuItem = new JMenuItem();
JMenuItem copyMenuItem = new JMenuItem();
@@ -141,6 +149,8 @@ class BasicComponentsPanel
"[]" +
"[]" +
"[]" +
"[]para" +
"[]" +
"[]"));
//---- labelLabel ----
@@ -179,9 +189,8 @@ class BasicComponentsPanel
add(button5, "cell 3 1");
//---- button6 ----
button6.setText("square");
button6.setEnabled(false);
button6.putClientProperty("JButton.buttonType", "square");
button6.setText("round");
button6.putClientProperty("JButton.buttonType", "roundRect");
add(button6, "cell 4 1");
//---- button3 ----
@@ -597,6 +606,45 @@ class BasicComponentsPanel
textPane5.setText("no scroll pane");
add(textPane5, "cell 5 11,growx");
//---- label3 ----
label3.setText("Error hints:");
add(label3, "cell 0 12");
//---- textField5 ----
textField5.putClientProperty("JComponent.outline", "error");
add(textField5, "cell 1 12,growx");
//---- comboBox7 ----
comboBox7.putClientProperty("JComponent.outline", "error");
comboBox7.setModel(new DefaultComboBoxModel<>(new String[] {
"editable"
}));
comboBox7.setEditable(true);
add(comboBox7, "cell 2 12,growx");
//---- spinner3 ----
spinner3.putClientProperty("JComponent.outline", "error");
add(spinner3, "cell 3 12,growx");
//---- label4 ----
label4.setText("Warning hints:");
add(label4, "cell 0 13");
//---- textField7 ----
textField7.putClientProperty("JComponent.outline", "warning");
add(textField7, "cell 1 13,growx");
//---- comboBox8 ----
comboBox8.putClientProperty("JComponent.outline", "warning");
comboBox8.setModel(new DefaultComboBoxModel<>(new String[] {
"not editable"
}));
add(comboBox8, "cell 2 13,growx");
//---- spinner4 ----
spinner4.putClientProperty("JComponent.outline", "warning");
add(spinner4, "cell 3 13,growx");
//======== popupMenu1 ========
{

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
@@ -9,7 +9,7 @@ new FormModel {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "hidemode 3"
"$columnConstraints": "[][][][][][]"
"$rowConstraints": "[][][][][][][][][][][][]"
"$rowConstraints": "[][][][][][][][][][][][]para[][]"
} ) {
name: "this"
add( new FormComponent( "javax.swing.JLabel" ) {
@@ -63,9 +63,8 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button6"
"text": "square"
"enabled": false
"$client.JButton.buttonType": "square"
"text": "round"
"$client.JButton.buttonType": "roundRect"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 1"
} )
@@ -592,9 +591,66 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 11,growx"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label3"
"text": "Error hints:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 12"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "textField5"
"$client.JComponent.outline": "error"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 12,growx"
} )
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "comboBox7"
"$client.JComponent.outline": "error"
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "editable"
addElement( "editable" )
}
"editable": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 12,growx"
} )
add( new FormComponent( "javax.swing.JSpinner" ) {
name: "spinner3"
"$client.JComponent.outline": "error"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 12,growx"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label4"
"text": "Warning hints:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 13"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "textField7"
"$client.JComponent.outline": "warning"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 13,growx"
} )
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "comboBox8"
"$client.JComponent.outline": "warning"
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "not editable"
addElement( "not editable" )
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 13,growx"
} )
add( new FormComponent( "javax.swing.JSpinner" ) {
name: "spinner4"
"$client.JComponent.outline": "warning"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 13,growx"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 790, 440 )
"size": new java.awt.Dimension( 920, 440 )
} )
add( new FormContainer( "javax.swing.JPopupMenu", new FormLayoutManager( class javax.swing.JPopupMenu ) ) {
name: "popupMenu1"

View File

@@ -64,6 +64,11 @@ class DemoFrame
UIManager.put( "MenuItem.selectionType", underlineMenuSelectionMenuItem.isSelected() ? "underline" : null );
}
private void alwaysShowMnemonics() {
UIManager.put( "Component.hideMnemonics", !alwaysShowMnemonicsMenuItem.isSelected() );
repaint();
}
private void fontFamilyChanged( ActionEvent e ) {
String fontFamily = e.getActionCommand();
@@ -140,6 +145,7 @@ class DemoFrame
JMenuItem decrFontMenuItem = new JMenuItem();
JMenu optionsMenu = new JMenu();
underlineMenuSelectionMenuItem = new JCheckBoxMenuItem();
alwaysShowMnemonicsMenuItem = new JCheckBoxMenuItem();
JMenu helpMenu = new JMenu();
JMenuItem aboutMenuItem = new JMenuItem();
JToolBar toolBar1 = new JToolBar();
@@ -376,6 +382,11 @@ class DemoFrame
underlineMenuSelectionMenuItem.setText("Use underline menu selection");
underlineMenuSelectionMenuItem.addActionListener(e -> underlineMenuSelection());
optionsMenu.add(underlineMenuSelectionMenuItem);
//---- alwaysShowMnemonicsMenuItem ----
alwaysShowMnemonicsMenuItem.setText("Always show mnemonics");
alwaysShowMnemonicsMenuItem.addActionListener(e -> alwaysShowMnemonics());
optionsMenu.add(alwaysShowMnemonicsMenuItem);
}
menuBar1.add(optionsMenu);
@@ -507,6 +518,7 @@ class DemoFrame
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JMenu fontMenu;
private JCheckBoxMenuItem underlineMenuSelectionMenuItem;
private JCheckBoxMenuItem alwaysShowMnemonicsMenuItem;
private JTabbedPane tabbedPane;
private ControlBar controlBar;
// JFormDesigner - End of variables declaration //GEN-END:variables

View File

@@ -330,6 +330,14 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "underlineMenuSelection", false ) )
} )
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
name: "alwaysShowMnemonicsMenuItem"
"text": "Always show mnemonics"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "alwaysShowMnemonics", false ) )
} )
} )
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "helpMenu"

View File

@@ -3,6 +3,9 @@ FlatLaf Extras
This sub-project provides some additional components and classes:
- [FlatSVGIcon](src/main/java/com/formdev/flatlaf/extras/FlatSVGIcon.java): An
icon that displays SVG using
[svgSalamander](https://github.com/JFormDesigner/svgSalamander).
- [TriStateCheckBox](src/main/java/com/formdev/flatlaf/extras/TriStateCheckBox.java):
A tri-state check box.
@@ -10,4 +13,21 @@ This sub-project provides some additional components and classes:
Download
--------
Not yet available.
FlatLaf Extras binaries are available on **JCenter** and **Maven Central**.
If you use Maven or Gradle, add a dependency with following coordinates to your
build script:
groupId: com.formdev
artifactId: flatlaf-extras
version: (see button below)
Otherwise download `flatlaf-extras-<version>.jar` here:
[![Download](https://api.bintray.com/packages/jformdesigner/flatlaf/flatlaf-extras/images/download.svg)](https://bintray.com/jformdesigner/flatlaf/flatlaf-extras/_latestVersion)
You also need `flatlaf-<version>.jar` and `svgSalamander-<version>.jar`, which
you can download here:
[![Download](https://api.bintray.com/packages/jformdesigner/flatlaf/flatlaf/images/download.svg)](https://bintray.com/jformdesigner/flatlaf/flatlaf/_latestVersion)
[![Download](https://api.bintray.com/packages/jformdesigner/svgSalamander/svgSalamander/images/download.svg)](https://bintray.com/jformdesigner/svgSalamander/svgSalamander/_latestVersion)

View File

@@ -16,9 +16,8 @@
plugins {
`java-library`
`maven-publish`
id( "com.jfrog.bintray" )
id( "com.jfrog.artifactory" )
`flatlaf-module-info`
`flatlaf-publish`
}
dependencies {
@@ -26,14 +25,16 @@ dependencies {
implementation( "com.formdev:svgSalamander:1.1.2.1" )
}
tasks {
assemble {
dependsOn(
"sourcesJar",
"javadocJar"
)
}
flatlafModuleInfo {
dependsOn( ":flatlaf-core:jar" )
}
java {
withSourcesJar()
withJavadocJar()
}
tasks {
javadoc {
options {
this as StandardJavadocDocletOptions
@@ -41,98 +42,10 @@ tasks {
}
isFailOnError = false
}
register( "sourcesJar", Jar::class ) {
archiveClassifier.set( "sources" )
from( sourceSets.main.get().allJava )
}
register( "javadocJar", Jar::class ) {
archiveClassifier.set( "javadoc" )
from( javadoc )
}
}
publishing {
publications {
create<MavenPublication>( "maven" ) {
artifactId = "flatlaf-extras"
groupId = "com.formdev"
from( components["java"] )
artifact( tasks["sourcesJar"] )
artifact( tasks["javadocJar"] )
pom {
name.set( "FlatLaf Extras" )
description.set( "Flat Look and Feel Extras" )
url.set( "https://github.com/JFormDesigner/FlatLaf" )
licenses {
license {
name.set( "The Apache License, Version 2.0" )
url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" )
}
}
developers {
developer {
name.set( "Karl Tauber" )
organization.set( "FormDev Software GmbH" )
organizationUrl.set( "https://www.formdev.com/" )
}
}
scm {
url.set( "https://github.com/JFormDesigner/FlatLaf" )
}
}
}
}
}
bintray {
user = rootProject.extra["bintray.user"] as String?
key = rootProject.extra["bintray.key"] as String?
setPublications( "maven" )
with( pkg ) {
repo = "flatlaf"
name = "flatlaf-extras"
setLicenses( "Apache-2.0" )
vcsUrl = "https://github.com/JFormDesigner/FlatLaf"
with( version ) {
name = project.version.toString()
}
publish = rootProject.extra["bintray.publish"] as Boolean
dryRun = rootProject.extra["bintray.dryRun"] as Boolean
}
}
artifactory {
setContextUrl( "https://oss.jfrog.org" )
publish( closureOf<org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig> {
repository( delegateClosureOf<groovy.lang.GroovyObject> {
setProperty( "repoKey", "oss-snapshot-local" )
setProperty( "username", rootProject.extra["bintray.user"] as String? )
setProperty( "password", rootProject.extra["bintray.key"] as String? )
} )
defaults( delegateClosureOf<groovy.lang.GroovyObject> {
invokeMethod( "publications", "maven" )
setProperty( "publishArtifacts", true )
setProperty( "publishPom", true )
} )
} )
resolve( delegateClosureOf<org.jfrog.gradle.plugin.artifactory.dsl.ResolverConfig> {
setProperty( "repoKey", "jcenter" )
} )
flatlafPublish {
artifactId = "flatlaf-extras"
name = "FlatLaf Extras"
description = "Flat Look and Feel Extras"
}

View File

@@ -16,17 +16,23 @@
package com.formdev.flatlaf.extras;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ItemEvent;
import javax.swing.JCheckBox;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import com.formdev.flatlaf.FlatLaf;
/**
* A tri-state check box.
*
* <p>
* To display the third state, this component requires an LaF that supports painting
* the indeterminate state if client property {@code "JButton.selectedState"} has the
* value {@code "indeterminate"}.
*
* <p>
* FlatLaf and Mac Aqua LaF support the third state.
* For other LaFs a magenta rectangle is painted around the component for the third state.
*
* @author Karl Tauber
*/
@@ -58,7 +64,7 @@ public class TriStateCheckBox
@Override
public void setSelected( boolean b ) {
switch( state ) {
case INDETERMINATE: setState( State.SELECTED ); break;
case INDETERMINATE: setState( State.SELECTED ); break;
case SELECTED: setState( State.UNSELECTED ); break;
case UNSELECTED: setState( thirdStateEnabled ? State.INDETERMINATE : State.SELECTED ); break;
}
@@ -104,4 +110,19 @@ public class TriStateCheckBox
public void setSelected( boolean b ) {
setState( b ? State.SELECTED : State.UNSELECTED );
}
@Override
protected void paintComponent( Graphics g ) {
super.paintComponent( g );
if( state == State.INDETERMINATE && !isThirdStateSupported() ) {
g.setColor( Color.magenta );
g.drawRect( 0, 0, getWidth() - 1, getHeight() - 1 );
}
}
private boolean isThirdStateSupported() {
LookAndFeel laf = UIManager.getLookAndFeel();
return laf instanceof FlatLaf || laf.getClass().getName().equals( "com.apple.laf.AquaLookAndFeel" );
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author Karl Tauber
*/
module com.formdev.flatlaf.extras {
requires java.desktop;
requires static com.kitfox.svg; // optional at runtime
requires com.formdev.flatlaf;
exports com.formdev.flatlaf.extras;
}

View File

@@ -16,55 +16,24 @@
plugins {
`java-library`
`maven-publish`
id( "com.jfrog.bintray" )
id( "com.jfrog.artifactory" )
`flatlaf-module-info`
`flatlaf-publish`
}
dependencies {
implementation( project( ":flatlaf-core" ) )
}
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
sourceSets {
create( "module-info" ) {
java {
// include "src/main/java" here to get compile errors if classes are
// used from other modules that are not specified in module dependencies
setSrcDirs( listOf( "src/main/module-info", "src/main/java" ) )
}
}
}
flatlafModuleInfo {
dependsOn( ":flatlaf-core:jar" )
}
java {
withSourcesJar()
withJavadocJar()
}
tasks {
assemble {
dependsOn(
"sourcesJar",
"javadocJar"
)
}
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
named<JavaCompile>( "compileModuleInfoJava" ) {
sourceCompatibility = "9"
targetCompatibility = "9"
dependsOn( ":flatlaf-core:jar" )
options.compilerArgs.add( "--module-path" )
options.compilerArgs.add( project( ":flatlaf-core" ).tasks["jar"].outputs.files.asPath )
}
}
jar {
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
from( sourceSets["module-info"].output ) {
include( "module-info.class" )
}
}
}
javadoc {
options {
this as StandardJavadocDocletOptions
@@ -72,98 +41,10 @@ tasks {
}
isFailOnError = false
}
register( "sourcesJar", Jar::class ) {
archiveClassifier.set( "sources" )
from( sourceSets.main.get().allJava )
}
register( "javadocJar", Jar::class ) {
archiveClassifier.set( "javadoc" )
from( javadoc )
}
}
publishing {
publications {
create<MavenPublication>( "maven" ) {
artifactId = "flatlaf-intellij-themes"
groupId = "com.formdev"
from( components["java"] )
artifact( tasks["sourcesJar"] )
artifact( tasks["javadocJar"] )
pom {
name.set( "FlatLaf IntelliJ Themes Pack" )
description.set( "Flat Look and Feel IntelliJ Themes Pack" )
url.set( "https://github.com/JFormDesigner/FlatLaf" )
licenses {
license {
name.set( "The Apache License, Version 2.0" )
url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" )
}
}
developers {
developer {
name.set( "Karl Tauber" )
organization.set( "FormDev Software GmbH" )
organizationUrl.set( "https://www.formdev.com/" )
}
}
scm {
url.set( "https://github.com/JFormDesigner/FlatLaf" )
}
}
}
}
}
bintray {
user = rootProject.extra["bintray.user"] as String?
key = rootProject.extra["bintray.key"] as String?
setPublications( "maven" )
with( pkg ) {
repo = "flatlaf"
name = "flatlaf-intellij-themes"
setLicenses( "Apache-2.0" )
vcsUrl = "https://github.com/JFormDesigner/FlatLaf"
with( version ) {
name = project.version.toString()
}
publish = rootProject.extra["bintray.publish"] as Boolean
dryRun = rootProject.extra["bintray.dryRun"] as Boolean
}
}
artifactory {
setContextUrl( "https://oss.jfrog.org" )
publish( closureOf<org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig> {
repository( delegateClosureOf<groovy.lang.GroovyObject> {
setProperty( "repoKey", "oss-snapshot-local" )
setProperty( "username", rootProject.extra["bintray.user"] as String? )
setProperty( "password", rootProject.extra["bintray.key"] as String? )
} )
defaults( delegateClosureOf<groovy.lang.GroovyObject> {
invokeMethod( "publications", "maven" )
setProperty( "publishArtifacts", true )
setProperty( "publishPom", true )
} )
} )
resolve( delegateClosureOf<org.jfrog.gradle.plugin.artifactory.dsl.ResolverConfig> {
setProperty( "repoKey", "jcenter" )
} )
flatlafPublish {
artifactId = "flatlaf-intellij-themes"
name = "FlatLaf IntelliJ Themes Pack"
description = "Flat Look and Feel IntelliJ Themes Pack"
}

View File

@@ -16,9 +16,7 @@
plugins {
`java-library`
`maven-publish`
id( "com.jfrog.bintray" )
id( "com.jfrog.artifactory" )
`flatlaf-publish`
}
dependencies {
@@ -26,14 +24,12 @@ dependencies {
implementation( "com.jidesoft:jide-oss:3.6.18" )
}
tasks {
assemble {
dependsOn(
"sourcesJar",
"javadocJar"
)
}
java {
withSourcesJar()
withJavadocJar()
}
tasks {
javadoc {
options {
this as StandardJavadocDocletOptions
@@ -41,98 +37,10 @@ tasks {
}
isFailOnError = false
}
register( "sourcesJar", Jar::class ) {
archiveClassifier.set( "sources" )
from( sourceSets.main.get().allJava )
}
register( "javadocJar", Jar::class ) {
archiveClassifier.set( "javadoc" )
from( javadoc )
}
}
publishing {
publications {
create<MavenPublication>( "maven" ) {
artifactId = "flatlaf-jide-oss"
groupId = "com.formdev"
from( components["java"] )
artifact( tasks["sourcesJar"] )
artifact( tasks["javadocJar"] )
pom {
name.set( "FlatLaf addon for JIDE Common Layer" )
description.set( "Flat Look and Feel addon for JIDE Common Layer" )
url.set( "https://github.com/JFormDesigner/FlatLaf" )
licenses {
license {
name.set( "The Apache License, Version 2.0" )
url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" )
}
}
developers {
developer {
name.set( "Karl Tauber" )
organization.set( "FormDev Software GmbH" )
organizationUrl.set( "https://www.formdev.com/" )
}
}
scm {
url.set( "https://github.com/JFormDesigner/FlatLaf" )
}
}
}
}
}
bintray {
user = rootProject.extra["bintray.user"] as String?
key = rootProject.extra["bintray.key"] as String?
setPublications( "maven" )
with( pkg ) {
repo = "flatlaf"
name = "flatlaf-jide-oss"
setLicenses( "Apache-2.0" )
vcsUrl = "https://github.com/JFormDesigner/FlatLaf"
with( version ) {
name = project.version.toString()
}
publish = rootProject.extra["bintray.publish"] as Boolean
dryRun = rootProject.extra["bintray.dryRun"] as Boolean
}
}
artifactory {
setContextUrl( "https://oss.jfrog.org" )
publish( closureOf<org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig> {
repository( delegateClosureOf<groovy.lang.GroovyObject> {
setProperty( "repoKey", "oss-snapshot-local" )
setProperty( "username", rootProject.extra["bintray.user"] as String? )
setProperty( "password", rootProject.extra["bintray.key"] as String? )
} )
defaults( delegateClosureOf<groovy.lang.GroovyObject> {
invokeMethod( "publications", "maven" )
setProperty( "publishArtifacts", true )
setProperty( "publishPom", true )
} )
} )
resolve( delegateClosureOf<org.jfrog.gradle.plugin.artifactory.dsl.ResolverConfig> {
setProperty( "repoKey", "jcenter" )
} )
flatlafPublish {
artifactId = "flatlaf-jide-oss"
name = "FlatLaf addon for JIDE Common Layer"
description = "Flat Look and Feel addon for JIDE Common Layer"
}

View File

@@ -16,9 +16,8 @@
plugins {
`java-library`
`maven-publish`
id( "com.jfrog.bintray" )
id( "com.jfrog.artifactory" )
`flatlaf-module-info`
`flatlaf-publish`
}
dependencies {
@@ -26,14 +25,16 @@ dependencies {
implementation( "org.swinglabs.swingx:swingx-all:1.6.5-1" )
}
tasks {
assemble {
dependsOn(
"sourcesJar",
"javadocJar"
)
}
flatlafModuleInfo {
dependsOn( ":flatlaf-core:jar" )
}
java {
withSourcesJar()
withJavadocJar()
}
tasks {
javadoc {
options {
this as StandardJavadocDocletOptions
@@ -41,98 +42,10 @@ tasks {
}
isFailOnError = false
}
register( "sourcesJar", Jar::class ) {
archiveClassifier.set( "sources" )
from( sourceSets.main.get().allJava )
}
register( "javadocJar", Jar::class ) {
archiveClassifier.set( "javadoc" )
from( javadoc )
}
}
publishing {
publications {
create<MavenPublication>( "maven" ) {
artifactId = "flatlaf-swingx"
groupId = "com.formdev"
from( components["java"] )
artifact( tasks["sourcesJar"] )
artifact( tasks["javadocJar"] )
pom {
name.set( "FlatLaf addon for SwingX" )
description.set( "Flat Look and Feel addon for SwingX" )
url.set( "https://github.com/JFormDesigner/FlatLaf" )
licenses {
license {
name.set( "The Apache License, Version 2.0" )
url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" )
}
}
developers {
developer {
name.set( "Karl Tauber" )
organization.set( "FormDev Software GmbH" )
organizationUrl.set( "https://www.formdev.com/" )
}
}
scm {
url.set( "https://github.com/JFormDesigner/FlatLaf" )
}
}
}
}
}
bintray {
user = rootProject.extra["bintray.user"] as String?
key = rootProject.extra["bintray.key"] as String?
setPublications( "maven" )
with( pkg ) {
repo = "flatlaf"
name = "flatlaf-swingx"
setLicenses( "Apache-2.0" )
vcsUrl = "https://github.com/JFormDesigner/FlatLaf"
with( version ) {
name = project.version.toString()
}
publish = rootProject.extra["bintray.publish"] as Boolean
dryRun = rootProject.extra["bintray.dryRun"] as Boolean
}
}
artifactory {
setContextUrl( "https://oss.jfrog.org" )
publish( closureOf<org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig> {
repository( delegateClosureOf<groovy.lang.GroovyObject> {
setProperty( "repoKey", "oss-snapshot-local" )
setProperty( "username", rootProject.extra["bintray.user"] as String? )
setProperty( "password", rootProject.extra["bintray.key"] as String? )
} )
defaults( delegateClosureOf<groovy.lang.GroovyObject> {
invokeMethod( "publications", "maven" )
setProperty( "publishArtifacts", true )
setProperty( "publishPom", true )
} )
} )
resolve( delegateClosureOf<org.jfrog.gradle.plugin.artifactory.dsl.ResolverConfig> {
setProperty( "repoKey", "jcenter" )
} )
flatlafPublish {
artifactId = "flatlaf-swingx"
name = "FlatLaf addon for SwingX"
description = "Flat Look and Feel addon for SwingX"
}

View File

@@ -46,8 +46,6 @@ import org.jdesktop.swingx.JXPanel;
import org.jdesktop.swingx.calendar.DatePickerFormatter.DatePickerFormatterUIResource;
import org.jdesktop.swingx.plaf.basic.BasicDatePickerUI;
import com.formdev.flatlaf.ui.FlatArrowButton;
import com.formdev.flatlaf.ui.FlatBorder;
import com.formdev.flatlaf.ui.FlatRoundBorder;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.ui.MigLayoutVisualPadding;
import com.formdev.flatlaf.util.UIScale;
@@ -62,8 +60,6 @@ public class FlatDatePickerUI
{
protected Insets padding;
protected int focusWidth;
protected int arc;
protected String arrowType;
protected Color borderColor;
protected Color disabledBorderColor;
@@ -88,8 +84,6 @@ public class FlatDatePickerUI
padding = UIManager.getInsets( "ComboBox.padding" );
focusWidth = UIManager.getInt( "Component.focusWidth" );
arc = UIManager.getInt( "Component.arc" );
arrowType = UIManager.getString( "Component.arrowType" );
borderColor = UIManager.getColor( "Component.borderColor" );
disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" );
@@ -130,7 +124,7 @@ public class FlatDatePickerUI
LookAndFeel.installBorder( datePicker, "JXDatePicker.border" );
LookAndFeel.installProperty( datePicker, "opaque", Boolean.TRUE );
MigLayoutVisualPadding.install( datePicker, focusWidth );
MigLayoutVisualPadding.install( datePicker );
}
@Override
@@ -228,8 +222,8 @@ public class FlatDatePickerUI
int width = c.getWidth();
int height = c.getHeight();
float focusWidth = (c.getBorder() instanceof FlatBorder) ? scale( (float) this.focusWidth ) : 0;
float arc = (c.getBorder() instanceof FlatRoundBorder) ? scale( (float) this.arc ) : 0;
float focusWidth = FlatUIUtils.getBorderFocusWidth( c );
float arc = FlatUIUtils.getBorderArc( c );
int arrowX = popupButton.getX();
int arrowWidth = popupButton.getWidth();
boolean enabled = c.isEnabled();

View File

@@ -0,0 +1,36 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author Karl Tauber
*/
module com.formdev.flatlaf.swingx {
requires java.desktop;
requires swingx.all;
requires com.formdev.flatlaf;
exports com.formdev.flatlaf.swingx;
exports com.formdev.flatlaf.swingx.ui;
// this allows com.formdev.flatlaf.FlatDefaultsAddon to read .properties files
opens com.formdev.flatlaf.swingx
to com.formdev.flatlaf;
provides com.formdev.flatlaf.FlatDefaultsAddon
with com.formdev.flatlaf.swingx.FlatSwingXDefaultsAddon;
provides org.jdesktop.swingx.plaf.LookAndFeelAddons
with com.formdev.flatlaf.swingx.FlatLookAndFeelAddons;
}

View File

@@ -18,6 +18,13 @@ plugins {
`java-library`
}
repositories {
maven {
// for using MigLayout snapshot
url = uri( "https://oss.sonatype.org/content/repositories/snapshots/" )
}
}
dependencies {
implementation( project( ":flatlaf-core" ) )
implementation( project( ":flatlaf-extras" ) )
@@ -26,7 +33,7 @@ dependencies {
implementation( project( ":flatlaf-intellij-themes" ) )
implementation( project( ":flatlaf-demo" ) )
implementation( "com.miglayout:miglayout-swing:5.2" )
implementation( "com.miglayout:miglayout-swing:5.3-SNAPSHOT" )
implementation( "com.jgoodies:jgoodies-forms:1.9.0" )
implementation( "org.swinglabs.swingx:swingx-all:1.6.5-1" )
implementation( "org.swinglabs.swingx:swingx-beaninfo:1.6.5-1" )

View File

@@ -62,7 +62,7 @@ public class FlatChooserTest
"[]",
// rows
"[top]" +
"[top]" +
"[grow,top]" +
"[]"));
//---- colorChooserLabel ----
@@ -73,7 +73,7 @@ public class FlatChooserTest
//---- fileChooserLabel ----
fileChooserLabel.setText("JFileChooser:");
add(fileChooserLabel, "cell 0 1");
add(fileChooser1, "cell 1 1");
add(fileChooser1, "cell 1 1,growy");
//---- label1 ----
label1.setText("icons:");

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
@@ -9,7 +9,7 @@ new FormModel {
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
"$columnConstraints": "[][]"
"$rowConstraints": "[top][top][]"
"$rowConstraints": "[top][grow,top][]"
} ) {
name: "this"
add( new FormComponent( "javax.swing.JLabel" ) {
@@ -32,7 +32,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JFileChooser" ) {
name: "fileChooser1"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1"
"value": "cell 1 1,growy"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label1"

View File

@@ -19,6 +19,7 @@ package com.formdev.flatlaf.testing;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import com.formdev.flatlaf.FlatClientProperties;
import net.miginfocom.swing.*;
/**
@@ -63,6 +64,46 @@ public class FlatComponentsTest
}
}
private void roundRectChanged() {
Boolean roundRect = roundRectCheckBox.isSelected() ? true : null;
for( Component c : getComponents() ) {
if( c instanceof JComponent )
((JComponent)c).putClientProperty( FlatClientProperties.COMPONENT_ROUND_RECT, roundRect );
}
}
private void buttonTypeChanged() {
String buttonType = (String) buttonTypeComboBox.getSelectedItem();
if( "-".equals( buttonType ) )
buttonType = null;
for( Component c : getComponents() ) {
if( c instanceof AbstractButton )
((AbstractButton)c).putClientProperty( FlatClientProperties.BUTTON_TYPE, buttonType );
}
}
private void outlineChanged() {
FlatTestFrame frame = (FlatTestFrame) SwingUtilities.getAncestorOfClass( FlatTestFrame.class, this );
if( frame == null )
return;
Object outline = errorOutlineRadioButton.isSelected() ? "error"
: warningOutlineRadioButton.isSelected() ? "warning"
: magentaOutlineRadioButton.isSelected() ? Color.magenta
: magentaCyanOutlineRadioButton.isSelected() ? new Color[] { Color.magenta, Color.cyan }
: null;
frame.updateComponentsRecur( this, (c, type) -> {
if( c instanceof JComponent )
((JComponent)c).putClientProperty( FlatClientProperties.OUTLINE, outline );
} );
frame.repaint();
textField1.requestFocusInWindow();
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JLabel labelLabel = new JLabel();
@@ -71,8 +112,10 @@ public class FlatComponentsTest
JLabel buttonLabel = new JLabel();
JButton button1 = new JButton();
JButton button17 = new JButton();
JButton button22 = new JButton();
JButton button2 = new JButton();
JButton button18 = new JButton();
JButton button23 = new JButton();
FlatComponentsTest.TestDefaultButton button5 = new FlatComponentsTest.TestDefaultButton();
JButton button3 = new JButton();
JButton button12 = new JButton();
@@ -80,17 +123,21 @@ public class FlatComponentsTest
JButton button14 = new JButton();
JButton button15 = new JButton();
JButton button16 = new JButton();
JButton button20 = new JButton();
JLabel toggleButtonLabel = new JLabel();
JToggleButton toggleButton1 = new JToggleButton();
JToggleButton toggleButton9 = new JToggleButton();
JToggleButton toggleButton19 = new JToggleButton();
JToggleButton toggleButton2 = new JToggleButton();
JToggleButton toggleButton10 = new JToggleButton();
JToggleButton toggleButton20 = new JToggleButton();
JToggleButton toggleButton3 = new JToggleButton();
JToggleButton toggleButton4 = new JToggleButton();
JToggleButton toggleButton11 = new JToggleButton();
JToggleButton toggleButton12 = new JToggleButton();
JToggleButton toggleButton13 = new JToggleButton();
JToggleButton toggleButton14 = new JToggleButton();
JToggleButton toggleButton18 = new JToggleButton();
JLabel checkBoxLabel = new JLabel();
JCheckBox checkBox1 = new JCheckBox();
JCheckBox checkBox2 = new JCheckBox();
@@ -98,40 +145,47 @@ public class FlatComponentsTest
JCheckBox checkBox4 = new JCheckBox();
JToggleButton toggleButton5 = new JToggleButton();
JToggleButton toggleButton8 = new JToggleButton();
buttonTypeComboBox = new JComboBox<>();
JLabel radioButtonLabel = new JLabel();
JRadioButton radioButton1 = new JRadioButton();
JRadioButton radioButton2 = new JRadioButton();
JRadioButton radioButton3 = new JRadioButton();
JRadioButton radioButton4 = new JRadioButton();
contentAreaFilledCheckBox = new JCheckBox();
roundRectCheckBox = new JCheckBox();
JLabel comboBoxLabel = new JLabel();
JComboBox<String> comboBox1 = new JComboBox<>();
JComboBox<String> comboBox2 = new JComboBox<>();
JComboBox<String> comboBox3 = new JComboBox<>();
JComboBox<String> comboBox4 = new JComboBox<>();
JComboBox<String> comboBox5 = new JComboBox<>();
JComboBox<String> comboBox6 = new JComboBox<>();
JLabel spinnerLabel = new JLabel();
JSpinner spinner1 = new JSpinner();
JSpinner spinner2 = new JSpinner();
JComboBox<String> comboBox7 = new JComboBox<>();
JSpinner spinner3 = new JSpinner();
JLabel textFieldLabel = new JLabel();
JTextField textField1 = new JTextField();
textField1 = new JTextField();
JTextField textField2 = new JTextField();
JTextField textField3 = new JTextField();
JTextField textField4 = new JTextField();
JTextField textField6 = new JTextField();
JTextField textField5 = new JTextField();
JLabel formattedTextFieldLabel = new JLabel();
JFormattedTextField formattedTextField1 = new JFormattedTextField();
JFormattedTextField formattedTextField2 = new JFormattedTextField();
JFormattedTextField formattedTextField3 = new JFormattedTextField();
JFormattedTextField formattedTextField4 = new JFormattedTextField();
JFormattedTextField formattedTextField5 = new JFormattedTextField();
JFormattedTextField formattedTextField6 = new JFormattedTextField();
JLabel passwordFieldLabel = new JLabel();
JPasswordField passwordField1 = new JPasswordField();
JPasswordField passwordField2 = new JPasswordField();
JPasswordField passwordField3 = new JPasswordField();
JPasswordField passwordField4 = new JPasswordField();
JPasswordField passwordField5 = new JPasswordField();
JPasswordField passwordField6 = new JPasswordField();
JLabel textAreaLabel = new JLabel();
JScrollPane scrollPane1 = new JScrollPane();
JTextArea textArea1 = new JTextArea();
@@ -181,6 +235,15 @@ public class FlatComponentsTest
JButton button10 = new JButton();
JButton button11 = new JButton();
JToggleButton toggleButton7 = new JToggleButton();
JPanel panel4 = new JPanel();
noOutlineRadioButton = new JRadioButton();
errorOutlineRadioButton = new JRadioButton();
warningOutlineRadioButton = new JRadioButton();
magentaOutlineRadioButton = new JRadioButton();
magentaCyanOutlineRadioButton = new JRadioButton();
JScrollPane scrollPane15 = new JScrollPane();
JPanel panel3 = new JPanel();
JButton button21 = new JButton();
JLabel scrollBarLabel = new JLabel();
JScrollBar scrollBar1 = new JScrollBar();
JScrollBar scrollBar4 = new JScrollBar();
@@ -211,6 +274,18 @@ public class FlatComponentsTest
JToggleButton toggleButton15 = new JToggleButton();
JToggleButton toggleButton16 = new JToggleButton();
JToggleButton toggleButton17 = new JToggleButton();
JLabel label3 = new JLabel();
JToolBar toolBar3 = new JToolBar();
JButton button26 = new JButton();
JButton button27 = new JButton();
JToggleButton toggleButton23 = new JToggleButton();
JToggleButton toggleButton24 = new JToggleButton();
JLabel label4 = new JLabel();
JToolBar toolBar4 = new JToolBar();
JButton button28 = new JButton();
JButton button29 = new JButton();
JToggleButton toggleButton25 = new JToggleButton();
JToggleButton toggleButton26 = new JToggleButton();
//======== this ========
setLayout(new MigLayout(
@@ -221,7 +296,8 @@ public class FlatComponentsTest
"[]" +
"[]" +
"[]" +
"[]",
"[]" +
"[left]",
// rows
"[]" +
"[]" +
@@ -274,11 +350,17 @@ public class FlatComponentsTest
add(button1, "cell 1 1");
//---- button17 ----
button17.setText("square");
button17.setText("sq");
button17.putClientProperty("JButton.buttonType", "square");
button17.putClientProperty("JComponent.minimumWidth", 0);
add(button17, "cell 1 1");
//---- button22 ----
button22.setText("rd");
button22.putClientProperty("JButton.buttonType", "roundRect");
button22.putClientProperty("JComponent.minimumWidth", 0);
add(button22, "cell 1 1");
//---- button2 ----
button2.setText("disabled");
button2.setDisplayedMnemonicIndex(0);
@@ -287,12 +369,19 @@ public class FlatComponentsTest
add(button2, "cell 2 1");
//---- button18 ----
button18.setText("square");
button18.setText("sq");
button18.putClientProperty("JButton.buttonType", "square");
button18.setEnabled(false);
button18.putClientProperty("JComponent.minimumWidth", 0);
add(button18, "cell 2 1");
//---- button23 ----
button23.setText("rd");
button23.putClientProperty("JButton.buttonType", "roundRect");
button23.setEnabled(false);
button23.putClientProperty("JComponent.minimumWidth", 0);
add(button23, "cell 2 1");
//---- button5 ----
button5.setText("default");
button5.setDisplayedMnemonicIndex(0);
@@ -326,6 +415,11 @@ public class FlatComponentsTest
button16.setText("#");
add(button16, "cell 5 1");
//---- button20 ----
button20.setText("empty border");
button20.setBorder(BorderFactory.createEmptyBorder());
add(button20, "cell 6 1");
//---- toggleButtonLabel ----
toggleButtonLabel.setText("JToggleButton:");
add(toggleButtonLabel, "cell 0 2");
@@ -335,21 +429,32 @@ public class FlatComponentsTest
add(toggleButton1, "cell 1 2");
//---- toggleButton9 ----
toggleButton9.setText("square");
toggleButton9.setText("sq");
toggleButton9.putClientProperty("JButton.buttonType", "square");
add(toggleButton9, "cell 1 2");
//---- toggleButton19 ----
toggleButton19.setText("rd");
toggleButton19.putClientProperty("JButton.buttonType", "roundRect");
add(toggleButton19, "cell 1 2");
//---- toggleButton2 ----
toggleButton2.setText("disabled");
toggleButton2.setEnabled(false);
add(toggleButton2, "cell 2 2");
//---- toggleButton10 ----
toggleButton10.setText("square");
toggleButton10.setText("sq");
toggleButton10.putClientProperty("JButton.buttonType", "square");
toggleButton10.setEnabled(false);
add(toggleButton10, "cell 2 2");
//---- toggleButton20 ----
toggleButton20.setText("rd");
toggleButton20.putClientProperty("JButton.buttonType", "roundRect");
toggleButton20.setEnabled(false);
add(toggleButton20, "cell 2 2");
//---- toggleButton3 ----
toggleButton3.setText("selected");
toggleButton3.setSelected(true);
@@ -381,6 +486,11 @@ public class FlatComponentsTest
toggleButton14.setSelected(true);
add(toggleButton14, "cell 5 2");
//---- toggleButton18 ----
toggleButton18.setText("empty border");
toggleButton18.setBorder(BorderFactory.createEmptyBorder());
add(toggleButton18, "cell 6 2");
//---- checkBoxLabel ----
checkBoxLabel.setText("JCheckBox");
add(checkBoxLabel, "cell 0 3");
@@ -420,6 +530,17 @@ public class FlatComponentsTest
toggleButton8.setSelected(true);
add(toggleButton8, "cell 5 3");
//---- buttonTypeComboBox ----
buttonTypeComboBox.setModel(new DefaultComboBoxModel<>(new String[] {
"-",
"square",
"roundRect",
"tab",
"help"
}));
buttonTypeComboBox.addActionListener(e -> buttonTypeChanged());
add(buttonTypeComboBox, "cell 6 3");
//---- radioButtonLabel ----
radioButtonLabel.setText("JRadioButton:");
add(radioButtonLabel, "cell 0 4");
@@ -452,6 +573,11 @@ public class FlatComponentsTest
contentAreaFilledCheckBox.addActionListener(e -> contentAreaFilledChanged());
add(contentAreaFilledCheckBox, "cell 5 4");
//---- roundRectCheckBox ----
roundRectCheckBox.setText("roundRect");
roundRectCheckBox.addActionListener(e -> roundRectChanged());
add(roundRectCheckBox, "cell 6 4");
//---- comboBoxLabel ----
comboBoxLabel.setText("JComboBox:");
add(comboBoxLabel, "cell 0 5");
@@ -521,6 +647,16 @@ public class FlatComponentsTest
}));
add(comboBox5, "cell 5 5,growx,wmax 100");
//---- comboBox6 ----
comboBox6.setBorder(BorderFactory.createEmptyBorder());
comboBox6.setModel(new DefaultComboBoxModel<>(new String[] {
"empty border",
"a",
"b",
"c"
}));
add(comboBox6, "cell 6 5");
//---- spinnerLabel ----
spinnerLabel.setText("JSpinner:");
add(spinnerLabel, "cell 0 6");
@@ -535,6 +671,11 @@ public class FlatComponentsTest
comboBox7.putClientProperty("JTextField.placeholderText", "placeholder");
add(comboBox7, "cell 5 6,growx");
//---- spinner3 ----
spinner3.setBorder(BorderFactory.createEmptyBorder());
spinner3.setModel(new SpinnerNumberModel(12345, null, null, 1));
add(spinner3, "cell 6 6");
//---- textFieldLabel ----
textFieldLabel.setText("JTextField:");
add(textFieldLabel, "cell 0 7");
@@ -563,6 +704,11 @@ public class FlatComponentsTest
textField6.putClientProperty("JTextField.placeholderText", "placeholder");
add(textField6, "cell 5 7,growx");
//---- textField5 ----
textField5.setText("empty border");
textField5.setBorder(BorderFactory.createEmptyBorder());
add(textField5, "cell 6 7");
//---- formattedTextFieldLabel ----
formattedTextFieldLabel.setText("JFormattedTextField:");
add(formattedTextFieldLabel, "cell 0 8");
@@ -591,6 +737,11 @@ public class FlatComponentsTest
formattedTextField5.putClientProperty("JTextField.placeholderText", "placeholder");
add(formattedTextField5, "cell 5 8,growx");
//---- formattedTextField6 ----
formattedTextField6.setText("empty border");
formattedTextField6.setBorder(BorderFactory.createEmptyBorder());
add(formattedTextField6, "cell 6 8");
//---- passwordFieldLabel ----
passwordFieldLabel.setText("JPasswordField:");
add(passwordFieldLabel, "cell 0 9");
@@ -619,6 +770,11 @@ public class FlatComponentsTest
passwordField5.putClientProperty("JTextField.placeholderText", "placeholder");
add(passwordField5, "cell 5 9,growx");
//---- passwordField6 ----
passwordField6.setText("empty border");
passwordField6.setBorder(BorderFactory.createEmptyBorder());
add(passwordField6, "cell 6 9");
//---- textAreaLabel ----
textAreaLabel.setText("JTextArea:");
add(textAreaLabel, "cell 0 10");
@@ -883,6 +1039,57 @@ public class FlatComponentsTest
}
add(toolBar2, "cell 4 13 1 6,growy");
//======== panel4 ========
{
panel4.setLayout(new BoxLayout(panel4, BoxLayout.Y_AXIS));
//---- noOutlineRadioButton ----
noOutlineRadioButton.setText("no outline");
noOutlineRadioButton.setSelected(true);
noOutlineRadioButton.addActionListener(e -> outlineChanged());
panel4.add(noOutlineRadioButton);
//---- errorOutlineRadioButton ----
errorOutlineRadioButton.setText("error");
errorOutlineRadioButton.addActionListener(e -> outlineChanged());
panel4.add(errorOutlineRadioButton);
//---- warningOutlineRadioButton ----
warningOutlineRadioButton.setText("warning");
warningOutlineRadioButton.addActionListener(e -> outlineChanged());
panel4.add(warningOutlineRadioButton);
//---- magentaOutlineRadioButton ----
magentaOutlineRadioButton.setText("magenta");
magentaOutlineRadioButton.addActionListener(e -> outlineChanged());
panel4.add(magentaOutlineRadioButton);
//---- magentaCyanOutlineRadioButton ----
magentaCyanOutlineRadioButton.setText("magenta / cyan");
magentaCyanOutlineRadioButton.addActionListener(e -> outlineChanged());
panel4.add(magentaCyanOutlineRadioButton);
}
add(panel4, "cell 5 13");
//======== scrollPane15 ========
{
scrollPane15.setBorder(BorderFactory.createEmptyBorder());
//======== panel3 ========
{
panel3.setPreferredSize(new Dimension(800, 400));
panel3.setLayout(new BorderLayout());
//---- button21 ----
button21.setText("I'm a large button in a scrollpane with empty border");
button21.setVerticalAlignment(SwingConstants.TOP);
button21.setHorizontalAlignment(SwingConstants.LEFT);
panel3.add(button21, BorderLayout.CENTER);
}
scrollPane15.setViewportView(panel3);
}
add(scrollPane15, "cell 6 13,growy,width 100,height 50");
//---- scrollBarLabel ----
scrollBarLabel.setText("JScrollBar:");
add(scrollBarLabel, "cell 0 14");
@@ -1028,19 +1235,97 @@ public class FlatComponentsTest
toggleButton17.setSelected(true);
toolBar1.add(toggleButton17);
}
add(toolBar1, "cell 1 23 3 1,growx");
add(toolBar1, "cell 1 23 2 1,growx");
//---- label3 ----
label3.setText("Square:");
add(label3, "cell 3 23 3 1");
//======== toolBar3 ========
{
//---- button26 ----
button26.setIcon(UIManager.getIcon("Tree.closedIcon"));
button26.putClientProperty("JButton.buttonType", "square");
toolBar3.add(button26);
//---- button27 ----
button27.setIcon(UIManager.getIcon("Tree.openIcon"));
button27.putClientProperty("JButton.buttonType", "square");
toolBar3.add(button27);
//---- toggleButton23 ----
toggleButton23.setIcon(UIManager.getIcon("FileView.computerIcon"));
toggleButton23.setSelected(true);
toggleButton23.putClientProperty("JButton.buttonType", "square");
toolBar3.add(toggleButton23);
//---- toggleButton24 ----
toggleButton24.setIcon(UIManager.getIcon("FileView.floppyDriveIcon"));
toggleButton24.setSelected(true);
toggleButton24.putClientProperty("JButton.buttonType", "square");
toolBar3.add(toggleButton24);
}
add(toolBar3, "cell 3 23 3 1");
//---- label4 ----
label4.setText("Round:");
add(label4, "cell 3 23 3 1");
//======== toolBar4 ========
{
//---- button28 ----
button28.setIcon(UIManager.getIcon("Tree.closedIcon"));
button28.putClientProperty("JButton.buttonType", "roundRect");
toolBar4.add(button28);
//---- button29 ----
button29.setIcon(UIManager.getIcon("Tree.openIcon"));
button29.putClientProperty("JButton.buttonType", "roundRect");
toolBar4.add(button29);
//---- toggleButton25 ----
toggleButton25.setIcon(UIManager.getIcon("FileView.computerIcon"));
toggleButton25.setSelected(true);
toggleButton25.putClientProperty("JButton.buttonType", "roundRect");
toolBar4.add(toggleButton25);
//---- toggleButton26 ----
toggleButton26.setIcon(UIManager.getIcon("FileView.floppyDriveIcon"));
toggleButton26.setSelected(true);
toggleButton26.putClientProperty("JButton.buttonType", "roundRect");
toolBar4.add(toggleButton26);
}
add(toolBar4, "cell 3 23 3 1");
//---- buttonGroup1 ----
ButtonGroup buttonGroup1 = new ButtonGroup();
buttonGroup1.add(noOutlineRadioButton);
buttonGroup1.add(errorOutlineRadioButton);
buttonGroup1.add(warningOutlineRadioButton);
buttonGroup1.add(magentaOutlineRadioButton);
buttonGroup1.add(magentaCyanOutlineRadioButton);
// JFormDesigner - End of component initialization //GEN-END:initComponents
// BasicComboBoxRenderer customaRenderer = new BasicComboBoxRenderer();
// customaRenderer.setBorder( new LineBorder( Color.red ) );
// comboBox1.setRenderer( customaRenderer );
// comboBox3.setRenderer( customaRenderer );
// BasicComboBoxRenderer customRenderer = new BasicComboBoxRenderer();
// customRenderer.setBorder( new LineBorder( Color.red ) );
// comboBox1.setRenderer( customRenderer );
// comboBox3.setRenderer( customRenderer );
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JComboBox<String> buttonTypeComboBox;
private JCheckBox contentAreaFilledCheckBox;
private JCheckBox roundRectCheckBox;
private JTextField textField1;
private JProgressBar progressBar3;
private JProgressBar progressBar4;
private JRadioButton noOutlineRadioButton;
private JRadioButton errorOutlineRadioButton;
private JRadioButton warningOutlineRadioButton;
private JRadioButton magentaOutlineRadioButton;
private JRadioButton magentaCyanOutlineRadioButton;
private JSlider slider3;
private JProgressBar progressBar1;
private JProgressBar progressBar2;

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.1" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
@@ -8,7 +8,7 @@ new FormModel {
}
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
"$columnConstraints": "[][][][][][]"
"$columnConstraints": "[][][][][][][left]"
"$rowConstraints": "[][][][][][][][][][][][][][][][][][][][][][][][]"
} ) {
name: "this"
@@ -49,12 +49,20 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button17"
"text": "square"
"text": "sq"
"$client.JButton.buttonType": "square"
"$client.JComponent.minimumWidth": 0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button22"
"text": "rd"
"$client.JButton.buttonType": "roundRect"
"$client.JComponent.minimumWidth": 0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button2"
"text": "disabled"
@@ -66,13 +74,22 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button18"
"text": "square"
"text": "sq"
"$client.JButton.buttonType": "square"
"enabled": false
"$client.JComponent.minimumWidth": 0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 1"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button23"
"text": "rd"
"$client.JButton.buttonType": "roundRect"
"enabled": false
"$client.JComponent.minimumWidth": 0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 1"
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatComponentsTest$TestDefaultButton" ) {
name: "button5"
"text": "default"
@@ -120,6 +137,13 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 1"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button20"
"text": "empty border"
"border": &EmptyBorder0 new javax.swing.border.EmptyBorder( 0, 0, 0, 0 )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "toggleButtonLabel"
"text": "JToggleButton:"
@@ -134,11 +158,18 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton9"
"text": "square"
"text": "sq"
"$client.JButton.buttonType": "square"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton19"
"text": "rd"
"$client.JButton.buttonType": "roundRect"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton2"
"text": "disabled"
@@ -148,12 +179,20 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton10"
"text": "square"
"text": "sq"
"$client.JButton.buttonType": "square"
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 2"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton20"
"text": "rd"
"$client.JButton.buttonType": "roundRect"
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 2"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton3"
"text": "selected"
@@ -197,6 +236,13 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 2"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton18"
"text": "empty border"
"border": #EmptyBorder0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 2"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "checkBoxLabel"
"text": "JCheckBox"
@@ -250,6 +296,23 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 3"
} )
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "buttonTypeComboBox"
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "-"
addElement( "-" )
addElement( "square" )
addElement( "roundRect" )
addElement( "tab" )
addElement( "help" )
}
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "buttonTypeChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 3"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "radioButtonLabel"
"text": "JRadioButton:"
@@ -297,6 +360,16 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 4"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "roundRectCheckBox"
"text": "roundRect"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "roundRectChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 4"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "comboBoxLabel"
"text": "JComboBox:"
@@ -383,6 +456,19 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 5,growx,wmax 100"
} )
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "comboBox6"
"border": #EmptyBorder0
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "empty border"
addElement( "empty border" )
addElement( "a" )
addElement( "b" )
addElement( "c" )
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 5"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "spinnerLabel"
"text": "JSpinner:"
@@ -410,6 +496,15 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 6,growx"
} )
add( new FormComponent( "javax.swing.JSpinner" ) {
name: "spinner3"
"border": new javax.swing.border.EmptyBorder( 0, 0, 0, 0 )
"model": new javax.swing.SpinnerNumberModel {
value: 12345
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 6"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "textFieldLabel"
"text": "JTextField:"
@@ -419,6 +514,9 @@ new FormModel {
add( new FormComponent( "javax.swing.JTextField" ) {
name: "textField1"
"text": "editable"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 7,growx"
} )
@@ -450,6 +548,13 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 7,growx"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "textField5"
"text": "empty border"
"border": #EmptyBorder0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 7"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "formattedTextFieldLabel"
"text": "JFormattedTextField:"
@@ -490,6 +595,13 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 8,growx"
} )
add( new FormComponent( "javax.swing.JFormattedTextField" ) {
name: "formattedTextField6"
"text": "empty border"
"border": #EmptyBorder0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 8"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "passwordFieldLabel"
"text": "JPasswordField:"
@@ -530,6 +642,13 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 9,growx"
} )
add( new FormComponent( "javax.swing.JPasswordField" ) {
name: "passwordField6"
"text": "empty border"
"border": #EmptyBorder0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 9"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "textAreaLabel"
"text": "JTextArea:"
@@ -839,6 +958,77 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 13 1 6,growy"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class javax.swing.BoxLayout ) {
"axis": 1
} ) {
name: "panel4"
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "noOutlineRadioButton"
"text": "no outline"
"$buttonGroup": new FormReference( "buttonGroup1" )
"selected": true
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "outlineChanged", false ) )
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "errorOutlineRadioButton"
"text": "error"
"$buttonGroup": new FormReference( "buttonGroup1" )
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "outlineChanged", false ) )
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "warningOutlineRadioButton"
"text": "warning"
"$buttonGroup": new FormReference( "buttonGroup1" )
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "outlineChanged", false ) )
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "magentaOutlineRadioButton"
"text": "magenta"
"$buttonGroup": &FormReference0 new FormReference( "buttonGroup1" )
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "outlineChanged", false ) )
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "magentaCyanOutlineRadioButton"
"text": "magenta / cyan"
"$buttonGroup": #FormReference0
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "outlineChanged", false ) )
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 13"
} )
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "scrollPane15"
"border": new javax.swing.border.EmptyBorder( 0, 0, 0, 0 )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel3"
"preferredSize": new java.awt.Dimension( 800, 400 )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button21"
"text": "I'm a large button in a scrollpane with empty border"
"verticalAlignment": 1
"horizontalAlignment": 2
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 13,growy,width 100,height 50"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "scrollBarLabel"
"text": "JScrollBar:"
@@ -1027,12 +1217,12 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton15"
"icon": new com.jformdesigner.model.SwingIcon( 2, "FileView.computerIcon" )
"icon": &SwingIcon4 new com.jformdesigner.model.SwingIcon( 2, "FileView.computerIcon" )
"selected": true
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton16"
"icon": new com.jformdesigner.model.SwingIcon( 2, "FileView.floppyDriveIcon" )
"icon": &SwingIcon5 new com.jformdesigner.model.SwingIcon( 2, "FileView.floppyDriveIcon" )
"selected": true
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
@@ -1041,11 +1231,82 @@ new FormModel {
"selected": true
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 23 3 1,growx"
"value": "cell 1 23 2 1,growx"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label3"
"text": "Square:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 23 3 1"
} )
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
name: "toolBar3"
add( new FormComponent( "javax.swing.JButton" ) {
name: "button26"
"icon": #SwingIcon1
"$client.JButton.buttonType": "square"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button27"
"icon": #SwingIcon2
"$client.JButton.buttonType": "square"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton23"
"icon": #SwingIcon4
"selected": true
"$client.JButton.buttonType": "square"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton24"
"icon": #SwingIcon5
"selected": true
"$client.JButton.buttonType": "square"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 23 3 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label4"
"text": "Round:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 23 3 1"
} )
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
name: "toolBar4"
add( new FormComponent( "javax.swing.JButton" ) {
name: "button28"
"icon": #SwingIcon1
"$client.JButton.buttonType": "roundRect"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button29"
"icon": #SwingIcon2
"$client.JButton.buttonType": "roundRect"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton25"
"icon": #SwingIcon4
"selected": true
"$client.JButton.buttonType": "roundRect"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton26"
"icon": #SwingIcon5
"selected": true
"$client.JButton.buttonType": "roundRect"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 23 3 1"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 1005, 800 )
"size": new java.awt.Dimension( 1135, 800 )
} )
add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
name: "buttonGroup1"
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 810 )
} )
}
}

View File

@@ -18,6 +18,7 @@ package com.formdev.flatlaf.testing;
import java.awt.*;
import javax.swing.*;
import com.formdev.flatlaf.util.StringUtils;
import com.formdev.flatlaf.util.UIScale;
import net.miginfocom.swing.*;
@@ -36,6 +37,18 @@ public class FlatHtmlTest
FlatHtmlTest() {
initComponents();
String html = label1.getText();
label2.setText( html );
toolTip1.setTipText( html );
toolTip2.setTipText( html );
String html2 = StringUtils.removeLeading( StringUtils.removeTrailing( html, "</html>" ), "<html>" );
editorPane1.setText( html2 );
editorPane2.setText( html2 );
textPane1.setText( html2 );
textPane2.setText( html2 );
increaseFontSize();
}
@@ -88,7 +101,7 @@ public class FlatHtmlTest
add(toolTipLabel, "cell 3 0");
//---- label1 ----
label1.setText("<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>");
label1.setText("<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p><hr><table border=\"1\"><tr><th>Col 1</th><th>Col 2</th></tr><tr><td>abc</td><td>def</td></tr></table><ul><li>item 1</li><li>item 2</li></ul></html>");
add(label1, "cell 0 1");
//======== scrollPane15 ========
@@ -96,7 +109,7 @@ public class FlatHtmlTest
//---- editorPane1 ----
editorPane1.setContentType("text/html");
editorPane1.setText("HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>");
editorPane1.setText("text");
scrollPane15.setViewportView(editorPane1);
}
add(scrollPane15, "cell 1 1,grow");
@@ -106,17 +119,17 @@ public class FlatHtmlTest
//---- textPane1 ----
textPane1.setContentType("text/html");
textPane1.setText("HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>");
textPane1.setText("text");
scrollPane16.setViewportView(textPane1);
}
add(scrollPane16, "cell 2 1");
//---- toolTip1 ----
toolTip1.setTipText("<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>");
toolTip1.setTipText("text");
add(toolTip1, "cell 3 1");
//---- label2 ----
label2.setText("<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>");
label2.setText("text");
add(label2, "cell 0 2");
//======== scrollPane17 ========
@@ -124,7 +137,7 @@ public class FlatHtmlTest
//---- editorPane2 ----
editorPane2.setContentType("text/html");
editorPane2.setText("HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>");
editorPane2.setText("text");
scrollPane17.setViewportView(editorPane2);
}
add(scrollPane17, "cell 1 2,grow");
@@ -134,13 +147,13 @@ public class FlatHtmlTest
//---- textPane2 ----
textPane2.setContentType("text/html");
textPane2.setText("HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>");
textPane2.setText("text");
scrollPane18.setViewportView(textPane2);
}
add(scrollPane18, "cell 2 2");
//---- toolTip2 ----
toolTip2.setTipText("<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>");
toolTip2.setTipText("text");
add(toolTip2, "cell 3 2");
// JFormDesigner - End of component initialization //GEN-END:initComponents
}

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
@@ -35,7 +35,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label1"
"text": "<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>"
"text": "<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p><hr><table border=\"1\"><tr><th>Col 1</th><th>Col 2</th></tr><tr><td>abc</td><td>def</td></tr></table><ul><li>item 1</li><li>item 2</li></ul></html>"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )
@@ -44,7 +44,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JEditorPane" ) {
name: "editorPane1"
"contentType": "text/html"
"text": "HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>"
"text": "text"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1,grow"
@@ -54,20 +54,20 @@ new FormModel {
add( new FormComponent( "javax.swing.JTextPane" ) {
name: "textPane1"
"contentType": "text/html"
"text": "HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>"
"text": "text"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 1"
} )
add( new FormComponent( "javax.swing.JToolTip" ) {
name: "toolTip1"
"tipText": "<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>"
"tipText": "text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label2"
"text": "<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>"
"text": "text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2"
} )
@@ -76,7 +76,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JEditorPane" ) {
name: "editorPane2"
"contentType": "text/html"
"text": "HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>"
"text": "text"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2,grow"
@@ -86,14 +86,14 @@ new FormModel {
add( new FormComponent( "javax.swing.JTextPane" ) {
name: "textPane2"
"contentType": "text/html"
"text": "HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>"
"text": "text"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 2"
} )
add( new FormComponent( "javax.swing.JToolTip" ) {
name: "toolTip2"
"tipText": "<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>"
"tipText": "text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 2"
} )

View File

@@ -304,6 +304,8 @@ public class FlatInspector
text += "Enabled: " + c.isEnabled() + '\n';
text += "Opaque: " + c.isOpaque() + (c instanceof JComponent &&
FlatUIUtils.hasOpaqueBeenExplicitlySet( (JComponent) c ) ? " EXPLICIT" : "") + '\n';
if( c instanceof AbstractButton )
text += "ContentAreaFilled: " + ((AbstractButton)c).isContentAreaFilled() + '\n';
text += "Focusable: " + c.isFocusable() + '\n';
text += "Left-to-right: " + c.getComponentOrientation().isLeftToRight() + '\n';
text += "Parent: " + c.getParent().getClass().getName();

View File

@@ -101,8 +101,8 @@ public class FlatTestFrame
continue;
if( (SystemInfo.IS_WINDOWS && className.equals( "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" )) ||
(SystemInfo.IS_MAC && className.equals( "com.apple.laf.AquaLookAndFeel") ) ||
(SystemInfo.IS_LINUX && className.equals( "com.sun.java.swing.plaf.gtk.GTKLookAndFeel") ) )
(SystemInfo.IS_MAC && className.equals( "com.apple.laf.AquaLookAndFeel" )) ||
(SystemInfo.IS_LINUX && className.equals( "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" )) )
name += " (F9)";
else if( className.equals( MetalLookAndFeel.class.getName() ) )
name += " (F12)";
@@ -440,7 +440,7 @@ public class FlatTestFrame
sizeVariantComboBox.setVisible( visible );
}
private void updateComponentsRecur( Container container, BiConsumer<Component, String> action ) {
void updateComponentsRecur( Container container, BiConsumer<Component, String> action ) {
for( Component c : container.getComponents() ) {
if( c instanceof JPanel || c instanceof JDesktopPane ) {
updateComponentsRecur( (Container) c, action );
@@ -566,7 +566,7 @@ public class FlatTestFrame
"1.25",
"1.5",
"1.75",
"2.0",
"2",
"2.25",
"2.5",
"3",

View File

@@ -41,7 +41,7 @@ new FormModel {
addElement( "1.25" )
addElement( "1.5" )
addElement( "1.75" )
addElement( "2.0" )
addElement( "2" )
addElement( "2.25" )
addElement( "2.5" )
addElement( "3" )

View File

@@ -20,16 +20,22 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.function.Predicate;
import javax.swing.Icon;
import javax.swing.ImageIcon;
@@ -54,6 +60,9 @@ import javax.swing.plaf.basic.BasicLookAndFeel;
import com.formdev.flatlaf.*;
import com.formdev.flatlaf.intellijthemes.FlatAllIJThemes;
import com.formdev.flatlaf.ui.FlatLineBorder;
import com.formdev.flatlaf.util.ColorFunctions.ColorFunction;
import com.formdev.flatlaf.util.ColorFunctions.HSLIncreaseDecrease;
import com.formdev.flatlaf.util.DerivedColor;
import com.formdev.flatlaf.util.StringUtils;
import com.formdev.flatlaf.util.SystemInfo;
@@ -159,15 +168,89 @@ public class UIDefaultsDump
File file = new File( dir, name + nameSuffix + "_"
+ System.getProperty( "java.version" ) + osSuffix + ".txt" );
// build differences
String content;
if( !osSuffix.isEmpty() && nameSuffix.isEmpty() ) {
File origFile = new File( dir, name + nameSuffix + "_"
+ System.getProperty( "java.version" ) + ".txt" );
try {
Map<String, String> defaults1 = parse( new FileReader( origFile ) );
Map<String, String> defaults2 = parse( new StringReader( stringWriter.toString() ) );
content = diff( defaults1, defaults2 );
} catch( Exception ex ) {
ex.printStackTrace();
return;
}
} else
content = stringWriter.toString().replace( "\r", "" );
// write to file
file.getParentFile().mkdirs();
try( FileWriter fileWriter = new FileWriter( file ) ) {
fileWriter.write( stringWriter.toString().replace( "\r", "" ) );
fileWriter.write( content );
} catch( IOException ex ) {
ex.printStackTrace();
}
}
private static String diff( Map<String, String> defaults1, Map<String, String> defaults2 ) {
defaults1 = new LinkedHashMap<>( defaults1 );
StringBuilder buf = new StringBuilder( 10000 );
for( Map.Entry<String, String> e : defaults2.entrySet() ) {
String key = e.getKey();
String value2 = e.getValue();
String value1 = defaults1.remove( key );
if( !value2.equals( value1 ) ) {
if( value1 != null )
buf.append( "- " ).append( key ).append( value1 ).append( '\n' );
buf.append( "+ " ).append( key ).append( value2 ).append( '\n' );
buf.append( '\n' );
}
}
for( Map.Entry<String, String> e : defaults1.entrySet() ) {
buf.append( "- " ).append( e.getKey() ).append( e.getValue() ).append( '\n' );
buf.append( '\n' );
}
return buf.toString();
}
private static Map<String, String> parse( Reader in ) throws IOException {
Map<String, String> defaults = new LinkedHashMap<>();
try( BufferedReader reader = new BufferedReader( in ) ) {
String lastKey = null;
String line;
while( (line = reader.readLine()) != null ) {
String trimmedLine = line.trim();
if( trimmedLine.isEmpty() || trimmedLine.startsWith( "#" ) ) {
lastKey = null;
continue;
}
if( Character.isWhitespace( line.charAt( 0 ) ) ) {
String value = defaults.get( lastKey );
value += '\n' + line;
defaults.put( lastKey, value );
} else {
int sep = line.indexOf( ' ' );
if( sep < 0 )
throw new IOException( line );
String key = line.substring( 0, sep );
String value = line.substring( sep );
defaults.put( key, value );
lastKey = key;
}
}
}
return defaults;
}
private UIDefaultsDump( LookAndFeel lookAndFeel ) {
this.lookAndFeel = lookAndFeel;
this.defaults = lookAndFeel.getDefaults();
@@ -275,6 +358,31 @@ public class UIDefaultsDump
out.printf( hasAlpha ? "#%08x %s" : "#%06x %s",
hasAlpha ? color.getRGB() : (color.getRGB() & 0xffffff),
dumpClass( color ) );
if( color instanceof DerivedColor ) {
out.print( " " );
DerivedColor derivedColor = (DerivedColor) color;
for( ColorFunction function : derivedColor.getFunctions() ) {
out.print( " " );
dumpColorFunction( out, function );
}
}
}
private void dumpColorFunction( PrintWriter out, ColorFunction function ) {
if( function instanceof HSLIncreaseDecrease ) {
HSLIncreaseDecrease func = (HSLIncreaseDecrease) function;
String name;
switch( func.hslIndex ) {
case 2: name = func.increase ? "lighten" : "darken"; break;
case 1: name = func.increase ? "saturate" : "desaturate"; break;
default: throw new IllegalArgumentException();
}
out.printf( "%s(%.0f%%%s%s)", name, func.amount,
(func.relative ? " relative" : ""),
(func.autoInverse ? " autoInverse" : "") );
} else
throw new IllegalArgumentException( "unknown color function: " + function );
}
private void dumpFont( PrintWriter out, Font font ) {

View File

@@ -26,7 +26,8 @@
@textComponentBackground=#ffffff
@menuBackground=#fff
@menuHoverBackground=darken(@menuBackground,10%)
@menuCheckBackground=darken(@menuBackground,15%)
@menuCheckBackground=darken(@menuBackground,10%)
@menuCheckHoverBackground=darken(@menuBackground,20%)
@cellFocusColor=#ff0000
@icon=#afafaf
@@ -210,6 +211,13 @@ OptionPane.icon.warningColor=#ffcc00
OptionPane.icon.foreground=#ffffff
#---- Popup ----
Popup.dropShadowColor=#0f0
Popup.dropShadowOpacity=0.5
Popup.dropShadowInsets=-6,6,6,6
#---- PopupMenu ----
PopupMenu.borderColor=#0000ff

View File

@@ -1,6 +1,6 @@
Class com.formdev.flatlaf.FlatDarkLaf
ID FlatLaf - Flat Dark
Name Flat Dark
ID FlatLaf - FlatLaf Dark
Name FlatLaf Dark
Java 1.8.0_202
OS Windows 10
@@ -73,9 +73,9 @@ Button.default.borderWidth 1
Button.default.focusColor #43688c javax.swing.plaf.ColorUIResource [UI]
Button.default.focusedBorderColor #537699 javax.swing.plaf.ColorUIResource [UI]
Button.default.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
Button.default.hoverBackground #3b5f8b com.formdev.flatlaf.util.DerivedColor [UI]
Button.default.hoverBackground #3b5f8b com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse)
Button.default.hoverBorderColor #537699 javax.swing.plaf.ColorUIResource [UI]
Button.default.pressedBackground #3f6796 com.formdev.flatlaf.util.DerivedColor [UI]
Button.default.pressedBackground #3f6796 com.formdev.flatlaf.util.DerivedColor [UI] lighten(6% autoInverse)
Button.defaultButtonFollowsFocus true
Button.disabledBorderColor #5e6060 javax.swing.plaf.ColorUIResource [UI]
Button.disabledText #777777 javax.swing.plaf.ColorUIResource [UI]
@@ -83,20 +83,20 @@ Button.focusedBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
Button.font [active] $defaultFont [UI]
Button.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
Button.highlight #242424 javax.swing.plaf.ColorUIResource [UI]
Button.hoverBackground #53585a com.formdev.flatlaf.util.DerivedColor [UI]
Button.hoverBackground #53585a com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse)
Button.hoverBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
Button.iconTextGap 4
Button.light #313131 javax.swing.plaf.ColorUIResource [UI]
Button.margin 2,14,2,14 javax.swing.plaf.InsetsUIResource [UI]
Button.minimumWidth 72
Button.pressedBackground #5b5f62 com.formdev.flatlaf.util.DerivedColor [UI]
Button.pressedBackground #5b5f62 com.formdev.flatlaf.util.DerivedColor [UI] lighten(6% autoInverse)
Button.rollover true
Button.shadow #646464 javax.swing.plaf.ColorUIResource [UI]
Button.textIconGap 4
Button.textShiftOffset 0
Button.toolbar.hoverBackground #4e5355 com.formdev.flatlaf.util.DerivedColor [UI]
Button.toolbar.hoverBackground #4e5355 com.formdev.flatlaf.util.DerivedColor [UI] lighten(1% autoInverse)
Button.toolbar.margin 3,3,3,3 javax.swing.plaf.InsetsUIResource [UI]
Button.toolbar.pressedBackground #565a5d com.formdev.flatlaf.util.DerivedColor [UI]
Button.toolbar.pressedBackground #565a5d com.formdev.flatlaf.util.DerivedColor [UI] lighten(4% autoInverse)
Button.toolbar.spacingInsets 1,2,1,2 javax.swing.plaf.InsetsUIResource [UI]
ButtonUI com.formdev.flatlaf.ui.FlatButtonUI
@@ -121,9 +121,9 @@ CheckBox.icon.disabledBackground #3c3f41 javax.swing.plaf.ColorUIResource [UI
CheckBox.icon.disabledBorderColor #545556 javax.swing.plaf.ColorUIResource [UI]
CheckBox.icon.disabledCheckmarkColor #606060 javax.swing.plaf.ColorUIResource [UI]
CheckBox.icon.focusedBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
CheckBox.icon.hoverBackground #4a5152 com.formdev.flatlaf.util.DerivedColor [UI]
CheckBox.icon.hoverBackground #4a5152 com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse)
CheckBox.icon.hoverBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
CheckBox.icon.pressedBackground #52595a com.formdev.flatlaf.util.DerivedColor [UI]
CheckBox.icon.pressedBackground #52595a com.formdev.flatlaf.util.DerivedColor [UI] lighten(6% autoInverse)
CheckBox.icon.selectedBackground #43494a javax.swing.plaf.ColorUIResource [UI]
CheckBox.icon.selectedBorderColor #6b6b6b javax.swing.plaf.ColorUIResource [UI]
CheckBox.icon.selectedFocusedBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
@@ -201,15 +201,21 @@ ComboBoxUI com.formdev.flatlaf.ui.FlatComboBoxUI
Component.arc 5
Component.arrowType chevron
Component.borderColor #646464 javax.swing.plaf.ColorUIResource [UI]
Component.custom.borderColor #bf4040 com.formdev.flatlaf.util.DerivedColor [UI] desaturate(50% relative)
Component.disabledBorderColor #646464 javax.swing.plaf.ColorUIResource [UI]
Component.error.borderColor #725555 javax.swing.plaf.ColorUIResource [UI]
Component.error.focusedBorderColor #8b3c3c javax.swing.plaf.ColorUIResource [UI]
Component.focusColor #3d6185 javax.swing.plaf.ColorUIResource [UI]
Component.focusWidth 0
Component.focusedBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
Component.grayFilter [lazy] [unknown type] com.formdev.flatlaf.util.GrayFilter
Component.hideMnemonics true
Component.innerFocusWidth 0.5
Component.innerOutlineWidth 1.0
Component.linkColor #589df6 javax.swing.plaf.ColorUIResource [UI]
Component.minimumWidth 64
Component.warning.borderColor #725627 javax.swing.plaf.ColorUIResource [UI]
Component.warning.focusedBorderColor #ac7920 javax.swing.plaf.ColorUIResource [UI]
#---- DatePicker ----
@@ -309,10 +315,10 @@ HelpButton.disabledBackground #3c3f41 javax.swing.plaf.ColorUIResource [UI]
HelpButton.disabledBorderColor #545556 javax.swing.plaf.ColorUIResource [UI]
HelpButton.disabledQuestionMarkColor #606060 javax.swing.plaf.ColorUIResource [UI]
HelpButton.focusedBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
HelpButton.hoverBackground #4a5152 com.formdev.flatlaf.util.DerivedColor [UI]
HelpButton.hoverBackground #4a5152 com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse)
HelpButton.hoverBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
HelpButton.icon [lazy] 22,22 com.formdev.flatlaf.icons.FlatHelpButtonIcon [UI]
HelpButton.pressedBackground #52595a com.formdev.flatlaf.util.DerivedColor [UI]
HelpButton.pressedBackground #52595a com.formdev.flatlaf.util.DerivedColor [UI] lighten(6% autoInverse)
HelpButton.questionMarkColor #a7a7a7 javax.swing.plaf.ColorUIResource [UI]
@@ -326,7 +332,9 @@ HyperlinkUI com.formdev.flatlaf.swingx.ui.FlatHyperlinkUI
#---- InternalFrame ----
InternalFrame.activeBorderColor #7e7e7e javax.swing.plaf.ColorUIResource [UI]
InternalFrame.activeBorderColor #2b2d2e javax.swing.plaf.ColorUIResource [UI]
InternalFrame.activeDropShadowInsets 5,5,6,6 javax.swing.plaf.InsetsUIResource [UI]
InternalFrame.activeDropShadowOpacity 0.5
InternalFrame.activeTitleBackground #242526 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.activeTitleForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
InternalFrame.border [lazy] 6,6,6,6 false com.formdev.flatlaf.ui.FlatInternalFrameUI$FlatInternalFrameBorder [UI]
@@ -337,17 +345,20 @@ InternalFrame.borderLight #313131 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.borderLineWidth 1
InternalFrame.borderMargins 6,6,6,6 javax.swing.plaf.InsetsUIResource [UI]
InternalFrame.borderShadow #646464 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.buttonHoverBackground #3d3f40 com.formdev.flatlaf.util.DerivedColor [UI]
InternalFrame.buttonPressedBackground #56585a com.formdev.flatlaf.util.DerivedColor [UI]
InternalFrame.buttonHoverBackground #3d3f40 com.formdev.flatlaf.util.DerivedColor [UI] lighten(10% autoInverse)
InternalFrame.buttonPressedBackground #56585a com.formdev.flatlaf.util.DerivedColor [UI] lighten(20% autoInverse)
InternalFrame.buttonSize 24,24 javax.swing.plaf.DimensionUIResource [UI]
InternalFrame.closeHoverBackground [lazy] #c75450 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.closeHoverForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
InternalFrame.closeIcon [lazy] 24,24 com.formdev.flatlaf.icons.FlatInternalFrameCloseIcon [UI]
InternalFrame.closePressedBackground [lazy] #ad3b37 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.closePressedForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
InternalFrame.dropShadowPainted true
InternalFrame.icon [lazy] 16,16 sun.swing.ImageIconUIResource [UI] (sun.awt.image.ToolkitImage)
InternalFrame.iconifyIcon [lazy] 24,24 com.formdev.flatlaf.icons.FlatInternalFrameIconifyIcon [UI]
InternalFrame.inactiveBorderColor #646464 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.inactiveBorderColor #353739 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.inactiveDropShadowInsets 3,3,4,4 javax.swing.plaf.InsetsUIResource [UI]
InternalFrame.inactiveDropShadowOpacity 0.75
InternalFrame.inactiveTitleBackground #303234 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.inactiveTitleForeground #777777 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.maximizeIcon [lazy] 24,24 com.formdev.flatlaf.icons.FlatInternalFrameMaximizeIcon [UI]
@@ -628,6 +639,14 @@ PasswordField.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [U
PasswordFieldUI com.formdev.flatlaf.ui.FlatPasswordFieldUI
#---- Popup ----
Popup.dropShadowColor #000000 javax.swing.plaf.ColorUIResource [UI]
Popup.dropShadowInsets -4,-4,4,4 javax.swing.plaf.InsetsUIResource [UI]
Popup.dropShadowOpacity 0.25
Popup.dropShadowPainted true
#---- PopupMenu ----
PopupMenu.background #303234 javax.swing.plaf.ColorUIResource [UI]
@@ -790,7 +809,7 @@ Slider.font [active] $defaultFont [UI]
Slider.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
Slider.highlight #242424 javax.swing.plaf.ColorUIResource [UI]
Slider.horizontalSize 200,21 java.awt.Dimension
Slider.hoverColor #808080 com.formdev.flatlaf.util.DerivedColor [UI]
Slider.hoverColor #808080 com.formdev.flatlaf.util.DerivedColor [UI] darken(15% autoInverse)
Slider.minimumHorizontalSize 36,21 java.awt.Dimension
Slider.minimumVerticalSize 21,36 java.awt.Dimension
Slider.onlyLeftMouseButtonDrag true
@@ -1029,7 +1048,7 @@ TitledPanelUI com.formdev.flatlaf.swingx.ui.FlatTitledPanelUI
ToggleButton.background #4c5052 javax.swing.plaf.ColorUIResource [UI]
ToggleButton.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatButtonBorder [UI]
ToggleButton.darkShadow #7e7e7e javax.swing.plaf.ColorUIResource [UI]
ToggleButton.disabledSelectedBackground #53585a com.formdev.flatlaf.util.DerivedColor [UI]
ToggleButton.disabledSelectedBackground #53585a com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse)
ToggleButton.disabledText #777777 javax.swing.plaf.ColorUIResource [UI]
ToggleButton.font [active] $defaultFont [UI]
ToggleButton.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
@@ -1037,9 +1056,9 @@ ToggleButton.highlight #242424 javax.swing.plaf.ColorUIResource [UI]
ToggleButton.iconTextGap 4
ToggleButton.light #313131 javax.swing.plaf.ColorUIResource [UI]
ToggleButton.margin 2,14,2,14 javax.swing.plaf.InsetsUIResource [UI]
ToggleButton.pressedBackground #5b5f62 com.formdev.flatlaf.util.DerivedColor [UI]
ToggleButton.pressedBackground #5b5f62 com.formdev.flatlaf.util.DerivedColor [UI] lighten(6% autoInverse)
ToggleButton.rollover true
ToggleButton.selectedBackground #656a6c com.formdev.flatlaf.util.DerivedColor [UI]
ToggleButton.selectedBackground #656a6c com.formdev.flatlaf.util.DerivedColor [UI] lighten(10% autoInverse)
ToggleButton.selectedForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
ToggleButton.shadow #646464 javax.swing.plaf.ColorUIResource [UI]
ToggleButton.tab.disabledUnderlineColor #7a7a7a javax.swing.plaf.ColorUIResource [UI]
@@ -1049,9 +1068,9 @@ ToggleButton.tab.underlineColor #4a88c7 javax.swing.plaf.ColorUIResource [UI]
ToggleButton.tab.underlineHeight 2
ToggleButton.textIconGap 4
ToggleButton.textShiftOffset 0
ToggleButton.toolbar.hoverBackground #4e5355 com.formdev.flatlaf.util.DerivedColor [UI]
ToggleButton.toolbar.pressedBackground #565a5d com.formdev.flatlaf.util.DerivedColor [UI]
ToggleButton.toolbar.selectedBackground #5d6265 com.formdev.flatlaf.util.DerivedColor [UI]
ToggleButton.toolbar.hoverBackground #4e5355 com.formdev.flatlaf.util.DerivedColor [UI] lighten(1% autoInverse)
ToggleButton.toolbar.pressedBackground #565a5d com.formdev.flatlaf.util.DerivedColor [UI] lighten(4% autoInverse)
ToggleButton.toolbar.selectedBackground #5d6265 com.formdev.flatlaf.util.DerivedColor [UI] lighten(7% autoInverse)
ToggleButtonUI com.formdev.flatlaf.ui.FlatToggleButtonUI
@@ -1185,6 +1204,15 @@ inactiveCaptionBorder #393c3d javax.swing.plaf.ColorUIResource [UI]
inactiveCaptionText #bbbbbb javax.swing.plaf.ColorUIResource [UI]
info #1e2123 javax.swing.plaf.ColorUIResource [UI]
infoText #bbbbbb javax.swing.plaf.ColorUIResource [UI]
#---- laf ----
laf.scaleFactor [active] 1.0
#---- ----
menu #3c3f41 javax.swing.plaf.ColorUIResource [UI]
menuText #bbbbbb javax.swing.plaf.ColorUIResource [UI]
scrollbar #3f4244 javax.swing.plaf.ColorUIResource [UI]

View File

@@ -1,6 +1,6 @@
Class com.formdev.flatlaf.FlatLightLaf
ID FlatLaf - Flat Light
Name Flat Light
ID FlatLaf - FlatLaf Light
Name FlatLaf Light
Java 1.8.0_202
OS Windows 10
@@ -73,9 +73,9 @@ Button.default.focusColor #97c3f3 javax.swing.plaf.ColorUIResource [UI]
Button.default.focusedBackground #e3f1fa javax.swing.plaf.ColorUIResource [UI]
Button.default.focusedBorderColor #87afda javax.swing.plaf.ColorUIResource [UI]
Button.default.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
Button.default.hoverBackground #f7f7f7 com.formdev.flatlaf.util.DerivedColor [UI]
Button.default.hoverBackground #f7f7f7 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse)
Button.default.hoverBorderColor #87afda javax.swing.plaf.ColorUIResource [UI]
Button.default.pressedBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI]
Button.default.pressedBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
Button.defaultButtonFollowsFocus true
Button.disabledBorderColor #cfcfcf javax.swing.plaf.ColorUIResource [UI]
Button.disabledText #8c8c8c javax.swing.plaf.ColorUIResource [UI]
@@ -84,20 +84,20 @@ Button.focusedBorderColor #87afda javax.swing.plaf.ColorUIResource [UI]
Button.font [active] $defaultFont [UI]
Button.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
Button.highlight #ffffff javax.swing.plaf.ColorUIResource [UI]
Button.hoverBackground #f7f7f7 com.formdev.flatlaf.util.DerivedColor [UI]
Button.hoverBackground #f7f7f7 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse)
Button.hoverBorderColor #87afda javax.swing.plaf.ColorUIResource [UI]
Button.iconTextGap 4
Button.light #e3e3e3 javax.swing.plaf.ColorUIResource [UI]
Button.margin 2,14,2,14 javax.swing.plaf.InsetsUIResource [UI]
Button.minimumWidth 72
Button.pressedBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI]
Button.pressedBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
Button.rollover true
Button.shadow #c4c4c4 javax.swing.plaf.ColorUIResource [UI]
Button.textIconGap 4
Button.textShiftOffset 0
Button.toolbar.hoverBackground #e0e0e0 com.formdev.flatlaf.util.DerivedColor [UI]
Button.toolbar.hoverBackground #e0e0e0 com.formdev.flatlaf.util.DerivedColor [UI] darken(12% autoInverse)
Button.toolbar.margin 3,3,3,3 javax.swing.plaf.InsetsUIResource [UI]
Button.toolbar.pressedBackground #d9d9d9 com.formdev.flatlaf.util.DerivedColor [UI]
Button.toolbar.pressedBackground #d9d9d9 com.formdev.flatlaf.util.DerivedColor [UI] darken(15% autoInverse)
Button.toolbar.spacingInsets 1,2,1,2 javax.swing.plaf.InsetsUIResource [UI]
ButtonUI com.formdev.flatlaf.ui.FlatButtonUI
@@ -123,9 +123,9 @@ CheckBox.icon.disabledBorderColor #bdbdbd javax.swing.plaf.ColorUIResource [U
CheckBox.icon.disabledCheckmarkColor #ababab javax.swing.plaf.ColorUIResource [UI]
CheckBox.icon.focusedBackground #e3f1fa javax.swing.plaf.ColorUIResource [UI]
CheckBox.icon.focusedBorderColor #7b9fc7 javax.swing.plaf.ColorUIResource [UI]
CheckBox.icon.hoverBackground #f7f7f7 com.formdev.flatlaf.util.DerivedColor [UI]
CheckBox.icon.hoverBackground #f7f7f7 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse)
CheckBox.icon.hoverBorderColor #7b9fc7 javax.swing.plaf.ColorUIResource [UI]
CheckBox.icon.pressedBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI]
CheckBox.icon.pressedBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
CheckBox.icon.selectedBackground #ffffff javax.swing.plaf.ColorUIResource [UI]
CheckBox.icon.selectedBorderColor #b0b0b0 javax.swing.plaf.ColorUIResource [UI]
CheckBox.icon [lazy] 15,15 com.formdev.flatlaf.icons.FlatCheckBoxIcon [UI]
@@ -202,15 +202,21 @@ ComboBoxUI com.formdev.flatlaf.ui.FlatComboBoxUI
Component.arc 5
Component.arrowType chevron
Component.borderColor #c4c4c4 javax.swing.plaf.ColorUIResource [UI]
Component.custom.borderColor #f38d8d com.formdev.flatlaf.util.DerivedColor [UI] desaturate(20%) lighten(25%)
Component.disabledBorderColor #cfcfcf javax.swing.plaf.ColorUIResource [UI]
Component.error.borderColor #ebb8bc javax.swing.plaf.ColorUIResource [UI]
Component.error.focusedBorderColor #e53e4d javax.swing.plaf.ColorUIResource [UI]
Component.focusColor #97c3f3 javax.swing.plaf.ColorUIResource [UI]
Component.focusWidth 0
Component.focusedBorderColor #87afda javax.swing.plaf.ColorUIResource [UI]
Component.grayFilter [lazy] [unknown type] com.formdev.flatlaf.util.GrayFilter
Component.hideMnemonics true
Component.innerFocusWidth 0.5
Component.innerOutlineWidth 1.0
Component.linkColor #2470b3 javax.swing.plaf.ColorUIResource [UI]
Component.minimumWidth 64
Component.warning.borderColor #fed284 javax.swing.plaf.ColorUIResource [UI]
Component.warning.focusedBorderColor #e2a53a javax.swing.plaf.ColorUIResource [UI]
#---- DatePicker ----
@@ -311,10 +317,10 @@ HelpButton.disabledBorderColor #bdbdbd javax.swing.plaf.ColorUIResource [UI]
HelpButton.disabledQuestionMarkColor #ababab javax.swing.plaf.ColorUIResource [UI]
HelpButton.focusedBackground #e3f1fa javax.swing.plaf.ColorUIResource [UI]
HelpButton.focusedBorderColor #7b9fc7 javax.swing.plaf.ColorUIResource [UI]
HelpButton.hoverBackground #f7f7f7 com.formdev.flatlaf.util.DerivedColor [UI]
HelpButton.hoverBackground #f7f7f7 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse)
HelpButton.hoverBorderColor #7b9fc7 javax.swing.plaf.ColorUIResource [UI]
HelpButton.icon [lazy] 22,22 com.formdev.flatlaf.icons.FlatHelpButtonIcon [UI]
HelpButton.pressedBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI]
HelpButton.pressedBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
HelpButton.questionMarkColor #4f9ee3 javax.swing.plaf.ColorUIResource [UI]
@@ -329,6 +335,8 @@ HyperlinkUI com.formdev.flatlaf.swingx.ui.FlatHyperlinkUI
#---- InternalFrame ----
InternalFrame.activeBorderColor #919191 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.activeDropShadowInsets 5,5,6,6 javax.swing.plaf.InsetsUIResource [UI]
InternalFrame.activeDropShadowOpacity 0.25
InternalFrame.activeTitleBackground #ffffff javax.swing.plaf.ColorUIResource [UI]
InternalFrame.activeTitleForeground #000000 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.border [lazy] 6,6,6,6 false com.formdev.flatlaf.ui.FlatInternalFrameUI$FlatInternalFrameBorder [UI]
@@ -339,17 +347,20 @@ InternalFrame.borderLight #e3e3e3 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.borderLineWidth 1
InternalFrame.borderMargins 6,6,6,6 javax.swing.plaf.InsetsUIResource [UI]
InternalFrame.borderShadow #c4c4c4 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.buttonHoverBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI]
InternalFrame.buttonPressedBackground #cccccc com.formdev.flatlaf.util.DerivedColor [UI]
InternalFrame.buttonHoverBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
InternalFrame.buttonPressedBackground #cccccc com.formdev.flatlaf.util.DerivedColor [UI] darken(20% autoInverse)
InternalFrame.buttonSize 24,24 javax.swing.plaf.DimensionUIResource [UI]
InternalFrame.closeHoverBackground [lazy] #db5860 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.closeHoverForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
InternalFrame.closeIcon [lazy] 24,24 com.formdev.flatlaf.icons.FlatInternalFrameCloseIcon [UI]
InternalFrame.closePressedBackground [lazy] #d22e38 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.closePressedForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
InternalFrame.dropShadowPainted true
InternalFrame.icon [lazy] 16,16 sun.swing.ImageIconUIResource [UI] (sun.awt.image.ToolkitImage)
InternalFrame.iconifyIcon [lazy] 24,24 com.formdev.flatlaf.icons.FlatInternalFrameIconifyIcon [UI]
InternalFrame.inactiveBorderColor #c4c4c4 javax.swing.plaf.ColorUIResource [UI]
InternalFrame.inactiveDropShadowInsets 3,3,4,4 javax.swing.plaf.InsetsUIResource [UI]
InternalFrame.inactiveDropShadowOpacity 0.5
InternalFrame.inactiveTitleBackground #fafafa javax.swing.plaf.ColorUIResource [UI]
InternalFrame.inactiveTitleForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
InternalFrame.maximizeIcon [lazy] 24,24 com.formdev.flatlaf.icons.FlatInternalFrameMaximizeIcon [UI]
@@ -630,6 +641,14 @@ PasswordField.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [U
PasswordFieldUI com.formdev.flatlaf.ui.FlatPasswordFieldUI
#---- Popup ----
Popup.dropShadowColor #000000 javax.swing.plaf.ColorUIResource [UI]
Popup.dropShadowInsets -4,-4,4,4 javax.swing.plaf.InsetsUIResource [UI]
Popup.dropShadowOpacity 0.15
Popup.dropShadowPainted true
#---- PopupMenu ----
PopupMenu.background #ffffff javax.swing.plaf.ColorUIResource [UI]
@@ -792,7 +811,7 @@ Slider.font [active] $defaultFont [UI]
Slider.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
Slider.highlight #ffffff javax.swing.plaf.ColorUIResource [UI]
Slider.horizontalSize 200,21 java.awt.Dimension
Slider.hoverColor #949494 com.formdev.flatlaf.util.DerivedColor [UI]
Slider.hoverColor #949494 com.formdev.flatlaf.util.DerivedColor [UI] lighten(15% autoInverse)
Slider.minimumHorizontalSize 36,21 java.awt.Dimension
Slider.minimumVerticalSize 21,36 java.awt.Dimension
Slider.onlyLeftMouseButtonDrag true
@@ -1031,7 +1050,7 @@ TitledPanelUI com.formdev.flatlaf.swingx.ui.FlatTitledPanelUI
ToggleButton.background #ffffff javax.swing.plaf.ColorUIResource [UI]
ToggleButton.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatButtonBorder [UI]
ToggleButton.darkShadow #9e9e9e javax.swing.plaf.ColorUIResource [UI]
ToggleButton.disabledSelectedBackground #dedede com.formdev.flatlaf.util.DerivedColor [UI]
ToggleButton.disabledSelectedBackground #dedede com.formdev.flatlaf.util.DerivedColor [UI] darken(13% autoInverse)
ToggleButton.disabledText #8c8c8c javax.swing.plaf.ColorUIResource [UI]
ToggleButton.font [active] $defaultFont [UI]
ToggleButton.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
@@ -1039,9 +1058,9 @@ ToggleButton.highlight #ffffff javax.swing.plaf.ColorUIResource [UI]
ToggleButton.iconTextGap 4
ToggleButton.light #e3e3e3 javax.swing.plaf.ColorUIResource [UI]
ToggleButton.margin 2,14,2,14 javax.swing.plaf.InsetsUIResource [UI]
ToggleButton.pressedBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI]
ToggleButton.pressedBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
ToggleButton.rollover true
ToggleButton.selectedBackground #cccccc com.formdev.flatlaf.util.DerivedColor [UI]
ToggleButton.selectedBackground #cccccc com.formdev.flatlaf.util.DerivedColor [UI] darken(20% autoInverse)
ToggleButton.selectedForeground #000000 javax.swing.plaf.ColorUIResource [UI]
ToggleButton.shadow #c4c4c4 javax.swing.plaf.ColorUIResource [UI]
ToggleButton.tab.disabledUnderlineColor #ababab javax.swing.plaf.ColorUIResource [UI]
@@ -1051,9 +1070,9 @@ ToggleButton.tab.underlineColor #4083c9 javax.swing.plaf.ColorUIResource [UI]
ToggleButton.tab.underlineHeight 2
ToggleButton.textIconGap 4
ToggleButton.textShiftOffset 0
ToggleButton.toolbar.hoverBackground #e0e0e0 com.formdev.flatlaf.util.DerivedColor [UI]
ToggleButton.toolbar.pressedBackground #d9d9d9 com.formdev.flatlaf.util.DerivedColor [UI]
ToggleButton.toolbar.selectedBackground #cccccc com.formdev.flatlaf.util.DerivedColor [UI]
ToggleButton.toolbar.hoverBackground #e0e0e0 com.formdev.flatlaf.util.DerivedColor [UI] darken(12% autoInverse)
ToggleButton.toolbar.pressedBackground #d9d9d9 com.formdev.flatlaf.util.DerivedColor [UI] darken(15% autoInverse)
ToggleButton.toolbar.selectedBackground #cccccc com.formdev.flatlaf.util.DerivedColor [UI] darken(20% autoInverse)
ToggleButtonUI com.formdev.flatlaf.ui.FlatToggleButtonUI
@@ -1187,6 +1206,15 @@ inactiveCaptionBorder #bfcddb javax.swing.plaf.ColorUIResource [UI]
inactiveCaptionText #000000 javax.swing.plaf.ColorUIResource [UI]
info #fafafa javax.swing.plaf.ColorUIResource [UI]
infoText #000000 javax.swing.plaf.ColorUIResource [UI]
#---- laf ----
laf.scaleFactor [active] 1.0
#---- ----
menu #f2f2f2 javax.swing.plaf.ColorUIResource [UI]
menuText #000000 javax.swing.plaf.ColorUIResource [UI]
scrollbar #f5f5f5 javax.swing.plaf.ColorUIResource [UI]

View File

@@ -1,6 +1,6 @@
Class com.formdev.flatlaf.FlatLightLaf
ID FlatLaf - Flat Light
Name Flat Light
ID FlatLaf - FlatLaf Light
Name FlatLaf Light
Java 1.8.0_202
OS Mac OS X

View File

@@ -1,6 +1,6 @@
Class com.formdev.flatlaf.FlatLightLaf
ID FlatLaf - Flat Light
Name Flat Light
ID FlatLaf - FlatLaf Light
Name FlatLaf Light
Java 1.8.0_202
OS Windows 10

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.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

2
gradlew vendored
View File

@@ -82,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
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

4
gradlew.bat vendored
View File

@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@@ -81,6 +84,7 @@ set CMD_LINE_ARGS=%*
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

View File

@@ -27,6 +27,7 @@ include( "flatlaf-theme-editor" )
pluginManagement {
plugins {
// NOTE: keep plugin versions in sync with buildSrc/build.gradle.kts
id( "com.jfrog.bintray" ) version "1.8.4"
id( "com.jfrog.artifactory" ) version "4.13.0"
}