Compare commits

..

56 Commits

Author SHA1 Message Date
Karl Tauber
efd8cf8236 release 2.0-rc1 2021-12-18 14:09:39 +01:00
Karl Tauber
8dbfc6d5d6 README.md: dark screenshots re-updated for v2 (using black background to avoid that light background shines through window border) 2021-12-16 14:53:29 +01:00
Karl Tauber
ef343397d4 README.md: screenshots updated for v2 2021-12-16 11:42:25 +01:00
Karl Tauber
cae02d31db IntelliJ Themes: updated themes to newest versions (used IJThemesUpdater) 2021-12-16 00:51:03 +01:00
Karl Tauber
96c78cbc16 ComboBox: fixed wrong popup border when using in theme editor preview 2021-12-15 23:39:16 +01:00
Karl Tauber
f8c769644d SwingX: fixed NullPointerException in FlatCaret when using org.jdesktop.swingx.prompt.PromptSupport.setPrompt() on a text field and then switching theme 2021-12-15 11:37:35 +01:00
Karl Tauber
0bd1e413b0 Native window decorations: fixed UnsatisfiedLinkError on Windows 11 for ARM processors (issue #443) 2021-12-15 00:49:08 +01:00
Karl Tauber
07c9ad484a MenuBar: do not fill background if non-opaque and having custom background color (issue #409) 2021-12-15 00:29:37 +01:00
Karl Tauber
5fd5b1206e InternalFrame: fill background to avoid that parent may shine through internal frame if it contains non-opaque components (better fix for issue #274) 2021-12-15 00:27:20 +01:00
Karl Tauber
8e107647bd Merge PR #442: TextField clear button and PasswordField reveal password button 2021-12-14 11:35:44 +01:00
Karl Tauber
12b7389376 TextField: added "clear" callback 2021-12-14 11:28:03 +01:00
Karl Tauber
45332c8126 TextField: added "clear" button to theme editor find/replace and to UI defaults inspector 2021-12-14 10:42:07 +01:00
Karl Tauber
02a9d4e31d PasswordField: support "reveal" button to show password (issue #173) 2021-12-14 01:09:21 +01:00
Karl Tauber
a4377e81cb TextField: support "clear" (or "cancel") button to empty text field 2021-12-13 22:10:21 +01:00
Karl Tauber
8d2ed3faf6 Merge PR #386: TextField: leading and trailing components 2021-12-13 17:50:38 +01:00
Karl Tauber
e7dacb8fef Unit tests: (temporary) disable testing scaled UI until it is clear why it fails now on GitHub Actions (but worked yesterday) 2021-12-13 17:45:46 +01:00
Karl Tauber
60e2ffac5f Demo: added text field leading/trailing components example 2021-12-13 17:27:36 +01:00
Karl Tauber
73c37b2018 Search/clear icons: option to ignore button state (hover/pressed) for usage where button background changes color on hover/pressed 2021-12-13 00:47:23 +01:00
Karl Tauber
1b3cc223da TextField: added styles for buttons and toolbars in leading and trailing components (smaller margins/insets, better hover/pressed/selected colors) 2021-12-12 18:43:29 +01:00
Karl Tauber
51be7ad832 TextField: require JComponent for leading and trailing components (to allow setting a style class client property) 2021-12-12 00:50:56 +01:00
Karl Tauber
f93d035e4e TextField: support leading and trailing components 2021-12-11 14:29:56 +01:00
Karl Tauber
a3885d7a48 Theme Editor: Preview: minor tweeks 2021-12-11 14:13:56 +01:00
Karl Tauber
bbf2331766 ComboBox and Spinner: made buttonBackground optional 2021-12-11 12:19:10 +01:00
Karl Tauber
2164bd363b Styling: MenuItem: support styling acceleratorFont
Theme Editor:
- support font keys in auto-completion
- ignore Menu.acceleratorFont, CheckBoxMenuItem.acceleratorFont and RadioButtonMenuItem.acceleratorFont because they are never used (keep UI values for backward compatibility)
2021-12-11 11:39:31 +01:00
Karl Tauber
6205e18c45 Styling: FlatMenuItemArrowIcon no longer extends FlatMenuArrowIcon because it does not paint anything and therefore should not inherit styling properties from FlatMenuArrowIcon 2021-12-11 01:06:23 +01:00
Karl Tauber
959b3e46fa Styling: fixes and added missing @since tags 2021-12-11 00:50:05 +01:00
Karl Tauber
09d8d09aad Theme Editor: Preview: support usage of variables in styles 2021-12-10 23:14:19 +01:00
Karl Tauber
70336e31c7 Theme Editor: update RSyntaxTextArea from 3.1.3 to 3.1.4 2021-12-10 22:44:24 +01:00
Karl Tauber
600e0f3d67 Panel: support painting background with rounded corners (issue #367)
FlatLineBorder: support rounded corners
2021-12-10 22:40:17 +01:00
Karl Tauber
023e356057 MenuItem: vertically align text if icons have different widths (issue #437) 2021-12-08 11:45:17 +01:00
Karl Tauber
27786ec00a UI defaults dumps updated for commits 269eb0ba29, c9a38f0a13 and dd3ffc64b9 2021-12-08 00:53:21 +01:00
Karl Tauber
e52e72c5a8 Merge PR #415: MenuItem: paint the selected icon when the item is selected 2021-12-07 22:52:25 +01:00
Karl Tauber
802dd08ce7 MenuItem: use isArmedOrSelected() instead of MenuSelectionManager to detect selected item 2021-12-07 22:46:39 +01:00
Karl Tauber
568ec5a1a2 added Jailer version number that first uses FlatLaf; reformatting 2021-12-07 19:46:03 +01:00
Karl Tauber
035d196392 Merge PR #440: Added Jailer to Applications using FlatLaf 2021-12-07 19:45:16 +01:00
Karl Tauber
dd3ffc64b9 SwingX: improved dark/light colors "column control" icon for JXTable (issue #434) 2021-12-07 18:10:09 +01:00
Karl Tauber
c9a38f0a13 SwingX: new "column control" icon for JXTable that scales and uses antialiasing (issue #434) 2021-12-07 17:45:25 +01:00
Wisser
78461a9d5a added Jailer to Applications using FlatLaf 2021-12-07 17:44:00 +01:00
Wisser
79b8fb910a added Jailer to Applications using FlatLaf 2021-12-07 17:39:52 +01:00
Karl Tauber
405e3df1f0 Merge remote-tracking branch 'origin/develop-1.x' into main
# Conflicts:
#	CHANGELOG.md
2021-12-07 16:05:31 +01:00
Karl Tauber
f7126d154f Window decorations: left indent was lost when icon is hidden and switching Laf (regression in commit 005c9f471e6bc3ea5d708a08e8fb0b087b2c3382; PR #429) 2021-12-07 16:00:38 +01:00
Karl Tauber
d8df8c9631 release 1.6.5 2021-12-07 15:05:13 +01:00
Karl Tauber
37b35f9063 updated svgSalamander to version 1.1.3 2021-12-07 14:34:39 +01:00
Karl Tauber
f61a7288eb fixed updating (embedded) menu bar layout when window is narrow and changing TitlePane.menuBarEmbedded 2021-12-07 11:52:33 +01:00
Karl Tauber
47a1122f04 Window decorations: do not exit application with UnsatisfiedLinkError in case that FlatLaf DLL cannot be executed because of restrictions on temporary directory (issue #436) 2021-12-07 00:39:28 +01:00
Karl Tauber
e1bfabbce5 macOS: fixed NullPointerException when using AWT component java.awt.Choice (issue #439) 2021-12-06 22:45:24 +01:00
Karl Tauber
9708fec0e0 GitHub Actions: produce snapshots only on develop-* branches; change version to 1.6.5-SNAPSHOT 2021-12-06 17:27:49 +01:00
Karl Tauber
7f4efaf0a3 ComboBox: fixed occasional StackOverflowError when modifying combo box not on AWT thread (issue #432) 2021-12-06 17:15:37 +01:00
Karl Tauber
269eb0ba29 MenuItem: changed accelerator delimiter from - to + (Windows and Linux) 2021-12-04 12:15:53 +01:00
Karl Tauber
428c6b7813 Styling: comment fixes 2021-11-30 18:37:03 +01:00
Karl Tauber
db2452a4ec Styling: support Panel 2021-11-30 18:36:48 +01:00
Karl Tauber
7dac3825d7 Linux: Fixed font problems when running on Oracle Java 8 (OpenJDK 8 is not affected):
- oversized text if system font is "Inter" (issue #427)
- missing text if system font is "Cantarell" (on Fedora)
2021-11-24 10:47:58 +01:00
Karl Tauber
7c99872278 Typography:
- fixed semibold font on Ubuntu
- use font "Montserrat SemiBold" on Fedora

(PR #396)
2021-11-24 10:37:48 +01:00
Karl Tauber
64c7318cfc README.md: added PDF Studio to applications using FlatLaf (#422, #430) 2021-11-23 17:07:19 +01:00
Karl Tauber
a9d6483829 removed accidentally committed log 2021-11-23 16:46:53 +01:00
Emmanuel Bourg
6b880af447 MenuItem: paint the selected icon when the item is selected 2021-11-03 18:10:13 +01:00
179 changed files with 30327 additions and 29226 deletions

View File

@@ -73,7 +73,7 @@ jobs:
needs: build needs: build
if: | if: |
github.event_name == 'push' && github.event_name == 'push' &&
github.ref == 'refs/heads/main' && (github.ref == 'refs/heads/main' || startsWith( github.ref, 'refs/heads/develop-' )) &&
github.repository == 'JFormDesigner/FlatLaf' github.repository == 'JFormDesigner/FlatLaf'
steps: steps:

View File

@@ -1,7 +1,7 @@
FlatLaf Change Log FlatLaf Change Log
================== ==================
## 2.0-SNAPSHOT ## 2.0-rc1
#### New features and improvements #### New features and improvements
@@ -28,9 +28,18 @@ FlatLaf Change Log
setting UI default `OptionPane.showIcon` to `true`. (issue #416) setting UI default `OptionPane.showIcon` to `true`. (issue #416)
- No longer show the Java "duke/cup" icon if no window icon image is set. - No longer show the Java "duke/cup" icon if no window icon image is set.
(issue #416) (issue #416)
- TextField, FormattedTextField and PasswordField: Support leading and trailing - TextField, FormattedTextField and PasswordField:
icons (set client property `JTextField.leadingIcon` or - Support leading and trailing icons (set client property
`JTextField.trailingIcon` to an `Icon`). (PR #378; issue #368) `JTextField.leadingIcon` or `JTextField.trailingIcon` to a
`javax.swing.Icon`). (PR #378; issue #368)
- Support leading and trailing components (set client property
`JTextField.leadingComponent` or `JTextField.trailingComponent` to a
`java.awt.Component`). (PR #386)
- Support "clear" (or "cancel") button to empty text field. Only shown if text
field is not empty, editable and enabled. (set client property
`JTextField.showClearButton` to `true`). (PR #442)
- PasswordField: Support reveal (or "eye") button to show password. (see UI
value `PasswordField.showRevealButton`) (PR #442; issue #173)
- TextComponents: Double/triple-click-and-drag now extends selection by whole - TextComponents: Double/triple-click-and-drag now extends selection by whole
words/lines. words/lines.
- Theming improvements: Reworks core themes to make it easier to create new - Theming improvements: Reworks core themes to make it easier to create new
@@ -61,6 +70,10 @@ FlatLaf Change Log
- Slider: Support specifying width of thumb border (see UI value - Slider: Support specifying width of thumb border (see UI value
`Slider.thumbBorderWidth`). `Slider.thumbBorderWidth`).
- TabbedPane: Optionally paint selected tab as card. (PR #343) - TabbedPane: Optionally paint selected tab as card. (PR #343)
- MenuItem:
- Paint the selected icon when the item is selected. (PR #415)
- Vertically align text if icons have different widths. (issue #437)
- Panel: Support painting background with rounded corners. (issue #367)
- Added more color functions to class `ColorFunctions` for easy use in - Added more color functions to class `ColorFunctions` for easy use in
applications: `lighten()`, `darken()`, `saturate()`, `desaturate()`, `spin()`, applications: `lighten()`, `darken()`, `saturate()`, `desaturate()`, `spin()`,
`tint()`, `shade()` and `luma()`. `tint()`, `shade()` and `luma()`.
@@ -73,6 +86,40 @@ FlatLaf Change Log
- `FlatSVGIcon`: Support loading SVG from `URL` (for JPMS), `URI`, `File` or - `FlatSVGIcon`: Support loading SVG from `URL` (for JPMS), `URI`, `File` or
`InputStream`. (issues #419 and #325) `InputStream`. (issues #419 and #325)
- `FlatSVGUtils`: Support loading SVG from `URL` (for JPMS). (issue #325) - `FlatSVGUtils`: Support loading SVG from `URL` (for JPMS). (issue #325)
- SwingX:
- New "column control" icon for `JXTable` that scales and uses antialiasing.
(issue #434)
#### Fixed bugs
- Native window decorations: Fixed `UnsatisfiedLinkError` on Windows 11 for ARM
processors. (issue #443)
- MenuBar: Do not fill background if non-opaque and having custom background
color. (issue #409)
- InternalFrame: Fill background to avoid that parent may shine through internal
frame if it contains non-opaque components. (better fix for issue #274)
- SwingX: Fixed `NullPointerException` in `FlatCaret` when using
`org.jdesktop.swingx.prompt.PromptSupport.setPrompt()` on a text field and
then switching theme.
## 1.6.5
#### Fixed bugs
- Linux: Fixed font problems when running on Oracle Java (OpenJDK is not
affected):
- oversized text if system font is "Inter" (issue #427)
- missing text if system font is "Cantarell" (on Fedora)
- MenuItem: Changed accelerator delimiter from `-` to `+`. (Windows and Linux).
- ComboBox: Fixed occasional `StackOverflowError` when modifying combo box not
on AWT thread. (issue #432)
- macOS: Fixed `NullPointerException` when using AWT component
`java.awt.Choice`. (issue #439)
- Native window decorations: Do not exit application with `UnsatisfiedLinkError`
in case that FlatLaf DLL cannot be executed because of restrictions on
temporary directory. Instead, continue with default window decorations. (issue
#436)
## 1.6.4 ## 1.6.4

View File

@@ -114,6 +114,8 @@ Buzz
Applications using FlatLaf Applications using FlatLaf
-------------------------- --------------------------
- ![New](images/new.svg) [Jailer](https://github.com/Wisser/Jailer) 11.2 -
database subsetting and relational data browsing tool
- [Apache NetBeans](https://netbeans.apache.org/) 11.3 - IDE for Java, PHP, HTML - [Apache NetBeans](https://netbeans.apache.org/) 11.3 - IDE for Java, PHP, HTML
and much more and much more
- [jclasslib bytecode viewer](https://github.com/ingokegel/jclasslib) 5.5 - [jclasslib bytecode viewer](https://github.com/ingokegel/jclasslib) 5.5
@@ -141,6 +143,8 @@ Applications using FlatLaf
[OpenStreetMap](https://www.openstreetmap.org/) (requires FlatLaf JOSM plugin) [OpenStreetMap](https://www.openstreetmap.org/) (requires FlatLaf JOSM plugin)
- [jAlbum](https://jalbum.net/) 21 (**commercial**) - creates photo album - [jAlbum](https://jalbum.net/) 21 (**commercial**) - creates photo album
websites websites
- ![New](images/new.svg) [PDF Studio](https://www.qoppa.com/pdfstudio/) 2021
(**commercial**) - create, review and edit PDF documents
- [XMLmind XML Editor](https://www.xmlmind.com/xmleditor/) 9.3 (**commercial**) - [XMLmind XML Editor](https://www.xmlmind.com/xmleditor/) 9.3 (**commercial**)
- [Total Validator](https://www.totalvalidator.com/) 15 (**commercial**) - - [Total Validator](https://www.totalvalidator.com/) 15 (**commercial**) -
checks your website checks your website
@@ -173,7 +177,7 @@ Applications using FlatLaf
systems development platform systems development platform
- [JPass](https://github.com/gaborbata/jpass) - password manager with strong - [JPass](https://github.com/gaborbata/jpass) - password manager with strong
encryption encryption
- [Jes - Die Java-EÜR](https://www.jes-eur.de) - [Jes - Die Java-EÜR](https://www.jes-eur.de)
- [Mapton](https://mapton.org/) 2.0 - [Mapton](https://mapton.org/) 2.0
([source code](https://github.com/trixon/mapton)) - some kind of map ([source code](https://github.com/trixon/mapton)) - some kind of map
application (based on NetBeans platform) application (based on NetBeans platform)

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -763,9 +763,9 @@ public interface FlatClientProperties
/** /**
* Specifies a component that will be placed at the leading edge of the tabs area. * Specifies a component that will be placed at the leading edge of the tabs area.
* <p> * <p>
* For top and bottom tab placement, the layed out component size will be * For top and bottom tab placement, the laid out component size will be
* the preferred component width and the tab area height.<br> * the preferred component width and the tab area height.<br>
* For left and right tab placement, the layed out component size will be * For left and right tab placement, the laid out component size will be
* the tab area width and the preferred component height. * the tab area width and the preferred component height.
* <p> * <p>
* <strong>Component</strong> {@link javax.swing.JTabbedPane}<br> * <strong>Component</strong> {@link javax.swing.JTabbedPane}<br>
@@ -776,9 +776,9 @@ public interface FlatClientProperties
/** /**
* Specifies a component that will be placed at the trailing edge of the tabs area. * Specifies a component that will be placed at the trailing edge of the tabs area.
* <p> * <p>
* For top and bottom tab placement, the layed out component size will be * For top and bottom tab placement, the laid out component size will be
* the available horizontal space (minimum is preferred component width) and the tab area height.<br> * the available horizontal space (minimum is preferred component width) and the tab area height.<br>
* For left and right tab placement, the layed out component size will be * For left and right tab placement, the laid out component size will be
* the tab area width and the available vertical space (minimum is preferred component height). * the tab area width and the available vertical space (minimum is preferred component height).
* <p> * <p>
* <strong>Component</strong> {@link javax.swing.JTabbedPane}<br> * <strong>Component</strong> {@link javax.swing.JTabbedPane}<br>
@@ -863,6 +863,87 @@ public interface FlatClientProperties
*/ */
String TEXT_FIELD_TRAILING_ICON = "JTextField.trailingIcon"; String TEXT_FIELD_TRAILING_ICON = "JTextField.trailingIcon";
/**
* Specifies a component that will be placed at the leading edge of the text field.
* <p>
* The component will be positioned inside and aligned to the visible text field border.
* There is no gap between the visible border and the component.
* The laid out component size will be the preferred component width
* and the inner text field height.
* <p>
* The component should be not opaque because the text field border is painted
* slightly inside the usually visible border in some cases.
* E.g. when focused (in some themes) or when an outline color is specified
* (see {@link #OUTLINE}.
* <p>
* <strong>Component</strong> {@link javax.swing.JTextField} (and subclasses)<br>
* <strong>Value type</strong> {@link javax.swing.JComponent}
*
* @since 2
*/
String TEXT_FIELD_LEADING_COMPONENT = "JTextField.leadingComponent";
/**
* Specifies a component that will be placed at the trailing edge of the text field.
* <p>
* The component will be positioned inside and aligned to the visible text field border.
* There is no gap between the visible border and the component.
* The laid out component size will be the preferred component width
* and the inner text field height.
* <p>
* The component should be not opaque because the text field border is painted
* slightly inside the usually visible border in some cases.
* E.g. when focused (in some themes) or when an outline color is specified
* (see {@link #OUTLINE}.
* <p>
* <strong>Component</strong> {@link javax.swing.JTextField} (and subclasses)<br>
* <strong>Value type</strong> {@link javax.swing.JComponent}
*
* @since 2
*/
String TEXT_FIELD_TRAILING_COMPONENT = "JTextField.trailingComponent";
/**
* Specifies whether a "clear" (or "cancel") button is shown on the trailing side
* if the text field is not empty, editable and enabled. Default is {@code false}.
* <p>
* <strong>Component</strong> {@link javax.swing.JTextField} (and subclasses)<br>
* <strong>Value type</strong> {@link java.lang.Boolean}
*
* @since 2
*/
String TEXT_FIELD_SHOW_CLEAR_BUTTON = "JTextField.showClearButton";
/**
* Specifies the callback that is invoked when a "clear" (or "cancel") button is clicked.
* If a callback is specified than it is responsible for clearing the text field.
* Without callback, the text field clears itself.
* <p>
* Either use a {@link java.lang.Runnable}:
* <pre>{@code
* myTextField.putClientProperty( "JTextField.clearCallback",
* (Runnable) () -> {
* // clear field here or cancel search
* } );
* }</pre>
* Or use a {@link java.util.function.Consumer}&lt;javax.swing.text.JTextComponent&gt;
* that receives the text field as parameter:
* <pre>{@code
* myTextField.putClientProperty( "JTextField.clearCallback",
* (Consumer<JTextComponent>) textField -> {
* // clear field here or cancel search
* } );
* }</pre>
* <p>
* <strong>Component</strong> {@link javax.swing.JTextField} (and subclasses)<br>
* <strong>Value type</strong> {@link java.lang.Runnable}
* or {@link java.util.function.Consumer}&lt;javax.swing.text.JTextComponent&gt;
*
* @see #TEXT_FIELD_SHOW_CLEAR_BUTTON
* @since 2
*/
String TEXT_FIELD_CLEAR_CALLBACK = "JTextField.clearCallback";
//---- JToggleButton ------------------------------------------------------ //---- JToggleButton ------------------------------------------------------
/** /**

View File

@@ -52,6 +52,7 @@ import javax.swing.ImageIcon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.LookAndFeel; import javax.swing.LookAndFeel;
import javax.swing.PopupFactory; import javax.swing.PopupFactory;
import javax.swing.RootPaneContainer; import javax.swing.RootPaneContainer;
@@ -1036,12 +1037,23 @@ public abstract class FlatLaf
/** /**
* Revalidate and repaint all displayable frames and dialogs. * Revalidate and repaint all displayable frames and dialogs.
* <p>
* Useful to update UI after changing {@code TitlePane.menuBarEmbedded}.
* *
* @since 1.1.2 * @since 1.1.2
*/ */
public static void revalidateAndRepaintAllFramesAndDialogs() { public static void revalidateAndRepaintAllFramesAndDialogs() {
for( Window w : Window.getWindows() ) { for( Window w : Window.getWindows() ) {
if( isDisplayableFrameOrDialog( w ) ) { if( isDisplayableFrameOrDialog( w ) ) {
// revalidate menu bar
JMenuBar menuBar = (w instanceof JFrame)
? ((JFrame)w).getJMenuBar()
: (w instanceof JDialog
? ((JDialog)w).getJMenuBar()
: null);
if( menuBar != null )
menuBar.revalidate();
w.revalidate(); w.revalidate();
w.repaint(); w.repaint();
} }
@@ -1050,6 +1062,9 @@ public abstract class FlatLaf
/** /**
* Repaint all displayable frames and dialogs. * Repaint all displayable frames and dialogs.
* <p>
* Useful to update UI after changing {@code TitlePane.unifiedBackground},
* {@code MenuItem.selectionType} or {@code Component.hideMnemonics}.
* *
* @since 1.1.2 * @since 1.1.2
*/ */
@@ -1324,9 +1339,19 @@ public abstract class FlatLaf
} }
// derive font // derive font
if( newStyle != baseStyle || newSize != baseSize ) if( newStyle != baseStyle || newSize != baseSize ) {
// hack for font "Ubuntu Medium" on Linux, which curiously belongs
// to family "Ubuntu Light" and using deriveFont() would create a light font
if( "Ubuntu Medium".equalsIgnoreCase( baseFont.getName() ) &&
"Ubuntu Light".equalsIgnoreCase( baseFont.getFamily() ) )
{
Font font = createCompositeFont( "Ubuntu Medium", newStyle, newSize );
if( !isFallbackFont( font ) )
return toUIResource( font );
}
return toUIResource( baseFont.deriveFont( newStyle, newSize ) ); return toUIResource( baseFont.deriveFont( newStyle, newSize ) );
else } else
return toUIResource( baseFont ); return toUIResource( baseFont );
} }

View File

@@ -17,6 +17,7 @@
package com.formdev.flatlaf; package com.formdev.flatlaf;
import java.awt.Font; import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.GraphicsConfiguration; import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
import java.awt.Toolkit; import java.awt.Toolkit;
@@ -28,7 +29,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import javax.swing.text.StyleContext;
import com.formdev.flatlaf.util.LoggingFacade; import com.formdev.flatlaf.util.LoggingFacade;
import com.formdev.flatlaf.util.StringUtils; import com.formdev.flatlaf.util.StringUtils;
import com.formdev.flatlaf.util.SystemInfo; import com.formdev.flatlaf.util.SystemInfo;
@@ -121,14 +122,25 @@ class LinuxFontPolicy
for(;;) { for(;;) {
Font font = createFont( family, style, size, dsize ); Font font = createFont( family, style, size, dsize );
// if the font family does not match any font on the system, "Dialog" family is returned if( Font.DIALOG.equals( family ) )
if( !"Dialog".equals( font.getFamily() ) || "Dialog".equals( family ) )
return font; return font;
// if the font family does not match any font on the system, "Dialog" family is returned
if( !Font.DIALOG.equals( font.getFamily() ) ) {
// check for font problems
// - font height much larger than expected (e.g. font Inter; Oracle Java 8)
// - character width is zero (e.g. font Cantarell; Fedora; Oracle Java 8)
FontMetrics fm = StyleContext.getDefaultStyleContext().getFontMetrics( font );
if( fm.getHeight() > size * 2 || fm.stringWidth( "a" ) == 0 )
return createFont( Font.DIALOG, style, size, dsize );
return font;
}
// find last word in family // find last word in family
int index = family.lastIndexOf( ' ' ); int index = family.lastIndexOf( ' ' );
if( index < 0 ) if( index < 0 )
return createFont( "Dialog", style, size, dsize ); return createFont( Font.DIALOG, style, size, dsize );
// check whether last work contains some font weight (e.g. Ultra-Bold or Heavy) // check whether last work contains some font weight (e.g. Ultra-Bold or Heavy)
String lastWord = family.substring( index + 1 ).toLowerCase(); String lastWord = family.substring( index + 1 ).toLowerCase();

View File

@@ -80,7 +80,7 @@ class UIDefaultsLoader
private static final String OPTIONAL_PREFIX = "?"; private static final String OPTIONAL_PREFIX = "?";
private static final String WILDCARD_PREFIX = "*."; private static final String WILDCARD_PREFIX = "*.";
private static final String KEY_VARIABLES = "FlatLaf.internal.variables"; static final String KEY_VARIABLES = "FlatLaf.internal.variables";
private static int parseColorDepth; private static int parseColorDepth;
@@ -364,6 +364,12 @@ class UIDefaultsLoader
if( resultValueType == null ) if( resultValueType == null )
resultValueType = tempResultValueType; resultValueType = tempResultValueType;
// do not parse styles here
if( key.startsWith( "[style]" ) ) {
resultValueType[0] = ValueType.STRING;
return value;
}
value = value.trim(); value = value.trim();
// null // null
@@ -582,17 +588,18 @@ class UIDefaultsLoader
private static Object parseBorder( String value, Function<String, String> resolver, List<ClassLoader> addonClassLoaders ) { private static Object parseBorder( String value, Function<String, String> resolver, List<ClassLoader> addonClassLoaders ) {
if( value.indexOf( ',' ) >= 0 ) { if( value.indexOf( ',' ) >= 0 ) {
// top,left,bottom,right[,lineColor[,lineThickness]] // top,left,bottom,right[,lineColor[,lineThickness[,arc]]]
List<String> parts = splitFunctionParams( value, ',' ); List<String> parts = splitFunctionParams( value, ',' );
Insets insets = parseInsets( value ); Insets insets = parseInsets( value );
ColorUIResource lineColor = (parts.size() >= 5) ColorUIResource lineColor = (parts.size() >= 5)
? (ColorUIResource) parseColorOrFunction( resolver.apply( parts.get( 4 ) ), resolver, true ) ? (ColorUIResource) parseColorOrFunction( resolver.apply( parts.get( 4 ) ), resolver, true )
: null; : null;
float lineThickness = (parts.size() >= 6) ? parseFloat( parts.get( 5 ), true ) : 1f; float lineThickness = (parts.size() >= 6 && !parts.get( 5 ).isEmpty()) ? parseFloat( parts.get( 5 ), true ) : 1f;
int arc = (parts.size() >= 7) ? parseInteger( parts.get( 6 ), true ) : 0;
return (LazyValue) t -> { return (LazyValue) t -> {
return (lineColor != null) return (lineColor != null)
? new FlatLineBorder( insets, lineColor, lineThickness ) ? new FlatLineBorder( insets, lineColor, lineThickness, arc )
: new FlatEmptyBorder( insets ); : new FlatEmptyBorder( insets );
}; };
} else } else

View File

@@ -69,13 +69,7 @@ public abstract class FlatAbstractIcon
} }
} }
/** protected abstract void paintIcon( Component c, Graphics2D g2 );
* Paint the icon at {@code [0,0]} location.
* <p>
* The given graphics context is scaled.
* Use unscaled coordinates, width and height for painting.
*/
protected abstract void paintIcon( Component c, Graphics2D g );
@Override @Override
public int getIconWidth() { public int getIconWidth() {

View File

@@ -21,7 +21,6 @@ import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import com.formdev.flatlaf.util.AnimatedIcon; import com.formdev.flatlaf.util.AnimatedIcon;
import com.formdev.flatlaf.util.AnimatedPainter;
/** /**
* Base class for animated icons that scales width and height, creates and initializes * Base class for animated icons that scales width and height, creates and initializes
@@ -31,7 +30,7 @@ import com.formdev.flatlaf.util.AnimatedPainter;
* <p> * <p>
* This class does not store any state information (needed for animation) in its instance. * This class does not store any state information (needed for animation) in its instance.
* Instead a client property is set on the painted component. * Instead a client property is set on the painted component.
* This makes it possible to use a shared icon instance for multiple components. * This makes it possible to use a share icon instance for multiple components.
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
@@ -46,34 +45,11 @@ public abstract class FlatAnimatedIcon
@Override @Override
public void paintIcon( Component c, Graphics g, int x, int y ) { public void paintIcon( Component c, Graphics g, int x, int y ) {
super.paintIcon( c, g, x, y ); super.paintIcon( c, g, x, y );
AnimatedPainter.saveRepaintLocation( this, c, x, y ); AnimatedIcon.AnimationSupport.saveIconLocation( this, c, x, y );
} }
@Override @Override
protected void paintIcon( Component c, Graphics2D g ) { protected void paintIcon( Component c, Graphics2D g ) {
paintWithAnimation( c, g, 0, 0, getIconWidth(), getIconHeight() ); AnimatedIcon.AnimationSupport.paintIcon( this, c, g, 0, 0 );
} }
/**
* Delegates painting to {@link #paintIconAnimated(Component, Graphics2D, float[])}.
* Ignores the given bounds because {@code [x,y]} are always {@code [0,0]} and
* {@code [width,height]} are scaled, but painting code should use unscaled width
* and height because given graphics context is scaled.
*
* @since 2
*/
@Override
public void paintAnimated( Component c, Graphics2D g, int x, int y, int width, int height, float[] animatedValues ) {
paintIconAnimated( c, g, animatedValues );
}
/**
* Paint the icon at {@code 0,0} location.
* <p>
* The given graphics context is scaled.
* Use unscaled coordinates, width and height for painting.
*
* @since 2
*/
protected abstract void paintIconAnimated( Component c, Graphics2D g, float[] animatedValues );
} }

View File

@@ -47,8 +47,16 @@ public class FlatClearIcon
@Styleable protected Color clearIconHoverColor = UIManager.getColor( "SearchField.clearIconHoverColor" ); @Styleable protected Color clearIconHoverColor = UIManager.getColor( "SearchField.clearIconHoverColor" );
@Styleable protected Color clearIconPressedColor = UIManager.getColor( "SearchField.clearIconPressedColor" ); @Styleable protected Color clearIconPressedColor = UIManager.getColor( "SearchField.clearIconPressedColor" );
private final boolean ignoreButtonState;
public FlatClearIcon() { public FlatClearIcon() {
this( false );
}
/** @since 2 */
public FlatClearIcon( boolean ignoreButtonState ) {
super( 16, 16, null ); super( 16, 16, null );
this.ignoreButtonState = ignoreButtonState;
} }
/** @since 2 */ /** @since 2 */
@@ -63,7 +71,7 @@ public class FlatClearIcon
@Override @Override
protected void paintIcon( Component c, Graphics2D g ) { protected void paintIcon( Component c, Graphics2D g ) {
if( c instanceof AbstractButton ) { if( !ignoreButtonState && c instanceof AbstractButton ) {
ButtonModel model = ((AbstractButton)c).getModel(); ButtonModel model = ((AbstractButton)c).getModel();
if( model.isPressed() || model.isRollover() ) { if( model.isPressed() || model.isRollover() ) {
/* /*

View File

@@ -21,14 +21,16 @@ import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
/** /**
* "arrow" icon for {@link javax.swing.JMenuItem}. * "arrow" icon for {@link javax.swing.JMenuItem}, {@link javax.swing.JCheckBoxMenuItem}
* and {@link javax.swing.JRadioButtonMenuItem}.
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatMenuItemArrowIcon public class FlatMenuItemArrowIcon
extends FlatMenuArrowIcon extends FlatAbstractIcon
{ {
public FlatMenuItemArrowIcon() { public FlatMenuItemArrowIcon() {
super( 6, 10, null );
} }
@Override @Override

View File

@@ -0,0 +1,56 @@
/*
* Copyright 2021 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formdev.flatlaf.icons;
import java.awt.Component;
import java.awt.Graphics2D;
import java.awt.geom.Area;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Path2D;
import java.awt.geom.Rectangle2D;
import javax.swing.UIManager;
/**
* "eye" icon for {@link javax.swing.JPasswordField}.
*
* @uiDefault PasswordField.revealIconColor Color
*
* @author Karl Tauber
* @since 2
*/
public class FlatRevealIcon
extends FlatAbstractIcon
{
public FlatRevealIcon() {
super( 16, 16, UIManager.getColor( "PasswordField.revealIconColor" ) );
}
@Override
protected void paintIcon( Component c, Graphics2D g ) {
Path2D path = new Path2D.Float( Path2D.WIND_EVEN_ODD );
path.append( new Ellipse2D.Float( 5.15f, 6.15f, 5.7f, 5.7f ), false );
path.append( new Ellipse2D.Float( 6, 7, 4, 4 ), false );
g.fill( path );
Path2D path2 = new Path2D.Float( Path2D.WIND_EVEN_ODD );
path2.append( new Ellipse2D.Float( 2.15f, 4.15f, 11.7f, 11.7f ), false );
path2.append( new Ellipse2D.Float( 3, 5, 10, 10 ), false );
Area area = new Area( path2 );
area.subtract( new Area( new Rectangle2D.Float( 0, 9.5f, 16, 16 ) ) );
g.fill( area );
}
}

View File

@@ -45,8 +45,16 @@ public class FlatSearchIcon
@Styleable protected Color searchIconHoverColor = UIManager.getColor( "SearchField.searchIconHoverColor" ); @Styleable protected Color searchIconHoverColor = UIManager.getColor( "SearchField.searchIconHoverColor" );
@Styleable protected Color searchIconPressedColor = UIManager.getColor( "SearchField.searchIconPressedColor" ); @Styleable protected Color searchIconPressedColor = UIManager.getColor( "SearchField.searchIconPressedColor" );
private final boolean ignoreButtonState;
public FlatSearchIcon() { public FlatSearchIcon() {
this( false );
}
/** @since 2 */
public FlatSearchIcon( boolean ignoreButtonState ) {
super( 16, 16, null ); super( 16, 16, null );
this.ignoreButtonState = ignoreButtonState;
} }
/** @since 2 */ /** @since 2 */
@@ -70,8 +78,10 @@ public class FlatSearchIcon
</svg> </svg>
*/ */
g.setColor( FlatButtonUI.buttonStateColor( c, searchIconColor, searchIconColor, g.setColor( ignoreButtonState
null, searchIconHoverColor, searchIconPressedColor ) ); ? searchIconColor
: FlatButtonUI.buttonStateColor( c, searchIconColor, searchIconColor,
null, searchIconHoverColor, searchIconPressedColor ) );
// paint magnifier // paint magnifier
Area area = new Area( new Ellipse2D.Float( 2, 2, 10, 10 ) ); Area area = new Area( new Ellipse2D.Float( 2, 2, 10, 10 ) );

View File

@@ -30,6 +30,12 @@ public class FlatSearchWithHistoryIcon
extends FlatSearchIcon extends FlatSearchIcon
{ {
public FlatSearchWithHistoryIcon() { public FlatSearchWithHistoryIcon() {
this( false );
}
/** @since 2 */
public FlatSearchWithHistoryIcon( boolean ignoreButtonState ) {
super( ignoreButtonState );
} }
@Override @Override

View File

@@ -263,7 +263,7 @@ public class FlatButtonUI
case STYLE_CLASS: case STYLE_CLASS:
if( shared && FlatStylingSupport.hasStyleProperty( b ) ) { if( shared && FlatStylingSupport.hasStyleProperty( b ) ) {
// unshare component UI if necessary // unshare component UI if necessary
// updateUI() invokes applyStyle() from installUI() // updateUI() invokes installStyle() from installUI()
b.updateUI(); b.updateUI();
} else } else
installStyle( b ); installStyle( b );

View File

@@ -101,6 +101,9 @@ public class FlatCaret
// adds selection highlights to the text component highlighter // adds selection highlights to the text component highlighter
if( isSelectionVisible() ) { if( isSelectionVisible() ) {
EventQueue.invokeLater( () -> { EventQueue.invokeLater( () -> {
if( getComponent() == null )
return; // was deinstalled
if( isSelectionVisible() ) { if( isSelectionVisible() ) {
setSelectionVisible( false ); setSelectionVisible( false );
setSelectionVisible( true ); setSelectionVisible( true );
@@ -253,6 +256,9 @@ public class FlatCaret
// select all // select all
if( c instanceof JFormattedTextField ) { if( c instanceof JFormattedTextField ) {
EventQueue.invokeLater( () -> { EventQueue.invokeLater( () -> {
if( getComponent() == null )
return; // was deinstalled
select( 0, doc.getLength() ); select( 0, doc.getLength() );
} ); } );
} else { } else {

View File

@@ -89,6 +89,7 @@ public class FlatCheckBoxMenuItemUI
protected void uninstallDefaults() { protected void uninstallDefaults() {
super.uninstallDefaults(); super.uninstallDefaults();
FlatMenuItemRenderer.clearClientProperties( menuItem.getParent() );
renderer = null; renderer = null;
oldStyleValues = null; oldStyleValues = null;
} }

View File

@@ -98,8 +98,8 @@ import com.formdev.flatlaf.util.SystemInfo;
* @uiDefault ComboBox.focusedBackground Color optional * @uiDefault ComboBox.focusedBackground Color optional
* @uiDefault ComboBox.disabledBackground Color * @uiDefault ComboBox.disabledBackground Color
* @uiDefault ComboBox.disabledForeground Color * @uiDefault ComboBox.disabledForeground Color
* @uiDefault ComboBox.buttonBackground Color * @uiDefault ComboBox.buttonBackground Color optional
* @uiDefault ComboBox.buttonEditableBackground Color * @uiDefault ComboBox.buttonEditableBackground Color optional
* @uiDefault ComboBox.buttonFocusedBackground Color optional; defaults to ComboBox.focusedBackground * @uiDefault ComboBox.buttonFocusedBackground Color optional; defaults to ComboBox.focusedBackground
* @uiDefault ComboBox.buttonSeparatorWidth int or float optional; defaults to Component.borderWidth * @uiDefault ComboBox.buttonSeparatorWidth int or float optional; defaults to Component.borderWidth
* @uiDefault ComboBox.buttonSeparatorColor Color optional * @uiDefault ComboBox.buttonSeparatorColor Color optional
@@ -281,7 +281,10 @@ public class FlatComboBoxUI
public void layoutContainer( Container parent ) { public void layoutContainer( Container parent ) {
super.layoutContainer( parent ); super.layoutContainer( parent );
if( arrowButton != null ) { // on macOS, a Swing combo box is used for AWT component java.awt.Choice
// and the font may be (temporary) null
if( arrowButton != null && comboBox.getFont() != null ) {
// limit button width to height of a raw combobox (without insets) // limit button width to height of a raw combobox (without insets)
FontMetrics fm = comboBox.getFontMetrics( comboBox.getFont() ); FontMetrics fm = comboBox.getFontMetrics( comboBox.getFont() );
int maxButtonWidth = fm.getHeight() + scale( padding.top ) + scale( padding.bottom ); int maxButtonWidth = fm.getHeight() + scale( padding.top ) + scale( padding.bottom );
@@ -540,24 +543,27 @@ public class FlatComboBoxUI
// paint arrow button background // paint arrow button background
if( enabled && !isCellRenderer ) { if( enabled && !isCellRenderer ) {
g2.setColor( paintButton Color buttonColor = paintButton
? buttonEditableBackground ? buttonEditableBackground
: (buttonFocusedBackground != null || focusedBackground != null) && isPermanentFocusOwner( comboBox ) : (buttonFocusedBackground != null || focusedBackground != null) && isPermanentFocusOwner( comboBox )
? (buttonFocusedBackground != null ? buttonFocusedBackground : focusedBackground) ? (buttonFocusedBackground != null ? buttonFocusedBackground : focusedBackground)
: buttonBackground ); : buttonBackground;
Shape oldClip = g2.getClip(); if( buttonColor != null ) {
if( isLeftToRight ) g2.setColor( buttonColor );
g2.clipRect( arrowX, 0, width - arrowX, height ); Shape oldClip = g2.getClip();
else if( isLeftToRight )
g2.clipRect( 0, 0, arrowX + arrowWidth, height ); g2.clipRect( arrowX, 0, width - arrowX, height );
FlatUIUtils.paintComponentBackground( g2, 0, 0, width, height, focusWidth, arc ); else
g2.setClip( oldClip ); g2.clipRect( 0, 0, arrowX + arrowWidth, height );
FlatUIUtils.paintComponentBackground( g2, 0, 0, width, height, focusWidth, arc );
g2.setClip( oldClip );
}
} }
// paint vertical line between value and arrow button // paint vertical line between value and arrow button
if( paintButton ) { if( paintButton ) {
Color separatorColor = enabled ? buttonSeparatorColor : buttonDisabledSeparatorColor; Color separatorColor = enabled ? buttonSeparatorColor : buttonDisabledSeparatorColor;
if( separatorColor != null ) { if( separatorColor != null && buttonSeparatorWidth > 0 ) {
g2.setColor( separatorColor ); g2.setColor( separatorColor );
float lw = scale( buttonSeparatorWidth ); float lw = scale( buttonSeparatorWidth );
float lx = isLeftToRight ? arrowX : arrowX + arrowWidth - lw; float lx = isLeftToRight ? arrowX : arrowX + arrowWidth - lw;
@@ -806,9 +812,12 @@ public class FlatComboBoxUI
// make opaque to avoid that background shines thru border (e.g. at 150% scaling) // make opaque to avoid that background shines thru border (e.g. at 150% scaling)
setOpaque( true ); setOpaque( true );
// set popup border
// use non-UIResource to avoid that it is overwritten when making
// popup visible (see JPopupMenu.setInvoker()) in theme editor preview
Border border = UIManager.getBorder( "PopupMenu.border" ); Border border = UIManager.getBorder( "PopupMenu.border" );
if( border != null ) if( border != null )
setBorder( border ); setBorder( FlatUIUtils.nonUIResource( border ) );
} }
@Override @Override
@@ -822,6 +831,11 @@ public class FlatComboBoxUI
void updateStyle() { void updateStyle() {
if( popupBackground != null ) if( popupBackground != null )
list.setBackground( popupBackground ); list.setBackground( popupBackground );
// set popup background because it may shine thru when scaled (e.g. at 150%)
// use non-UIResource to avoid that it is overwritten when making
// popup visible (see JPopupMenu.setInvoker()) in theme editor preview
setBackground( FlatUIUtils.nonUIResource( list.getBackground() ) );
} }
@Override @Override
@@ -908,7 +922,9 @@ public class FlatComboBoxUI
this.padding = padding; this.padding = padding;
} }
void install( Component c ) { // using synchronized to avoid problems with code that modifies combo box
// (model, selection, etc) not on AWT thread (which should be not done)
synchronized void install( Component c ) {
if( !(c instanceof JComponent) ) if( !(c instanceof JComponent) )
return; return;
@@ -940,7 +956,7 @@ public class FlatComboBoxUI
* there is no single place to uninstall it. * there is no single place to uninstall it.
* This is the reason why this method is called from various places. * This is the reason why this method is called from various places.
*/ */
void uninstall() { synchronized void uninstall() {
if( rendererComponent == null ) if( rendererComponent == null )
return; return;
@@ -951,9 +967,9 @@ public class FlatComboBoxUI
} }
@Override @Override
public Insets getBorderInsets( Component c, Insets insets ) { synchronized public Insets getBorderInsets( Component c, Insets insets ) {
Insets padding = scale( this.padding ); Insets padding = scale( this.padding );
if( rendererBorder != null ) { if( rendererBorder != null && !(rendererBorder instanceof CellPaddingBorder) ) {
Insets insideInsets = rendererBorder.getBorderInsets( c ); Insets insideInsets = rendererBorder.getBorderInsets( c );
insets.top = Math.max( padding.top, insideInsets.top ); insets.top = Math.max( padding.top, insideInsets.top );
insets.left = Math.max( padding.left, insideInsets.left ); insets.left = Math.max( padding.left, insideInsets.left );

View File

@@ -44,8 +44,8 @@ import com.formdev.flatlaf.util.LoggingFacade;
* <!-- BasicEditorPaneUI --> * <!-- BasicEditorPaneUI -->
* *
* @uiDefault EditorPane.font Font * @uiDefault EditorPane.font Font
* @uiDefault EditorPane.background Color also used if not editable * @uiDefault EditorPane.background Color
* @uiDefault EditorPane.foreground Color * @uiDefault EditorPane.foreground Color also used if not editable
* @uiDefault EditorPane.caretForeground Color * @uiDefault EditorPane.caretForeground Color
* @uiDefault EditorPane.selectionBackground Color * @uiDefault EditorPane.selectionBackground Color
* @uiDefault EditorPane.selectionForeground Color * @uiDefault EditorPane.selectionForeground Color

View File

@@ -213,6 +213,13 @@ public class FlatInternalFrameTitlePane
case "componentOrientation": case "componentOrientation":
applyComponentOrientation( frame.getComponentOrientation() ); applyComponentOrientation( frame.getComponentOrientation() );
break; break;
case "opaque":
// Do not invoke super.propertyChange() here because it always
// invokes repaint(), which would cause endless repainting.
// The opaque flag is temporary changed in FlatUIUtils.hasOpaqueBeenExplicitlySet(),
// invoked from FlatInternalFrameUI.update().
return;
} }
super.propertyChange( e ); super.propertyChange( e );

View File

@@ -179,6 +179,26 @@ public class FlatInternalFrameUI
return FlatStylingSupport.getAnnotatedStyleableInfos( this, frame.getBorder() ); return FlatStylingSupport.getAnnotatedStyleableInfos( this, frame.getBorder() );
} }
@Override
public void update( Graphics g, JComponent c ) {
// The internal frame actually should be opaque and fill its background,
// but it must be non-opaque to allow translucent resize handles (outside of visual bounds).
// To avoid that parent may shine through internal frame (e.g. if menu bar is non-opaque),
// fill background excluding insets (translucent resize handles),
// but only if opaque was not set explicitly by application to false.
// If applications has set internal frame opacity to false, do not fill background (for compatibility).
if( !c.isOpaque() && !FlatUIUtils.hasOpaqueBeenExplicitlySet( c ) ) {
Insets insets = c.getInsets();
g.setColor( c.getBackground() );
g.fillRect( insets.left, insets.top,
c.getWidth() - insets.left - insets.right,
c.getHeight() - insets.top - insets.bottom );
}
super.update( g, c );
}
//---- class FlatInternalFrameBorder -------------------------------------- //---- class FlatInternalFrameBorder --------------------------------------
public static class FlatInternalFrameBorder public static class FlatInternalFrameBorder

View File

@@ -122,7 +122,7 @@ public class FlatLabelUI
JLabel label = (JLabel) e.getSource(); JLabel label = (JLabel) e.getSource();
if( shared && FlatStylingSupport.hasStyleProperty( label ) ) { if( shared && FlatStylingSupport.hasStyleProperty( label ) ) {
// unshare component UI if necessary // unshare component UI if necessary
// updateUI() invokes applyStyle() from installUI() // updateUI() invokes installStyle() from installUI()
label.updateUI(); label.updateUI();
} else } else
installStyle( label ); installStyle( label );

View File

@@ -37,15 +37,18 @@ public class FlatLineBorder
{ {
private final Color lineColor; private final Color lineColor;
private final float lineThickness; private final float lineThickness;
/** @since 2 */ private final int arc;
public FlatLineBorder( Insets insets, Color lineColor ) { public FlatLineBorder( Insets insets, Color lineColor ) {
this( insets, lineColor, 1f ); this( insets, lineColor, 1f, 0 );
} }
public FlatLineBorder( Insets insets, Color lineColor, float lineThickness ) { /** @since 2 */
public FlatLineBorder( Insets insets, Color lineColor, float lineThickness, int arc ) {
super( insets ); super( insets );
this.lineColor = lineColor; this.lineColor = lineColor;
this.lineThickness = lineThickness; this.lineThickness = lineThickness;
this.arc = arc;
} }
public Color getLineColor() { public Color getLineColor() {
@@ -56,13 +59,18 @@ public class FlatLineBorder
return lineThickness; return lineThickness;
} }
/** @since 2 */
public int getArc() {
return arc;
}
@Override @Override
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) { public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
Graphics2D g2 = (Graphics2D) g.create(); Graphics2D g2 = (Graphics2D) g.create();
try { try {
FlatUIUtils.setRenderingHints( g2 ); FlatUIUtils.setRenderingHints( g2 );
FlatUIUtils.paintOutlinedComponent( g2, x, y, width, height, FlatUIUtils.paintOutlinedComponent( g2, x, y, width, height,
0, 0, 0, scale( getLineThickness() ), 0, null, getLineColor(), null ); 0, 0, 0, scale( getLineThickness() ), scale( getArc() ), null, getLineColor(), null );
} finally { } finally {
g2.dispose(); g2.dispose();
} }

View File

@@ -37,7 +37,7 @@ import javax.swing.plaf.ListUI;
public class FlatListCellBorder public class FlatListCellBorder
extends FlatLineBorder extends FlatLineBorder
{ {
protected boolean showCellFocusIndicator = UIManager.getBoolean( "List.showCellFocusIndicator" ); /** @since 2 */ protected boolean showCellFocusIndicator = UIManager.getBoolean( "List.showCellFocusIndicator" );
private Component c; private Component c;
@@ -113,7 +113,7 @@ public class FlatListCellBorder
/** /**
* Border for selected cell that uses margins and paints focus indicator border * Border for selected cell that uses margins and paints focus indicator border
* if enabled (List.showCellFocusIndicator=true) and exactly one item is selected. * if enabled (List.showCellFocusIndicator=true) and multiple items are selected.
*/ */
public static class Selected public static class Selected
extends FlatListCellBorder extends FlatListCellBorder
@@ -125,7 +125,7 @@ public class FlatListCellBorder
if( !showCellFocusIndicator ) if( !showCellFocusIndicator )
return; return;
// paint focus indicator border only if exactly one item is selected // paint focus indicator border only if multiple items are selected
JList<?> list = (JList<?>) SwingUtilities.getAncestorOfClass( JList.class, c ); JList<?> list = (JList<?>) SwingUtilities.getAncestorOfClass( JList.class, c );
if( list != null && list.getMinSelectionIndex() == list.getMaxSelectionIndex() ) if( list != null && list.getMinSelectionIndex() == list.getMaxSelectionIndex() )
return; return;

View File

@@ -78,9 +78,9 @@ public class FlatListUI
@Styleable protected Color selectionInactiveForeground; @Styleable protected Color selectionInactiveForeground;
// for FlatListCellBorder // for FlatListCellBorder
@Styleable protected Insets cellMargins; /** @since 2 */ @Styleable protected Insets cellMargins;
@Styleable protected Color cellFocusColor; /** @since 2 */ @Styleable protected Color cellFocusColor;
@Styleable protected boolean showCellFocusIndicator; /** @since 2 */ @Styleable protected Boolean showCellFocusIndicator;
private Map<String, Object> oldStyleValues; private Map<String, Object> oldStyleValues;

View File

@@ -180,11 +180,15 @@ public class FlatMenuBarUI
protected Color getBackground( JComponent c ) { protected Color getBackground( JComponent c ) {
Color background = c.getBackground(); Color background = c.getBackground();
// paint background if opaque or if having custom background color // paint background if opaque
if( c.isOpaque() || !(background instanceof UIResource) ) if( c.isOpaque() )
return background; return background;
// paint background if menu bar is not the "main" menu bar // do not paint background if non-opaque and having custom background color
if( !(background instanceof UIResource) )
return null;
// paint background if menu bar is not the "main" menu bar (e.g. in internal frame)
JRootPane rootPane = SwingUtilities.getRootPane( c ); JRootPane rootPane = SwingUtilities.getRootPane( c );
if( rootPane == null || !(rootPane.getParent() instanceof Window) || rootPane.getJMenuBar() != c ) if( rootPane == null || !(rootPane.getParent() instanceof Window) || rootPane.getJMenuBar() != c )
return background; return background;

View File

@@ -19,6 +19,7 @@ package com.formdev.flatlaf.ui;
import static com.formdev.flatlaf.util.UIScale.scale; import static com.formdev.flatlaf.util.UIScale.scale;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font; import java.awt.Font;
import java.awt.FontMetrics; import java.awt.FontMetrics;
@@ -32,6 +33,7 @@ import java.awt.event.KeyEvent;
import java.text.AttributedCharacterIterator; import java.text.AttributedCharacterIterator;
import java.util.Map; import java.util.Map;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JMenu; import javax.swing.JMenu;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
@@ -39,6 +41,7 @@ import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicHTML; import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.View; import javax.swing.text.View;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon; import com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon;
import com.formdev.flatlaf.icons.FlatMenuArrowIcon; import com.formdev.flatlaf.icons.FlatMenuArrowIcon;
@@ -52,12 +55,15 @@ import com.formdev.flatlaf.util.SystemInfo;
/** /**
* Renderer for menu items. * Renderer for menu items.
* *
* @uiDefault MenuItem.verticallyAlignText boolean
* @uiDefault MenuItem.minimumWidth int * @uiDefault MenuItem.minimumWidth int
* @uiDefault MenuItem.minimumIconSize Dimension * @uiDefault MenuItem.minimumIconSize Dimension
* @uiDefault MenuItem.textAcceleratorGap int * @uiDefault MenuItem.textAcceleratorGap int
* @uiDefault MenuItem.textNoAcceleratorGap int * @uiDefault MenuItem.textNoAcceleratorGap int
* @uiDefault MenuItem.acceleratorArrowGap int * @uiDefault MenuItem.acceleratorArrowGap int
* @uiDefault MenuItem.checkBackground Color * @uiDefault MenuItem.checkBackground Color
* @uiDefault MenuItem.checkMargins Insets
* @uiDefault MenuItem.selectionType String null (default) or underline
* @uiDefault MenuItem.underlineSelectionBackground Color * @uiDefault MenuItem.underlineSelectionBackground Color
* @uiDefault MenuItem.underlineSelectionCheckBackground Color * @uiDefault MenuItem.underlineSelectionCheckBackground Color
* @uiDefault MenuItem.underlineSelectionColor Color * @uiDefault MenuItem.underlineSelectionColor Color
@@ -67,12 +73,15 @@ import com.formdev.flatlaf.util.SystemInfo;
*/ */
public class FlatMenuItemRenderer public class FlatMenuItemRenderer
{ {
private static final String KEY_MAX_ICONS_WIDTH = "FlatLaf.internal.FlatMenuItemRenderer.maxIconWidth";
protected final JMenuItem menuItem; protected final JMenuItem menuItem;
protected Icon checkIcon; protected Icon checkIcon;
protected Icon arrowIcon; protected Icon arrowIcon;
protected final Font acceleratorFont; @Styleable protected Font acceleratorFont;
protected final String acceleratorDelimiter; protected final String acceleratorDelimiter;
/** @since 2 */ @Styleable protected boolean verticallyAlignText = FlatUIUtils.getUIBoolean( "MenuItem.verticallyAlignText", true );
@Styleable protected int minimumWidth = UIManager.getInt( "MenuItem.minimumWidth" ); @Styleable protected int minimumWidth = UIManager.getInt( "MenuItem.minimumWidth" );
@Styleable protected Dimension minimumIconSize; @Styleable protected Dimension minimumIconSize;
@Styleable protected int textAcceleratorGap = FlatUIUtils.getUIInt( "MenuItem.textAcceleratorGap", 28 ); @Styleable protected int textAcceleratorGap = FlatUIUtils.getUIInt( "MenuItem.textAcceleratorGap", 28 );
@@ -405,11 +414,10 @@ debug*/
return; return;
// center because the real icon may be smaller than dimension in iconRect // center because the real icon may be smaller than dimension in iconRect
int x = iconRect.x + centerOffset( iconRect.width, icon.getIconWidth() );
int y = iconRect.y + centerOffset( iconRect.height, icon.getIconHeight() ); int y = iconRect.y + centerOffset( iconRect.height, icon.getIconHeight() );
// paint // paint
icon.paintIcon( menuItem, g, x, y ); icon.paintIcon( menuItem, g, iconRect.x, y );
} }
protected static void paintText( Graphics g, JMenuItem menuItem, protected static void paintText( Graphics g, JMenuItem menuItem,
@@ -444,6 +452,10 @@ debug*/
htmlView.paint( HiDPIUtils.createGraphicsTextYCorrection( (Graphics2D) g ), textRect ); htmlView.paint( HiDPIUtils.createGraphicsTextYCorrection( (Graphics2D) g ), textRect );
} }
/**
* Returns {@code true} if either the menu item is armed (mouse over item)
* or it is a {@code JMenu} and selected (shows submenu).
*/
protected static boolean isArmedOrSelected( JMenuItem menuItem ) { protected static boolean isArmedOrSelected( JMenuItem menuItem ) {
return menuItem.isArmed() || (menuItem instanceof JMenu && menuItem.isSelected()); return menuItem.isArmed() || (menuItem instanceof JMenu && menuItem.isSelected());
} }
@@ -474,6 +486,12 @@ debug*/
return pressedIcon; return pressedIcon;
} }
if( isArmedOrSelected( menuItem ) ) {
Icon selectedIcon = menuItem.getSelectedIcon();
if( selectedIcon != null )
return selectedIcon;
}
return icon; return icon;
} }
@@ -560,6 +578,44 @@ debug*/
shiftGlyph = 0x21E7, shiftGlyph = 0x21E7,
commandGlyph = 0x2318; commandGlyph = 0x2318;
/**
* Calculates the maximum width of all menu item icons in the popup.
*/
private int getMaxIconsWidth() {
if( !verticallyAlignText )
return 0;
Container parent = menuItem.getParent();
if( !(parent instanceof JComponent) )
return 0;
int maxWidth = FlatClientProperties.clientPropertyInt( (JComponent) parent, KEY_MAX_ICONS_WIDTH, -1 );
if( maxWidth >= 0 )
return maxWidth;
maxWidth = 0;
for( Component c : parent.getComponents() ) {
if( !(c instanceof JMenuItem) )
continue;
Icon icon = ((JMenuItem)c).getIcon();
if( icon != null )
maxWidth = Math.max( maxWidth, icon.getIconWidth() );
}
((JComponent)parent).putClientProperty( KEY_MAX_ICONS_WIDTH, maxWidth );
return maxWidth;
}
static void clearClientProperties( Component c ) {
if( !(c instanceof JComponent) )
return;
JComponent jc = (JComponent) c;
jc.putClientProperty( FlatMenuItemRenderer.KEY_MAX_ICONS_WIDTH, null );
}
//---- class MinSizeIcon -------------------------------------------------- //---- class MinSizeIcon --------------------------------------------------
private class MinSizeIcon private class MinSizeIcon
@@ -574,6 +630,7 @@ debug*/
@Override @Override
public int getIconWidth() { public int getIconWidth() {
int iconWidth = (delegate != null) ? delegate.getIconWidth() : 0; int iconWidth = (delegate != null) ? delegate.getIconWidth() : 0;
iconWidth = Math.max( iconWidth, getMaxIconsWidth() );
return Math.max( iconWidth, scale( minimumIconSize.width ) ); return Math.max( iconWidth, scale( minimumIconSize.width ) );
} }

View File

@@ -89,6 +89,7 @@ public class FlatMenuItemUI
protected void uninstallDefaults() { protected void uninstallDefaults() {
super.uninstallDefaults(); super.uninstallDefaults();
FlatMenuItemRenderer.clearClientProperties( menuItem.getParent() );
renderer = null; renderer = null;
oldStyleValues = null; oldStyleValues = null;
} }

View File

@@ -111,6 +111,7 @@ public class FlatMenuUI
protected void uninstallDefaults() { protected void uninstallDefaults() {
super.uninstallDefaults(); super.uninstallDefaults();
FlatMenuItemRenderer.clearClientProperties( menuItem.getParent() );
renderer = null; renderer = null;
oldStyleValues = null; oldStyleValues = null;
} }

View File

@@ -19,9 +19,7 @@ package com.formdev.flatlaf.ui;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridBagConstraints; import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import javax.swing.Box; import javax.swing.Box;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
@@ -230,7 +228,7 @@ public class FlatOptionPaneUI
// use non-UIResource borders to avoid that they are replaced when switching LaF // use non-UIResource borders to avoid that they are replaced when switching LaF
Border border = panel.getBorder(); Border border = panel.getBorder();
if( border instanceof UIResource ) if( border instanceof UIResource )
panel.setBorder( new NonUIResourceBorder( border ) ); panel.setBorder( FlatUIUtils.nonUIResource( border ) );
} }
if( child instanceof Container ) if( child instanceof Container )
@@ -256,31 +254,4 @@ public class FlatOptionPaneUI
protected boolean getSizeButtonsToSameWidth() { protected boolean getSizeButtonsToSameWidth() {
return sameSizeButtons; return sameSizeButtons;
} }
//---- class NonUIResourceBorder ------------------------------------------
private static class NonUIResourceBorder
implements Border
{
private final Border delegate;
NonUIResourceBorder( Border delegate ) {
this.delegate = delegate;
}
@Override
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
delegate.paintBorder( c, g, x, y, width, height );
}
@Override
public Insets getBorderInsets( Component c ) {
return delegate.getBorderInsets( c );
}
@Override
public boolean isBorderOpaque() {
return delegate.isBorderOpaque();
}
}
} }

View File

@@ -16,9 +16,18 @@
package com.formdev.flatlaf.ui; package com.formdev.flatlaf.ui;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.beans.PropertyChangeListener;
import java.util.Map;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicPanelUI; import javax.swing.plaf.basic.BasicPanelUI;
import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable;
import com.formdev.flatlaf.ui.FlatStylingSupport.StyleableUI;
import com.formdev.flatlaf.util.LoggingFacade;
import com.formdev.flatlaf.util.UIScale;
/** /**
* Provides the Flat LaF UI delegate for {@link javax.swing.JPanel}. * Provides the Flat LaF UI delegate for {@link javax.swing.JPanel}.
@@ -27,15 +36,118 @@ import javax.swing.plaf.basic.BasicPanelUI;
* *
* @uiDefault Panel.font Font unused * @uiDefault Panel.font Font unused
* @uiDefault Panel.background Color only used if opaque * @uiDefault Panel.background Color only used if opaque
* @uiDefault Panel.foreground Color * @uiDefault Panel.foreground Color unused
* @uiDefault Panel.border Border * @uiDefault Panel.border Border
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatPanelUI public class FlatPanelUI
extends BasicPanelUI extends BasicPanelUI
implements StyleableUI
{ {
// only used via styling (not in UI defaults)
/** @since 2 */ @Styleable protected int arc = -1;
private final boolean shared;
private PropertyChangeListener propertyChangeListener;
private Map<String, Object> oldStyleValues;
public static ComponentUI createUI( JComponent c ) { public static ComponentUI createUI( JComponent c ) {
return FlatUIUtils.createSharedUI( FlatPanelUI.class, FlatPanelUI::new ); return FlatUIUtils.canUseSharedUI( c )
? FlatUIUtils.createSharedUI( FlatPanelUI.class, () -> new FlatPanelUI( true ) )
: new FlatPanelUI( false );
}
/** @since 2 */
protected FlatPanelUI( boolean shared ) {
this.shared = shared;
}
@Override
public void installUI( JComponent c ) {
super.installUI( c );
propertyChangeListener = FlatStylingSupport.createPropertyChangeListener(
c, () -> stylePropertyChange( (JPanel) c ), null );
c.addPropertyChangeListener( propertyChangeListener );
installStyle( (JPanel) c );
}
@Override
public void uninstallUI( JComponent c ) {
super.uninstallUI( c );
c.removePropertyChangeListener( propertyChangeListener );
propertyChangeListener = null;
oldStyleValues = null;
}
private void stylePropertyChange( JPanel c ) {
if( shared && FlatStylingSupport.hasStyleProperty( c ) ) {
// unshare component UI if necessary
// updateUI() invokes installStyle() from installUI()
c.updateUI();
} else
installStyle( c );
c.revalidate();
c.repaint();
}
/** @since 2 */
protected void installStyle( JPanel c ) {
try {
applyStyle( c, FlatStylingSupport.getResolvedStyle( c, "Panel" ) );
} catch( RuntimeException ex ) {
LoggingFacade.INSTANCE.logSevere( null, ex );
}
}
/** @since 2 */
protected void applyStyle( JPanel c, Object style ) {
oldStyleValues = FlatStylingSupport.parseAndApply( oldStyleValues, style,
(key, value) -> applyStyleProperty( c, key, value ) );
}
/** @since 2 */
protected Object applyStyleProperty( JPanel c, String key, Object value ) {
return FlatStylingSupport.applyToAnnotatedObjectOrComponent( this, c, key, value );
}
/** @since 2 */
@Override
public Map<String, Class<?>> getStyleableInfos( JComponent c ) {
return FlatStylingSupport.getAnnotatedStyleableInfos( this );
}
@Override
public void update( Graphics g, JComponent c ) {
// fill background
if( c.isOpaque() ) {
int width = c.getWidth();
int height = c.getHeight();
int arc = (this.arc >= 0)
? this.arc
: ((c.getBorder() instanceof FlatLineBorder)
? ((FlatLineBorder)c.getBorder()).getArc()
: 0);
// fill background with parent color to avoid garbage in rounded corners
if( arc > 0 )
FlatUIUtils.paintParentBackground( g, c );
g.setColor( c.getBackground() );
if( arc > 0 ) {
// fill rounded rectangle if having rounded corners
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
FlatUIUtils.paintComponentBackground( (Graphics2D) g, 0, 0, width, height,
0, UIScale.scale( arc ) );
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
} else
g.fillRect( 0, 0, width, height );
}
paint( g, c );
} }
} }

View File

@@ -28,6 +28,7 @@ import javax.swing.Action;
import javax.swing.ActionMap; import javax.swing.ActionMap;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JToggleButton;
import javax.swing.LookAndFeel; import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
@@ -73,18 +74,25 @@ import com.formdev.flatlaf.util.UIScale;
* *
* @uiDefault PasswordField.echoChar character * @uiDefault PasswordField.echoChar character
* @uiDefault PasswordField.showCapsLock boolean * @uiDefault PasswordField.showCapsLock boolean
* @uiDefault PasswordField.showRevealButton boolean
* @uiDefault PasswordField.capsLockIcon Icon * @uiDefault PasswordField.capsLockIcon Icon
* @uiDefault PasswordField.revealIcon Icon
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatPasswordFieldUI public class FlatPasswordFieldUI
extends FlatTextFieldUI extends FlatTextFieldUI
{ {
private Character echoChar;
@Styleable protected boolean showCapsLock; @Styleable protected boolean showCapsLock;
/** @since 2 */ @Styleable protected boolean showRevealButton;
protected Icon capsLockIcon; protected Icon capsLockIcon;
/** @since 2 */ protected Icon revealIcon;
private KeyListener capsLockListener; private KeyListener capsLockListener;
private boolean capsLockIconShared = true; private boolean capsLockIconShared = true;
private JToggleButton revealButton;
public static ComponentUI createUI( JComponent c ) { public static ComponentUI createUI( JComponent c ) {
return new FlatPasswordFieldUI(); return new FlatPasswordFieldUI();
@@ -95,17 +103,33 @@ public class FlatPasswordFieldUI
return "PasswordField"; return "PasswordField";
} }
@Override
public void installUI( JComponent c ) {
super.installUI( c );
installRevealButton();
}
@Override
public void uninstallUI( JComponent c ) {
uninstallRevealButton();
super.uninstallUI( c );
}
@Override @Override
protected void installDefaults() { protected void installDefaults() {
super.installDefaults(); super.installDefaults();
String prefix = getPropertyPrefix(); String prefix = getPropertyPrefix();
Character echoChar = (Character) UIManager.get( prefix + ".echoChar" ); echoChar = (Character) UIManager.get( prefix + ".echoChar" );
if( echoChar != null ) if( echoChar != null )
LookAndFeel.installProperty( getComponent(), "echoChar", echoChar ); LookAndFeel.installProperty( getComponent(), "echoChar", echoChar );
showCapsLock = UIManager.getBoolean( "PasswordField.showCapsLock" ); showCapsLock = UIManager.getBoolean( "PasswordField.showCapsLock" );
showRevealButton = UIManager.getBoolean( "PasswordField.showRevealButton" );
capsLockIcon = UIManager.getIcon( "PasswordField.capsLockIcon" ); capsLockIcon = UIManager.getIcon( "PasswordField.capsLockIcon" );
revealIcon = UIManager.getIcon( "PasswordField.revealIcon" );
capsLockIconShared = true; capsLockIconShared = true;
} }
@@ -114,6 +138,7 @@ public class FlatPasswordFieldUI
super.uninstallDefaults(); super.uninstallDefaults();
capsLockIcon = null; capsLockIcon = null;
revealIcon = null;
} }
@Override @Override
@@ -168,6 +193,18 @@ public class FlatPasswordFieldUI
return "PasswordField"; return "PasswordField";
} }
@Override
protected void applyStyle( Object style ) {
boolean oldShowRevealButton = showRevealButton;
super.applyStyle( style );
if( showRevealButton != oldShowRevealButton ) {
uninstallRevealButton();
installRevealButton();
}
}
/** @since 2 */ /** @since 2 */
@Override @Override
protected Object applyStyleProperty( String key, Object value ) { protected Object applyStyleProperty( String key, Object value ) {
@@ -236,4 +273,39 @@ public class FlatPasswordFieldUI
return FlatUIUtils.isPermanentFocusOwner( c ) && return FlatUIUtils.isPermanentFocusOwner( c ) &&
Toolkit.getDefaultToolkit().getLockingKeyState( KeyEvent.VK_CAPS_LOCK ); Toolkit.getDefaultToolkit().getLockingKeyState( KeyEvent.VK_CAPS_LOCK );
} }
/** @since 2 */
protected void installRevealButton() {
JTextComponent c = getComponent();
if( showRevealButton ) {
revealButton = createRevealButton();
installLayout();
c.add( revealButton );
}
}
/** @since 2 */
protected JToggleButton createRevealButton() {
JToggleButton button = new JToggleButton( revealIcon );
prepareLeadingOrTrailingComponent( button );
button.addActionListener( e -> {
LookAndFeel.installProperty( getComponent(), "echoChar", button.isSelected()
? '\0'
: (echoChar != null ? echoChar : '*'));
} );
return button;
}
/** @since 2 */
protected void uninstallRevealButton() {
if( revealButton != null ) {
getComponent().remove( revealButton );
revealButton = null;
}
}
@Override
protected JComponent[] getTrailingComponents() {
return new JComponent[] { trailingComponent, revealButton, clearButton };
}
} }

View File

@@ -121,6 +121,10 @@ public class FlatPopupFactory
popupWindow.getGraphicsConfiguration() == owner.getGraphicsConfiguration() ) popupWindow.getGraphicsConfiguration() == owner.getGraphicsConfiguration() )
return popup; return popup;
// avoid endless loop (should newer happen; PopupFactory cache size is 5)
if( ++count > 10 )
return popup;
// remove contents component from popup window // remove contents component from popup window
if( popupWindow instanceof JWindow ) if( popupWindow instanceof JWindow )
((JWindow)popupWindow).getContentPane().removeAll(); ((JWindow)popupWindow).getContentPane().removeAll();
@@ -128,10 +132,6 @@ public class FlatPopupFactory
// dispose unused popup // dispose unused popup
// (do not invoke popup.hide() because this would cache the popup window) // (do not invoke popup.hide() because this would cache the popup window)
popupWindow.dispose(); popupWindow.dispose();
// avoid endless loop (should newer happen; PopupFactory cache size is 5)
if( ++count > 10 )
return popup;
} }
} }

View File

@@ -16,12 +16,18 @@
package com.formdev.flatlaf.ui; package com.formdev.flatlaf.ui;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import javax.swing.BoxLayout;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicPopupMenuUI; import javax.swing.plaf.basic.BasicPopupMenuUI;
import javax.swing.plaf.basic.DefaultMenuLayout;
import com.formdev.flatlaf.ui.FlatStylingSupport.StyleableUI; import com.formdev.flatlaf.ui.FlatStylingSupport.StyleableUI;
import com.formdev.flatlaf.util.LoggingFacade; import com.formdev.flatlaf.util.LoggingFacade;
@@ -64,6 +70,15 @@ public class FlatPopupMenuUI
borderShared = null; borderShared = null;
} }
@Override
public void installDefaults() {
super.installDefaults();
LayoutManager layout = popupMenu.getLayout();
if( layout == null || layout instanceof UIResource )
popupMenu.setLayout( new FlatMenuLayout( popupMenu, BoxLayout.Y_AXIS ) );
}
@Override @Override
protected void installListeners() { protected void installListeners() {
super.installListeners(); super.installListeners();
@@ -106,4 +121,21 @@ public class FlatPopupMenuUI
public Map<String, Class<?>> getStyleableInfos( JComponent c ) { public Map<String, Class<?>> getStyleableInfos( JComponent c ) {
return FlatStylingSupport.getAnnotatedStyleableInfos( this, popupMenu.getBorder() ); return FlatStylingSupport.getAnnotatedStyleableInfos( this, popupMenu.getBorder() );
} }
//---- class FlatMenuLayout -----------------------------------------------
protected static class FlatMenuLayout
extends DefaultMenuLayout
{
public FlatMenuLayout( Container target, int axis ) {
super( target, axis );
}
@Override
public Dimension preferredLayoutSize( Container target ) {
FlatMenuItemRenderer.clearClientProperties( target );
return super.preferredLayoutSize( target );
}
}
} }

View File

@@ -89,6 +89,7 @@ public class FlatRadioButtonMenuItemUI
protected void uninstallDefaults() { protected void uninstallDefaults() {
super.uninstallDefaults(); super.uninstallDefaults();
FlatMenuItemRenderer.clearClientProperties( menuItem.getParent() );
renderer = null; renderer = null;
oldStyleValues = null; oldStyleValues = null;
} }

View File

@@ -139,7 +139,7 @@ public class FlatRadioButtonUI
case FlatClientProperties.STYLE_CLASS: case FlatClientProperties.STYLE_CLASS:
if( shared && FlatStylingSupport.hasStyleProperty( b ) ) { if( shared && FlatStylingSupport.hasStyleProperty( b ) ) {
// unshare component UI if necessary // unshare component UI if necessary
// updateUI() invokes applyStyle() from installUI() // updateUI() invokes installStyle() from installUI()
b.updateUI(); b.updateUI();
} else } else
installStyle( b ); installStyle( b );

View File

@@ -47,7 +47,7 @@ import com.formdev.flatlaf.util.UIScale;
* <!-- BasicScrollBarUI --> * <!-- BasicScrollBarUI -->
* *
* @uiDefault ScrollBar.background Color * @uiDefault ScrollBar.background Color
* @uiDefault ScrollBar.foreground Color * @uiDefault ScrollBar.foreground Color unused
* @uiDefault ScrollBar.track Color * @uiDefault ScrollBar.track Color
* @uiDefault ScrollBar.thumb Color * @uiDefault ScrollBar.thumb Color
* @uiDefault ScrollBar.width int * @uiDefault ScrollBar.width int

View File

@@ -125,7 +125,7 @@ public class FlatSeparatorUI
private void stylePropertyChange( JSeparator s ) { private void stylePropertyChange( JSeparator s ) {
if( shared && FlatStylingSupport.hasStyleProperty( s ) ) { if( shared && FlatStylingSupport.hasStyleProperty( s ) ) {
// unshare component UI if necessary // unshare component UI if necessary
// updateUI() invokes applyStyle() from installUI() // updateUI() invokes installStyle() from installUI()
s.updateUI(); s.updateUI();
} else } else
installStyle( s ); installStyle( s );

View File

@@ -71,7 +71,7 @@ import com.formdev.flatlaf.util.LoggingFacade;
* @uiDefault Spinner.disabledBackground Color * @uiDefault Spinner.disabledBackground Color
* @uiDefault Spinner.disabledForeground Color * @uiDefault Spinner.disabledForeground Color
* @uiDefault Spinner.focusedBackground Color optional * @uiDefault Spinner.focusedBackground Color optional
* @uiDefault Spinner.buttonBackground Color * @uiDefault Spinner.buttonBackground Color optional
* @uiDefault Spinner.buttonSeparatorWidth int or float optional; defaults to Component.borderWidth * @uiDefault Spinner.buttonSeparatorWidth int or float optional; defaults to Component.borderWidth
* @uiDefault Spinner.buttonSeparatorColor Color optional * @uiDefault Spinner.buttonSeparatorColor Color optional
* @uiDefault Spinner.buttonDisabledSeparatorColor Color optional * @uiDefault Spinner.buttonDisabledSeparatorColor Color optional
@@ -385,7 +385,7 @@ public class FlatSpinnerUI
boolean isLeftToRight = spinner.getComponentOrientation().isLeftToRight(); boolean isLeftToRight = spinner.getComponentOrientation().isLeftToRight();
// paint arrow buttons background // paint arrow buttons background
if( enabled ) { if( enabled && buttonBackground != null ) {
g2.setColor( buttonBackground ); g2.setColor( buttonBackground );
Shape oldClip = g2.getClip(); Shape oldClip = g2.getClip();
if( isLeftToRight ) if( isLeftToRight )
@@ -398,7 +398,7 @@ public class FlatSpinnerUI
// paint vertical line between value and arrow buttons // paint vertical line between value and arrow buttons
Color separatorColor = enabled ? buttonSeparatorColor : buttonDisabledSeparatorColor; Color separatorColor = enabled ? buttonSeparatorColor : buttonDisabledSeparatorColor;
if( separatorColor != null ) { if( separatorColor != null && buttonSeparatorWidth > 0 ) {
g2.setColor( separatorColor ); g2.setColor( separatorColor );
float lw = scale( buttonSeparatorWidth ); float lw = scale( buttonSeparatorWidth );
float lx = isLeftToRight ? arrowX : arrowX + arrowWidth - lw; float lx = isLeftToRight ? arrowX : arrowX + arrowWidth - lw;

View File

@@ -37,7 +37,7 @@ import javax.swing.plaf.TableUI;
public class FlatTableCellBorder public class FlatTableCellBorder
extends FlatLineBorder extends FlatLineBorder
{ {
protected boolean showCellFocusIndicator = UIManager.getBoolean( "Table.showCellFocusIndicator" ); /** @since 2 */ protected boolean showCellFocusIndicator = UIManager.getBoolean( "Table.showCellFocusIndicator" );
private Component c; private Component c;

View File

@@ -141,8 +141,8 @@ public class FlatTableHeaderBorder
protected boolean hideTrailingVerticalLine( JTableHeader header ) { protected boolean hideTrailingVerticalLine( JTableHeader header ) {
if( header.getUI() instanceof FlatTableHeaderUI ) { if( header.getUI() instanceof FlatTableHeaderUI ) {
FlatTableHeaderUI ui = (FlatTableHeaderUI) header.getUI(); FlatTableHeaderUI ui = (FlatTableHeaderUI) header.getUI();
if( ui.showTrailingVerticalLine ) if( ui.showTrailingVerticalLine != null )
return false; return !ui.showTrailingVerticalLine;
} }
if( showTrailingVerticalLine ) if( showTrailingVerticalLine )

View File

@@ -84,14 +84,14 @@ public class FlatTableHeaderUI
@Styleable(type=String.class) protected int sortIconPosition; @Styleable(type=String.class) protected int sortIconPosition;
// for FlatTableHeaderBorder // for FlatTableHeaderBorder
@Styleable protected Insets cellMargins; /** @since 2 */ @Styleable protected Insets cellMargins;
@Styleable protected Color separatorColor; /** @since 2 */ @Styleable protected Color separatorColor;
/** @since 2 */ @Styleable protected boolean showTrailingVerticalLine; /** @since 2 */ @Styleable protected Boolean showTrailingVerticalLine;
// for FlatAscendingSortIcon and FlatDescendingSortIcon // for FlatAscendingSortIcon and FlatDescendingSortIcon
// (needs to be public because icon classes are in another package) // (needs to be public because icon classes are in another package)
@Styleable public String arrowType; /** @since 2 */ @Styleable public String arrowType;
@Styleable public Color sortIconColor; /** @since 2 */ @Styleable public Color sortIconColor;
private PropertyChangeListener propertyChangeListener; private PropertyChangeListener propertyChangeListener;
private Map<String, Object> oldStyleValues; private Map<String, Object> oldStyleValues;

View File

@@ -108,9 +108,9 @@ public class FlatTableUI
@Styleable protected Color selectionInactiveForeground; @Styleable protected Color selectionInactiveForeground;
// for FlatTableCellBorder // for FlatTableCellBorder
@Styleable protected Insets cellMargins; /** @since 2 */ @Styleable protected Insets cellMargins;
@Styleable protected Color cellFocusColor; /** @since 2 */ @Styleable protected Color cellFocusColor;
@Styleable protected boolean showCellFocusIndicator; /** @since 2 */ @Styleable protected Boolean showCellFocusIndicator;
private boolean oldShowHorizontalLines; private boolean oldShowHorizontalLines;
private boolean oldShowVerticalLines; private boolean oldShowVerticalLines;

View File

@@ -19,29 +19,40 @@ package com.formdev.flatlaf.ui;
import static com.formdev.flatlaf.FlatClientProperties.*; import static com.formdev.flatlaf.FlatClientProperties.*;
import static com.formdev.flatlaf.util.UIScale.scale; import static com.formdev.flatlaf.util.UIScale.scale;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Insets; import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.LayoutManager2;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.FocusListener; import java.awt.event.FocusListener;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JComboBox; import javax.swing.JComboBox;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JSpinner; import javax.swing.JSpinner;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.JToolBar;
import javax.swing.LookAndFeel; import javax.swing.LookAndFeel;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource; import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicTextFieldUI; import javax.swing.plaf.basic.BasicTextFieldUI;
import javax.swing.text.Caret; import javax.swing.text.Caret;
import javax.swing.text.Document;
import javax.swing.text.JTextComponent; import javax.swing.text.JTextComponent;
import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable; import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable;
import com.formdev.flatlaf.ui.FlatStylingSupport.StyleableUI; import com.formdev.flatlaf.ui.FlatStylingSupport.StyleableUI;
@@ -94,6 +105,12 @@ public class FlatTextFieldUI
/** @since 2 */ @Styleable protected Icon leadingIcon; /** @since 2 */ @Styleable protected Icon leadingIcon;
/** @since 2 */ @Styleable protected Icon trailingIcon; /** @since 2 */ @Styleable protected Icon trailingIcon;
/** @since 2 */ protected JComponent leadingComponent;
/** @since 2 */ protected JComponent trailingComponent;
/** @since 2 */ protected JComponent clearButton;
// only used via styling (not in UI defaults, but has likewise client properties)
/** @since 2 */ @Styleable protected boolean showClearButton;
private Color oldDisabledBackground; private Color oldDisabledBackground;
private Color oldInactiveBackground; private Color oldInactiveBackground;
@@ -101,6 +118,7 @@ public class FlatTextFieldUI
private Insets defaultMargin; private Insets defaultMargin;
private FocusListener focusListener; private FocusListener focusListener;
private DocumentListener documentListener;
private Map<String, Object> oldStyleValues; private Map<String, Object> oldStyleValues;
private AtomicBoolean borderShared; private AtomicBoolean borderShared;
@@ -115,11 +133,19 @@ public class FlatTextFieldUI
leadingIcon = clientProperty( c, TEXT_FIELD_LEADING_ICON, null, Icon.class ); leadingIcon = clientProperty( c, TEXT_FIELD_LEADING_ICON, null, Icon.class );
trailingIcon = clientProperty( c, TEXT_FIELD_TRAILING_ICON, null, Icon.class ); trailingIcon = clientProperty( c, TEXT_FIELD_TRAILING_ICON, null, Icon.class );
installLeadingComponent();
installTrailingComponent();
installClearButton();
installStyle(); installStyle();
} }
@Override @Override
public void uninstallUI( JComponent c ) { public void uninstallUI( JComponent c ) {
uninstallLeadingComponent();
uninstallTrailingComponent();
uninstallClearButton();
super.uninstallUI( c ); super.uninstallUI( c );
leadingIcon = null; leadingIcon = null;
@@ -181,6 +207,11 @@ public class FlatTextFieldUI
getComponent().removeFocusListener( focusListener ); getComponent().removeFocusListener( focusListener );
focusListener = null; focusListener = null;
if( documentListener != null ) {
getComponent().getDocument().removeDocumentListener( documentListener );
documentListener = null;
}
} }
@Override @Override
@@ -225,9 +256,61 @@ public class FlatTextFieldUI
trailingIcon = (e.getNewValue() instanceof Icon) ? (Icon) e.getNewValue() : null; trailingIcon = (e.getNewValue() instanceof Icon) ? (Icon) e.getNewValue() : null;
c.repaint(); c.repaint();
break; break;
case TEXT_FIELD_LEADING_COMPONENT:
uninstallLeadingComponent();
installLeadingComponent();
c.revalidate();
c.repaint();
break;
case TEXT_FIELD_TRAILING_COMPONENT:
uninstallTrailingComponent();
installTrailingComponent();
c.revalidate();
c.repaint();
break;
case TEXT_FIELD_SHOW_CLEAR_BUTTON:
uninstallClearButton();
installClearButton();
c.revalidate();
c.repaint();
break;
case "enabled":
case "editable":
updateClearButton();
break;
case "document":
if( documentListener != null ) {
if( e.getOldValue() instanceof Document )
((Document)e.getOldValue()).removeDocumentListener( documentListener );
if( e.getNewValue() instanceof Document )
((Document)e.getNewValue()).addDocumentListener( documentListener );
updateClearButton();
}
break;
} }
} }
/** @since 2 */
protected void installDocumentListener() {
if( documentListener != null )
return;
documentListener = new FlatDocumentListener();
getComponent().getDocument().addDocumentListener( documentListener );
}
/** @since 2 */
protected void documentChanged( DocumentEvent e ) {
if( clearButton != null )
updateClearButton();
}
/** @since 2 */ /** @since 2 */
protected void installStyle() { protected void installStyle() {
try { try {
@@ -246,10 +329,15 @@ public class FlatTextFieldUI
protected void applyStyle( Object style ) { protected void applyStyle( Object style ) {
oldDisabledBackground = disabledBackground; oldDisabledBackground = disabledBackground;
oldInactiveBackground = inactiveBackground; oldInactiveBackground = inactiveBackground;
boolean oldShowClearButton = showClearButton;
oldStyleValues = FlatStylingSupport.parseAndApply( oldStyleValues, style, this::applyStyleProperty ); oldStyleValues = FlatStylingSupport.parseAndApply( oldStyleValues, style, this::applyStyleProperty );
updateBackground(); updateBackground();
if( showClearButton != oldShowClearButton ) {
uninstallClearButton();
installClearButton();
}
} }
/** @since 2 */ /** @since 2 */
@@ -444,6 +532,16 @@ debug*/
// add width of leading and trailing icons // add width of leading and trailing icons
size.width += getLeadingIconWidth() + getTrailingIconWidth(); size.width += getLeadingIconWidth() + getTrailingIconWidth();
// add width of leading and trailing components
for( JComponent comp : getLeadingComponents() ) {
if( comp != null && comp.isVisible() )
size.width += comp.getPreferredSize().width;
}
for( JComponent comp : getTrailingComponents() ) {
if( comp != null && comp.isVisible() )
size.width += comp.getPreferredSize().width;
}
return size; return size;
} }
@@ -510,7 +608,8 @@ debug*/
/** /**
* Returns the rectangle used to paint leading and trailing icons. * Returns the rectangle used to paint leading and trailing icons.
* It invokes {@code super.getVisibleEditorRect()} and reduces left and/or * It invokes {@code super.getVisibleEditorRect()} and reduces left and/or
* right margin if the text field has leading or trailing icons. * right margin if the text field has leading or trailing icons or components.
* Also the preferred widths of leading and trailing components are removed.
* *
* @since 2 * @since 2
*/ */
@@ -519,10 +618,31 @@ debug*/
if( r == null ) if( r == null )
return null; return null;
// if a leading/trailing icon is shown, then the left/right margin is reduced
// to the top margin, which places the icon nicely centered on left/right side
boolean ltr = isLeftToRight(); boolean ltr = isLeftToRight();
if( ltr ? hasLeadingIcon() : hasTrailingIcon() ) {
// remove width of leading/trailing components
JComponent[] leftComponents = ltr ? getLeadingComponents() : getTrailingComponents();
JComponent[] rightComponents = ltr ? getTrailingComponents() : getLeadingComponents();
boolean leftVisible = false;
boolean rightVisible = false;
for( JComponent leftComponent : leftComponents ) {
if( leftComponent != null && leftComponent.isVisible() ) {
int w = leftComponent.getPreferredSize().width;
r.x += w;
r.width -= w;
leftVisible = true;
}
}
for( JComponent rightComponent : rightComponents ) {
if( rightComponent != null && rightComponent.isVisible() ) {
r.width -= rightComponent.getPreferredSize().width;
rightVisible = true;
}
}
// if a leading/trailing icons (or components) are shown, then the left/right margins are reduced
// to the top margin, which places the icon nicely centered on left/right side
if( leftVisible || (ltr ? hasLeadingIcon() : hasTrailingIcon()) ) {
// reduce left margin // reduce left margin
Insets margin = getComponent().getMargin(); Insets margin = getComponent().getMargin();
int newLeftMargin = Math.min( margin.left, margin.top ); int newLeftMargin = Math.min( margin.left, margin.top );
@@ -532,7 +652,7 @@ debug*/
r.width += diff; r.width += diff;
} }
} }
if( ltr ? hasTrailingIcon() : hasLeadingIcon() ) { if( rightVisible || (ltr ? hasTrailingIcon() : hasLeadingIcon()) ) {
// reduce right margin // reduce right margin
Insets margin = getComponent().getMargin(); Insets margin = getComponent().getMargin();
int newRightMargin = Math.min( margin.right, margin.top ); int newRightMargin = Math.min( margin.right, margin.top );
@@ -540,6 +660,10 @@ debug*/
r.width += scale( margin.right - newRightMargin ); r.width += scale( margin.right - newRightMargin );
} }
// make sure that width and height are not negative
r.width = Math.max( r.width, 0 );
r.height = Math.max( r.height, 0 );
return r; return r;
} }
@@ -578,4 +702,259 @@ debug*/
if( caret instanceof FlatCaret ) if( caret instanceof FlatCaret )
((FlatCaret)caret).scrollCaretToVisible(); ((FlatCaret)caret).scrollCaretToVisible();
} }
/** @since 2 */
protected void installLeadingComponent() {
JTextComponent c = getComponent();
leadingComponent = clientProperty( c, TEXT_FIELD_LEADING_COMPONENT, null, JComponent.class );
if( leadingComponent != null ) {
prepareLeadingOrTrailingComponent( leadingComponent );
installLayout();
c.add( leadingComponent );
}
}
/** @since 2 */
protected void installTrailingComponent() {
JTextComponent c = getComponent();
trailingComponent = clientProperty( c, TEXT_FIELD_TRAILING_COMPONENT, null, JComponent.class );
if( trailingComponent != null ) {
prepareLeadingOrTrailingComponent( trailingComponent );
installLayout();
c.add( trailingComponent );
}
}
/** @since 2 */
protected void uninstallLeadingComponent() {
if( leadingComponent != null ) {
getComponent().remove( leadingComponent );
leadingComponent = null;
}
}
/** @since 2 */
protected void uninstallTrailingComponent() {
if( trailingComponent != null ) {
getComponent().remove( trailingComponent );
trailingComponent = null;
}
}
/** @since 2 */
protected void installClearButton() {
JTextComponent c = getComponent();
if( clientPropertyBoolean( c, TEXT_FIELD_SHOW_CLEAR_BUTTON, showClearButton ) ) {
clearButton = createClearButton();
updateClearButton();
installDocumentListener();
installLayout();
c.add( clearButton );
}
}
/** @since 2 */
protected void uninstallClearButton() {
if( clearButton != null ) {
getComponent().remove( clearButton );
clearButton = null;
}
}
/** @since 2 */
protected JComponent createClearButton() {
JButton button = new JButton();
button.putClientProperty( STYLE_CLASS, "clearButton" );
button.putClientProperty( BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON );
button.setCursor( Cursor.getDefaultCursor() );
button.addActionListener( e -> clearButtonClicked() );
return button;
}
/** @since 2 */
@SuppressWarnings( "unchecked" )
protected void clearButtonClicked() {
JTextComponent c = getComponent();
Object callback = c.getClientProperty( TEXT_FIELD_CLEAR_CALLBACK );
if( callback instanceof Runnable )
((Runnable)callback).run();
else if( callback instanceof Consumer )
((Consumer<JTextComponent>)callback).accept( c );
else
c.setText( "" );
}
/** @since 2 */
protected void updateClearButton() {
if( clearButton == null )
return;
JTextComponent c = getComponent();
boolean visible = c.isEnabled() && c.isEditable() && c.getDocument().getLength() > 0;
if( visible != clearButton.isVisible() ) {
clearButton.setVisible( visible );
c.revalidate();
c.repaint();
}
}
/**
* Returns components placed at the leading side of the text field.
* The returned array may contain {@code null}.
* The default implementation returns {@link #leadingComponent}.
*
* @since 2
*/
protected JComponent[] getLeadingComponents() {
return new JComponent[] { leadingComponent };
}
/**
* Returns components placed at the trailing side of the text field.
* The returned array may contain {@code null}.
* The default implementation returns {@link #trailingComponent} and {@link #clearButton}.
* <p>
* <strong>Note</strong>: The components in the array must be in reverse (visual) order.
*
* @since 2
*/
protected JComponent[] getTrailingComponents() {
return new JComponent[] { trailingComponent, clearButton };
}
/** @since 2 */
protected void prepareLeadingOrTrailingComponent( JComponent c ) {
c.putClientProperty( STYLE_CLASS, "inTextField" );
c.setCursor( Cursor.getDefaultCursor() );
if( c instanceof JButton || c instanceof JToggleButton )
c.putClientProperty( BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON );
else if( c instanceof JToolBar ) {
for( Component child : c.getComponents() ) {
if( child instanceof JComponent )
((JComponent)child).putClientProperty( STYLE_CLASS, "inTextField" );
}
}
}
/** @since 2 */
protected void installLayout() {
JTextComponent c = getComponent();
LayoutManager oldLayout = c.getLayout();
if( !(oldLayout instanceof FlatTextFieldLayout) )
c.setLayout( new FlatTextFieldLayout( oldLayout ) );
}
//---- class FlatTextFieldLayout ------------------------------------------
private class FlatTextFieldLayout
implements LayoutManager2, UIResource
{
private final LayoutManager delegate;
FlatTextFieldLayout( LayoutManager delegate ) {
this.delegate = delegate;
}
@Override
public void addLayoutComponent( String name, Component comp ) {
if( delegate != null )
delegate.addLayoutComponent( name, comp );
}
@Override
public void removeLayoutComponent( Component comp ) {
if( delegate != null )
delegate.removeLayoutComponent( comp );
}
@Override
public Dimension preferredLayoutSize( Container parent ) {
return (delegate != null) ? delegate.preferredLayoutSize( parent ) : null;
}
@Override
public Dimension minimumLayoutSize( Container parent ) {
return (delegate != null) ? delegate.minimumLayoutSize( parent ) : null;
}
@Override
public void layoutContainer( Container parent ) {
if( delegate != null )
delegate.layoutContainer( parent );
int ow = FlatUIUtils.getBorderFocusAndLineWidth( getComponent() );
int h = parent.getHeight() - ow - ow;
boolean ltr = isLeftToRight();
JComponent[] leftComponents = ltr ? getLeadingComponents() : getTrailingComponents();
JComponent[] rightComponents = ltr ? getTrailingComponents() : getLeadingComponents();
// layout left components
int x = ow;
for( JComponent leftComponent : leftComponents ) {
if( leftComponent != null && leftComponent.isVisible() ) {
int cw = leftComponent.getPreferredSize().width;
leftComponent.setBounds( x, ow, cw, h );
x += cw;
}
}
// layout right components
x = parent.getWidth() - ow;
for( JComponent rightComponent : rightComponents ) {
if( rightComponent != null && rightComponent.isVisible() ) {
int cw = rightComponent.getPreferredSize().width;
x -= cw;
rightComponent.setBounds( x, ow, cw, h );
}
}
}
@Override
public void addLayoutComponent( Component comp, Object constraints ) {
if( delegate instanceof LayoutManager2 )
((LayoutManager2)delegate).addLayoutComponent( comp, constraints );
}
@Override
public Dimension maximumLayoutSize( Container target ) {
return (delegate instanceof LayoutManager2) ? ((LayoutManager2)delegate).maximumLayoutSize( target ) : null;
}
@Override
public float getLayoutAlignmentX( Container target ) {
return (delegate instanceof LayoutManager2) ? ((LayoutManager2)delegate).getLayoutAlignmentX( target ) : 0.5f;
}
@Override
public float getLayoutAlignmentY( Container target ) {
return (delegate instanceof LayoutManager2) ? ((LayoutManager2)delegate).getLayoutAlignmentY( target ) : 0.5f;
}
@Override
public void invalidateLayout( Container target ) {
if( delegate instanceof LayoutManager2 )
((LayoutManager2)delegate).invalidateLayout( target );
}
}
//---- class FlatDocumentListener -----------------------------------------
private class FlatDocumentListener
implements DocumentListener
{
@Override
public void insertUpdate( DocumentEvent e ) {
documentChanged( e );
}
@Override
public void removeUpdate( DocumentEvent e ) {
documentChanged( e );
}
@Override
public void changedUpdate( DocumentEvent e ) {
documentChanged( e );
}
}
} }

View File

@@ -360,7 +360,7 @@ public class FlatTitlePane
// show/hide icon // show/hide icon
iconLabel.setVisible( hasIcon ); iconLabel.setVisible( hasIcon );
leftPanel.setBorder( hasIcon ? null : new FlatEmptyBorder( 0, noIconLeftGap, 0, 0 ) ); leftPanel.setBorder( hasIcon ? null : FlatUIUtils.nonUIResource( new FlatEmptyBorder( 0, noIconLeftGap, 0, 0 ) ) );
updateNativeTitleBarHeightAndHitTestSpotsLater(); updateNativeTitleBarHeightAndHitTestSpotsLater();
} }

View File

@@ -121,7 +121,7 @@ public class FlatToolBarSeparatorUI
private void stylePropertyChange( JSeparator s ) { private void stylePropertyChange( JSeparator s ) {
if( shared && FlatStylingSupport.hasStyleProperty( s ) ) { if( shared && FlatStylingSupport.hasStyleProperty( s ) ) {
// unshare component UI if necessary // unshare component UI if necessary
// updateUI() invokes applyStyle() from installUI() // updateUI() invokes installStyle() from installUI()
s.updateUI(); s.updateUI();
} else } else
installStyle( s ); installStyle( s );

View File

@@ -52,6 +52,7 @@ import com.formdev.flatlaf.util.UIScale;
* *
* @uiDefault Tree.font Font * @uiDefault Tree.font Font
* @uiDefault Tree.background Color * @uiDefault Tree.background Color
* @uiDefault Tree.foreground Color unused
* @uiDefault Tree.hash Color * @uiDefault Tree.hash Color
* @uiDefault Tree.dropLineColor Color * @uiDefault Tree.dropLineColor Color
* @uiDefault Tree.expandedIcon Icon * @uiDefault Tree.expandedIcon Icon
@@ -136,12 +137,12 @@ public class FlatTreeUI
// for icons // for icons
// (needs to be public because icon classes are in another package) // (needs to be public because icon classes are in another package)
@Styleable(dot=true) public String iconArrowType; /** @since 2 */ @Styleable(dot=true) public String iconArrowType;
@Styleable(dot=true) public Color iconExpandedColor; /** @since 2 */ @Styleable(dot=true) public Color iconExpandedColor;
@Styleable(dot=true) public Color iconCollapsedColor; /** @since 2 */ @Styleable(dot=true) public Color iconCollapsedColor;
@Styleable(dot=true) public Color iconLeafColor; /** @since 2 */ @Styleable(dot=true) public Color iconLeafColor;
@Styleable(dot=true) public Color iconClosedColor; /** @since 2 */ @Styleable(dot=true) public Color iconClosedColor;
@Styleable(dot=true) public Color iconOpenColor; /** @since 2 */ @Styleable(dot=true) public Color iconOpenColor;
// only used via styling (not in UI defaults, but has likewise client properties) // only used via styling (not in UI defaults, but has likewise client properties)
/** @since 2 */ @Styleable protected boolean paintSelection = true; /** @since 2 */ @Styleable protected boolean paintSelection = true;

View File

@@ -188,6 +188,11 @@ public class FlatUIUtils
return (font instanceof UIResource) ? font.deriveFont( font.getStyle() ) : font; return (font instanceof UIResource) ? font.deriveFont( font.getStyle() ) : font;
} }
/** @since 2 */
public static Border nonUIResource( Border border ) {
return (border instanceof UIResource) ? new NonUIResourceBorder( border ) : border;
}
public static int minimumWidth( JComponent c, int minimumWidth ) { public static int minimumWidth( JComponent c, int minimumWidth ) {
return FlatClientProperties.clientPropertyInt( c, FlatClientProperties.MINIMUM_WIDTH, minimumWidth ); return FlatClientProperties.clientPropertyInt( c, FlatClientProperties.MINIMUM_WIDTH, minimumWidth );
} }
@@ -273,6 +278,32 @@ public class FlatUIUtils
: 0; : 0;
} }
/**
* Returns the scaled line thickness used to compute the border insets.
*
* @since 2
*/
public static float getBorderLineWidth( JComponent c ) {
FlatBorder border = getOutsideFlatBorder( c );
return (border != null)
? UIScale.scale( (float) border.getLineWidth( c ) )
: 0;
}
/**
* Returns the scaled thickness of the border.
* This includes the outer focus border and the actual component border.
*
* @since 2
*/
public static int getBorderFocusAndLineWidth( JComponent c ) {
FlatBorder border = getOutsideFlatBorder( c );
return (border != null)
? Math.round( UIScale.scale( (float) border.getFocusWidth( c ) )
+ UIScale.scale( (float) border.getLineWidth( c ) ) )
: 0;
}
/** /**
* Returns the scaled arc diameter of the border for the given component. * Returns the scaled arc diameter of the border for the given component.
*/ */
@@ -982,4 +1013,31 @@ debug*/
repaintComponent.repaint(); repaintComponent.repaint();
} }
} }
//---- class NonUIResourceBorder ------------------------------------------
private static class NonUIResourceBorder
implements Border
{
private final Border delegate;
NonUIResourceBorder( Border delegate ) {
this.delegate = delegate;
}
@Override
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
delegate.paintBorder( c, g, x, y, width, height );
}
@Override
public Insets getBorderInsets( Component c ) {
return delegate.getBorderInsets( c );
}
@Override
public boolean isBorderOpaque() {
return delegate.isBorderOpaque();
}
}
} }

View File

@@ -90,6 +90,10 @@ class FlatWindowsNativeWindowBorder
if( !SystemInfo.isWindows_10_orLater ) if( !SystemInfo.isWindows_10_orLater )
return null; return null;
// requires x86 architecture
if( !SystemInfo.isX86 && !SystemInfo.isX86_64 )
return null;
// load native library // load native library
if( nativeLibrary == null ) { if( nativeLibrary == null ) {
if( !SystemInfo.isJava_9_orLater ) { if( !SystemInfo.isJava_9_orLater ) {
@@ -167,11 +171,18 @@ class FlatWindowsNativeWindowBorder
return; return;
// install // install
WndProc wndProc = new WndProc( window ); try {
if( wndProc.hwnd == 0 ) WndProc wndProc = new WndProc( window );
return; if( wndProc.hwnd == 0 )
return;
windowsMap.put( window, wndProc ); windowsMap.put( window, wndProc );
} catch( UnsatisfiedLinkError ex ) {
// catch for the case that the operating system prevents execution of DLL
// (e.g. if DLLs in temp folder are restricted)
// --> continue application without custom decorations
LoggingFacade.INSTANCE.logSevere( null, ex );
}
} }
private void uninstall( Window window ) { private void uninstall( Window window ) {

View File

@@ -1,83 +0,0 @@
/*
* Copyright 2021 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 javax.swing.JComponent;
import javax.swing.border.Border;
/**
* Border that automatically animates painting on component value changes.
* <p>
* {@link #getAnimatableValues(Component)} returns the animatable value(s) of the component.
* If the value(s) have changed, then {@link #paintAnimated(Component, Graphics2D, int, int, int, int, float[])}
* is invoked multiple times with animated value(s) (from old value(s) to new value(s)).
* If {@link #getAnimatableValues(Component)} returns multiple values, then each value
* gets its own independent animation, which may start/end at different points in time,
* may have different duration, resolution and interpolator.
* <p>
* Example for an animated border:
* <pre>
* private class MyAnimatedBorder
* implements AnimatedBorder
* {
* &#64;Override
* public float[] getAnimatableValues( Component c ) {
* return new float[] { c.isFocusOwner() ? 1 : 0 };
* }
*
* &#64;Override
* public void paintAnimated( Component c, Graphics2D g, int x, int y, int width, int height, float[] animatedValues ) {
* int lh = UIScale.scale( 2 );
*
* g.setColor( Color.blue );
* g.fillRect( x, y + height - lh, Math.round( width * animatedValues[0] ), lh );
* }
*
* &#64;Override
* public Insets getBorderInsets( Component c ) {
* return UIScale.scale( new Insets( 4, 4, 4, 4 ) );
* }
*
* &#64;Override public boolean isBorderOpaque() { return false; }
* }
*
* // sample usage
* JTextField textField = new JTextField();
* textField.setBorder( new MyAnimatedBorder() );
* </pre>
*
* Animation works only if the component passed to {@link #paintBorder(Component, Graphics, int, int, int, int)}
* is a instance of {@link JComponent}.
* A client property is set on the component to store the animation state.
*
* @author Karl Tauber
* @since 2
*/
public interface AnimatedBorder
extends Border, AnimatedPainter
{
/**
* Invokes {@link #paintWithAnimation(Component, Graphics, int, int, int, int)}.
*/
@Override
default void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
paintWithAnimation( c, g, x, y, width, height );
}
}

View File

@@ -18,87 +18,62 @@ package com.formdev.flatlaf.util;
import java.awt.Component; import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
import com.formdev.flatlaf.util.Animator.Interpolator;
/** /**
* Icon that automatically animates painting on component value changes. * Icon that automatically animates painting on component value changes.
* <p> * <p>
* {@link #getAnimatableValues(Component)} returns the animatable value(s) of the component. * {@link #getValue(Component)} returns the value of the component.
* If the value(s) have changed, then {@link #paintAnimated(Component, Graphics2D, int, int, int, int, float[])} * If the value changes, then {@link #paintIconAnimated(Component, Graphics, int, int, float)}
* is invoked multiple times with animated value(s) (from old value(s) to new value(s)). * is invoked multiple times with animated value (from old value to new value).
* If {@link #getAnimatableValues(Component)} returns multiple values, then each value
* gets its own independent animation, which may start/end at different points in time,
* may have different duration, resolution and interpolator.
* <p> * <p>
* Example for an animated icon: * Example for an animated icon:
* <pre> * <pre>
* private class MyAnimatedIcon * private class AnimatedMinimalTestIcon
* implements AnimatedIcon * implements AnimatedIcon
* { * {
* &#64;Override
* public float[] getAnimatableValues( Component c ) {
* return new float[] { ((AbstractButton)c).isSelected() ? 1 : 0 };
* }
*
* &#64;Override public int getIconWidth() { return 100; } * &#64;Override public int getIconWidth() { return 100; }
* &#64;Override public int getIconHeight() { return 20; } * &#64;Override public int getIconHeight() { return 20; }
* *
* &#64;Override * &#64;Override
* public void paintAnimated( Component c, Graphics2D g, int x, int y, int width, int height, float[] animatedValues ) { * public void paintIconAnimated( Component c, Graphics g, int x, int y, float animatedValue ) {
* int w = getIconWidth();
* int h = getIconHeight();
*
* g.setColor( Color.red ); * g.setColor( Color.red );
* g.drawRect( x, y, width - 1, height - 1 ); * g.drawRect( x, y, w - 1, h - 1 );
* g.fillRect( x, y, Math.round( width * animatedValues[0] ), height ); * g.fillRect( x, y, Math.round( w * animatedValue ), h );
* }
*
* &#64;Override
* public float getValue( Component c ) {
* return ((AbstractButton)c).isSelected() ? 1 : 0;
* } * }
* } * }
* *
* // sample usage * // sample usage
* JCheckBox checkBox = new JCheckBox( "test" ); * JCheckBox checkBox = new JCheckBox( "test" );
* checkBox.setIcon( new MyAnimatedIcon() ); * checkBox.setIcon( new AnimatedMinimalTestIcon() );
* </pre> * </pre>
* *
* Animation works only if the component passed to {@link #paintIcon(Component, Graphics, int, int)} * Animation works only if the component passed to {@link #paintIcon(Component, Graphics, int, int)}
* is an instance of {@link JComponent}. * is a instance of {@link JComponent}.
* A client property is set on the component to store the animation state. * A client property is set on the component to store the animation state.
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
public interface AnimatedIcon public interface AnimatedIcon
extends Icon, AnimatedPainter extends Icon
{ {
/**
* {@inheritDoc}
*
* @since 2
*/
@Override @Override
default float[] getAnimatableValues( Component c ) { public default void paintIcon( Component c, Graphics g, int x, int y ) {
// for compatibility AnimationSupport.paintIcon( this, c, g, x, y );
return new float[] { getValue( c ) };
} }
/** /**
* Invokes {@link #paintWithAnimation(Component, Graphics, int, int, int, int)}. * Paints the icon for the given animated value.
*/
@Override
default void paintIcon( Component c, Graphics g, int x, int y ) {
paintWithAnimation( c, g, x, y, getIconWidth(), getIconHeight() );
}
/**
* {@inheritDoc}
*
* @since 2
*/
@Override
default void paintAnimated( Component c, Graphics2D g, int x, int y, int width, int height, float[] animatedValues ) {
// for compatibility
paintIconAnimated( c, g, x, y, animatedValues[0] );
}
/**
* Paints the icon for the given (animated) value.
* *
* @param c the component that this icon belongs to * @param c the component that this icon belongs to
* @param g the graphics context * @param g the graphics context
@@ -107,45 +82,52 @@ public interface AnimatedIcon
* @param animatedValue the animated value, which is either equal to what {@link #getValue(Component)} * @param animatedValue the animated value, which is either equal to what {@link #getValue(Component)}
* returned, or somewhere between the previous value and the latest value * returned, or somewhere between the previous value and the latest value
* that {@link #getValue(Component)} returned * that {@link #getValue(Component)} returned
*
* @deprecated override {@link #paintAnimated(Component, Graphics2D, int, int, int, int, float[])} instead
*/ */
@Deprecated void paintIconAnimated( Component c, Graphics g, int x, int y, float animatedValue );
default void paintIconAnimated( Component c, Graphics g, int x, int y, float animatedValue ) {
}
/** /**
* Gets the animatable value of the component. * Gets the value of the component.
* <p> * <p>
* This can be any value and depends on the component. * This can be any value and depends on the component.
* If the value changes, then this class animates from the old value to the new one. * If the value changes, then this class animates from the old value to the new one.
* <p> * <p>
* For a toggle button this could be {@code 0} for off and {@code 1} for on. * For a toggle button this could be {@code 0} for off and {@code 1} for on.
*
* @deprecated override {@link #getAnimatableValues(Component)} instead
*/ */
@Deprecated float getValue( Component c );
default float getValue( Component c ) {
return 0; /**
* Returns whether animation is enabled for this icon (default is {@code true}).
*/
default boolean isAnimationEnabled() {
return true;
} }
/** /**
* {@inheritDoc} * Returns the duration of the animation in milliseconds (default is 150).
*
* @since TODO
*/ */
@Override default int getAnimationDuration() {
default Object getAnimationClientPropertyKey() { return 150;
// for compatibility }
return getClientPropertyKey();
/**
* Returns the resolution of the animation in milliseconds (default is 10).
* Resolution is the amount of time between timing events.
*/
default int getAnimationResolution() {
return 10;
}
/**
* Returns the interpolator for the animation.
* Default is {@link CubicBezierEasing#STANDARD_EASING}.
*/
default Interpolator getAnimationInterpolator() {
return CubicBezierEasing.STANDARD_EASING;
} }
/** /**
* Returns the client property key used to store the animation support. * Returns the client property key used to store the animation support.
*
* @deprecated override {@link #getAnimationClientPropertyKey()} instead
*/ */
@Deprecated
default Object getClientPropertyKey() { default Object getClientPropertyKey() {
return getClass(); return getClass();
} }
@@ -153,25 +135,115 @@ public interface AnimatedIcon
//---- class AnimationSupport --------------------------------------------- //---- class AnimationSupport ---------------------------------------------
/** /**
* Animation support. * Animation support class that stores the animation state and implements the animation.
*/ */
@Deprecated
class AnimationSupport class AnimationSupport
{ {
/** private float startValue;
* @deprecated use {@link AnimatedPainter#paintWithAnimation(Component, Graphics, int, int, int, int)} instead private float targetValue;
*/ private float animatedValue;
@Deprecated private float fraction;
private Animator animator;
// last x,y coordinates of the icon needed to repaint while animating
private int x;
private int y;
public static void paintIcon( AnimatedIcon icon, Component c, Graphics g, int x, int y ) { public static void paintIcon( AnimatedIcon icon, Component c, Graphics g, int x, int y ) {
AnimatedPainterSupport.paint( icon, c, (Graphics2D) g, x, y, icon.getIconWidth(), icon.getIconHeight() ); if( !isAnimationEnabled( icon, c ) ) {
// paint without animation if animation is disabled or
// component is not a JComponent and therefore does not support
// client properties, which are required to keep animation state
paintIconImpl( icon, c, g, x, y, null );
return;
}
JComponent jc = (JComponent) c;
Object key = icon.getClientPropertyKey();
AnimationSupport as = (AnimationSupport) jc.getClientProperty( key );
if( as == null ) {
// painted first time --> do not animate, but remember current component value
as = new AnimationSupport();
as.startValue = as.targetValue = as.animatedValue = icon.getValue( c );
as.x = x;
as.y = y;
jc.putClientProperty( key, as );
} else {
// get component value
float value = icon.getValue( c );
if( value != as.targetValue ) {
// value changed --> (re)start animation
if( as.animator == null ) {
// create animator
AnimationSupport as2 = as;
as.animator = new Animator( icon.getAnimationDuration(), fraction -> {
// check whether component was removed while animation is running
if( !c.isDisplayable() ) {
as2.animator.stop();
return;
}
// compute animated value
as2.animatedValue = as2.startValue + ((as2.targetValue - as2.startValue) * fraction);
as2.fraction = fraction;
// repaint icon
c.repaint( as2.x, as2.y, icon.getIconWidth(), icon.getIconHeight() );
}, () -> {
as2.startValue = as2.animatedValue = as2.targetValue;
as2.animator = null;
} );
}
if( as.animator.isRunning() ) {
// if animation is still running, restart it from the current
// animated value to the new target value with reduced duration
as.animator.cancel();
int duration2 = (int) (icon.getAnimationDuration() * as.fraction);
if( duration2 > 0 )
as.animator.setDuration( duration2 );
as.startValue = as.animatedValue;
} else {
// new animation
as.animator.setDuration( icon.getAnimationDuration() );
as.animator.setResolution( icon.getAnimationResolution() );
as.animator.setInterpolator( icon.getAnimationInterpolator() );
as.animatedValue = as.startValue;
}
as.targetValue = value;
as.animator.start();
}
as.x = x;
as.y = y;
}
paintIconImpl( icon, c, g, x, y, as );
}
private static void paintIconImpl( AnimatedIcon icon, Component c, Graphics g, int x, int y, AnimationSupport as ) {
float value = (as != null) ? as.animatedValue : icon.getValue( c );
icon.paintIconAnimated( c, g, x, y, value );
}
private static boolean isAnimationEnabled( AnimatedIcon icon, Component c ) {
return Animator.useAnimation() && icon.isAnimationEnabled() && c instanceof JComponent;
} }
/**
* @deprecated use {@link AnimatedPainter#saveRepaintLocation(AnimatedPainter, Component, int, int)} instead
*/
@Deprecated
public static void saveIconLocation( AnimatedIcon icon, Component c, int x, int y ) { public static void saveIconLocation( AnimatedIcon icon, Component c, int x, int y ) {
AnimatedPainterSupport.saveRepaintLocation( icon, c, x, y ); if( !isAnimationEnabled( icon, c ) )
return;
AnimationSupport as = (AnimationSupport) ((JComponent)c).getClientProperty( icon.getClientPropertyKey() );
if( as != null ) {
as.x = x;
as.y = y;
}
} }
} }
} }

View File

@@ -1,181 +0,0 @@
/*
* Copyright 2021 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 javax.swing.JComponent;
import com.formdev.flatlaf.util.Animator.Interpolator;
/**
* Painter that automatically animates painting on component value(s) changes.
* <p>
* {@link #getAnimatableValues(Component)} returns the animatable value(s) of the component.
* If the value(s) have changed, then {@link #paintAnimated(Component, Graphics2D, int, int, int, int, float[])}
* is invoked multiple times with animated value(s) (from old value(s) to new value(s)).
* If {@link #getAnimatableValues(Component)} returns multiple values, then each value
* gets its own independent animation, which may start/end at different points in time,
* may have different duration, resolution and interpolator.
* <p>
* See {@link AnimatedBorder} or {@link AnimatedIcon} for examples.
* <p>
* Animation works only if the component passed to {@link #paintWithAnimation(Component, Graphics, int, int, int, int)}
* is an instance of {@link JComponent}.
* A client property is set on the component to store the animation state.
*
* @author Karl Tauber
* @since 2
*/
public interface AnimatedPainter
{
/**
* Gets the animatable value(s) of the component.
* <p>
* This can be any value(s) and depends on the component.
* If the value(s) changes, then this class animates from the old value(s) to the new ones.
* If multiple values are returned, then each value gets its own independent animation.
* <p>
* For a toggle button this could be {@code 0} for off and {@code 1} for on.
* A complex check box could return values for selected, hover, pressed and focused states.
* The painter then can show independent animations for those states.
*/
float[] getAnimatableValues( Component c );
/**
* Starts painting.
* Either invokes {@link #paintAnimated(Component, Graphics2D, int, int, int, int, float[])}
* once to paint current value(s) (see {@link #getAnimatableValues(Component)}. Or if value(s) has
* changed, compared to last painting, then it starts an animation and invokes
* {@link #paintAnimated(Component, Graphics2D, int, int, int, int, float[])}
* multiple times with animated value(s) (from old value(s) to new value(s)).
*
* @param c the component that this painter belongs to
* @param g the graphics context
* @param x the x coordinate of the paint area
* @param y the y coordinate of the paint area
* @param width the width of the paint area
* @param height the height of the paint area
*/
default void paintWithAnimation( Component c, Graphics g, int x, int y, int width, int height ) {
AnimatedPainterSupport.paint( this, c, (Graphics2D) g, x, y, width, height );
}
/**
* Paints the given (animated) value(s).
* <p>
* Invoked from {@link #paintWithAnimation(Component, Graphics, int, int, int, int)}.
*
* @param c the component that this painter belongs to
* @param g the graphics context
* @param x the x coordinate of the paint area
* @param y the y coordinate of the paint area
* @param width the width of the paint area
* @param height the height of the paint area
* @param animatedValues the animated values, which are either equal to what {@link #getAnimatableValues(Component)}
* returned, or somewhere between the previous values and the latest values
* that {@link #getAnimatableValues(Component)} returned
*/
void paintAnimated( Component c, Graphics2D g, int x, int y, int width, int height, float[] animatedValues );
/**
* Invoked from animator to repaint an area.
* <p>
* Useful to limit the repaint region. E.g. if only the bottom border is animated.
* If more than one border side is animated (e.g. bottom and right side), then it
* makes no sense to do separate repaints because the Swing repaint manager unions
* the regions and the whole component is repainted.
* <p>
* The default implementation repaints the whole given area.
*/
default void repaintDuringAnimation( Component c, int x, int y, int width, int height ) {
c.repaint( x, y, width, height );
}
/**
* Returns whether animation is enabled for this painter (default is {@code true}).
*/
default boolean isAnimationEnabled() {
return true;
}
/**
* Returns the duration of the animation in milliseconds (default is 150).
*/
default int getAnimationDuration() {
return 150;
}
/**
* Returns the resolution of the animation in milliseconds (default is 10).
* Resolution is the amount of time between timing events.
*/
default int getAnimationResolution() {
return 10;
}
/**
* Returns the interpolator for the animation.
* Default is {@link CubicBezierEasing#STANDARD_EASING}.
*/
default Interpolator getAnimationInterpolator() {
return CubicBezierEasing.STANDARD_EASING;
}
/**
* Returns the duration of the animation in milliseconds (default is 150)
* for the given value index and value.
*/
default int getAnimationDuration( int valueIndex, float value ) {
return getAnimationDuration();
}
/**
* Returns the resolution of the animation in milliseconds (default is 10)
* for the given value index and value.
* Resolution is the amount of time between timing events.
*/
default int getAnimationResolution( int valueIndex, float value ) {
return getAnimationResolution();
}
/**
* Returns the interpolator for the animation
* for the given value index and value.
* Default is {@link CubicBezierEasing#STANDARD_EASING}.
*/
default Interpolator getAnimationInterpolator( int valueIndex, float value ) {
return getAnimationInterpolator();
}
/**
* Returns the client property key used to store the animation support.
*/
default Object getAnimationClientPropertyKey() {
return getClass();
}
/**
* Saves location for repainting animated area with
* {@link AnimatedPainter#repaintDuringAnimation(Component, int, int, int, int)}.
* Only needed when graphics context passed to {@link #paintWithAnimation(Component, Graphics, int, int, int, int)}
* uses transformed location.
*/
static void saveRepaintLocation( AnimatedPainter painter, Component c, int x, int y ) {
AnimatedPainterSupport.saveRepaintLocation( painter, c, x, y );
}
}

View File

@@ -1,185 +0,0 @@
/*
* Copyright 2021 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.Graphics2D;
import javax.swing.JComponent;
/**
* Animation support class that stores the animation state and implements the animation.
*
* @author Karl Tauber
* @since 2
*/
class AnimatedPainterSupport
{
private final int valueIndex;
private float startValue;
private float targetValue;
private float animatedValue;
private float fraction;
private Animator animator;
// last bounds of the paint area needed to repaint while animating
private int x;
private int y;
private int width;
private int height;
private AnimatedPainterSupport( int valueIndex ) {
this.valueIndex = valueIndex;
}
static void paint( AnimatedPainter painter, Component c, Graphics2D g,
int x, int y, int width, int height )
{
// get animatable component values
float[] values = painter.getAnimatableValues( c );
if( !isAnimationEnabled( painter, c ) ) {
// paint without animation if animation is disabled or
// component is not a JComponent and therefore does not support
// client properties, which are required to keep animation state
painter.paintAnimated( c, g, x, y, width, height, values );
return;
}
JComponent jc = (JComponent) c;
Object key = painter.getAnimationClientPropertyKey();
AnimatedPainterSupport[] ass = (AnimatedPainterSupport[]) jc.getClientProperty( key );
// check whether length of values array has changed
if( ass != null && ass.length != values.length ) {
// cancel all running animations
for( int i = 0; i < ass.length; i++ ) {
AnimatedPainterSupport as = ass[i];
if( as.animator != null )
as.animator.cancel();
}
ass = null;
}
if( ass == null ) {
ass = new AnimatedPainterSupport[values.length];
jc.putClientProperty( key, ass );
}
for( int i = 0; i < ass.length; i++ ) {
AnimatedPainterSupport as = ass[i];
float value = values[i];
if( as == null ) {
// painted first time --> do not animate, but remember current component value
as = new AnimatedPainterSupport( i );
as.startValue = as.targetValue = as.animatedValue = value;
ass[i] = as;
} else if( value != as.targetValue ) {
// value changed --> (re)start animation
int animationDuration = painter.getAnimationDuration( as.valueIndex, value );
// do not animate if animation duration (for current value) is zero
if( animationDuration <= 0 ) {
if( as.animator != null ) {
as.animator.cancel();
as.animator = null;
}
as.startValue = as.targetValue = as.animatedValue = value;
as.fraction = 0;
continue;
}
if( as.animator == null ) {
// create animator
AnimatedPainterSupport as2 = as;
as.animator = new Animator( 1, fraction -> {
// check whether component was removed while animation is running
if( !c.isDisplayable() ) {
as2.animator.stop();
return;
}
// compute animated value
as2.animatedValue = as2.startValue + ((as2.targetValue - as2.startValue) * fraction);
as2.fraction = fraction;
// repaint
painter.repaintDuringAnimation( c, as2.x, as2.y, as2.width, as2.height );
}, () -> {
as2.startValue = as2.animatedValue = as2.targetValue;
as2.animator = null;
} );
}
if( as.animator.isRunning() ) {
// if animation is still running, restart it from the current
// animated value to the new target value with reduced duration
as.animator.cancel();
int duration2 = (int) (animationDuration * as.fraction);
if( duration2 > 0 )
as.animator.setDuration( duration2 );
as.startValue = as.animatedValue;
} else {
// new animation
as.animator.setDuration( animationDuration );
as.animatedValue = as.startValue;
}
// update animator for new value
as.animator.setResolution( painter.getAnimationResolution( as.valueIndex, value ) );
as.animator.setInterpolator( painter.getAnimationInterpolator( as.valueIndex, value ) );
// start animation
as.targetValue = value;
as.animator.start();
}
as.x = x;
as.y = y;
as.width = width;
as.height = height;
}
float[] animatedValues = new float[ass.length];
for( int i = 0; i < ass.length; i++ )
animatedValues[i] = ass[i].animatedValue;
painter.paintAnimated( c, g, x, y, width, height, animatedValues );
}
private static boolean isAnimationEnabled( AnimatedPainter painter, Component c ) {
return Animator.useAnimation() && painter.isAnimationEnabled() && c instanceof JComponent;
}
static void saveRepaintLocation( AnimatedPainter painter, Component c, int x, int y ) {
if( !isAnimationEnabled( painter, c ) )
return;
AnimatedPainterSupport[] ass = (AnimatedPainterSupport[]) ((JComponent)c).getClientProperty( painter.getAnimationClientPropertyKey() );
if( ass != null ) {
for( int i = 0; i < ass.length; i++ ) {
AnimatedPainterSupport as = ass[i];
as.x = x;
as.y = y;
}
}
}
}

View File

@@ -39,7 +39,9 @@ public class SystemInfo
public static final boolean isMacOS_10_15_Catalina_orLater; public static final boolean isMacOS_10_15_Catalina_orLater;
// OS architecture // OS architecture
/** @since 2 */ public static final boolean isX86;
/** @since 1.1 */ public static final boolean isX86_64; /** @since 1.1 */ public static final boolean isX86_64;
/** @since 2 */ public static final boolean isAARCH64;
// Java versions // Java versions
public static final long javaVersion; public static final long javaVersion;
@@ -76,7 +78,9 @@ public class SystemInfo
// OS architecture // OS architecture
String osArch = System.getProperty( "os.arch" ); String osArch = System.getProperty( "os.arch" );
isX86 = osArch.equals( "x86" );
isX86_64 = osArch.equals( "amd64" ) || osArch.equals( "x86_64" ); isX86_64 = osArch.equals( "amd64" ) || osArch.equals( "x86_64" );
isAARCH64 = osArch.equals( "aarch64" );
// Java versions // Java versions
javaVersion = scanVersion( System.getProperty( "java.version" ) ); javaVersion = scanVersion( System.getProperty( "java.version" ) );

View File

@@ -355,3 +355,19 @@ ToolTip.background = shade(@background,50%)
#---- Tree ---- #---- Tree ----
Tree.hash = lighten($Tree.background,5%) Tree.hash = lighten($Tree.background,5%)
#---- Styles ------------------------------------------------------------------
#---- inTextField ----
# for leading/trailing components in text fields
[style]Button.inTextField = \
focusable: false; \
toolbar.margin: 1,1,1,1; \
toolbar.spacingInsets: 1,1,1,1; \
background: $TextField.background; \
toolbar.hoverBackground: lighten($TextField.background,4%,derived); \
toolbar.pressedBackground: lighten($TextField.background,6%,derived); \
toolbar.selectedBackground: lighten($TextField.background,12%,derived)

View File

@@ -58,7 +58,7 @@ mini.font = -3
[mac]semibold.font = "HelveticaNeue-Medium" [mac]semibold.font = "HelveticaNeue-Medium"
# Linux # Linux
[linux]light.font = "Lato Light", "Ubuntu Light", "Cantarell Light" [linux]light.font = "Lato Light", "Ubuntu Light", "Cantarell Light"
[linux]semibold.font = "Lato Semibold", "Ubuntu Medium" [linux]semibold.font = "Lato Semibold", "Ubuntu Medium", "Montserrat SemiBold"
# fallback for unknown platform # fallback for unknown platform
light.font = +0 light.font = +0
semibold.font = +0 semibold.font = +0
@@ -227,6 +227,7 @@ Button.defaultButtonFollowsFocus = false
Button.borderWidth = 1 Button.borderWidth = 1
Button.default.borderWidth = 1 Button.default.borderWidth = 1
# for buttons in toolbars
Button.toolbar.margin = 3,3,3,3 Button.toolbar.margin = 3,3,3,3
Button.toolbar.spacingInsets = 1,2,1,2 Button.toolbar.spacingInsets = 1,2,1,2
@@ -430,6 +431,7 @@ MenuItem.checkIcon = null
MenuItem.margin = @menuItemMargin MenuItem.margin = @menuItemMargin
MenuItem.opaque = false MenuItem.opaque = false
MenuItem.borderPainted = true MenuItem.borderPainted = true
MenuItem.verticallyAlignText = true
MenuItem.background = @menuBackground MenuItem.background = @menuBackground
MenuItem.checkBackground = @menuCheckBackground MenuItem.checkBackground = @menuCheckBackground
MenuItem.checkMargins = 2,2,2,2 MenuItem.checkMargins = 2,2,2,2
@@ -439,7 +441,7 @@ MenuItem.iconTextGap = 6
MenuItem.textAcceleratorGap = 24 MenuItem.textAcceleratorGap = 24
MenuItem.textNoAcceleratorGap = 6 MenuItem.textNoAcceleratorGap = 6
MenuItem.acceleratorArrowGap = 2 MenuItem.acceleratorArrowGap = 2
MenuItem.acceleratorDelimiter = - MenuItem.acceleratorDelimiter = +
[mac]MenuItem.acceleratorDelimiter = [mac]MenuItem.acceleratorDelimiter =
# for MenuItem.selectionType = underline # for MenuItem.selectionType = underline
@@ -482,7 +484,10 @@ PasswordField.placeholderForeground = @disabledForeground
PasswordField.iconTextGap = 4 PasswordField.iconTextGap = 4
PasswordField.echoChar = \u2022 PasswordField.echoChar = \u2022
PasswordField.showCapsLock = true PasswordField.showCapsLock = true
PasswordField.showRevealButton = false
PasswordField.capsLockIcon = com.formdev.flatlaf.icons.FlatCapsLockIcon PasswordField.capsLockIcon = com.formdev.flatlaf.icons.FlatCapsLockIcon
PasswordField.revealIcon = com.formdev.flatlaf.icons.FlatRevealIcon
PasswordField.revealIconColor = lazy(Actions.Grey)
#---- Popup ---- #---- Popup ----
@@ -888,3 +893,33 @@ Tree.icon.collapsedColor = @icon
Tree.icon.leafColor = @icon Tree.icon.leafColor = @icon
Tree.icon.closedColor = @icon Tree.icon.closedColor = @icon
Tree.icon.openColor = @icon Tree.icon.openColor = @icon
#---- Styles ------------------------------------------------------------------
#---- inTextField ----
# for leading/trailing components in text fields
[style]ToggleButton.inTextField = $[style]Button.inTextField
[style]ToolBar.inTextField = \
floatable: false; \
opaque: false; \
borderMargins: 0,0,0,0
[style]ToolBarSeparator.inTextField = \
separatorWidth: 3
#---- clearButton ----
# for clear/cancel button in text fields
[style]Button.clearButton = \
icon: com.formdev.flatlaf.icons.FlatClearIcon; \
focusable: false; \
toolbar.margin: 1,1,1,1; \
toolbar.spacingInsets: 1,1,1,1; \
background: $TextField.background; \
toolbar.hoverBackground: $TextField.background; \
toolbar.pressedBackground: $TextField.background

View File

@@ -362,3 +362,19 @@ ToolTip.background = lighten(@background,3%)
#---- Tree ---- #---- Tree ----
Tree.hash = darken($Tree.background,10%) Tree.hash = darken($Tree.background,10%)
#---- Styles ------------------------------------------------------------------
#---- inTextField ----
# for leading/trailing components in text fields
[style]Button.inTextField = \
focusable: false; \
toolbar.margin: 1,1,1,1; \
toolbar.spacingInsets: 1,1,1,1; \
background: $TextField.background; \
toolbar.hoverBackground: darken($TextField.background,4%,derived); \
toolbar.pressedBackground: darken($TextField.background,8%,derived); \
toolbar.selectedBackground: darken($TextField.background,12%,derived)

View File

@@ -150,6 +150,7 @@ ToggleButton.endBackground = $ToggleButton.background
[Gruvbox_Dark_Soft]ToggleButton.selectedBackground = $ToggleButton.selectedBackground [Gruvbox_Dark_Soft]ToggleButton.selectedBackground = $ToggleButton.selectedBackground
[Gruvbox_Dark_Soft]ToggleButton.toolbar.selectedBackground = $ToggleButton.toolbar.selectedBackground [Gruvbox_Dark_Soft]ToggleButton.toolbar.selectedBackground = $ToggleButton.toolbar.selectedBackground
[Hiberbee_Dark]TabbedPane.focusColor = #5A5A5A
[Hiberbee_Dark]ToggleButton.selectedBackground = $ToggleButton.selectedBackground [Hiberbee_Dark]ToggleButton.selectedBackground = $ToggleButton.selectedBackground
[Hiberbee_Dark]ToggleButton.selectedBackground = $ToggleButton.selectedBackground [Hiberbee_Dark]ToggleButton.selectedBackground = $ToggleButton.selectedBackground
[Hiberbee_Dark]ToggleButton.toolbar.selectedBackground = $ToggleButton.toolbar.selectedBackground [Hiberbee_Dark]ToggleButton.toolbar.selectedBackground = $ToggleButton.toolbar.selectedBackground
@@ -210,11 +211,17 @@ ToggleButton.endBackground = $ToggleButton.background
[GitHub_Contrast]ProgressBar.selectionBackground = #222 [GitHub_Contrast]ProgressBar.selectionBackground = #222
[GitHub_Contrast]ProgressBar.selectionForeground = #222 [GitHub_Contrast]ProgressBar.selectionForeground = #222
[Light_Owl]List.selectionInactiveForeground = lazy(List.foreground)
[Light_Owl]ProgressBar.selectionBackground = #111 [Light_Owl]ProgressBar.selectionBackground = #111
[Light_Owl]ProgressBar.selectionForeground = #fff [Light_Owl]ProgressBar.selectionForeground = #fff
[Light_Owl]TabbedPane.selectedForeground = lazy(TabbedPane.foreground)
[Light_Owl]Table.selectionForeground = lazy(Table.foreground)
[Light_Owl_Contrast]List.selectionInactiveForeground = lazy(List.foreground)
[Light_Owl_Contrast]ProgressBar.selectionBackground = #111 [Light_Owl_Contrast]ProgressBar.selectionBackground = #111
[Light_Owl_Contrast]ProgressBar.selectionForeground = #fff [Light_Owl_Contrast]ProgressBar.selectionForeground = #fff
[Light_Owl_Contrast]TabbedPane.selectedForeground = lazy(TabbedPane.foreground)
[Light_Owl_Contrast]Table.selectionForeground = lazy(Table.foreground)
[Material_Lighter]ProgressBar.selectionBackground = #222 [Material_Lighter]ProgressBar.selectionBackground = #222
[Material_Lighter]ProgressBar.selectionForeground = #fff [Material_Lighter]ProgressBar.selectionForeground = #fff

View File

@@ -22,8 +22,12 @@ import java.awt.Dimension;
import java.awt.Font; import java.awt.Font;
import java.awt.Insets; import java.awt.Insets;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.UIDefaults.ActiveValue; import javax.swing.UIDefaults.ActiveValue;
import javax.swing.UIDefaults.LazyValue;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import com.formdev.flatlaf.ui.FlatEmptyBorder;
import com.formdev.flatlaf.ui.FlatLineBorder;
/** /**
* @author Karl Tauber * @author Karl Tauber
@@ -46,8 +50,8 @@ public class TestUIDefaultsLoader
assertEquals( 1.23f, UIDefaultsLoader.parseValue( "dummy", "1.23", null ) ); assertEquals( 1.23f, UIDefaultsLoader.parseValue( "dummy", "1.23", null ) );
assertEquals( 1.23f, UIDefaultsLoader.parseValue( "dummyWidth", "1.23", null ) ); assertEquals( 1.23f, UIDefaultsLoader.parseValue( "dummyWidth", "1.23", null ) );
assertEquals( new Insets( 2,2,2,2 ), UIDefaultsLoader.parseValue( "dummyInsets", "2,2,2,2", null ) ); assertEquals( new Insets( 1,2,3,4 ), UIDefaultsLoader.parseValue( "dummyInsets", "1,2,3,4", null ) );
assertEquals( new Dimension( 2,2 ), UIDefaultsLoader.parseValue( "dummySize", "2,2", null ) ); assertEquals( new Dimension( 1,2 ), UIDefaultsLoader.parseValue( "dummySize", "1,2", null ) );
assertEquals( new Color( 0xff0000 ), UIDefaultsLoader.parseValue( "dummy", "#f00", null ) ); assertEquals( new Color( 0xff0000 ), UIDefaultsLoader.parseValue( "dummy", "#f00", null ) );
assertEquals( new Color( 0xff0000 ), UIDefaultsLoader.parseValue( "dummyColor", "#f00", null ) ); assertEquals( new Color( 0xff0000 ), UIDefaultsLoader.parseValue( "dummyColor", "#f00", null ) );
} }
@@ -70,11 +74,35 @@ public class TestUIDefaultsLoader
assertEquals( 1.23f, UIDefaultsLoader.parseValue( "dummy", "1.23", float.class ) ); assertEquals( 1.23f, UIDefaultsLoader.parseValue( "dummy", "1.23", float.class ) );
assertEquals( 1.23f, UIDefaultsLoader.parseValue( "dummy", "1.23", Float.class ) ); assertEquals( 1.23f, UIDefaultsLoader.parseValue( "dummy", "1.23", Float.class ) );
assertEquals( new Insets( 2,2,2,2 ), UIDefaultsLoader.parseValue( "dummy", "2,2,2,2", Insets.class ) ); assertEquals( new Insets( 1,2,3,4 ), UIDefaultsLoader.parseValue( "dummy", "1,2,3,4", Insets.class ) );
assertEquals( new Dimension( 2,2 ), UIDefaultsLoader.parseValue( "dummy", "2,2", Dimension.class ) ); assertEquals( new Dimension( 1,2 ), UIDefaultsLoader.parseValue( "dummy", "1,2", Dimension.class ) );
assertEquals( new Color( 0xff0000 ), UIDefaultsLoader.parseValue( "dummy", "#f00", Color.class ) ); assertEquals( new Color( 0xff0000 ), UIDefaultsLoader.parseValue( "dummy", "#f00", Color.class ) );
} }
@Test
void parseBorders() {
Insets insets = new Insets( 1,2,3,4 );
assertBorderEquals( new FlatEmptyBorder( insets ), "1,2,3,4" );
assertBorderEquals( new FlatLineBorder( insets, Color.red ), "1,2,3,4,#f00" );
assertBorderEquals( new FlatLineBorder( insets, Color.red, 2.5f, 0 ), "1,2,3,4,#f00,2.5" );
assertBorderEquals( new FlatLineBorder( insets, Color.red, 2.5f, 6 ), "1,2,3,4,#f00,2.5,6" );
assertBorderEquals( new FlatLineBorder( insets, Color.red, 1, 6 ), "1,2,3,4,#f00,,6" );
}
private void assertBorderEquals( Border expected, String actualStyle ) {
Border actual = (Border) ((LazyValue)UIDefaultsLoader.parseValue( "dummyBorder", actualStyle, null )).createValue( null );
assertEquals( expected.getClass(), actual.getClass() );
if( expected instanceof FlatEmptyBorder )
assertEquals( ((FlatEmptyBorder)actual).getBorderInsets(), ((FlatEmptyBorder)expected).getBorderInsets() );
if( expected instanceof FlatLineBorder ) {
FlatLineBorder a = (FlatLineBorder) actual;
FlatLineBorder e = (FlatLineBorder) expected;
assertEquals( a.getLineColor(), e.getLineColor() );
assertEquals( a.getLineThickness(), e.getLineThickness() );
assertEquals( a.getArc(), e.getArc() );
}
}
@Test @Test
void parseFonts() { void parseFonts() {
// style // style

View File

@@ -61,6 +61,7 @@ public class TestFlatStyleClasses
UIManager.put( "[style]MenuItem.test", "foreground: #000011" ); UIManager.put( "[style]MenuItem.test", "foreground: #000011" );
UIManager.put( "[style]CheckBoxMenuItem.test", "foreground: #000012" ); UIManager.put( "[style]CheckBoxMenuItem.test", "foreground: #000012" );
UIManager.put( "[style]RadioButtonMenuItem.test", "foreground: #000013" ); UIManager.put( "[style]RadioButtonMenuItem.test", "foreground: #000013" );
UIManager.put( "[style]Panel.test", "foreground: #000034" );
UIManager.put( "[style]PasswordField.test", "foreground: #000014" ); UIManager.put( "[style]PasswordField.test", "foreground: #000014" );
UIManager.put( "[style]PopupMenu.test", "foreground: #000015" ); UIManager.put( "[style]PopupMenu.test", "foreground: #000015" );
UIManager.put( "[style]PopupMenuSeparator.test", "foreground: #000016" ); UIManager.put( "[style]PopupMenuSeparator.test", "foreground: #000016" );
@@ -278,6 +279,14 @@ public class TestFlatStyleClasses
assertEquals( new Color( 0x000013 ), c.getForeground() ); assertEquals( new Color( 0x000013 ), c.getForeground() );
} }
@Test
void panel() {
JPanel c = new JPanel();
c.putClientProperty( FlatClientProperties.STYLE_CLASS, "test" );
assertEquals( Color.magenta, c.getBackground() );
assertEquals( new Color( 0x000034 ), c.getForeground() );
}
@Test @Test
void passwordField() { void passwordField() {
JPasswordField c = new JPasswordField(); JPasswordField c = new JPasswordField();

View File

@@ -20,6 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import static com.formdev.flatlaf.ui.TestUtils.assertMapEquals; import static com.formdev.flatlaf.ui.TestUtils.assertMapEquals;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets; import java.awt.Insets;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
@@ -257,7 +258,7 @@ public class TestFlatStyleableInfo
// FlatListCellBorder // FlatListCellBorder
"cellMargins", Insets.class, "cellMargins", Insets.class,
"cellFocusColor", Color.class, "cellFocusColor", Color.class,
"showCellFocusIndicator", boolean.class "showCellFocusIndicator", Boolean.class
); );
assertMapEquals( expected, ui.getStyleableInfos( c ) ); assertMapEquals( expected, ui.getStyleableInfos( c ) );
@@ -301,7 +302,6 @@ public class TestFlatStyleableInfo
Map<String, Class<?>> expected = new LinkedHashMap<>(); Map<String, Class<?>> expected = new LinkedHashMap<>();
menuItem( expected ); menuItem( expected );
menuItem_arrowIcon( expected );
assertMapEquals( expected, ui.getStyleableInfos( c ) ); assertMapEquals( expected, ui.getStyleableInfos( c ) );
} }
@@ -314,7 +314,6 @@ public class TestFlatStyleableInfo
Map<String, Class<?>> expected = new LinkedHashMap<>(); Map<String, Class<?>> expected = new LinkedHashMap<>();
menuItem( expected ); menuItem( expected );
menuItem_checkIcon( expected ); menuItem_checkIcon( expected );
menuItem_arrowIcon( expected );
assertMapEquals( expected, ui.getStyleableInfos( c ) ); assertMapEquals( expected, ui.getStyleableInfos( c ) );
} }
@@ -327,7 +326,6 @@ public class TestFlatStyleableInfo
Map<String, Class<?>> expected = new LinkedHashMap<>(); Map<String, Class<?>> expected = new LinkedHashMap<>();
menuItem( expected ); menuItem( expected );
menuItem_checkIcon( expected ); menuItem_checkIcon( expected );
menuItem_arrowIcon( expected );
assertMapEquals( expected, ui.getStyleableInfos( c ) ); assertMapEquals( expected, ui.getStyleableInfos( c ) );
} }
@@ -338,7 +336,8 @@ public class TestFlatStyleableInfo
"selectionForeground", Color.class, "selectionForeground", Color.class,
"disabledForeground", Color.class, "disabledForeground", Color.class,
"acceleratorForeground", Color.class, "acceleratorForeground", Color.class,
"acceleratorSelectionForeground", Color.class "acceleratorSelectionForeground", Color.class,
"acceleratorFont", Font.class
); );
menuItemRenderer( expected ); menuItemRenderer( expected );
@@ -346,6 +345,7 @@ public class TestFlatStyleableInfo
private void menuItemRenderer( Map<String, Class<?>> expected ) { private void menuItemRenderer( Map<String, Class<?>> expected ) {
expectedMap( expected, expectedMap( expected,
"verticallyAlignText", boolean.class,
"minimumWidth", int.class, "minimumWidth", int.class,
"minimumIconSize", Dimension.class, "minimumIconSize", Dimension.class,
"textAcceleratorGap", int.class, "textAcceleratorGap", int.class,
@@ -379,6 +379,18 @@ public class TestFlatStyleableInfo
); );
} }
@Test
void panel() {
JPanel c = new JPanel();
FlatPanelUI ui = (FlatPanelUI) c.getUI();
Map<String, Class<?>> expected = expectedMap(
"arc", int.class
);
assertMapEquals( expected, ui.getStyleableInfos( c ) );
}
@Test @Test
void passwordField() { void passwordField() {
JPasswordField c = new JPasswordField(); JPasswordField c = new JPasswordField();
@@ -386,7 +398,8 @@ public class TestFlatStyleableInfo
Map<String, Class<?>> expected = new LinkedHashMap<>(); Map<String, Class<?>> expected = new LinkedHashMap<>();
expectedMap( expected, expectedMap( expected,
"showCapsLock", boolean.class "showCapsLock", boolean.class,
"showRevealButton", boolean.class
); );
// FlatPasswordFieldUI extends FlatTextFieldUI // FlatPasswordFieldUI extends FlatTextFieldUI
@@ -747,7 +760,7 @@ public class TestFlatStyleableInfo
// FlatTableCellBorder // FlatTableCellBorder
"cellMargins", Insets.class, "cellMargins", Insets.class,
"cellFocusColor", Color.class, "cellFocusColor", Color.class,
"showCellFocusIndicator", boolean.class "showCellFocusIndicator", Boolean.class
); );
assertMapEquals( expected, ui.getStyleableInfos( c ) ); assertMapEquals( expected, ui.getStyleableInfos( c ) );
@@ -766,7 +779,7 @@ public class TestFlatStyleableInfo
// FlatTableHeaderBorder // FlatTableHeaderBorder
"cellMargins", Insets.class, "cellMargins", Insets.class,
"separatorColor", Color.class, "separatorColor", Color.class,
"showTrailingVerticalLine", boolean.class, "showTrailingVerticalLine", Boolean.class,
// FlatAscendingSortIcon and FlatDescendingSortIcon // FlatAscendingSortIcon and FlatDescendingSortIcon
"arrowType", String.class, "arrowType", String.class,
@@ -811,7 +824,8 @@ public class TestFlatStyleableInfo
"focusedBackground", Color.class, "focusedBackground", Color.class,
"iconTextGap", int.class, "iconTextGap", int.class,
"leadingIcon", Icon.class, "leadingIcon", Icon.class,
"trailingIcon", Icon.class "trailingIcon", Icon.class,
"showClearButton", boolean.class
); );
// border // border
@@ -1134,17 +1148,6 @@ public class TestFlatStyleableInfo
assertMapEquals( expected, icon.getStyleableInfos() ); assertMapEquals( expected, icon.getStyleableInfos() );
} }
@Test
void flatMenuItemArrowIcon() {
FlatMenuItemArrowIcon icon = new FlatMenuItemArrowIcon();
// FlatMenuItemArrowIcon extends FlatMenuArrowIcon
Map<String, Class<?>> expected = new LinkedHashMap<>();
flatMenuArrowIcon( expected );
assertMapEquals( expected, icon.getStyleableInfos() );
}
private void flatMenuArrowIcon( Map<String, Class<?>> expected ) { private void flatMenuArrowIcon( Map<String, Class<?>> expected ) {
expectedMap( expected, expectedMap( expected,
"arrowType", String.class, "arrowType", String.class,

View File

@@ -261,6 +261,7 @@ public class TestFlatStyling
// AbstractButton properties // AbstractButton properties
ui.applyStyle( b, "margin: 2,2,2,2" ); ui.applyStyle( b, "margin: 2,2,2,2" );
ui.applyStyle( b, "iconTextGap: 4" );
} }
@Test @Test
@@ -312,6 +313,9 @@ public class TestFlatStyling
ui.applyStyle( "foreground: #fff" ); ui.applyStyle( "foreground: #fff" );
ui.applyStyle( "border: 2,2,2,2,#f00" ); ui.applyStyle( "border: 2,2,2,2,#f00" );
ui.applyStyle( "font: italic 12 monospaced" ); ui.applyStyle( "font: italic 12 monospaced" );
// JComboBox properties
ui.applyStyle( "maximumRowCount: 20" );
} }
@Test @Test
@@ -335,6 +339,7 @@ public class TestFlatStyling
ui.applyStyle( "selectionColor: #fff" ); ui.applyStyle( "selectionColor: #fff" );
ui.applyStyle( "selectedTextColor: #fff" ); ui.applyStyle( "selectedTextColor: #fff" );
ui.applyStyle( "disabledTextColor: #fff" ); ui.applyStyle( "disabledTextColor: #fff" );
ui.applyStyle( "margin: 2,2,2,2" );
} }
@Test @Test
@@ -450,7 +455,6 @@ public class TestFlatStyling
Consumer<String> applyStyle = style -> ui.applyStyle( style ); Consumer<String> applyStyle = style -> ui.applyStyle( style );
menuItem( applyStyle ); menuItem( applyStyle );
menuItem_arrowIcon( applyStyle );
} }
@Test @Test
@@ -461,7 +465,6 @@ public class TestFlatStyling
Consumer<String> applyStyle = style -> ui.applyStyle( style ); Consumer<String> applyStyle = style -> ui.applyStyle( style );
menuItem( applyStyle ); menuItem( applyStyle );
menuItem_checkIcon( applyStyle ); menuItem_checkIcon( applyStyle );
menuItem_arrowIcon( applyStyle );
} }
@Test @Test
@@ -472,7 +475,6 @@ public class TestFlatStyling
Consumer<String> applyStyle = style -> ui.applyStyle( style ); Consumer<String> applyStyle = style -> ui.applyStyle( style );
menuItem( applyStyle ); menuItem( applyStyle );
menuItem_checkIcon( applyStyle ); menuItem_checkIcon( applyStyle );
menuItem_arrowIcon( applyStyle );
} }
private void menuItem( Consumer<String> applyStyle ) { private void menuItem( Consumer<String> applyStyle ) {
@@ -481,6 +483,7 @@ public class TestFlatStyling
applyStyle.accept( "disabledForeground: #fff" ); applyStyle.accept( "disabledForeground: #fff" );
applyStyle.accept( "acceleratorForeground: #fff" ); applyStyle.accept( "acceleratorForeground: #fff" );
applyStyle.accept( "acceleratorSelectionForeground: #fff" ); applyStyle.accept( "acceleratorSelectionForeground: #fff" );
applyStyle.accept( "acceleratorFont: italic 12 monospaced" );
menuItemRenderer( applyStyle ); menuItemRenderer( applyStyle );
@@ -492,9 +495,11 @@ public class TestFlatStyling
// AbstractButton properties // AbstractButton properties
applyStyle.accept( "margin: 2,2,2,2" ); applyStyle.accept( "margin: 2,2,2,2" );
applyStyle.accept( "iconTextGap: 4" );
} }
private void menuItemRenderer( Consumer<String> applyStyle ) { private void menuItemRenderer( Consumer<String> applyStyle ) {
applyStyle.accept( "verticallyAlignText: false" );
applyStyle.accept( "minimumWidth: 10" ); applyStyle.accept( "minimumWidth: 10" );
applyStyle.accept( "minimumIconSize: 16,16" ); applyStyle.accept( "minimumIconSize: 16,16" );
applyStyle.accept( "textAcceleratorGap: 28" ); applyStyle.accept( "textAcceleratorGap: 28" );
@@ -523,6 +528,20 @@ public class TestFlatStyling
applyStyle.accept( "selectionForeground: #fff" ); applyStyle.accept( "selectionForeground: #fff" );
} }
@Test
void panel() {
JPanel c = new JPanel();
FlatPanelUI ui = (FlatPanelUI) c.getUI();
ui.applyStyle( c, "arc: 8" );
// JComponent properties
ui.applyStyle( c, "background: #fff" );
ui.applyStyle( c, "foreground: #fff" );
ui.applyStyle( c, "border: 2,2,2,2,#f00" );
ui.applyStyle( c, "font: italic 12 monospaced" );
}
@Test @Test
void passwordField() { void passwordField() {
JPasswordField c = new JPasswordField(); JPasswordField c = new JPasswordField();
@@ -532,6 +551,7 @@ public class TestFlatStyling
textField( ui ); textField( ui );
ui.applyStyle( "showCapsLock: true" ); ui.applyStyle( "showCapsLock: true" );
ui.applyStyle( "showRevealButton: true" );
// capsLockIcon // capsLockIcon
ui.applyStyle( "capsLockIconColor: #fff" ); ui.applyStyle( "capsLockIconColor: #fff" );
@@ -605,6 +625,7 @@ public class TestFlatStyling
// AbstractButton properties // AbstractButton properties
ui.applyStyle( b, "margin: 2,2,2,2" ); ui.applyStyle( b, "margin: 2,2,2,2" );
ui.applyStyle( b, "iconTextGap: 4" );
//---- icon ---- //---- icon ----
@@ -701,6 +722,7 @@ public class TestFlatStyling
ui.applyStyle( "background: #fff" ); ui.applyStyle( "background: #fff" );
ui.applyStyle( "foreground: #fff" ); ui.applyStyle( "foreground: #fff" );
ui.applyStyle( "border: 2,2,2,2,#f00" ); ui.applyStyle( "border: 2,2,2,2,#f00" );
ui.applyStyle( "viewportBorder: 2,2,2,2,#f00" );
} }
@Test @Test
@@ -750,6 +772,8 @@ public class TestFlatStyling
ui.applyStyle( "foreground: #fff" ); ui.applyStyle( "foreground: #fff" );
ui.applyStyle( "border: 2,2,2,2,#f00" ); ui.applyStyle( "border: 2,2,2,2,#f00" );
ui.applyStyle( "font: italic 12 monospaced" ); ui.applyStyle( "font: italic 12 monospaced" );
// JSlider properties
ui.applyStyle( "minimum: 0" ); ui.applyStyle( "minimum: 0" );
ui.applyStyle( "maximum: 50" ); ui.applyStyle( "maximum: 50" );
ui.applyStyle( "value: 20" ); ui.applyStyle( "value: 20" );
@@ -761,12 +785,6 @@ public class TestFlatStyling
ui.applyStyle( "paintTicks: true" ); ui.applyStyle( "paintTicks: true" );
ui.applyStyle( "paintTrack: true" ); ui.applyStyle( "paintTrack: true" );
ui.applyStyle( "snapToTicks: true" ); ui.applyStyle( "snapToTicks: true" );
// JSlider properties
ui.applyStyle( "paintLabels: true" );
ui.applyStyle( "paintTicks: true" );
ui.applyStyle( "paintTrack: true" );
ui.applyStyle( "snapToTicks: true" );
} }
@Test @Test
@@ -918,7 +936,6 @@ public class TestFlatStyling
// JComponent properties // JComponent properties
ui.applyStyle( "background: #fff" ); ui.applyStyle( "background: #fff" );
ui.applyStyle( "foreground: #fff" ); ui.applyStyle( "foreground: #fff" );
ui.applyStyle( "border: 2,2,2,2,#f00" );
ui.applyStyle( "font: italic 12 monospaced" ); ui.applyStyle( "font: italic 12 monospaced" );
// JTable properties // JTable properties
@@ -950,7 +967,6 @@ public class TestFlatStyling
// JComponent properties // JComponent properties
ui.applyStyle( "background: #fff" ); ui.applyStyle( "background: #fff" );
ui.applyStyle( "foreground: #fff" ); ui.applyStyle( "foreground: #fff" );
ui.applyStyle( "border: 2,2,2,2,#f00" );
ui.applyStyle( "font: italic 12 monospaced" ); ui.applyStyle( "font: italic 12 monospaced" );
} }
@@ -975,6 +991,7 @@ public class TestFlatStyling
ui.applyStyle( "selectionColor: #fff" ); ui.applyStyle( "selectionColor: #fff" );
ui.applyStyle( "selectedTextColor: #fff" ); ui.applyStyle( "selectedTextColor: #fff" );
ui.applyStyle( "disabledTextColor: #fff" ); ui.applyStyle( "disabledTextColor: #fff" );
ui.applyStyle( "margin: 2,2,2,2" );
} }
@Test @Test
@@ -995,6 +1012,8 @@ public class TestFlatStyling
ui.applyStyle( "leadingIcon: com.formdev.flatlaf.icons.FlatSearchIcon" ); ui.applyStyle( "leadingIcon: com.formdev.flatlaf.icons.FlatSearchIcon" );
ui.applyStyle( "trailingIcon: com.formdev.flatlaf.icons.FlatClearIcon" ); ui.applyStyle( "trailingIcon: com.formdev.flatlaf.icons.FlatClearIcon" );
ui.applyStyle( "showClearButton: true" );
// border // border
flatTextBorder( style -> ui.applyStyle( style ) ); flatTextBorder( style -> ui.applyStyle( style ) );
@@ -1009,6 +1028,7 @@ public class TestFlatStyling
ui.applyStyle( "selectionColor: #fff" ); ui.applyStyle( "selectionColor: #fff" );
ui.applyStyle( "selectedTextColor: #fff" ); ui.applyStyle( "selectedTextColor: #fff" );
ui.applyStyle( "disabledTextColor: #fff" ); ui.applyStyle( "disabledTextColor: #fff" );
ui.applyStyle( "margin: 2,2,2,2" );
} }
@Test @Test
@@ -1032,6 +1052,7 @@ public class TestFlatStyling
ui.applyStyle( "selectionColor: #fff" ); ui.applyStyle( "selectionColor: #fff" );
ui.applyStyle( "selectedTextColor: #fff" ); ui.applyStyle( "selectedTextColor: #fff" );
ui.applyStyle( "disabledTextColor: #fff" ); ui.applyStyle( "disabledTextColor: #fff" );
ui.applyStyle( "margin: 2,2,2,2" );
} }
@Test @Test
@@ -1342,18 +1363,6 @@ public class TestFlatStyling
void flatMenuArrowIcon() { void flatMenuArrowIcon() {
FlatMenuArrowIcon icon = new FlatMenuArrowIcon(); FlatMenuArrowIcon icon = new FlatMenuArrowIcon();
flatMenuArrowIcon( icon );
}
@Test
void flatMenuItemArrowIcon() {
FlatMenuItemArrowIcon icon = new FlatMenuItemArrowIcon();
// FlatMenuItemArrowIcon extends FlatMenuArrowIcon
flatMenuArrowIcon( icon );
}
private void flatMenuArrowIcon( FlatMenuArrowIcon icon ) {
icon.applyStyleProperty( "arrowType", "chevron" ); icon.applyStyleProperty( "arrowType", "chevron" );
icon.applyStyleProperty( "arrowColor", Color.WHITE ); icon.applyStyleProperty( "arrowColor", Color.WHITE );
icon.applyStyleProperty( "disabledArrowColor", Color.WHITE ); icon.applyStyleProperty( "disabledArrowColor", Color.WHITE );

View File

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

View File

@@ -22,6 +22,7 @@ import javax.swing.text.DefaultEditorKit;
import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.extras.FlatSVGIcon; import com.formdev.flatlaf.extras.FlatSVGIcon;
import com.formdev.flatlaf.icons.FlatSearchIcon; import com.formdev.flatlaf.icons.FlatSearchIcon;
import com.formdev.flatlaf.icons.FlatSearchWithHistoryIcon;
import net.miginfocom.layout.AC; import net.miginfocom.layout.AC;
import net.miginfocom.layout.BoundSize; import net.miginfocom.layout.BoundSize;
import net.miginfocom.layout.ConstraintParser; import net.miginfocom.layout.ConstraintParser;
@@ -36,6 +37,51 @@ class BasicComponentsPanel
{ {
BasicComponentsPanel() { BasicComponentsPanel() {
initComponents(); initComponents();
// show reveal button for password field
// to enable this for all password fields use:
// UIManager.put( "PasswordField.showRevealButton", true );
passwordField1.putClientProperty( FlatClientProperties.STYLE, "showRevealButton: true" );
// search history button
JButton searchHistoryButton = new JButton( new FlatSearchWithHistoryIcon( true ) );
searchHistoryButton.setToolTipText( "Search History" );
searchHistoryButton.addActionListener( e -> {
JPopupMenu popupMenu = new JPopupMenu();
popupMenu.add( "(empty)" );
popupMenu.show( searchHistoryButton, 0, searchHistoryButton.getHeight() );
} );
compsTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_LEADING_COMPONENT, searchHistoryButton );
// match case button
JToggleButton matchCaseButton = new JToggleButton( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/matchCase.svg" ) );
matchCaseButton.setRolloverIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/matchCaseHovered.svg" ) );
matchCaseButton.setSelectedIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/matchCaseSelected.svg" ) );
matchCaseButton.setToolTipText( "Match Case" );
// whole words button
JToggleButton wordsButton = new JToggleButton( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/words.svg" ) );
wordsButton.setRolloverIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/wordsHovered.svg" ) );
wordsButton.setSelectedIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/wordsSelected.svg" ) );
wordsButton.setToolTipText( "Whole Words" );
// regex button
JToggleButton regexButton = new JToggleButton( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/regex.svg" ) );
regexButton.setRolloverIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/regexHovered.svg" ) );
regexButton.setSelectedIcon( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/regexSelected.svg" ) );
regexButton.setToolTipText( "Regular Expression" );
// search toolbar
JToolBar searchToolbar = new JToolBar();
searchToolbar.add( matchCaseButton );
searchToolbar.add( wordsButton );
searchToolbar.addSeparator();
searchToolbar.add( regexButton );
compsTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_TRAILING_COMPONENT, searchToolbar );
// show clear button (if text field is not empty)
compsTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_SHOW_CLEAR_BUTTON, true );
clearTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_SHOW_CLEAR_BUTTON, true );
} }
private void initComponents() { private void initComponents() {
@@ -87,7 +133,7 @@ class BasicComponentsPanel
JFormattedTextField formattedTextField4 = new JFormattedTextField(); JFormattedTextField formattedTextField4 = new JFormattedTextField();
JFormattedTextField formattedTextField5 = new JFormattedTextField(); JFormattedTextField formattedTextField5 = new JFormattedTextField();
JLabel passwordFieldLabel = new JLabel(); JLabel passwordFieldLabel = new JLabel();
JPasswordField passwordField1 = new JPasswordField(); passwordField1 = new JPasswordField();
JPasswordField passwordField2 = new JPasswordField(); JPasswordField passwordField2 = new JPasswordField();
JPasswordField passwordField3 = new JPasswordField(); JPasswordField passwordField3 = new JPasswordField();
JPasswordField passwordField4 = new JPasswordField(); JPasswordField passwordField4 = new JPasswordField();
@@ -134,6 +180,9 @@ class BasicComponentsPanel
JTextField leadingIconTextField = new JTextField(); JTextField leadingIconTextField = new JTextField();
JTextField trailingIconTextField = new JTextField(); JTextField trailingIconTextField = new JTextField();
JTextField iconsTextField = new JTextField(); JTextField iconsTextField = new JTextField();
JLabel compsLabel = new JLabel();
compsTextField = new JTextField();
clearTextField = new JTextField();
JLabel fontsLabel = new JLabel(); JLabel fontsLabel = new JLabel();
JLabel h00Label = new JLabel(); JLabel h00Label = new JLabel();
JLabel h0Label = new JLabel(); JLabel h0Label = new JLabel();
@@ -181,6 +230,7 @@ class BasicComponentsPanel
"[]" + "[]" +
"[]" + "[]" +
"[]" + "[]" +
"[]" +
"[]0" + "[]0" +
"[]")); "[]"));
@@ -689,84 +739,93 @@ class BasicComponentsPanel
iconsTextField.setText("text"); iconsTextField.setText("text");
add(iconsTextField, "cell 3 14,growx"); add(iconsTextField, "cell 3 14,growx");
//---- compsLabel ----
compsLabel.setText("Leading/trailing comp.:");
add(compsLabel, "cell 0 15");
add(compsTextField, "cell 1 15 2 1,growx");
//---- clearTextField ----
clearTextField.setText("clear me");
add(clearTextField, "cell 3 15,growx");
//---- fontsLabel ---- //---- fontsLabel ----
fontsLabel.setText("Typography / Fonts:"); fontsLabel.setText("Typography / Fonts:");
add(fontsLabel, "cell 0 15"); add(fontsLabel, "cell 0 16");
//---- h00Label ---- //---- h00Label ----
h00Label.setText("H00"); h00Label.setText("H00");
h00Label.putClientProperty("FlatLaf.styleClass", "h00"); h00Label.putClientProperty("FlatLaf.styleClass", "h00");
add(h00Label, "cell 1 15 5 1"); add(h00Label, "cell 1 16 5 1");
//---- h0Label ---- //---- h0Label ----
h0Label.setText("H0"); h0Label.setText("H0");
h0Label.putClientProperty("FlatLaf.styleClass", "h0"); h0Label.putClientProperty("FlatLaf.styleClass", "h0");
add(h0Label, "cell 1 15 5 1"); add(h0Label, "cell 1 16 5 1");
//---- h1Label ---- //---- h1Label ----
h1Label.setText("H1"); h1Label.setText("H1");
h1Label.putClientProperty("FlatLaf.styleClass", "h1"); h1Label.putClientProperty("FlatLaf.styleClass", "h1");
add(h1Label, "cell 1 15 5 1"); add(h1Label, "cell 1 16 5 1");
//---- h2Label ---- //---- h2Label ----
h2Label.setText("H2"); h2Label.setText("H2");
h2Label.putClientProperty("FlatLaf.styleClass", "h2"); h2Label.putClientProperty("FlatLaf.styleClass", "h2");
add(h2Label, "cell 1 15 5 1"); add(h2Label, "cell 1 16 5 1");
//---- h3Label ---- //---- h3Label ----
h3Label.setText("H3"); h3Label.setText("H3");
h3Label.putClientProperty("FlatLaf.styleClass", "h3"); h3Label.putClientProperty("FlatLaf.styleClass", "h3");
add(h3Label, "cell 1 15 5 1"); add(h3Label, "cell 1 16 5 1");
//---- h4Label ---- //---- h4Label ----
h4Label.setText("H4"); h4Label.setText("H4");
h4Label.putClientProperty("FlatLaf.styleClass", "h4"); h4Label.putClientProperty("FlatLaf.styleClass", "h4");
add(h4Label, "cell 1 15 5 1"); add(h4Label, "cell 1 16 5 1");
//---- lightLabel ---- //---- lightLabel ----
lightLabel.setText("light"); lightLabel.setText("light");
lightLabel.putClientProperty("FlatLaf.style", "font: 200% $light.font"); lightLabel.putClientProperty("FlatLaf.style", "font: 200% $light.font");
add(lightLabel, "cell 1 15 5 1,gapx 30"); add(lightLabel, "cell 1 16 5 1,gapx 30");
//---- semiboldLabel ---- //---- semiboldLabel ----
semiboldLabel.setText("semibold"); semiboldLabel.setText("semibold");
semiboldLabel.putClientProperty("FlatLaf.style", "font: 200% $semibold.font"); semiboldLabel.putClientProperty("FlatLaf.style", "font: 200% $semibold.font");
add(semiboldLabel, "cell 1 15 5 1"); add(semiboldLabel, "cell 1 16 5 1");
//---- fontZoomLabel ---- //---- fontZoomLabel ----
fontZoomLabel.setText("(200%)"); fontZoomLabel.setText("(200%)");
fontZoomLabel.putClientProperty("FlatLaf.styleClass", "small"); fontZoomLabel.putClientProperty("FlatLaf.styleClass", "small");
fontZoomLabel.setEnabled(false); fontZoomLabel.setEnabled(false);
add(fontZoomLabel, "cell 1 15 5 1"); add(fontZoomLabel, "cell 1 16 5 1");
//---- largeLabel ---- //---- largeLabel ----
largeLabel.setText("large"); largeLabel.setText("large");
largeLabel.putClientProperty("FlatLaf.styleClass", "large"); largeLabel.putClientProperty("FlatLaf.styleClass", "large");
add(largeLabel, "cell 1 16 5 1"); add(largeLabel, "cell 1 17 5 1");
//---- defaultLabel ---- //---- defaultLabel ----
defaultLabel.setText("default"); defaultLabel.setText("default");
add(defaultLabel, "cell 1 16 5 1"); add(defaultLabel, "cell 1 17 5 1");
//---- mediumLabel ---- //---- mediumLabel ----
mediumLabel.setText("medium"); mediumLabel.setText("medium");
mediumLabel.putClientProperty("FlatLaf.styleClass", "medium"); mediumLabel.putClientProperty("FlatLaf.styleClass", "medium");
add(mediumLabel, "cell 1 16 5 1"); add(mediumLabel, "cell 1 17 5 1");
//---- smallLabel ---- //---- smallLabel ----
smallLabel.setText("small"); smallLabel.setText("small");
smallLabel.putClientProperty("FlatLaf.styleClass", "small"); smallLabel.putClientProperty("FlatLaf.styleClass", "small");
add(smallLabel, "cell 1 16 5 1"); add(smallLabel, "cell 1 17 5 1");
//---- miniLabel ---- //---- miniLabel ----
miniLabel.setText("mini"); miniLabel.setText("mini");
miniLabel.putClientProperty("FlatLaf.styleClass", "mini"); miniLabel.putClientProperty("FlatLaf.styleClass", "mini");
add(miniLabel, "cell 1 16 5 1"); add(miniLabel, "cell 1 17 5 1");
//---- monospacedLabel ---- //---- monospacedLabel ----
monospacedLabel.setText("monospaced"); monospacedLabel.setText("monospaced");
monospacedLabel.putClientProperty("FlatLaf.styleClass", "monospaced"); monospacedLabel.putClientProperty("FlatLaf.styleClass", "monospaced");
add(monospacedLabel, "cell 1 16 5 1,gapx 30"); add(monospacedLabel, "cell 1 17 5 1,gapx 30");
//======== popupMenu1 ======== //======== popupMenu1 ========
{ {
@@ -841,7 +900,7 @@ class BasicComponentsPanel
rows[11].setGapAfter( zeroGap ); rows[11].setGapAfter( zeroGap );
rows[12].setGapBefore( zeroGap ); rows[12].setGapBefore( zeroGap );
rows[13].setGapBefore( zeroGap ); rows[13].setGapBefore( zeroGap );
rows[15].setGapBefore( zeroGap ); rows[16].setGapBefore( zeroGap );
layout.setRowConstraints( ac ); layout.setRowConstraints( ac );
// move two text field into same row as spinners // move two text field into same row as spinners
@@ -859,5 +918,8 @@ class BasicComponentsPanel
} }
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JPasswordField passwordField1;
private JTextField compsTextField;
private JTextField clearTextField;
// JFormDesigner - End of variables declaration //GEN-END:variables // JFormDesigner - End of variables declaration //GEN-END:variables
} }

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.4.0.360" Java: "16" encoding: "UTF-8" JFDML JFormDesigner: "7.0.5.0.404" Java: "17" encoding: "UTF-8"
new FormModel { new FormModel {
contentType: "form/swing" contentType: "form/swing"
@@ -9,7 +9,7 @@ new FormModel {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets dialog,hidemode 3" "$layoutConstraints": "insets dialog,hidemode 3"
"$columnConstraints": "[][sizegroup 1][sizegroup 1][sizegroup 1][][]" "$columnConstraints": "[][sizegroup 1][sizegroup 1][sizegroup 1][][]"
"$rowConstraints": "[][][][][][][][][][][][]para[][][][]0[]" "$rowConstraints": "[][][][][][][][][][][][]para[][][][][]0[]"
} ) { } ) {
name: "this" name: "this"
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
@@ -375,6 +375,9 @@ new FormModel {
add( new FormComponent( "javax.swing.JPasswordField" ) { add( new FormComponent( "javax.swing.JPasswordField" ) {
name: "passwordField1" name: "passwordField1"
"text": "Editable" "text": "Editable"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 8,growx" "value": "cell 1 8,growx"
} ) } )
@@ -671,67 +674,90 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 14,growx" "value": "cell 3 14,growx"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "compsLabel"
"text": "Leading/trailing comp.:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 15"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "compsTextField"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 2 1,growx"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "clearTextField"
"text": "clear me"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 15,growx"
} )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "fontsLabel" name: "fontsLabel"
"text": "Typography / Fonts:" "text": "Typography / Fonts:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 15" "value": "cell 0 16"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "h00Label" name: "h00Label"
"text": "H00" "text": "H00"
"$client.FlatLaf.styleClass": "h00" "$client.FlatLaf.styleClass": "h00"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1" "value": "cell 1 16 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "h0Label" name: "h0Label"
"text": "H0" "text": "H0"
"$client.FlatLaf.styleClass": "h0" "$client.FlatLaf.styleClass": "h0"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1" "value": "cell 1 16 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "h1Label" name: "h1Label"
"text": "H1" "text": "H1"
"$client.FlatLaf.styleClass": "h1" "$client.FlatLaf.styleClass": "h1"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1" "value": "cell 1 16 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "h2Label" name: "h2Label"
"text": "H2" "text": "H2"
"$client.FlatLaf.styleClass": "h2" "$client.FlatLaf.styleClass": "h2"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1" "value": "cell 1 16 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "h3Label" name: "h3Label"
"text": "H3" "text": "H3"
"$client.FlatLaf.styleClass": "h3" "$client.FlatLaf.styleClass": "h3"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1" "value": "cell 1 16 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "h4Label" name: "h4Label"
"text": "H4" "text": "H4"
"$client.FlatLaf.styleClass": "h4" "$client.FlatLaf.styleClass": "h4"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1" "value": "cell 1 16 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "lightLabel" name: "lightLabel"
"text": "light" "text": "light"
"$client.FlatLaf.style": "font: 200% $light.font" "$client.FlatLaf.style": "font: 200% $light.font"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1,gapx 30" "value": "cell 1 16 5 1,gapx 30"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "semiboldLabel" name: "semiboldLabel"
"text": "semibold" "text": "semibold"
"$client.FlatLaf.style": "font: 200% $semibold.font" "$client.FlatLaf.style": "font: 200% $semibold.font"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1" "value": "cell 1 16 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "fontZoomLabel" name: "fontZoomLabel"
@@ -739,48 +765,48 @@ new FormModel {
"$client.FlatLaf.styleClass": "small" "$client.FlatLaf.styleClass": "small"
"enabled": false "enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1" "value": "cell 1 16 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "largeLabel" name: "largeLabel"
"text": "large" "text": "large"
"$client.FlatLaf.styleClass": "large" "$client.FlatLaf.styleClass": "large"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 16 5 1" "value": "cell 1 17 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "defaultLabel" name: "defaultLabel"
"text": "default" "text": "default"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 16 5 1" "value": "cell 1 17 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "mediumLabel" name: "mediumLabel"
"text": "medium" "text": "medium"
"$client.FlatLaf.styleClass": "medium" "$client.FlatLaf.styleClass": "medium"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 16 5 1" "value": "cell 1 17 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "smallLabel" name: "smallLabel"
"text": "small" "text": "small"
"$client.FlatLaf.styleClass": "small" "$client.FlatLaf.styleClass": "small"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 16 5 1" "value": "cell 1 17 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "miniLabel" name: "miniLabel"
"text": "mini" "text": "mini"
"$client.FlatLaf.styleClass": "mini" "$client.FlatLaf.styleClass": "mini"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 16 5 1" "value": "cell 1 17 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "monospacedLabel" name: "monospacedLabel"
"text": "monospaced" "text": "monospaced"
"$client.FlatLaf.styleClass": "monospaced" "$client.FlatLaf.styleClass": "monospaced"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 16 5 1,gapx 30" "value": "cell 1 17 5 1,gapx 30"
} ) } )
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 ) "location": new java.awt.Point( 0, 0 )

View File

@@ -71,8 +71,11 @@ public class FlatLafDemo
// create frame // create frame
DemoFrame frame = new DemoFrame(); DemoFrame frame = new DemoFrame();
if( FlatLafDemo.screenshotsMode ) if( FlatLafDemo.screenshotsMode ) {
frame.setPreferredSize( new Dimension( 1660, 840 ) ); frame.setPreferredSize( SystemInfo.isJava_9_orLater
? new Dimension( 830, 440 )
: new Dimension( 1660, 880 ) );
}
// show frame // show frame
frame.pack(); frame.pack();

View File

@@ -0,0 +1,9 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="matchCase">
<g id="Cc">
<path d="M8.77476 11.8297C8.32279 12.2816 7.83717 12.623 7.31789 12.8538C6.80823 13.075 6.19279 13.1856 5.47157 13.1856C4.17337 13.1856 3.10116 12.7144 2.25492 11.772C1.41831 10.8296 1 9.5939 1 8.06491V7.93509C1 6.4061 1.42792 5.17041 2.28377 4.22802C3.13962 3.27601 4.23588 2.8 5.57254 2.8C6.81304 2.8 7.8564 3.18465 8.70263 3.95395L7.72178 5.64161C7.01979 5.0454 6.3178 4.7473 5.61581 4.7473C4.89459 4.7473 4.30319 5.03098 3.84161 5.59834C3.38964 6.1657 3.16366 6.935 3.16366 7.90624V8.05049C3.16366 9.04096 3.38964 9.81988 3.84161 10.3872C4.29357 10.9546 4.88978 11.2383 5.63024 11.2383C6.35146 11.2383 7.06787 10.9306 7.77947 10.3151L8.77476 11.8297Z" fill="#7F8B91" fill-opacity="0.5"/>
<path d="M15.6304 12.1182C15.2842 12.474 14.914 12.7432 14.5197 12.9259C14.135 13.1086 13.6542 13.2 13.0773 13.2C12.0483 13.2 11.2021 12.8346 10.5386 12.1037C9.87504 11.3633 9.54327 10.4209 9.54327 9.27656V9.11789C9.54327 7.97356 9.87984 7.03116 10.553 6.29071C11.2261 5.55025 12.0772 5.18003 13.1061 5.18003C14.135 5.18003 14.962 5.50217 15.5871 6.14646L14.6639 7.67545C14.1927 7.22349 13.6927 6.9975 13.1638 6.9975C12.7022 6.9975 12.3224 7.18983 12.0243 7.57448C11.7262 7.95913 11.5771 8.46398 11.5771 9.08904V9.26214C11.5771 9.90643 11.7262 10.4209 12.0243 10.8055C12.332 11.1902 12.7359 11.3825 13.2359 11.3825C13.736 11.3825 14.236 11.1565 14.7361 10.7046L15.6304 12.1182Z" fill="#7F8B91" fill-opacity="0.5"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,9 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="matchCaseHovered">
<g id="Cc">
<path d="M8.77476 11.8297C8.32279 12.2816 7.83717 12.623 7.31789 12.8538C6.80823 13.075 6.19279 13.1856 5.47157 13.1856C4.17337 13.1856 3.10116 12.7144 2.25492 11.772C1.41831 10.8296 1 9.5939 1 8.06491V7.93509C1 6.4061 1.42792 5.17041 2.28377 4.22802C3.13962 3.27601 4.23588 2.8 5.57254 2.8C6.81304 2.8 7.8564 3.18465 8.70263 3.95395L7.72178 5.64161C7.01979 5.0454 6.3178 4.7473 5.61581 4.7473C4.89459 4.7473 4.30319 5.03098 3.84161 5.59834C3.38964 6.1657 3.16366 6.935 3.16366 7.90624V8.05049C3.16366 9.04096 3.38964 9.81988 3.84161 10.3872C4.29357 10.9546 4.88978 11.2383 5.63024 11.2383C6.35146 11.2383 7.06787 10.9306 7.77947 10.3151L8.77476 11.8297Z" fill="#7F8B91" fill-opacity="0.9"/>
<path d="M15.6304 12.1182C15.2842 12.474 14.914 12.7432 14.5197 12.9259C14.135 13.1086 13.6542 13.2 13.0773 13.2C12.0483 13.2 11.2021 12.8346 10.5386 12.1037C9.87504 11.3633 9.54327 10.4209 9.54327 9.27656V9.11789C9.54327 7.97356 9.87984 7.03116 10.553 6.29071C11.2261 5.55025 12.0772 5.18003 13.1061 5.18003C14.135 5.18003 14.962 5.50217 15.5871 6.14646L14.6639 7.67545C14.1927 7.22349 13.6927 6.9975 13.1638 6.9975C12.7022 6.9975 12.3224 7.18983 12.0243 7.57448C11.7262 7.95913 11.5771 8.46398 11.5771 9.08904V9.26214C11.5771 9.90643 11.7262 10.4209 12.0243 10.8055C12.332 11.1902 12.7359 11.3825 13.2359 11.3825C13.736 11.3825 14.236 11.1565 14.7361 10.7046L15.6304 12.1182Z" fill="#7F8B91" fill-opacity="0.9"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,9 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="matchCaseSelected">
<g id="Cc">
<path d="M8.77476 11.8297C8.32279 12.2816 7.83717 12.623 7.31789 12.8538C6.80823 13.075 6.19279 13.1856 5.47157 13.1856C4.17337 13.1856 3.10116 12.7144 2.25492 11.772C1.41831 10.8296 1 9.5939 1 8.06491V7.93509C1 6.4061 1.42792 5.17041 2.28377 4.22802C3.13962 3.276 4.23588 2.8 5.57254 2.8C6.81304 2.8 7.8564 3.18465 8.70263 3.95395L7.72178 5.64161C7.01979 5.0454 6.3178 4.74729 5.61581 4.74729C4.89459 4.74729 4.30319 5.03097 3.84161 5.59833C3.38964 6.16569 3.16366 6.935 3.16366 7.90624V8.05048C3.16366 9.04096 3.38964 9.81988 3.84161 10.3872C4.29357 10.9546 4.88978 11.2383 5.63024 11.2383C6.35146 11.2383 7.06787 10.9306 7.77947 10.3151L8.77476 11.8297Z" fill="#40B6E0"/>
<path d="M15.6304 12.1182C15.2842 12.474 14.914 12.7432 14.5197 12.9259C14.135 13.1086 13.6542 13.2 13.0773 13.2C12.0483 13.2 11.2021 12.8346 10.5386 12.1037C9.87504 11.3633 9.54327 10.4209 9.54327 9.27656V9.11789C9.54327 7.97355 9.87984 7.03116 10.553 6.29071C11.2261 5.55025 12.0772 5.18003 13.1061 5.18003C14.135 5.18003 14.962 5.50217 15.5871 6.14646L14.6639 7.67545C14.1927 7.22348 13.6927 6.9975 13.1638 6.9975C12.7022 6.9975 12.3224 7.18983 12.0243 7.57448C11.7262 7.95913 11.5771 8.46398 11.5771 9.08904V9.26213C11.5771 9.90643 11.7262 10.4209 12.0243 10.8055C12.332 11.1902 12.7359 11.3825 13.2359 11.3825C13.736 11.3825 14.236 11.1565 14.7361 10.7046L15.6304 12.1182Z" fill="#40B6E0"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

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

After

Width:  |  Height:  |  Size: 770 B

View File

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

After

Width:  |  Height:  |  Size: 770 B

View File

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

After

Width:  |  Height:  |  Size: 752 B

View File

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

After

Width:  |  Height:  |  Size: 487 B

View File

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

After

Width:  |  Height:  |  Size: 494 B

View File

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

After

Width:  |  Height:  |  Size: 476 B

View File

@@ -145,7 +145,7 @@
"license": "MIT", "license": "MIT",
"licenseFile": "Hiberbee.LICENSE.txt", "licenseFile": "Hiberbee.LICENSE.txt",
"sourceCodeUrl": "https://github.com/Hiberbee/code-highlight-themes", "sourceCodeUrl": "https://github.com/Hiberbee/code-highlight-themes",
"sourceCodePath": "blob/master/src/main/resources/HiberbeeDark.theme.json" "sourceCodePath": "blob/latest/src/main/resources/HiberbeeDark.theme.json"
}, },
"HighContrast.theme.json": { "HighContrast.theme.json": {
"name": "High contrast", "name": "High contrast",
@@ -184,7 +184,7 @@
"license": "MIT", "license": "MIT",
"licenseFile": "nord.LICENSE.txt", "licenseFile": "nord.LICENSE.txt",
"sourceCodeUrl": "https://github.com/arcticicestudio/nord-jetbrains", "sourceCodeUrl": "https://github.com/arcticicestudio/nord-jetbrains",
"sourceCodePath": "blob/develop/src/nord.theme.json" "sourceCodePath": "blob/main/src/nord.theme.json"
}, },
"one_dark.theme.json": { "one_dark.theme.json": {
"name": "One Dark", "name": "One Dark",

View File

@@ -22,7 +22,7 @@ plugins {
dependencies { dependencies {
implementation( project( ":flatlaf-core" ) ) implementation( project( ":flatlaf-core" ) )
implementation( "com.formdev:svgSalamander:1.1.2.4" ) implementation( "com.formdev:svgSalamander:1.1.3" )
} }
flatlafModuleInfo { flatlafModuleInfo {

View File

@@ -43,6 +43,7 @@ import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableColumnModel; import javax.swing.table.TableColumnModel;
import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.extras.components.FlatTextField;
import com.formdev.flatlaf.icons.FlatAbstractIcon; import com.formdev.flatlaf.icons.FlatAbstractIcon;
import com.formdev.flatlaf.ui.FlatBorder; import com.formdev.flatlaf.ui.FlatBorder;
import com.formdev.flatlaf.ui.FlatEmptyBorder; import com.formdev.flatlaf.ui.FlatEmptyBorder;
@@ -557,7 +558,7 @@ public class FlatUIDefaultsInspector
panel = new JPanel(); panel = new JPanel();
filterPanel = new JPanel(); filterPanel = new JPanel();
flterLabel = new JLabel(); flterLabel = new JLabel();
filterField = new JTextField(); filterField = new FlatTextField();
valueTypeLabel = new JLabel(); valueTypeLabel = new JLabel();
valueTypeField = new JComboBox<>(); valueTypeField = new JComboBox<>();
scrollPane = new JScrollPane(); scrollPane = new JScrollPane();
@@ -588,7 +589,8 @@ public class FlatUIDefaultsInspector
new Insets(0, 0, 0, 10), 0, 0)); new Insets(0, 0, 0, 10), 0, 0));
//---- filterField ---- //---- filterField ----
filterField.putClientProperty("JTextField.placeholderText", "enter one or more filter strings, separated by space characters"); filterField.setPlaceholderText("enter one or more filter strings, separated by space characters");
filterField.setShowClearButton(true);
filterPanel.add(filterField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, filterPanel.add(filterField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 10), 0, 0)); new Insets(0, 0, 0, 10), 0, 0));
@@ -667,7 +669,7 @@ public class FlatUIDefaultsInspector
private JPanel panel; private JPanel panel;
private JPanel filterPanel; private JPanel filterPanel;
private JLabel flterLabel; private JLabel flterLabel;
private JTextField filterField; private FlatTextField filterField;
private JLabel valueTypeLabel; private JLabel valueTypeLabel;
private JComboBox<String> valueTypeField; private JComboBox<String> valueTypeField;
private JScrollPane scrollPane; private JScrollPane scrollPane;

View File

@@ -20,9 +20,10 @@ new FormModel {
"labelFor": new FormReference( "filterField" ) "labelFor": new FormReference( "filterField" )
"displayedMnemonic": 70 "displayedMnemonic": 70
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) ) }, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) )
add( new FormComponent( "javax.swing.JTextField" ) { add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTextField" ) {
name: "filterField" name: "filterField"
"$client.JTextField.placeholderText": "enter one or more filter strings, separated by space characters" "placeholderText": "enter one or more filter strings, separated by space characters"
"showClearButton": true
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) { }, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) {
"gridx": 1 "gridx": 1
} ) } )

View File

@@ -20,6 +20,7 @@ import static com.formdev.flatlaf.FlatClientProperties.*;
import java.awt.Color; import java.awt.Color;
import java.awt.Insets; import java.awt.Insets;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFormattedTextField; import javax.swing.JFormattedTextField;
import com.formdev.flatlaf.extras.components.FlatTextField.SelectAllOnFocusPolicy; import com.formdev.flatlaf.extras.components.FlatTextField.SelectAllOnFocusPolicy;
@@ -85,6 +86,84 @@ public class FlatFormattedTextField
} }
/**
* Returns a component that will be placed at the leading edge of the text field.
*
* @since 2
*/
public JComponent getLeadingComponent() {
return (JComponent) getClientProperty( TEXT_FIELD_LEADING_COMPONENT );
}
/**
* Specifies a component that will be placed at the leading edge of the text field.
* <p>
* The component will be positioned inside and aligned to the visible text field border.
* There is no gap between the visible border and the component.
* The laid out component size will be the preferred component width
* and the inner text field height.
* <p>
* The component should be not opaque because the text field border is painted
* slightly inside the usually visible border in some cases.
* E.g. when focused (in some themes) or when an outline color is specified
* (see {@link #setOutline(Object)}.
*
* @since 2
*/
public void setLeadingComponent( JComponent leadingComponent ) {
putClientProperty( TEXT_FIELD_LEADING_COMPONENT, leadingComponent );
}
/**
* Returns a component that will be placed at the trailing edge of the text field.
*
* @since 2
*/
public JComponent getTrailingComponent() {
return (JComponent) getClientProperty( TEXT_FIELD_TRAILING_COMPONENT );
}
/**
* Specifies a component that will be placed at the trailing edge of the text field.
* <p>
* The component will be positioned inside and aligned to the visible text field border.
* There is no gap between the visible border and the component.
* The laid out component size will be the preferred component width
* and the inner text field height.
* <p>
* The component should be not opaque because the text field border is painted
* slightly inside the usually visible border in some cases.
* E.g. when focused (in some themes) or when an outline color is specified
* (see {@link #setOutline(Object)}.
*
* @since 2
*/
public void setTrailingComponent( JComponent trailingComponent ) {
putClientProperty( TEXT_FIELD_TRAILING_COMPONENT, trailingComponent );
}
/**
* Returns whether a "clear" (or "cancel") button is shown.
*
* @since 2
*/
public boolean isShowClearButton() {
return getClientPropertyBoolean( TEXT_FIELD_SHOW_CLEAR_BUTTON, false );
}
/**
* Specifies whether a "clear" (or "cancel") button is shown on the trailing side
* if the text field is not empty, editable and enabled.
*
* @since 2
*/
public void setShowClearButton( boolean showClearButton ) {
putClientPropertyBoolean( TEXT_FIELD_SHOW_CLEAR_BUTTON, showClearButton, false );
}
/** /**
* Returns whether all text is selected when the text component gains focus. * Returns whether all text is selected when the text component gains focus.
*/ */

View File

@@ -20,6 +20,7 @@ import static com.formdev.flatlaf.FlatClientProperties.*;
import java.awt.Color; import java.awt.Color;
import java.awt.Insets; import java.awt.Insets;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPasswordField; import javax.swing.JPasswordField;
import com.formdev.flatlaf.extras.components.FlatTextField.SelectAllOnFocusPolicy; import com.formdev.flatlaf.extras.components.FlatTextField.SelectAllOnFocusPolicy;
@@ -85,6 +86,84 @@ public class FlatPasswordField
} }
/**
* Returns a component that will be placed at the leading edge of the text field.
*
* @since 2
*/
public JComponent getLeadingComponent() {
return (JComponent) getClientProperty( TEXT_FIELD_LEADING_COMPONENT );
}
/**
* Specifies a component that will be placed at the leading edge of the text field.
* <p>
* The component will be positioned inside and aligned to the visible text field border.
* There is no gap between the visible border and the component.
* The laid out component size will be the preferred component width
* and the inner text field height.
* <p>
* The component should be not opaque because the text field border is painted
* slightly inside the usually visible border in some cases.
* E.g. when focused (in some themes) or when an outline color is specified
* (see {@link #setOutline(Object)}.
*
* @since 2
*/
public void setLeadingComponent( JComponent leadingComponent ) {
putClientProperty( TEXT_FIELD_LEADING_COMPONENT, leadingComponent );
}
/**
* Returns a component that will be placed at the trailing edge of the text field.
*
* @since 2
*/
public JComponent getTrailingComponent() {
return (JComponent) getClientProperty( TEXT_FIELD_TRAILING_COMPONENT );
}
/**
* Specifies a component that will be placed at the trailing edge of the text field.
* <p>
* The component will be positioned inside and aligned to the visible text field border.
* There is no gap between the visible border and the component.
* The laid out component size will be the preferred component width
* and the inner text field height.
* <p>
* The component should be not opaque because the text field border is painted
* slightly inside the usually visible border in some cases.
* E.g. when focused (in some themes) or when an outline color is specified
* (see {@link #setOutline(Object)}.
*
* @since 2
*/
public void setTrailingComponent( JComponent trailingComponent ) {
putClientProperty( TEXT_FIELD_TRAILING_COMPONENT, trailingComponent );
}
/**
* Returns whether a "clear" (or "cancel") button is shown.
*
* @since 2
*/
public boolean isShowClearButton() {
return getClientPropertyBoolean( TEXT_FIELD_SHOW_CLEAR_BUTTON, false );
}
/**
* Specifies whether a "clear" (or "cancel") button is shown on the trailing side
* if the text field is not empty, editable and enabled.
*
* @since 2
*/
public void setShowClearButton( boolean showClearButton ) {
putClientPropertyBoolean( TEXT_FIELD_SHOW_CLEAR_BUTTON, showClearButton, false );
}
/** /**
* Returns whether all text is selected when the text component gains focus. * Returns whether all text is selected when the text component gains focus.
*/ */

View File

@@ -20,6 +20,7 @@ import static com.formdev.flatlaf.FlatClientProperties.*;
import java.awt.Color; import java.awt.Color;
import java.awt.Insets; import java.awt.Insets;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JTextField; import javax.swing.JTextField;
/** /**
@@ -84,6 +85,84 @@ public class FlatTextField
} }
/**
* Returns a component that will be placed at the leading edge of the text field.
*
* @since 2
*/
public JComponent getLeadingComponent() {
return (JComponent) getClientProperty( TEXT_FIELD_LEADING_COMPONENT );
}
/**
* Specifies a component that will be placed at the leading edge of the text field.
* <p>
* The component will be positioned inside and aligned to the visible text field border.
* There is no gap between the visible border and the component.
* The laid out component size will be the preferred component width
* and the inner text field height.
* <p>
* The component should be not opaque because the text field border is painted
* slightly inside the usually visible border in some cases.
* E.g. when focused (in some themes) or when an outline color is specified
* (see {@link #setOutline(Object)}.
*
* @since 2
*/
public void setLeadingComponent( JComponent leadingComponent ) {
putClientProperty( TEXT_FIELD_LEADING_COMPONENT, leadingComponent );
}
/**
* Returns a component that will be placed at the trailing edge of the text field.
*
* @since 2
*/
public JComponent getTrailingComponent() {
return (JComponent) getClientProperty( TEXT_FIELD_TRAILING_COMPONENT );
}
/**
* Specifies a component that will be placed at the trailing edge of the text field.
* <p>
* The component will be positioned inside and aligned to the visible text field border.
* There is no gap between the visible border and the component.
* The laid out component size will be the preferred component width
* and the inner text field height.
* <p>
* The component should be not opaque because the text field border is painted
* slightly inside the usually visible border in some cases.
* E.g. when focused (in some themes) or when an outline color is specified
* (see {@link #setOutline(Object)}.
*
* @since 2
*/
public void setTrailingComponent( JComponent trailingComponent ) {
putClientProperty( TEXT_FIELD_TRAILING_COMPONENT, trailingComponent );
}
/**
* Returns whether a "clear" (or "cancel") button is shown.
*
* @since 2
*/
public boolean isShowClearButton() {
return getClientPropertyBoolean( TEXT_FIELD_SHOW_CLEAR_BUTTON, false );
}
/**
* Specifies whether a "clear" (or "cancel") button is shown on the trailing side
* if the text field is not empty, editable and enabled.
*
* @since 2
*/
public void setShowClearButton( boolean showClearButton ) {
putClientPropertyBoolean( TEXT_FIELD_SHOW_CLEAR_BUTTON, showClearButton, false );
}
// NOTE: enum names must be equal to allowed strings // NOTE: enum names must be equal to allowed strings
public enum SelectAllOnFocusPolicy { never, once, always }; public enum SelectAllOnFocusPolicy { never, once, always };

View File

@@ -75,7 +75,7 @@
"nonEditableBackground": "secondaryBackground" "nonEditableBackground": "secondaryBackground"
}, },
"CompletionPopup": { "CompletionPopup": {
"selectionBackground": "selectionBackground", "selectionBackground": "selectionInactiveBackground",
"selectionInactiveBackground": "selectionInactiveBackground", "selectionInactiveBackground": "selectionInactiveBackground",
"matchForeground": "accentColor" "matchForeground": "accentColor"
}, },
@@ -256,10 +256,8 @@
"selectionInactiveBackground": "selectionInactiveBackground" "selectionInactiveBackground": "selectionInactiveBackground"
}, },
"ValidationTooltip": { "ValidationTooltip": {
"errorBackground": "#ff5554", "errorBackground": "#4c273c",
"errorBorderColor": "#ff5554", "warningBackground": "#4f4b41"
"warningBorderColor": "#ffb86c",
"warningBackground": "#ffb86c"
}, },
"VersionControl": { "VersionControl": {
"FileHistory": { "FileHistory": {
@@ -330,4 +328,4 @@
"Checkbox.Focus.Thin.Default.Dark": "#bd93f9" "Checkbox.Focus.Thin.Default.Dark": "#bd93f9"
} }
} }
} }

View File

@@ -5,309 +5,350 @@
"editorScheme": "/colors/Dark.xml", "editorScheme": "/colors/Dark.xml",
"colors": { "colors": {
"black": "#000000", "black": "#000000",
"consoleBackground": "#191919", "editorDarkerBg": "#2D2B29",
"editorBackground": "#212121", "shortcutForeground": "#2d2b29",
"panelBackground": "#333333", "editorBg": "#1B1A19",
"textColor": "#F9F6EF", "consoleBackground": "#171615",
"border": "#3c3c3c", "editorPaneBg": "#333231",
"panelBackground": "#333231",
"textColor": "#f9f6ef",
"textColorTransparent": "#f9f6ef7f",
"border": "#4d4c4b",
"redMac": "#fb3b45", "redMac": "#fb3b45",
"redWin": "#ef6950", "redWin": "#ef6950",
"redMonokaiPro": "#ff6188", "redMonokaiPro": "#ff6188",
"blueWinPalette": "#409AE1", "blueWinPalette": "#409AE1",
"blue": "#78dce8", "blue": "#78dce8",
"deepBlue": "#3199b3",
"orangeMonokaiPro": "#fc9867", "orangeMonokaiPro": "#fc9867",
"greenMonokaiPro": "#a9dc76", "greenMonokaiPro": "#a9dc76",
"yellowWinPalette": "#ffc83d", "yellow": "#FFB900",
"yellowMac": "#faaa1f",
"purpleWinPalette": "#b4a0ff", "purpleWinPalette": "#b4a0ff",
"purpleMonokaiPro": "#ab9df2", "purpleMonokaiPro": "#ab9df2",
"greenWinPalette": "#40c5af", "greenWinPalette": "#40c5af",
"greyWinPalette": "#b2b2b2", "greyWinPalette": "#b2b2b2",
"panelText": "#a6a6a6", "panelText": "#acacac",
"desaturatedBlue": "#1e282d",
"desaturatedOrange": "#8049117f", "desaturatedOrange": "#8049117f",
"green": "#5B8021", "green": "#92d923",
"greyDot15": "#d8d8d8", "greyDot15": "#f9f6ef",
"greyDot20": "#cccccc", "greyDot20": "#c0c0c0",
"greyDot25": "#bfbfbf", "greyDot25": "#bfbfbf",
"greyDot33": "#aaaaaa", "greyDot33": "#aaaaaa",
"greyDot50": "#7d7d7d", "greyDot50": "#7d7d7d",
"greyDot60": "#666666", "greyDot60": "#666666",
"greyDot65": "#5a5a5a", "greyDot65": "#5a5a5a",
"greyDot70": "#4d4d4d", "greyDot70": "#4d4c4b",
"greyDot75": "#434343", "greyDot75": "#434241",
"greyDot80": "#323232", "greyDot80": "#333231",
"greyDot85": "#252525", "greyDot85": "#2d2b29",
"greyDot90": "#1f2021", "greyDot90": "#1f1e1d",
"greyDot95": "#242220",
"greyDot100": "#181615",
"lightBlue": "#70D7FF", "lightBlue": "#70D7FF",
"navyDot85": "#191d21",
"navyDot90": "#1f2021",
"red": "#800040", "red": "#800040",
"transparentGreen": "#5B80217f", "transparentGreen": "#5B80217f",
"transparentRed": "#8000407f", "transparentRed": "#F250227f",
"transparentViolet": "#9478F67f", "transparentViolet": "#242221ff",
"transparentYellow": "#8066357f", "transparentYellow": "#FFB9007f"
"yellow": "#806635"
},
"icons": {
"ColorPalette": {
"Actions.Blue": "#57D1EB",
"Actions.Green": "#92D923",
"Actions.Grey": "#afafaf",
"Actions.GreyInline": "#7f7f7f",
"Actions.GreyInline.Dark": "#646464",
"Actions.Red": "#ff6188",
"Actions.Yellow": "#FFC83C",
"Objects.BlackText": "#7d7d7d",
"Objects.Blue": "#57D1EB",
"Objects.Green": "#92D923",
"Objects.GreenAndroid": "#92D923",
"Objects.Grey": "#7f7f7f",
"Objects.Pink": "#ffa9ca",
"Objects.Purple": "#9380FF",
"Objects.Red": "#ed005c",
"Objects.RedStatus": "#EC5F5D",
"Objects.Yellow": "#FFC83C",
"Objects.YellowDark": "#FD971F"
}
}, },
"ui": { "ui": {
"*": { "*": {
"arc": "3", "arc": 5,
"shadow": "greyDot75", "background": "panelBackground",
"background": "greyDot80", "borderColor": "border",
"borderColor": "greyDot70", "caretForeground": "yellow",
"caretForeground": "yellowMac", "color": "greyDot60",
"color": "greyDot50", "foreground": "textColor",
"foreground": "greyDot20", "hoverBackground": "greyDot85",
"hoverBackground": "greyDot70", "selectedBackground": "greyDot90",
"selectedBackground": "greyDot85", "selectedForeground": "textColor",
"selectedForeground": "greyDot15", "selectedInactiveBackground": "greyDot75",
"selectedInactiveBackground": "greyDot70", "selectionBackground": "greyDot95",
"selectionBackground": "navyDot85", "selectionForeground": "yellow",
"selectionForeground": "yellowMac", "separatorColor": "border",
"separatorColor": "greyDot75",
"underlineHeight": 1 "underlineHeight": 1
}, },
"ActionButton": { "ActionButton": {
"hoverBorderColor": "greyDot50", "pressedBackground": "greyDot95",
"pressedBackground": "greyDot65", "hoverBorderColor": "greyDot65",
"pressedBorderColor": "greyDot50" "pressedBorderColor": "greyDot60"
}, },
"Borders": { "Borders": {
"ContrastBorderColor": "greyDot65", "ContrastBorderColor": "greyDot60",
"color": "border" "color": "border"
}, },
"Button.default.endBackground": "greyDot80", "Button": {
"Button.default.endBorderColor": "greyDot65", "arc": 5,
"Button.default.focusColor": "greyDot80", "default": {
"Button.default.focusedBorderColor": "greyDot15", "endBackground": "greyDot80",
"Button.default.foreground": "greyDot15", "endBorderColor": "greyDot70",
"Button.default.startBackground": "greyDot80", "focusColor": "greyDot60",
"Button.default.startBorderColor": "greyDot65", "focusedBorderColor": "greyDot50",
"Button.endBackground": "greyDot80", "foreground": "greyDot33",
"Button.endBorderColor": "greyDot65", "startBackground": "greyDot80",
"Button.focusedBorderColor": "yellowMac", "startBorderColor": "greyDot70"
"Button.startBackground": "greyDot80", },
"Button.startBorderColor": "greyDot65", "shadowWidth": 1,
"CheckBox.disabledText": "greyDot33", "endBackground": "greyDot80",
"CheckBox.select": "greyDot50", "endBorderColor": "greyDot70",
"CheckBoxMenuItem.disabledBackground": "greyDot80", "focusedBorderColor": "greyDot50",
"ComboBox.ArrowButton.disabledIconColor": "greyDot50",
"ComboBox.ArrowButton.iconColor": "yellowMac",
"ComboBox.ArrowButton.nonEditableBackground": "greyDot70",
"ComboBox.modifiedItemForeground": "yellowMac",
"ComboBox.disabledForeground": "greyDot80",
"ComboBox.nonEditableBackground": "greyDot75",
"ComboPopup.border": "1,1,1,1,4d4d4d",
"CompletionPopup": {
"nonFocusedMask": "#34343434",
"selectionBackground": "navyDot85",
"foreground": "greyDot20", "foreground": "greyDot20",
"matchForeground": "yellowMac" "disabledBorderColor": "greyDot75",
"startBackground": "greyDot80",
"startBorderColor": "greyDot70"
},
"CheckBox.disabledText": "greyDot50",
"CheckBox.foreground": "greyDot33",
"CheckBox.select": "greyDot50",
"CheckBoxMenuItem.background": "greyDot80",
"CheckBoxMenuItem.disabledBackground": "greyDot80",
"CheckBoxMenuItem.disabledForeground": "greyDot50",
"CheckBoxMenuItem.foreground": "greyDot20",
"ColorChooser.background": "greyDot80",
"ComboBox": {
"ArrowButton": {
"disabledIconColor": "textColorTransparent",
"iconColor": "yellow",
"nonEditableBackground": "greyDot65"
},
"background": "greyDot80",
"disabledForeground": "greyDot50",
"foreground": "greyDot20",
"modifiedItemForeground": "yellow",
"nonEditableBackground": "greyDot75",
"selectionBackground": "greyDot95"
},
"CompletionPopup": {
"foreground": "greyDot20",
"matchForeground": "yellow",
"selectionBackground": "greyDot95",
"selectionInactiveBackground": "greyDot85"
}, },
"Component": { "Component": {
"arc": "3", "arc": "4",
"disabledBorderColor": "greyDot70", "iconColor": "yellow",
"disabledBorderColor": "greyDot75",
"infoForeground": "greyDot50", "infoForeground": "greyDot50",
"errorFocusColor": "#F65F87", "errorFocusColor": "red",
"focusColor": "greyDot50", "focusColor": "greyDot60",
"focusWidth": "0", "focusWidth": 0,
"focusedBorderColor": "greyDot50", "focusedBorderColor": "greyDot65",
"hoverIconColor": "yellowMac",
"inactiveErrorFocusColor": "transparentRed", "inactiveErrorFocusColor": "transparentRed",
"inactiveWarningFocusColor": "transparentYellow", "inactiveWarningFocusColor": "transparentYellow",
"warningFocusColor": "yellow" "warningFocusColor": "yellow"
}, },
"Debugger.Variables.changedValueForeground": "yellowMac", "Debugger.Variables.changedValueForeground": "yellow",
"Debugger.Variables.evaluatingExpressionForeground": "lightBlue", "Debugger.Variables.evaluatingExpressionForeground": "lightBlue",
"DefaultTabs.underlineColor": "yellowMac", "DefaultTabs.borderColor": "border",
"DefaultTabs.inactiveUnderlineColor": "border",
"DefaultTabs.underlineColor": "yellow",
"DefaultTabs.underlineHeight": 1, "DefaultTabs.underlineHeight": 1,
"DefaultTabs.underlinedTabBackground": "greyDot75", "DefaultTabs.underlinedTabForeground": "yellow",
"DefaultTabs.underlinedTabForeground": "lightBlue",
"DragAndDrop.areaBackground": "greyDot75", "DragAndDrop.areaBackground": "greyDot75",
"DragAndDrop.areaForeground": "greyDot25", "DragAndDrop.areaForeground": "greyDot25",
"Editor.background": "greyDot90", "Editor": {
"EditorPane.inactiveBackground": "greyDot85", "background": "editorPaneBg",
"EditorPane.inactiveForeground": "greyDot50", "foreground": "textColor",
"EditorTabs.underlineHeight": 1, "shortcutForeground": "greyDot20"
"FileColor.Blue": "#23282d", },
"FileColor.Green": "#232d28", "EditorPane": {
"FileColor.Orange": "#2d2823", "background": "editorPaneBg",
"FileColor.Rose": "#2d2323", "inactiveBackground": "editorDarkerBg",
"FileColor.Violet": "#2D232D", "inactiveForeground": "greyDot50",
"FileColor.Yellow": "#2d2d23", "selectionBackground": "editorBg",
"FormattedTextField.inactiveBackground": "greyDot80", "selectionForeground": "textColor"
"FormattedTextField.background": "greyDot75", },
"GutterTooltip.infoForeground": "greyDot50", "EditorTabs": {
"underlineHeight": 1,
"borderColor": "editorDarkerBg",
"hoverBackground": "editorBg",
"background": "editorPaneBg",
"inactiveUnderlineColor": "editorPaneBg",
"underlinedTabForeground": "textColor"
},
"EditorTabs.inactiveColoredFileBackground": true,
"FileColor": {
"Blue": "#23282d",
"Green": "#232d28",
"Orange": "#2d2823",
"Rose": "#2d2323",
"Violet": "#2D232D",
"Yellow": "#2d2d23"
},
"FormattedTextField": {
"foreground": "textColor",
"selectionBackground": "greyDot95",
"inactiveBackground": "greyDot80",
"inactiveForeground": "greyDot33",
"background": "greyDot75"
},
"GutterTooltip": {
"infoForeground": "greyDot33",
"lineSeparatorColor": "greyDot70"
},
"InformationHint.borderColor": "greyDot75",
"InplaceRefactoringPopup.borderColor": "greyDot75",
"Label": { "Label": {
"foreground": "greyDot25", "disabledForeground": "greyDot33",
"disabledText": "greyDot33",
"foreground": "greyDot20",
"infoForeground": "greyDot50" "infoForeground": "greyDot50"
}, },
"Link.activeForeground": "lightBlue", "Link.hoverForeground": "yellow",
"Link.hoverForeground": "yellowMac",
"Link.pressedForeground": "lightBlue",
"Link.visitedForeground": "greyDot25",
"MemoryIndicator.allocatedBackground": "green", "MemoryIndicator.allocatedBackground": "green",
"MemoryIndicator.usedBackground": "red", "MemoryIndicator.usedBackground": "red",
"Menu": { "Menu": {
"background": "greyDot80",
"disabledForeground": "greyDot70",
"separatorColor": "greyDot75", "separatorColor": "greyDot75",
"foreground": "textColor", "foreground": "textColor",
"borderColor": "greyDot70", "borderColor": "greyDot70",
"acceleratorForeground": "greyDot25" "acceleratorForeground": "greyDot33"
}, },
"Notification.MoreButton.innerBorderColor": "greyDot65", "Notification.MoreButton.innerBorderColor": "greyDot65",
"Notification.ToolWindow.errorBackground": "greyDot85", "Notification.ToolWindow.errorBackground": "greyDot95",
"Notification.ToolWindow.errorBorderColor": "#ed005c", "Notification.ToolWindow.errorBorderColor": "red",
"Notification.ToolWindow.errorForeground": "#F65F87", "Notification.ToolWindow.errorForeground": "#EE7762",
"Notification.ToolWindow.informativeBackground": "greyDot85", "Notification.ToolWindow.informativeBackground": "greyDot95",
"Notification.ToolWindow.informativeBorderColor": "#92D923", "Notification.ToolWindow.informativeBorderColor": "#92D923",
"Notification.ToolWindow.informativeForeground": "#92D923", "Notification.ToolWindow.informativeForeground": "#92D923",
"Notification.ToolWindow.warningBackground": "greyDot85", "Notification.ToolWindow.warningBackground": "greyDot95",
"Notification.ToolWindow.warningBorderColor": "yellowMac", "Notification.ToolWindow.warningBorderColor": "yellow",
"Notification.ToolWindow.warningForeground": "yellowMac", "Notification.ToolWindow.warningForeground": "yellow",
"Notification.background": "greyDot85", "Notification.background": "greyDot95",
"Notification.errorBackground": "greyDot85", "Notification.errorBackground": "greyDot95",
"Notification.errorBorderColor": "#ed005c", "Notification.errorBorderColor": "red",
"Notification.errorForeground": "#F65F87", "Notification.errorForeground": "#EE7762",
"OptionPane": { "OptionPane": {
"background": "greyDot80", "background": "editorPaneBg",
"foreground": "greyDot20" "foreground": "greyDot20"
}, },
"Panel": { "Panel": {
"background": "greyDot80", "background": "editorPaneBg",
"foreground": "greyDot20" "foreground": "textColor"
}, },
"Panel.foreground": "greyDot20",
"ParameterInfo.background": "greyDot85", "ParameterInfo.background": "greyDot85",
"ParameterInfo.foreground": "greyDot25", "ParameterInfo.borderColor": "greyDot75",
"ParameterInfo.currentOverloadBackground": "greyDot65", "ParameterInfo.currentOverloadBackground": "greyDot65",
"ParameterInfo.currentParameterForeground": "yellowMac", "ParameterInfo.currentParameterForeground": "yellow",
"ParameterInfo.foreground": "greyDot25",
"ParameterInfo.infoForeground": "greyDot33", "ParameterInfo.infoForeground": "greyDot33",
"ParameterInfo.lineSeparatorColor": "greyDot75", "ParameterInfo.lineSeparatorColor": "greyDot75",
"PasswordField.background": "greyDot75", "PasswordField.background": "greyDot75",
"Plugins.Button.installBackground": "greyDot80", "Plugins.Button.installBackground": "greyDot80",
"Plugins.Button.installBorderColor": "greyDot65", "Plugins.Button.installBorderColor": "greyDot60",
"Plugins.Button.installFillBackground": "greyDot80", "Plugins.Button.installFillBackground": "greyDot80",
"Plugins.Button.installFillForeground": "greyDot25", "Plugins.Button.installFillForeground": "greyDot25",
"Plugins.Button.installForeground": "yellowMac", "Plugins.Button.installForeground": "yellow",
"Plugins.SearchField.background": "greyDot75", "Plugins.SearchField.background": "greyDot75",
"Plugins.SectionHeader.background": "greyDot75", "Plugins.SectionHeader.background": "greyDot75",
"Plugins.Tab.hoverBackground": "navyDot85", "Plugins.Tab.hoverBackground": "editorBg",
"Plugins.Tab.selectedBackground": "greyDot85", "Plugins.Tab.selectedBackground": "editorPaneBg",
"Plugins.background": "greyDot80", "Plugins.background": "editorPaneBg",
"Plugins.lightSelectionBackground": "#242220",
"Plugins.disabledForeground": "greyDot50", "Plugins.disabledForeground": "greyDot50",
"Plugins.lightSelectionBackground": "navyDot85", "Plugins.tagBackground": "editorBg",
"Plugins.tagBackground": "greyDot85", "Plugins.tagForeground": "greyDot33",
"Plugins.hoverBackground": "editorBg",
"Popup.Advertiser.background": "greyDot85", "Popup.Advertiser.background": "greyDot85",
"Popup.Advertiser.foreground": "greyDot50", "Popup.Advertiser.foreground": "greyDot50",
"Popup.Header.activeBackground": "greyDot75", "Popup.Header.activeBackground": "greyDot75",
"Popup.Header.inactiveBackground": "greyDot85", "Popup.Header.inactiveBackground": "greyDot85",
"Popup.paintBorder": true, "Popup.paintBorder": false,
"PopupMenu.background": "greyDot80", "PopupMenu.background": "greyDot80",
"PopupMenuSeparator.stripeWidth": 1, "PopupMenuSeparator.stripeWidth": 1,
"ProgressBar.failedColor": "#ed005c", "ProgressBar.failedColor": "red",
"ProgressBar.failedEndColor": "greyDot75", "ProgressBar.failedEndColor": "greyDot75",
"ProgressBar.indeterminateStartColor": "yellowMac",
"ProgressBar.indeterminateEndColor": "#FD971F", "ProgressBar.indeterminateEndColor": "#FD971F",
"ProgressBar.passedColor": "#92D923", "ProgressBar.indeterminateStartColor": "yellow",
"ProgressBar.passedColor": "green",
"ProgressBar.passedEndColor": "greyDot75", "ProgressBar.passedEndColor": "greyDot75",
"ProgressBar.progressColor": "yellowMac", "ProgressBar.progressColor": "yellow",
"ProgressBar.trackColor": "greyDot75", "ProgressBar.trackColor": "greyDot75",
"RadioButton.background": "greyDot80", "RadioButton.background": "greyDot80",
"RadioButton.disabledText": "greyDot70",
"RadioButtonMenuItem.disabledBackground": "greyDot80", "RadioButtonMenuItem.disabledBackground": "greyDot80",
"ScrollPane.background": "greyDot80", "ScrollPane.background": "greyDot80",
"SearchEverywhere.Advertiser.foreground": "greyDot50", "SearchEverywhere.Advertiser.foreground": "greyDot50",
"SearchEverywhere.List.separatorForeground": "greyDot50",
"SearchEverywhere.SearchField.infoForeground": "greyDot33",
"SearchEverywhere.SearchField.background": "greyDot75",
"SearchEverywhere.Header.background": "greyDot80", "SearchEverywhere.Header.background": "greyDot80",
"SearchEverywhere.Tab.selectedBackground": "greyDot85", "SearchEverywhere.List.separatorForeground": "greyDot50",
"SearchEverywhere.Tab.selectedForeground": "lightBlue", "SearchEverywhere.SearchField.background": "greyDot75",
"SearchMatch.endBackground": "yellowMac", "SearchEverywhere.SearchField.infoForeground": "greyDot33",
"SearchMatch.startBackground": "yellowMac", "SearchEverywhere.Tab.selectedBackground": "greyDot95",
"SearchEverywhere.Tab.selectedForeground": "yellow",
"SearchMatch.endBackground": "yellow",
"SearchMatch.startBackground": "yellow",
"SidePanel.background": "greyDot85", "SidePanel.background": "greyDot85",
"SpeedSearch.errorForeground": "#F65F87", "SpeedSearch.errorForeground": "red",
"SpeedSearch.foreground": "yellowMac", "SpeedSearch.foreground": "yellow",
"SplitPane.highlight": "yellowMac", "SplitPane.highlight": "yellow",
"PopupMenu.translucentBackground": "greyDot50", "TabbedPane.disabledUnderlineColor": "editorPaneBg",
"TabbedPane.disabledUnderlineColor": "greyDot65", "TabbedPane.focus": "greyDot75",
"TabbedPane.focusColor": "greyDot65", "TabbedPane.focusColor": "greyDot33",
"TabbedPane.tabSelectionHeight": 1, "TabbedPane.tabSelectionHeight": 1,
"TabbedPane.underlineColor": "yellowMac", "TabbedPane.underlineColor": "yellow",
"Table.dropLineColor": "greyDot75", "Table.dropLineColor": "greyDot75",
"Table.dropLineShortColor": "greyDot70", "Table.dropLineShortColor": "greyDot70",
"Table.focusCellBackground": "greyDot85", "Table.focusCellBackground": "greyDot85",
"Table.focusCellForeground": "yellowMac", "Table.focusCellForeground": "yellow",
"Table.sortIconColor": "yellowMac", "Table.sortIconColor": "yellow",
"Table.stripeColor": "greyDot75", "Table.stripeColor": "greyDot75",
"TableHeader.background": "greyDot85", "TableHeader.background": "greyDot85",
"TableHeader.bottomSeparatorColor": "greyDot65", "TableHeader.bottomSeparatorColor": "greyDot65",
"TextArea.background": "greyDot75", "TextArea.background": "greyDot75",
"TextArea.caretForeground": "yellowMac", "TextArea.caretForeground": "yellow",
"TextArea.inactiveBackground": "greyDot80", "TextArea.inactiveBackground": "greyDot80",
"TextArea.selectionBackground": "greyDot95",
"TextField.background": "greyDot75", "TextField.background": "greyDot75",
"TextField.foreground": "greyDot25", "TextField.caretForeground": "yellow",
"TextField.caretForeground": "yellowMac", "TextField.foreground": "greyDot33",
"TextField.highlight": "greyDot15", "TextField.highlight": "yellow",
"TextField.inactiveForeground": "greyDot33", "TextField.inactiveForeground": "greyDot33",
"TextPane.inactiveBackground": "greyDot80", "TextPane.inactiveBackground": "greyDot80",
"TextPane.inactiveForeground": "greyDot50",
"TitlePane.background": "greyDot85", "TitlePane.background": "greyDot85",
"ToggleButton.buttonColor": "greyDot65", "ToggleButton.buttonColor": "greyDot65",
"ToggleButton.offBackground": "greyDot75", "ToggleButton.offBackground": "greyDot75",
"ToggleButton.offForeground": "greyDot25", "ToggleButton.offForeground": "greyDot25",
"ToggleButton.onBackground": "yellowMac", "ToggleButton.onBackground": "yellow",
"ToggleButton.onForeground": "greyDot80", "ToggleButton.onForeground": "greyDot80",
"ToolBar.borderHandleColor": "greyDot65", "ToolBar.borderHandleColor": "greyDot65",
"ToolTip.Actions.background": "greyDot80", "ToolTip.Actions.background": "greyDot80",
"ToolTip.Actions.infoForeground": "greyDot50", "ToolTip.Actions.infoForeground": "greyDot50",
"ToolTip.background": "greyDot75", "ToolTip.background": "greyDot80",
"ToolTip.borderColor": "border",
"ToolTip.infoForeground": "greyDot50", "ToolTip.infoForeground": "greyDot50",
"ToolWindow.Button.hoverBackground": "greyDot65", "ToolWindow.Button.hoverBackground": "greyDot95",
"ToolWindow.Button.selectedBackground": "greyDot85", "ToolWindow.Button.selectedBackground": "greyDot95",
"ToolWindow.Button.selectedForeground": "lightBlue", "ToolWindow.Button.selectedForeground": "yellow",
"ToolWindow.Header.background": "greyDot85", "ToolWindow.Header.background": "greyDot85",
"ToolWindow.Header.inactiveBackground": "greyDot80", "ToolWindow.Header.inactiveBackground": "editorPaneBg",
"ToolWindow.HeaderTab.hoverBackground": "greyDot65", "ToolWindow.HeaderTab.hoverBackground": "consoleBackground",
"ToolWindow.HeaderTab.hoverInactiveBackground": "greyDot85", "ToolWindow.HeaderTab.hoverInactiveBackground": "editorBg",
"ToolWindow.HeaderTab.inactiveUnderlineColor": "greyDot75", "ToolWindow.HeaderTab.underlineColor": "yellow",
"ToolWindow.HeaderTab.underlineColor": "yellowMac",
"ToolWindow.HeaderTab.underlineHeight": 1, "ToolWindow.HeaderTab.underlineHeight": 1,
"ToolWindow.HeaderTab.underlinedTabBackground": "greyDot90", "Tooltip.separatorColor": "border",
"ToolWindow.HeaderTab.underlinedTabInactiveBackground": "greyDot75",
"Tree.background": "greyDot85", "Tree.background": "greyDot85",
"Tree.foreground": "greyDot15", "Tree.foreground": "textColor",
"Tree.modifiedItemForeground": "yellowMac", "Tree.hoverBackground": "greyDot95",
"ValidationTooltip.errorBackground": "greyDot85", "Tree.modifiedItemForeground": "yellow",
"ValidationTooltip.errorBorderColor": "#ed005c", "Tree.selectionBackground": "greyDot95",
"ValidationTooltip.warningBackground": "greyDot85", "Tree.selectionInactiveBackground": "greyDot95",
"ValidationTooltip.warningBorderColor": "yellowMac", "ValidationTooltip.errorBackground": "greyDot95",
"VersionControl.FileHistory.Commit.selectedBranchBackground": "greyDot70", "ValidationTooltip.errorBorderColor": "red",
"ValidationTooltip.warningBackground": "greyDot95",
"ValidationTooltip.warningBorderColor": "yellow",
"VersionControl.FileHistory.Commit.selectedBranchBackground": "greyDot95",
"VersionControl.Log.Commit.currentBranchBackground": "greyDot85", "VersionControl.Log.Commit.currentBranchBackground": "greyDot85",
"VersionControl.Log.Commit.hoveredBackground": "greyDot95",
"VersionControl.Log.Commit.unmatchedForeground": "greyDot25", "VersionControl.Log.Commit.unmatchedForeground": "greyDot25",
"WelcomeScreen.Projects.selectionBackground": "navyDot85", "WelcomeScreen.Details.background": "greyDot80",
"WelcomeScreen.Projects.selectionInactiveBackground": "navyDot90", "WelcomeScreen.Projects.background": "greyDot85",
"WelcomeScreen.separatorColor": "greyDot65", "WelcomeScreen.Projects.selectionBackground": "greyDot95",
"Window.border": "1,1,1,1,4d4d4d" "WelcomeScreen.SidePanel.background": "greyDot80",
"WelcomeScreen.background": "greyDot80",
"WelcomeScreen.borderColor": "border",
"WelcomeScreen.separatorColor": "border",
"Window.border": "0,0,0,0,4d4d4d"
} }
} }

View File

@@ -11,7 +11,8 @@
"colorSelectionBackgroundInactive": "#00243C", "colorSelectionBackgroundInactive": "#00243C",
"colorSelectionForeground": "#C2C5BC", "colorSelectionForeground": "#C2C5BC",
"colorSelectionForegroundInactive": "#A9B3AE", "colorSelectionForegroundInactive": "#A9B3AE",
"colorHoverBackground": "#284E5B", "colorHoverBackground": "#1B4755",
"colorHoverInactiveBackground": "#1B4755",
"colorBorder": "#04343F", "colorBorder": "#04343F",
"colorDisabledForeground": "#657B83", "colorDisabledForeground": "#657B83",
"colorAlternativeBackground": "#1B4854", "colorAlternativeBackground": "#1B4854",
@@ -30,6 +31,8 @@
"disabledForeground": "colorDisabledForeground", "disabledForeground": "colorDisabledForeground",
"disabledText": "colorDisabledForeground", "disabledText": "colorDisabledForeground",
"foreground": "colorForeground", "foreground": "colorForeground",
"hoverBackground": "colorHoverBackground",
"hoverInactiveBackground": "colorHoverInactiveBackground",
"inactiveBackground": "colorBackground", "inactiveBackground": "colorBackground",
"inactiveForeground": "colorInactiveForeground", "inactiveForeground": "colorInactiveForeground",
"selectionBackground": "colorSelectionBackground", "selectionBackground": "colorSelectionBackground",
@@ -42,11 +45,22 @@
"textForeground": "colorForeground" "textForeground": "colorForeground"
}, },
"ActionButton": { "ActionButton": {
"hoverBackground": "colorHoverBackground", "hoverBackground": "#284E5B",
"hoverBorderColor": "colorHoverBackground", "hoverBorderColor": "#284E5B",
"pressedBackground": "#43616C", "pressedBackground": "#43616C",
"pressedBorderColor": "#43616C" "pressedBorderColor": "#43616C"
}, },
"AssignedMnemonic": {
"background": "#47573B",
"borderColor": "#47573B"
},
"AvailableMnemonic": {
"borderColor": "#456168"
},
"BigSpinner": {},
"BookmarkIcon": {
"background": "#73888C"
},
"Borders": { "Borders": {
"color": "colorBorder", "color": "colorBorder",
"ContrastBorderColor": "colorBorder" "ContrastBorderColor": "colorBorder"
@@ -111,6 +125,11 @@
"background": "#99A6A5B0", "background": "#99A6A5B0",
"foreground": "#002B36" "foreground": "#002B36"
}, },
"CurrentMnemonic": {
"background": "#175D8B",
"borderColor": "#175D8B",
"foreground": "#BEC2B9"
},
"Debugger": { "Debugger": {
"Variables": { "Variables": {
"changedValueForeground": "#519AF2", "changedValueForeground": "#519AF2",
@@ -137,7 +156,8 @@
"DragAndDrop": { "DragAndDrop": {
"areaBackground": "#17475F", "areaBackground": "#17475F",
"areaBorderColor": "#386FA8", "areaBorderColor": "#386FA8",
"areaForeground": "colorForeground" "areaForeground": "colorForeground",
"borderColor": "#FA6060"
}, },
"Editor": { "Editor": {
"background": "#0E272F", "background": "#0E272F",
@@ -219,6 +239,7 @@
"FormattedTextField": { "FormattedTextField": {
"background": "colorAlternativeBackground" "background": "colorAlternativeBackground"
}, },
"GotItTooltip": {},
"Group": { "Group": {
"disabledSeparatorColor": "colorSeparator", "disabledSeparatorColor": "colorSeparator",
"separatorColor": "colorSeparator" "separatorColor": "colorSeparator"
@@ -239,7 +260,18 @@
"Label": { "Label": {
"errorForeground": "#FA6060", "errorForeground": "#FA6060",
"infoForeground": "#778A8F", "infoForeground": "#778A8F",
"selectedForeground": "colorForeground" "selectedForeground": "colorForeground",
"successForeground": "#39A464"
},
"Lesson": {
"shortcutBackground": "#0C3340",
"stepNumberForeground": "#73888C",
"Tooltip": {
"background": "#005DCB",
"foreground": "#EEE8D5",
"spanBackground": "#004AA8",
"stepNumberForeground": "#629ADE"
}
}, },
"Link": { "Link": {
"activeForeground": "#519AF2", "activeForeground": "#519AF2",
@@ -269,6 +301,10 @@
"acceleratorForeground": "colorForeground", "acceleratorForeground": "colorForeground",
"disabledBackground": "colorBackground" "disabledBackground": "colorBackground"
}, },
"MnemonicIcon": {
"background": "#36544C",
"borderColor": "#D0A244"
},
"NavBar": { "NavBar": {
"borderColor": "colorSeparator" "borderColor": "colorSeparator"
}, },
@@ -297,7 +333,9 @@
"OptionPane": { "OptionPane": {
"messageForeground": "colorForeground" "messageForeground": "colorForeground"
}, },
"Panel": {}, "Panel": {
"mouseShortcutBackground": "#214C5A"
},
"ParameterInfo": { "ParameterInfo": {
"background": "#254C57", "background": "#254C57",
"borderColor": "#415E69", "borderColor": "#415E69",
@@ -357,6 +395,7 @@
"PopupMenu": { "PopupMenu": {
"translucentBackground": "colorBackground" "translucentBackground": "colorBackground"
}, },
"ProblemsView": {},
"ProgressBar": { "ProgressBar": {
"failedColor": "#DE4647", "failedColor": "#DE4647",
"failedEndColor": "#EFA0A0", "failedEndColor": "#EFA0A0",
@@ -432,6 +471,9 @@
"endBackground": "#FCCE40", "endBackground": "#FCCE40",
"startBackground": "#FFEAA2" "startBackground": "#FFEAA2"
}, },
"SearchOption": {
"selectedBackground": "#456168"
},
"Separator": { "Separator": {
"separatorColor": "colorSeparator" "separatorColor": "colorSeparator"
}, },
@@ -462,9 +504,12 @@
"SplitPaneDivider": { "SplitPaneDivider": {
"draggingColor": "#193E49" "draggingColor": "#193E49"
}, },
"StateWidget": {
"activeBackground": "#FAC640"
},
"StatusBar": { "StatusBar": {
"borderColor": "#204550", "borderColor": "#204550",
"hoverBackground": "colorHoverBackground" "hoverBackground": "#284E5B"
}, },
"TabbedPane": { "TabbedPane": {
"contentAreaColor": "#04343F", "contentAreaColor": "#04343F",
@@ -475,6 +520,7 @@
"underlineColor": "#3985C7" "underlineColor": "#3985C7"
}, },
"Table": { "Table": {
"alternativeRowBackground": "#013441",
"dropLineColor": "colorAcceleratorForeground", "dropLineColor": "colorAcceleratorForeground",
"dropLineShortColor": "#0C3542", "dropLineShortColor": "#0C3542",
"focusCellBackground": "colorAlternativeBackground", "focusCellBackground": "colorAlternativeBackground",
@@ -605,6 +651,7 @@
"Log": { "Log": {
"Commit": { "Commit": {
"currentBranchBackground": "#044452", "currentBranchBackground": "#044452",
"hoveredBackground": "#124957",
"unmatchedForeground": "#657B83" "unmatchedForeground": "#657B83"
} }
}, },
@@ -619,17 +666,27 @@
"borderColor": "#31535F", "borderColor": "#31535F",
"captionBackground": "#294953", "captionBackground": "#294953",
"captionForeground": "#C2C5BC", "captionForeground": "#C2C5BC",
"Details": {
"background": "#013441"
},
"footerBackground": "#294953", "footerBackground": "#294953",
"footerForeground": "#C2C5BC", "footerForeground": "#C2C5BC",
"groupIconBorderColor": "#0A3844", "groupIconBorderColor": "#0A3844",
"headerBackground": "#294953", "headerBackground": "#294953",
"headerForeground": "#C2C5BC", "headerForeground": "#C2C5BC",
"Projects": { "Projects": {
"actions": {
"background": "#195787",
"selectionBackground": "#206ABF"
},
"background": "#113842", "background": "#113842",
"selectionBackground": "#396AB0", "selectionBackground": "#396AB0",
"selectionInactiveBackground": "#1E434E" "selectionInactiveBackground": "#1E434E"
}, },
"separatorColor": "#244A57" "separatorColor": "#244A57",
"SidePanel": {
"background": "colorBackground"
}
}, },
"Window": { "Window": {
"border": "colorBorder" "border": "colorBorder"

View File

@@ -11,7 +11,8 @@
"colorSelectionBackgroundInactive": "#D3D2C6", "colorSelectionBackgroundInactive": "#D3D2C6",
"colorSelectionForeground": "#FFFFEB", "colorSelectionForeground": "#FFFFEB",
"colorSelectionForegroundInactive": "#2E4E58", "colorSelectionForegroundInactive": "#2E4E58",
"colorHoverBackground": "#D9D7CA", "colorHoverBackground": "#EBECDF",
"colorHoverInactiveBackground": "#F3ECDA",
"colorBorder": "#C8CAC0", "colorBorder": "#C8CAC0",
"colorDisabledForeground": "#839496", "colorDisabledForeground": "#839496",
"colorAlternativeBackground": "#FDF6E3", "colorAlternativeBackground": "#FDF6E3",
@@ -30,6 +31,8 @@
"disabledForeground": "colorDisabledForeground", "disabledForeground": "colorDisabledForeground",
"disabledText": "colorDisabledForeground", "disabledText": "colorDisabledForeground",
"foreground": "colorForeground", "foreground": "colorForeground",
"hoverBackground": "colorHoverBackground",
"hoverInactiveBackground": "colorHoverInactiveBackground",
"inactiveBackground": "colorBackground", "inactiveBackground": "colorBackground",
"inactiveForeground": "colorInactiveForeground", "inactiveForeground": "colorInactiveForeground",
"selectionBackground": "colorSelectionBackground", "selectionBackground": "colorSelectionBackground",
@@ -42,11 +45,22 @@
"textForeground": "colorForeground" "textForeground": "colorForeground"
}, },
"ActionButton": { "ActionButton": {
"hoverBackground": "colorHoverBackground", "hoverBackground": "#D9D7CA",
"hoverBorderColor": "colorHoverBackground", "hoverBorderColor": "#D9D7CA",
"pressedBackground": "#C6C7BD", "pressedBackground": "#C6C7BD",
"pressedBorderColor": "#C6C7BD" "pressedBorderColor": "#C6C7BD"
}, },
"AssignedMnemonic": {
"background": "#EFBE65",
"borderColor": "#EFBE65"
},
"AvailableMnemonic": {
"borderColor": "#BAC0B8"
},
"BigSpinner": {},
"BookmarkIcon": {
"background": "#EFBE65"
},
"Borders": { "Borders": {
"color": "colorBorder", "color": "colorBorder",
"ContrastBorderColor": "colorBorder" "ContrastBorderColor": "colorBorder"
@@ -115,6 +129,11 @@
"background": "#99A6A5B0", "background": "#99A6A5B0",
"foreground": "#002B36" "foreground": "#002B36"
}, },
"CurrentMnemonic": {
"background": "#3399CB",
"borderColor": "#3399CB",
"foreground": "#FDF6E3"
},
"Debugger": { "Debugger": {
"Variables": { "Variables": {
"changedValueForeground": "#3961FA", "changedValueForeground": "#3961FA",
@@ -141,7 +160,8 @@
"DragAndDrop": { "DragAndDrop": {
"areaBackground": "#DEE3DE", "areaBackground": "#DEE3DE",
"areaBorderColor": "#88ACCD", "areaBorderColor": "#88ACCD",
"areaForeground": "#657B83" "areaForeground": "#657B83",
"borderColor": "#F94A26"
}, },
"Editor": { "Editor": {
"background": "#B5B0A2", "background": "#B5B0A2",
@@ -224,6 +244,7 @@
"background": "colorAlternativeBackground", "background": "colorAlternativeBackground",
"inactiveBackground": "colorAlternativeBackground" "inactiveBackground": "colorAlternativeBackground"
}, },
"GotItTooltip": {},
"Group": { "Group": {
"disabledSeparatorColor": "colorSeparator", "disabledSeparatorColor": "colorSeparator",
"separatorColor": "colorSeparator" "separatorColor": "colorSeparator"
@@ -244,7 +265,18 @@
"Label": { "Label": {
"errorForeground": "#F95551", "errorForeground": "#F95551",
"infoForeground": "#657B83", "infoForeground": "#657B83",
"selectedForeground": "colorForeground" "selectedForeground": "colorForeground",
"successForeground": "#45944E"
},
"Lesson": {
"shortcutBackground": "#E2E6E3",
"stepNumberForeground": "#839496",
"Tooltip": {
"background": "#006CE1",
"foreground": "#FDF6E3",
"spanBackground": "#0059B9",
"stepNumberForeground": "#67A0DF"
}
}, },
"Link": { "Link": {
"activeForeground": "#4975B9", "activeForeground": "#4975B9",
@@ -276,6 +308,10 @@
"acceleratorForeground": "#49636B", "acceleratorForeground": "#49636B",
"disabledBackground": "colorBackground" "disabledBackground": "colorBackground"
}, },
"MnemonicIcon": {
"background": "#FCEFD2",
"borderColor": "#F1A933"
},
"NavBar": { "NavBar": {
"borderColor": "colorSeparator" "borderColor": "colorSeparator"
}, },
@@ -304,7 +340,9 @@
"OptionPane": { "OptionPane": {
"messageForeground": "colorForeground" "messageForeground": "colorForeground"
}, },
"Panel": {}, "Panel": {
"mouseShortcutBackground": "#F3ECDA"
},
"ParameterInfo": { "ParameterInfo": {
"background": "#F5F1E5", "background": "#F5F1E5",
"borderColor": "#D9D7CA", "borderColor": "#D9D7CA",
@@ -364,6 +402,7 @@
"PopupMenu": { "PopupMenu": {
"translucentBackground": "colorBackground" "translucentBackground": "colorBackground"
}, },
"ProblemsView": {},
"ProgressBar": { "ProgressBar": {
"failedColor": "#D14943", "failedColor": "#D14943",
"failedEndColor": "#F6887C", "failedEndColor": "#F6887C",
@@ -436,6 +475,9 @@
"endBackground": "#F8C734", "endBackground": "#F8C734",
"startBackground": "#FAE08D" "startBackground": "#FAE08D"
}, },
"SearchOption": {
"selectedBackground": "#D6DBD3"
},
"Separator": { "Separator": {
"separatorColor": "colorSeparator" "separatorColor": "colorSeparator"
}, },
@@ -466,9 +508,12 @@
"SplitPaneDivider": { "SplitPaneDivider": {
"draggingColor": "#1E434E" "draggingColor": "#1E434E"
}, },
"StateWidget": {
"activeBackground": "#F7C338"
},
"StatusBar": { "StatusBar": {
"borderColor": "colorBorder", "borderColor": "colorBorder",
"hoverBackground": "colorHoverBackground" "hoverBackground": "#D9D7CA"
}, },
"TabbedPane": { "TabbedPane": {
"contentAreaColor": "#B4BAB5", "contentAreaColor": "#B4BAB5",
@@ -479,6 +524,7 @@
"underlineColor": "#3D7EC0" "underlineColor": "#3D7EC0"
}, },
"Table": { "Table": {
"alternativeRowBackground": "colorAlternativeBackground",
"background": "colorAlternativeBackground", "background": "colorAlternativeBackground",
"dropLineColor": "colorAcceleratorForeground", "dropLineColor": "colorAcceleratorForeground",
"dropLineShortColor": "#5F63A9", "dropLineShortColor": "#5F63A9",
@@ -611,6 +657,7 @@
"Log": { "Log": {
"Commit": { "Commit": {
"currentBranchBackground": "#E3F2E4", "currentBranchBackground": "#E3F2E4",
"hoveredBackground": "#D8E5DC",
"unmatchedForeground": "#6B8086" "unmatchedForeground": "#6B8086"
} }
}, },
@@ -625,16 +672,26 @@
"borderColor": "#B4BAB5", "borderColor": "#B4BAB5",
"captionBackground": "#CCCDC1", "captionBackground": "#CCCDC1",
"captionForeground": "colorForeground", "captionForeground": "colorForeground",
"Details": {
"background": "colorAlternativeBackground"
},
"footerBackground": "#CCCDC1", "footerBackground": "#CCCDC1",
"footerForeground": "colorForeground", "footerForeground": "colorForeground",
"groupIconBorderColor": "#B4BAB5", "groupIconBorderColor": "#B4BAB5",
"headerBackground": "#D9D7CA", "headerBackground": "#D9D7CA",
"headerForeground": "#36525B", "headerForeground": "#36525B",
"Projects": { "Projects": {
"actions": {
"background": "#DAE5E6",
"selectionBackground": "#3282DA"
},
"background": "colorAlternativeBackground", "background": "colorAlternativeBackground",
"selectionInactiveBackground": "#D7D5C7" "selectionInactiveBackground": "#D7D5C7"
}, },
"separatorColor": "#ECE5D3" "separatorColor": "#ECE5D3",
"SidePanel": {
"background": "colorBackground"
}
}, },
"Window": { "Window": {
"border": "colorBorder" "border": "colorBorder"

View File

@@ -67,7 +67,9 @@
}, },
"ComboPopup.border": "1,1,1,1,64647A", "ComboPopup.border": "1,1,1,1,64647A",
"CompletionPopup": { "CompletionPopup": {
"matchForeground": "#BF616A" "matchForeground": "#BF616A",
"selectionBackground": "#5a6173",
"selectionInactiveBackground": "#383C4A"
}, },
"Component": { "Component": {
"errorFocusColor": "#bf4c53", "errorFocusColor": "#bf4c53",
@@ -95,9 +97,9 @@
}, },
"EditorPane.inactiveBackground": "#2b303b", "EditorPane.inactiveBackground": "#2b303b",
"EditorTabs": { "EditorTabs": {
"selectedBackground": "#2b303b",
"underlinedTabBackground": "#2b303b", "underlinedTabBackground": "#2b303b",
"underlineHeight": "0" "underlineHeight": "0",
"borderColor": "#2b303b"
}, },
"Link": { "Link": {
"activeForeground": "#7FA1B3", "activeForeground": "#7FA1B3",
@@ -156,6 +158,14 @@
"passedColor": "#99BD8E", "passedColor": "#99BD8E",
"passedEndColor": "#62795b" "passedEndColor": "#62795b"
}, },
"ScrollBar": {
"thumbColor": "#383C4A",
"hoverThumbColor": "#5a6173",
"Mac": {
"thumbColor": "#383C4A",
"hoverThumbColor": "#5a6173"
}
},
"SearchEverywhere": { "SearchEverywhere": {
"Header.background": "#1C1F26", "Header.background": "#1C1F26",
"Tab": { "Tab": {
@@ -202,7 +212,6 @@
"borderColor": "#232830" "borderColor": "#232830"
}, },
"HeaderTab": { "HeaderTab": {
"selectedBackground": "#232830",
"selectedInactiveBackground": "#232830", "selectedInactiveBackground": "#232830",
"hoverBackground": "#1C1F26", "hoverBackground": "#1C1F26",
"hoverInactiveBackground": "#1C1F26" "hoverInactiveBackground": "#1C1F26"

View File

@@ -127,6 +127,36 @@
"hoverForeground": "blue1", "hoverForeground": "blue1",
"pressedForeground": "blue1", "pressedForeground": "blue1",
"visitedForeground": "blue1" "visitedForeground": "blue1"
},
"ScrollBar" : {
"hoverThumbBorderColor" : "bg1",
"background" : "bg0",
"hoverThumbColor": "bg1",
"hoverTrackColor": "bg0",
"thumb": "bg2",
"thumbBorderColor": "bg2",
"thumbColor": "bg2",
"Transparent": {
"thumbColor": "bg2",
"hoverThumbBorderColor" : "bg1",
"hoverThumbColor": "bg1",
"hoverTrackColor": "bg0",
"thumbBorderColor": "bg2"
},
"Mac" : {
"Transparent": {
"thumbColor": "bg2",
"hoverThumbBorderColor" : "bg1",
"hoverThumbColor": "bg1",
"hoverTrackColor": "bg0",
"thumbBorderColor": "bg2"
},
"hoverThumbBorderColor" : "bg1",
"hoverThumbColor": "bg1",
"hoverTrackColor": "bg0",
"thumbBorderColor": "bg2",
"thumbColor": "bg2"
}
} }
}, },
"icons": { "icons": {

View File

@@ -126,6 +126,36 @@
"hoverForeground": "blue1", "hoverForeground": "blue1",
"pressedForeground": "blue1", "pressedForeground": "blue1",
"visitedForeground": "blue1" "visitedForeground": "blue1"
},
"ScrollBar" : {
"hoverThumbBorderColor" : "bg1",
"background" : "bg0",
"hoverThumbColor": "bg1",
"hoverTrackColor": "bg0",
"thumb": "bg2",
"thumbBorderColor": "bg2",
"thumbColor": "bg2",
"Transparent": {
"thumbColor": "bg2",
"hoverThumbBorderColor" : "bg1",
"hoverThumbColor": "bg1",
"hoverTrackColor": "bg0",
"thumbBorderColor": "bg2"
},
"Mac" : {
"Transparent": {
"thumbColor": "bg2",
"hoverThumbBorderColor" : "bg1",
"hoverThumbColor": "bg1",
"hoverTrackColor": "bg0",
"thumbBorderColor": "bg2"
},
"hoverThumbBorderColor" : "bg1",
"hoverThumbColor": "bg1",
"hoverTrackColor": "bg0",
"thumbBorderColor": "bg2",
"thumbColor": "bg2"
}
} }
}, },
"icons": { "icons": {

View File

@@ -127,6 +127,36 @@
"hoverForeground": "blue1", "hoverForeground": "blue1",
"pressedForeground": "blue1", "pressedForeground": "blue1",
"visitedForeground": "blue1" "visitedForeground": "blue1"
},
"ScrollBar" : {
"hoverThumbBorderColor" : "bg1",
"background" : "bg0",
"hoverThumbColor": "bg1",
"hoverTrackColor": "bg0",
"thumb": "bg2",
"thumbBorderColor": "bg2",
"thumbColor": "bg2",
"Transparent": {
"thumbColor": "bg2",
"hoverThumbBorderColor" : "bg1",
"hoverThumbColor": "bg1",
"hoverTrackColor": "bg0",
"thumbBorderColor": "bg2"
},
"Mac" : {
"Transparent": {
"thumbColor": "bg2",
"hoverThumbBorderColor" : "bg1",
"hoverThumbColor": "bg1",
"hoverTrackColor": "bg0",
"thumbBorderColor": "bg2"
},
"hoverThumbBorderColor" : "bg1",
"hoverThumbColor": "bg1",
"hoverTrackColor": "bg0",
"thumbBorderColor": "bg2",
"thumbColor": "bg2"
}
} }
}, },
"icons": { "icons": {

Some files were not shown because too many files have changed in this diff Show More