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
165 changed files with 30094 additions and 26717 deletions

View File

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

View File

@@ -1,7 +1,7 @@
FlatLaf Change Log
==================
## 2.0-SNAPSHOT
## 2.0-rc1
#### New features and improvements
@@ -28,9 +28,18 @@ FlatLaf Change Log
setting UI default `OptionPane.showIcon` to `true`. (issue #416)
- No longer show the Java "duke/cup" icon if no window icon image is set.
(issue #416)
- TextField, FormattedTextField and PasswordField: Support leading and trailing
icons (set client property `JTextField.leadingIcon` or
`JTextField.trailingIcon` to an `Icon`). (PR #378; issue #368)
- TextField, FormattedTextField and PasswordField:
- Support leading and trailing icons (set client property
`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
words/lines.
- 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.thumbBorderWidth`).
- 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
applications: `lighten()`, `darken()`, `saturate()`, `desaturate()`, `spin()`,
`tint()`, `shade()` and `luma()`.
@@ -73,6 +86,40 @@ FlatLaf Change Log
- `FlatSVGIcon`: Support loading SVG from `URL` (for JPMS), `URI`, `File` or
`InputStream`. (issues #419 and #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

View File

@@ -114,6 +114,8 @@ Buzz
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
and much more
- [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)
- [jAlbum](https://jalbum.net/) 21 (**commercial**) - creates photo album
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**)
- [Total Validator](https://www.totalvalidator.com/) 15 (**commercial**) -
checks your website
@@ -173,7 +177,7 @@ Applications using FlatLaf
systems development platform
- [JPass](https://github.com/gaborbata/jpass) - password manager with strong
encryption
- [Jes - Die Java-E<EFBFBD>R](https://www.jes-eur.de)
- [Jes - Die Java-EÜR](https://www.jes-eur.de)
- [Mapton](https://mapton.org/) 2.0
([source code](https://github.com/trixon/mapton)) - some kind of map
application (based on NetBeans platform)

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
val releaseVersion = "1.6.4"
val releaseVersion = "2.0-rc1"
val developmentVersion = "2.0-SNAPSHOT"
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.
* <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>
* 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.
* <p>
* <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.
* <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>
* 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).
* <p>
* <strong>Component</strong> {@link javax.swing.JTabbedPane}<br>
@@ -863,6 +863,87 @@ public interface FlatClientProperties
*/
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 ------------------------------------------------------
/**

View File

@@ -52,6 +52,7 @@ import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.LookAndFeel;
import javax.swing.PopupFactory;
import javax.swing.RootPaneContainer;
@@ -1036,12 +1037,23 @@ public abstract class FlatLaf
/**
* Revalidate and repaint all displayable frames and dialogs.
* <p>
* Useful to update UI after changing {@code TitlePane.menuBarEmbedded}.
*
* @since 1.1.2
*/
public static void revalidateAndRepaintAllFramesAndDialogs() {
for( Window w : Window.getWindows() ) {
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.repaint();
}
@@ -1050,6 +1062,9 @@ public abstract class FlatLaf
/**
* 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
*/
@@ -1324,9 +1339,19 @@ public abstract class FlatLaf
}
// 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 ) );
else
} else
return toUIResource( baseFont );
}

View File

@@ -17,6 +17,7 @@
package com.formdev.flatlaf;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;
@@ -28,7 +29,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;
import javax.swing.text.StyleContext;
import com.formdev.flatlaf.util.LoggingFacade;
import com.formdev.flatlaf.util.StringUtils;
import com.formdev.flatlaf.util.SystemInfo;
@@ -121,14 +122,25 @@ class LinuxFontPolicy
for(;;) {
Font font = createFont( family, style, size, dsize );
// if the font family does not match any font on the system, "Dialog" family is returned
if( !"Dialog".equals( font.getFamily() ) || "Dialog".equals( family ) )
if( Font.DIALOG.equals( family ) )
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
int index = family.lastIndexOf( ' ' );
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)
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 WILDCARD_PREFIX = "*.";
private static final String KEY_VARIABLES = "FlatLaf.internal.variables";
static final String KEY_VARIABLES = "FlatLaf.internal.variables";
private static int parseColorDepth;
@@ -364,6 +364,12 @@ class UIDefaultsLoader
if( resultValueType == null )
resultValueType = tempResultValueType;
// do not parse styles here
if( key.startsWith( "[style]" ) ) {
resultValueType[0] = ValueType.STRING;
return value;
}
value = value.trim();
// null
@@ -582,17 +588,18 @@ class UIDefaultsLoader
private static Object parseBorder( String value, Function<String, String> resolver, List<ClassLoader> addonClassLoaders ) {
if( value.indexOf( ',' ) >= 0 ) {
// top,left,bottom,right[,lineColor[,lineThickness]]
// top,left,bottom,right[,lineColor[,lineThickness[,arc]]]
List<String> parts = splitFunctionParams( value, ',' );
Insets insets = parseInsets( value );
ColorUIResource lineColor = (parts.size() >= 5)
? (ColorUIResource) parseColorOrFunction( resolver.apply( parts.get( 4 ) ), resolver, true )
: 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 (lineColor != null)
? new FlatLineBorder( insets, lineColor, lineThickness )
? new FlatLineBorder( insets, lineColor, lineThickness, arc )
: new FlatEmptyBorder( insets );
};
} else

View File

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

View File

@@ -21,14 +21,16 @@ import java.awt.Graphics;
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
*/
public class FlatMenuItemArrowIcon
extends FlatMenuArrowIcon
extends FlatAbstractIcon
{
public FlatMenuItemArrowIcon() {
super( 6, 10, null );
}
@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 searchIconPressedColor = UIManager.getColor( "SearchField.searchIconPressedColor" );
private final boolean ignoreButtonState;
public FlatSearchIcon() {
this( false );
}
/** @since 2 */
public FlatSearchIcon( boolean ignoreButtonState ) {
super( 16, 16, null );
this.ignoreButtonState = ignoreButtonState;
}
/** @since 2 */
@@ -70,8 +78,10 @@ public class FlatSearchIcon
</svg>
*/
g.setColor( FlatButtonUI.buttonStateColor( c, searchIconColor, searchIconColor,
null, searchIconHoverColor, searchIconPressedColor ) );
g.setColor( ignoreButtonState
? searchIconColor
: FlatButtonUI.buttonStateColor( c, searchIconColor, searchIconColor,
null, searchIconHoverColor, searchIconPressedColor ) );
// paint magnifier
Area area = new Area( new Ellipse2D.Float( 2, 2, 10, 10 ) );

View File

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

View File

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

View File

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

View File

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

View File

@@ -98,8 +98,8 @@ import com.formdev.flatlaf.util.SystemInfo;
* @uiDefault ComboBox.focusedBackground Color optional
* @uiDefault ComboBox.disabledBackground Color
* @uiDefault ComboBox.disabledForeground Color
* @uiDefault ComboBox.buttonBackground Color
* @uiDefault ComboBox.buttonEditableBackground Color
* @uiDefault ComboBox.buttonBackground Color optional
* @uiDefault ComboBox.buttonEditableBackground Color optional
* @uiDefault ComboBox.buttonFocusedBackground Color optional; defaults to ComboBox.focusedBackground
* @uiDefault ComboBox.buttonSeparatorWidth int or float optional; defaults to Component.borderWidth
* @uiDefault ComboBox.buttonSeparatorColor Color optional
@@ -281,7 +281,10 @@ public class FlatComboBoxUI
public void layoutContainer( Container 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)
FontMetrics fm = comboBox.getFontMetrics( comboBox.getFont() );
int maxButtonWidth = fm.getHeight() + scale( padding.top ) + scale( padding.bottom );
@@ -540,24 +543,27 @@ public class FlatComboBoxUI
// paint arrow button background
if( enabled && !isCellRenderer ) {
g2.setColor( paintButton
Color buttonColor = paintButton
? buttonEditableBackground
: (buttonFocusedBackground != null || focusedBackground != null) && isPermanentFocusOwner( comboBox )
? (buttonFocusedBackground != null ? buttonFocusedBackground : focusedBackground)
: buttonBackground );
Shape oldClip = g2.getClip();
if( isLeftToRight )
g2.clipRect( arrowX, 0, width - arrowX, height );
else
g2.clipRect( 0, 0, arrowX + arrowWidth, height );
FlatUIUtils.paintComponentBackground( g2, 0, 0, width, height, focusWidth, arc );
g2.setClip( oldClip );
: buttonBackground;
if( buttonColor != null ) {
g2.setColor( buttonColor );
Shape oldClip = g2.getClip();
if( isLeftToRight )
g2.clipRect( arrowX, 0, width - arrowX, height );
else
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
if( paintButton ) {
Color separatorColor = enabled ? buttonSeparatorColor : buttonDisabledSeparatorColor;
if( separatorColor != null ) {
if( separatorColor != null && buttonSeparatorWidth > 0 ) {
g2.setColor( separatorColor );
float lw = scale( buttonSeparatorWidth );
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)
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" );
if( border != null )
setBorder( border );
setBorder( FlatUIUtils.nonUIResource( border ) );
}
@Override
@@ -822,6 +831,11 @@ public class FlatComboBoxUI
void updateStyle() {
if( popupBackground != null )
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
@@ -908,7 +922,9 @@ public class FlatComboBoxUI
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) )
return;
@@ -940,7 +956,7 @@ public class FlatComboBoxUI
* there is no single place to uninstall it.
* This is the reason why this method is called from various places.
*/
void uninstall() {
synchronized void uninstall() {
if( rendererComponent == null )
return;
@@ -951,9 +967,9 @@ public class FlatComboBoxUI
}
@Override
public Insets getBorderInsets( Component c, Insets insets ) {
synchronized public Insets getBorderInsets( Component c, Insets insets ) {
Insets padding = scale( this.padding );
if( rendererBorder != null ) {
if( rendererBorder != null && !(rendererBorder instanceof CellPaddingBorder) ) {
Insets insideInsets = rendererBorder.getBorderInsets( c );
insets.top = Math.max( padding.top, insideInsets.top );
insets.left = Math.max( padding.left, insideInsets.left );

View File

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

View File

@@ -213,6 +213,13 @@ public class FlatInternalFrameTitlePane
case "componentOrientation":
applyComponentOrientation( frame.getComponentOrientation() );
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 );

View File

@@ -179,6 +179,26 @@ public class FlatInternalFrameUI
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 --------------------------------------
public static class FlatInternalFrameBorder

View File

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

View File

@@ -37,15 +37,18 @@ public class FlatLineBorder
{
private final Color lineColor;
private final float lineThickness;
/** @since 2 */ private final int arc;
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 );
this.lineColor = lineColor;
this.lineThickness = lineThickness;
this.arc = arc;
}
public Color getLineColor() {
@@ -56,13 +59,18 @@ public class FlatLineBorder
return lineThickness;
}
/** @since 2 */
public int getArc() {
return arc;
}
@Override
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
Graphics2D g2 = (Graphics2D) g.create();
try {
FlatUIUtils.setRenderingHints( g2 );
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 {
g2.dispose();
}

View File

@@ -37,7 +37,7 @@ import javax.swing.plaf.ListUI;
public class FlatListCellBorder
extends FlatLineBorder
{
protected boolean showCellFocusIndicator = UIManager.getBoolean( "List.showCellFocusIndicator" );
/** @since 2 */ protected boolean showCellFocusIndicator = UIManager.getBoolean( "List.showCellFocusIndicator" );
private Component c;
@@ -113,7 +113,7 @@ public class FlatListCellBorder
/**
* 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
extends FlatListCellBorder
@@ -125,7 +125,7 @@ public class FlatListCellBorder
if( !showCellFocusIndicator )
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 );
if( list != null && list.getMinSelectionIndex() == list.getMaxSelectionIndex() )
return;

View File

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

View File

@@ -180,11 +180,15 @@ public class FlatMenuBarUI
protected Color getBackground( JComponent c ) {
Color background = c.getBackground();
// paint background if opaque or if having custom background color
if( c.isOpaque() || !(background instanceof UIResource) )
// paint background if opaque
if( c.isOpaque() )
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 );
if( rootPane == null || !(rootPane.getParent() instanceof Window) || rootPane.getJMenuBar() != c )
return background;

View File

@@ -19,6 +19,7 @@ package com.formdev.flatlaf.ui;
import static com.formdev.flatlaf.util.UIScale.scale;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
@@ -32,6 +33,7 @@ import java.awt.event.KeyEvent;
import java.text.AttributedCharacterIterator;
import java.util.Map;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;
@@ -39,6 +41,7 @@ import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.View;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon;
import com.formdev.flatlaf.icons.FlatMenuArrowIcon;
@@ -52,12 +55,15 @@ import com.formdev.flatlaf.util.SystemInfo;
/**
* Renderer for menu items.
*
* @uiDefault MenuItem.verticallyAlignText boolean
* @uiDefault MenuItem.minimumWidth int
* @uiDefault MenuItem.minimumIconSize Dimension
* @uiDefault MenuItem.textAcceleratorGap int
* @uiDefault MenuItem.textNoAcceleratorGap int
* @uiDefault MenuItem.acceleratorArrowGap int
* @uiDefault MenuItem.checkBackground Color
* @uiDefault MenuItem.checkMargins Insets
* @uiDefault MenuItem.selectionType String null (default) or underline
* @uiDefault MenuItem.underlineSelectionBackground Color
* @uiDefault MenuItem.underlineSelectionCheckBackground Color
* @uiDefault MenuItem.underlineSelectionColor Color
@@ -67,12 +73,15 @@ import com.formdev.flatlaf.util.SystemInfo;
*/
public class FlatMenuItemRenderer
{
private static final String KEY_MAX_ICONS_WIDTH = "FlatLaf.internal.FlatMenuItemRenderer.maxIconWidth";
protected final JMenuItem menuItem;
protected Icon checkIcon;
protected Icon arrowIcon;
protected final Font acceleratorFont;
@Styleable protected Font acceleratorFont;
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 Dimension minimumIconSize;
@Styleable protected int textAcceleratorGap = FlatUIUtils.getUIInt( "MenuItem.textAcceleratorGap", 28 );
@@ -405,11 +414,10 @@ debug*/
return;
// 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() );
// paint
icon.paintIcon( menuItem, g, x, y );
icon.paintIcon( menuItem, g, iconRect.x, y );
}
protected static void paintText( Graphics g, JMenuItem menuItem,
@@ -444,6 +452,10 @@ debug*/
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 ) {
return menuItem.isArmed() || (menuItem instanceof JMenu && menuItem.isSelected());
}
@@ -474,6 +486,12 @@ debug*/
return pressedIcon;
}
if( isArmedOrSelected( menuItem ) ) {
Icon selectedIcon = menuItem.getSelectedIcon();
if( selectedIcon != null )
return selectedIcon;
}
return icon;
}
@@ -560,6 +578,44 @@ debug*/
shiftGlyph = 0x21E7,
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 --------------------------------------------------
private class MinSizeIcon
@@ -574,6 +630,7 @@ debug*/
@Override
public int getIconWidth() {
int iconWidth = (delegate != null) ? delegate.getIconWidth() : 0;
iconWidth = Math.max( iconWidth, getMaxIconsWidth() );
return Math.max( iconWidth, scale( minimumIconSize.width ) );
}

View File

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

View File

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

View File

@@ -19,9 +19,7 @@ package com.formdev.flatlaf.ui;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.beans.PropertyChangeListener;
import javax.swing.Box;
import javax.swing.BoxLayout;
@@ -230,7 +228,7 @@ public class FlatOptionPaneUI
// use non-UIResource borders to avoid that they are replaced when switching LaF
Border border = panel.getBorder();
if( border instanceof UIResource )
panel.setBorder( new NonUIResourceBorder( border ) );
panel.setBorder( FlatUIUtils.nonUIResource( border ) );
}
if( child instanceof Container )
@@ -256,31 +254,4 @@ public class FlatOptionPaneUI
protected boolean getSizeButtonsToSameWidth() {
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;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.beans.PropertyChangeListener;
import java.util.Map;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicPanelUI;
import com.formdev.flatlaf.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}.
@@ -27,15 +36,118 @@ import javax.swing.plaf.basic.BasicPanelUI;
*
* @uiDefault Panel.font Font unused
* @uiDefault Panel.background Color only used if opaque
* @uiDefault Panel.foreground Color
* @uiDefault Panel.foreground Color unused
* @uiDefault Panel.border Border
*
* @author Karl Tauber
*/
public class FlatPanelUI
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 ) {
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.Icon;
import javax.swing.JComponent;
import javax.swing.JToggleButton;
import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
@@ -73,18 +74,25 @@ import com.formdev.flatlaf.util.UIScale;
*
* @uiDefault PasswordField.echoChar character
* @uiDefault PasswordField.showCapsLock boolean
* @uiDefault PasswordField.showRevealButton boolean
* @uiDefault PasswordField.capsLockIcon Icon
* @uiDefault PasswordField.revealIcon Icon
*
* @author Karl Tauber
*/
public class FlatPasswordFieldUI
extends FlatTextFieldUI
{
private Character echoChar;
@Styleable protected boolean showCapsLock;
/** @since 2 */ @Styleable protected boolean showRevealButton;
protected Icon capsLockIcon;
/** @since 2 */ protected Icon revealIcon;
private KeyListener capsLockListener;
private boolean capsLockIconShared = true;
private JToggleButton revealButton;
public static ComponentUI createUI( JComponent c ) {
return new FlatPasswordFieldUI();
@@ -95,17 +103,33 @@ public class FlatPasswordFieldUI
return "PasswordField";
}
@Override
public void installUI( JComponent c ) {
super.installUI( c );
installRevealButton();
}
@Override
public void uninstallUI( JComponent c ) {
uninstallRevealButton();
super.uninstallUI( c );
}
@Override
protected void installDefaults() {
super.installDefaults();
String prefix = getPropertyPrefix();
Character echoChar = (Character) UIManager.get( prefix + ".echoChar" );
echoChar = (Character) UIManager.get( prefix + ".echoChar" );
if( echoChar != null )
LookAndFeel.installProperty( getComponent(), "echoChar", echoChar );
showCapsLock = UIManager.getBoolean( "PasswordField.showCapsLock" );
showRevealButton = UIManager.getBoolean( "PasswordField.showRevealButton" );
capsLockIcon = UIManager.getIcon( "PasswordField.capsLockIcon" );
revealIcon = UIManager.getIcon( "PasswordField.revealIcon" );
capsLockIconShared = true;
}
@@ -114,6 +138,7 @@ public class FlatPasswordFieldUI
super.uninstallDefaults();
capsLockIcon = null;
revealIcon = null;
}
@Override
@@ -168,6 +193,18 @@ public class FlatPasswordFieldUI
return "PasswordField";
}
@Override
protected void applyStyle( Object style ) {
boolean oldShowRevealButton = showRevealButton;
super.applyStyle( style );
if( showRevealButton != oldShowRevealButton ) {
uninstallRevealButton();
installRevealButton();
}
}
/** @since 2 */
@Override
protected Object applyStyleProperty( String key, Object value ) {
@@ -236,4 +273,39 @@ public class FlatPasswordFieldUI
return FlatUIUtils.isPermanentFocusOwner( c ) &&
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() )
return popup;
// avoid endless loop (should newer happen; PopupFactory cache size is 5)
if( ++count > 10 )
return popup;
// remove contents component from popup window
if( popupWindow instanceof JWindow )
((JWindow)popupWindow).getContentPane().removeAll();
@@ -128,10 +132,6 @@ public class FlatPopupFactory
// dispose unused popup
// (do not invoke popup.hide() because this would cache the popup window)
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;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager;
import java.beans.PropertyChangeListener;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.swing.BoxLayout;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicPopupMenuUI;
import javax.swing.plaf.basic.DefaultMenuLayout;
import com.formdev.flatlaf.ui.FlatStylingSupport.StyleableUI;
import com.formdev.flatlaf.util.LoggingFacade;
@@ -64,6 +70,15 @@ public class FlatPopupMenuUI
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
protected void installListeners() {
super.installListeners();
@@ -106,4 +121,21 @@ public class FlatPopupMenuUI
public Map<String, Class<?>> getStyleableInfos( JComponent c ) {
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() {
super.uninstallDefaults();
FlatMenuItemRenderer.clearClientProperties( menuItem.getParent() );
renderer = null;
oldStyleValues = null;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -108,9 +108,9 @@ public class FlatTableUI
@Styleable protected Color selectionInactiveForeground;
// for FlatTableCellBorder
@Styleable protected Insets cellMargins;
@Styleable protected Color cellFocusColor;
@Styleable protected boolean showCellFocusIndicator;
/** @since 2 */ @Styleable protected Insets cellMargins;
/** @since 2 */ @Styleable protected Color cellFocusColor;
/** @since 2 */ @Styleable protected Boolean showCellFocusIndicator;
private boolean oldShowHorizontalLines;
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.util.UIScale.scale;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.LayoutManager2;
import java.awt.Rectangle;
import java.awt.event.FocusListener;
import java.beans.PropertyChangeEvent;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.JToolBar;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicTextFieldUI;
import javax.swing.text.Caret;
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable;
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 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 oldInactiveBackground;
@@ -101,6 +118,7 @@ public class FlatTextFieldUI
private Insets defaultMargin;
private FocusListener focusListener;
private DocumentListener documentListener;
private Map<String, Object> oldStyleValues;
private AtomicBoolean borderShared;
@@ -115,11 +133,19 @@ public class FlatTextFieldUI
leadingIcon = clientProperty( c, TEXT_FIELD_LEADING_ICON, null, Icon.class );
trailingIcon = clientProperty( c, TEXT_FIELD_TRAILING_ICON, null, Icon.class );
installLeadingComponent();
installTrailingComponent();
installClearButton();
installStyle();
}
@Override
public void uninstallUI( JComponent c ) {
uninstallLeadingComponent();
uninstallTrailingComponent();
uninstallClearButton();
super.uninstallUI( c );
leadingIcon = null;
@@ -181,6 +207,11 @@ public class FlatTextFieldUI
getComponent().removeFocusListener( focusListener );
focusListener = null;
if( documentListener != null ) {
getComponent().getDocument().removeDocumentListener( documentListener );
documentListener = null;
}
}
@Override
@@ -225,9 +256,61 @@ public class FlatTextFieldUI
trailingIcon = (e.getNewValue() instanceof Icon) ? (Icon) e.getNewValue() : null;
c.repaint();
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 */
protected void installStyle() {
try {
@@ -246,10 +329,15 @@ public class FlatTextFieldUI
protected void applyStyle( Object style ) {
oldDisabledBackground = disabledBackground;
oldInactiveBackground = inactiveBackground;
boolean oldShowClearButton = showClearButton;
oldStyleValues = FlatStylingSupport.parseAndApply( oldStyleValues, style, this::applyStyleProperty );
updateBackground();
if( showClearButton != oldShowClearButton ) {
uninstallClearButton();
installClearButton();
}
}
/** @since 2 */
@@ -444,6 +532,16 @@ debug*/
// add width of leading and trailing icons
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;
}
@@ -510,7 +608,8 @@ debug*/
/**
* Returns the rectangle used to paint leading and trailing icons.
* 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
*/
@@ -519,10 +618,31 @@ debug*/
if( r == 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();
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
Insets margin = getComponent().getMargin();
int newLeftMargin = Math.min( margin.left, margin.top );
@@ -532,7 +652,7 @@ debug*/
r.width += diff;
}
}
if( ltr ? hasTrailingIcon() : hasLeadingIcon() ) {
if( rightVisible || (ltr ? hasTrailingIcon() : hasLeadingIcon()) ) {
// reduce right margin
Insets margin = getComponent().getMargin();
int newRightMargin = Math.min( margin.right, margin.top );
@@ -540,6 +660,10 @@ debug*/
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;
}
@@ -578,4 +702,259 @@ debug*/
if( caret instanceof FlatCaret )
((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
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();
}

View File

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

View File

@@ -52,6 +52,7 @@ import com.formdev.flatlaf.util.UIScale;
*
* @uiDefault Tree.font Font
* @uiDefault Tree.background Color
* @uiDefault Tree.foreground Color unused
* @uiDefault Tree.hash Color
* @uiDefault Tree.dropLineColor Color
* @uiDefault Tree.expandedIcon Icon
@@ -136,12 +137,12 @@ public class FlatTreeUI
// for icons
// (needs to be public because icon classes are in another package)
@Styleable(dot=true) public String iconArrowType;
@Styleable(dot=true) public Color iconExpandedColor;
@Styleable(dot=true) public Color iconCollapsedColor;
@Styleable(dot=true) public Color iconLeafColor;
@Styleable(dot=true) public Color iconClosedColor;
@Styleable(dot=true) public Color iconOpenColor;
/** @since 2 */ @Styleable(dot=true) public String iconArrowType;
/** @since 2 */ @Styleable(dot=true) public Color iconExpandedColor;
/** @since 2 */ @Styleable(dot=true) public Color iconCollapsedColor;
/** @since 2 */ @Styleable(dot=true) public Color iconLeafColor;
/** @since 2 */ @Styleable(dot=true) public Color iconClosedColor;
/** @since 2 */ @Styleable(dot=true) public Color iconOpenColor;
// only used via styling (not in UI defaults, but has likewise client properties)
/** @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;
}
/** @since 2 */
public static Border nonUIResource( Border border ) {
return (border instanceof UIResource) ? new NonUIResourceBorder( border ) : border;
}
public static int minimumWidth( JComponent c, int minimumWidth ) {
return FlatClientProperties.clientPropertyInt( c, FlatClientProperties.MINIMUM_WIDTH, minimumWidth );
}
@@ -273,6 +278,32 @@ public class FlatUIUtils
: 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.
*/
@@ -982,4 +1013,31 @@ debug*/
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 )
return null;
// requires x86 architecture
if( !SystemInfo.isX86 && !SystemInfo.isX86_64 )
return null;
// load native library
if( nativeLibrary == null ) {
if( !SystemInfo.isJava_9_orLater ) {
@@ -167,11 +171,18 @@ class FlatWindowsNativeWindowBorder
return;
// install
WndProc wndProc = new WndProc( window );
if( wndProc.hwnd == 0 )
return;
try {
WndProc wndProc = new WndProc( window );
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 ) {

View File

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

View File

@@ -355,3 +355,19 @@ ToolTip.background = shade(@background,50%)
#---- Tree ----
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"
# Linux
[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
light.font = +0
semibold.font = +0
@@ -227,6 +227,7 @@ Button.defaultButtonFollowsFocus = false
Button.borderWidth = 1
Button.default.borderWidth = 1
# for buttons in toolbars
Button.toolbar.margin = 3,3,3,3
Button.toolbar.spacingInsets = 1,2,1,2
@@ -430,6 +431,7 @@ MenuItem.checkIcon = null
MenuItem.margin = @menuItemMargin
MenuItem.opaque = false
MenuItem.borderPainted = true
MenuItem.verticallyAlignText = true
MenuItem.background = @menuBackground
MenuItem.checkBackground = @menuCheckBackground
MenuItem.checkMargins = 2,2,2,2
@@ -439,7 +441,7 @@ MenuItem.iconTextGap = 6
MenuItem.textAcceleratorGap = 24
MenuItem.textNoAcceleratorGap = 6
MenuItem.acceleratorArrowGap = 2
MenuItem.acceleratorDelimiter = -
MenuItem.acceleratorDelimiter = +
[mac]MenuItem.acceleratorDelimiter =
# for MenuItem.selectionType = underline
@@ -482,7 +484,10 @@ PasswordField.placeholderForeground = @disabledForeground
PasswordField.iconTextGap = 4
PasswordField.echoChar = \u2022
PasswordField.showCapsLock = true
PasswordField.showRevealButton = false
PasswordField.capsLockIcon = com.formdev.flatlaf.icons.FlatCapsLockIcon
PasswordField.revealIcon = com.formdev.flatlaf.icons.FlatRevealIcon
PasswordField.revealIconColor = lazy(Actions.Grey)
#---- Popup ----
@@ -888,3 +893,33 @@ Tree.icon.collapsedColor = @icon
Tree.icon.leafColor = @icon
Tree.icon.closedColor = @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.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.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.toolbar.selectedBackground = $ToggleButton.toolbar.selectedBackground
@@ -210,11 +211,17 @@ ToggleButton.endBackground = $ToggleButton.background
[GitHub_Contrast]ProgressBar.selectionBackground = #222
[GitHub_Contrast]ProgressBar.selectionForeground = #222
[Light_Owl]List.selectionInactiveForeground = lazy(List.foreground)
[Light_Owl]ProgressBar.selectionBackground = #111
[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.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.selectionForeground = #fff

View File

@@ -22,8 +22,12 @@ import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.UIDefaults.ActiveValue;
import javax.swing.UIDefaults.LazyValue;
import org.junit.jupiter.api.Test;
import com.formdev.flatlaf.ui.FlatEmptyBorder;
import com.formdev.flatlaf.ui.FlatLineBorder;
/**
* @author Karl Tauber
@@ -46,8 +50,8 @@ public class TestUIDefaultsLoader
assertEquals( 1.23f, UIDefaultsLoader.parseValue( "dummy", "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 Dimension( 2,2 ), UIDefaultsLoader.parseValue( "dummySize", "2,2", null ) );
assertEquals( new Insets( 1,2,3,4 ), UIDefaultsLoader.parseValue( "dummyInsets", "1,2,3,4", 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( "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( new Insets( 2,2,2,2 ), UIDefaultsLoader.parseValue( "dummy", "2,2,2,2", Insets.class ) );
assertEquals( new Dimension( 2,2 ), UIDefaultsLoader.parseValue( "dummy", "2,2", Dimension.class ) );
assertEquals( new Insets( 1,2,3,4 ), UIDefaultsLoader.parseValue( "dummy", "1,2,3,4", Insets.class ) );
assertEquals( new Dimension( 1,2 ), UIDefaultsLoader.parseValue( "dummy", "1,2", Dimension.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
void parseFonts() {
// style

View File

@@ -61,6 +61,7 @@ public class TestFlatStyleClasses
UIManager.put( "[style]MenuItem.test", "foreground: #000011" );
UIManager.put( "[style]CheckBoxMenuItem.test", "foreground: #000012" );
UIManager.put( "[style]RadioButtonMenuItem.test", "foreground: #000013" );
UIManager.put( "[style]Panel.test", "foreground: #000034" );
UIManager.put( "[style]PasswordField.test", "foreground: #000014" );
UIManager.put( "[style]PopupMenu.test", "foreground: #000015" );
UIManager.put( "[style]PopupMenuSeparator.test", "foreground: #000016" );
@@ -278,6 +279,14 @@ public class TestFlatStyleClasses
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
void passwordField() {
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 java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -257,7 +258,7 @@ public class TestFlatStyleableInfo
// FlatListCellBorder
"cellMargins", Insets.class,
"cellFocusColor", Color.class,
"showCellFocusIndicator", boolean.class
"showCellFocusIndicator", Boolean.class
);
assertMapEquals( expected, ui.getStyleableInfos( c ) );
@@ -301,7 +302,6 @@ public class TestFlatStyleableInfo
Map<String, Class<?>> expected = new LinkedHashMap<>();
menuItem( expected );
menuItem_arrowIcon( expected );
assertMapEquals( expected, ui.getStyleableInfos( c ) );
}
@@ -314,7 +314,6 @@ public class TestFlatStyleableInfo
Map<String, Class<?>> expected = new LinkedHashMap<>();
menuItem( expected );
menuItem_checkIcon( expected );
menuItem_arrowIcon( expected );
assertMapEquals( expected, ui.getStyleableInfos( c ) );
}
@@ -327,7 +326,6 @@ public class TestFlatStyleableInfo
Map<String, Class<?>> expected = new LinkedHashMap<>();
menuItem( expected );
menuItem_checkIcon( expected );
menuItem_arrowIcon( expected );
assertMapEquals( expected, ui.getStyleableInfos( c ) );
}
@@ -338,7 +336,8 @@ public class TestFlatStyleableInfo
"selectionForeground", Color.class,
"disabledForeground", Color.class,
"acceleratorForeground", Color.class,
"acceleratorSelectionForeground", Color.class
"acceleratorSelectionForeground", Color.class,
"acceleratorFont", Font.class
);
menuItemRenderer( expected );
@@ -346,6 +345,7 @@ public class TestFlatStyleableInfo
private void menuItemRenderer( Map<String, Class<?>> expected ) {
expectedMap( expected,
"verticallyAlignText", boolean.class,
"minimumWidth", int.class,
"minimumIconSize", Dimension.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
void passwordField() {
JPasswordField c = new JPasswordField();
@@ -386,7 +398,8 @@ public class TestFlatStyleableInfo
Map<String, Class<?>> expected = new LinkedHashMap<>();
expectedMap( expected,
"showCapsLock", boolean.class
"showCapsLock", boolean.class,
"showRevealButton", boolean.class
);
// FlatPasswordFieldUI extends FlatTextFieldUI
@@ -747,7 +760,7 @@ public class TestFlatStyleableInfo
// FlatTableCellBorder
"cellMargins", Insets.class,
"cellFocusColor", Color.class,
"showCellFocusIndicator", boolean.class
"showCellFocusIndicator", Boolean.class
);
assertMapEquals( expected, ui.getStyleableInfos( c ) );
@@ -766,7 +779,7 @@ public class TestFlatStyleableInfo
// FlatTableHeaderBorder
"cellMargins", Insets.class,
"separatorColor", Color.class,
"showTrailingVerticalLine", boolean.class,
"showTrailingVerticalLine", Boolean.class,
// FlatAscendingSortIcon and FlatDescendingSortIcon
"arrowType", String.class,
@@ -811,7 +824,8 @@ public class TestFlatStyleableInfo
"focusedBackground", Color.class,
"iconTextGap", int.class,
"leadingIcon", Icon.class,
"trailingIcon", Icon.class
"trailingIcon", Icon.class,
"showClearButton", boolean.class
);
// border
@@ -1134,17 +1148,6 @@ public class TestFlatStyleableInfo
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 ) {
expectedMap( expected,
"arrowType", String.class,

View File

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

View File

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

View File

@@ -22,6 +22,7 @@ import javax.swing.text.DefaultEditorKit;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.extras.FlatSVGIcon;
import com.formdev.flatlaf.icons.FlatSearchIcon;
import com.formdev.flatlaf.icons.FlatSearchWithHistoryIcon;
import net.miginfocom.layout.AC;
import net.miginfocom.layout.BoundSize;
import net.miginfocom.layout.ConstraintParser;
@@ -36,6 +37,51 @@ class BasicComponentsPanel
{
BasicComponentsPanel() {
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() {
@@ -87,7 +133,7 @@ class BasicComponentsPanel
JFormattedTextField formattedTextField4 = new JFormattedTextField();
JFormattedTextField formattedTextField5 = new JFormattedTextField();
JLabel passwordFieldLabel = new JLabel();
JPasswordField passwordField1 = new JPasswordField();
passwordField1 = new JPasswordField();
JPasswordField passwordField2 = new JPasswordField();
JPasswordField passwordField3 = new JPasswordField();
JPasswordField passwordField4 = new JPasswordField();
@@ -134,6 +180,9 @@ class BasicComponentsPanel
JTextField leadingIconTextField = new JTextField();
JTextField trailingIconTextField = new JTextField();
JTextField iconsTextField = new JTextField();
JLabel compsLabel = new JLabel();
compsTextField = new JTextField();
clearTextField = new JTextField();
JLabel fontsLabel = new JLabel();
JLabel h00Label = new JLabel();
JLabel h0Label = new JLabel();
@@ -181,6 +230,7 @@ class BasicComponentsPanel
"[]" +
"[]" +
"[]" +
"[]" +
"[]0" +
"[]"));
@@ -689,84 +739,93 @@ class BasicComponentsPanel
iconsTextField.setText("text");
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.setText("Typography / Fonts:");
add(fontsLabel, "cell 0 15");
add(fontsLabel, "cell 0 16");
//---- h00Label ----
h00Label.setText("H00");
h00Label.putClientProperty("FlatLaf.styleClass", "h00");
add(h00Label, "cell 1 15 5 1");
add(h00Label, "cell 1 16 5 1");
//---- h0Label ----
h0Label.setText("H0");
h0Label.putClientProperty("FlatLaf.styleClass", "h0");
add(h0Label, "cell 1 15 5 1");
add(h0Label, "cell 1 16 5 1");
//---- h1Label ----
h1Label.setText("H1");
h1Label.putClientProperty("FlatLaf.styleClass", "h1");
add(h1Label, "cell 1 15 5 1");
add(h1Label, "cell 1 16 5 1");
//---- h2Label ----
h2Label.setText("H2");
h2Label.putClientProperty("FlatLaf.styleClass", "h2");
add(h2Label, "cell 1 15 5 1");
add(h2Label, "cell 1 16 5 1");
//---- h3Label ----
h3Label.setText("H3");
h3Label.putClientProperty("FlatLaf.styleClass", "h3");
add(h3Label, "cell 1 15 5 1");
add(h3Label, "cell 1 16 5 1");
//---- h4Label ----
h4Label.setText("H4");
h4Label.putClientProperty("FlatLaf.styleClass", "h4");
add(h4Label, "cell 1 15 5 1");
add(h4Label, "cell 1 16 5 1");
//---- lightLabel ----
lightLabel.setText("light");
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.setText("semibold");
semiboldLabel.putClientProperty("FlatLaf.style", "font: 200% $semibold.font");
add(semiboldLabel, "cell 1 15 5 1");
add(semiboldLabel, "cell 1 16 5 1");
//---- fontZoomLabel ----
fontZoomLabel.setText("(200%)");
fontZoomLabel.putClientProperty("FlatLaf.styleClass", "small");
fontZoomLabel.setEnabled(false);
add(fontZoomLabel, "cell 1 15 5 1");
add(fontZoomLabel, "cell 1 16 5 1");
//---- largeLabel ----
largeLabel.setText("large");
largeLabel.putClientProperty("FlatLaf.styleClass", "large");
add(largeLabel, "cell 1 16 5 1");
add(largeLabel, "cell 1 17 5 1");
//---- defaultLabel ----
defaultLabel.setText("default");
add(defaultLabel, "cell 1 16 5 1");
add(defaultLabel, "cell 1 17 5 1");
//---- mediumLabel ----
mediumLabel.setText("medium");
mediumLabel.putClientProperty("FlatLaf.styleClass", "medium");
add(mediumLabel, "cell 1 16 5 1");
add(mediumLabel, "cell 1 17 5 1");
//---- smallLabel ----
smallLabel.setText("small");
smallLabel.putClientProperty("FlatLaf.styleClass", "small");
add(smallLabel, "cell 1 16 5 1");
add(smallLabel, "cell 1 17 5 1");
//---- miniLabel ----
miniLabel.setText("mini");
miniLabel.putClientProperty("FlatLaf.styleClass", "mini");
add(miniLabel, "cell 1 16 5 1");
add(miniLabel, "cell 1 17 5 1");
//---- monospacedLabel ----
monospacedLabel.setText("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 ========
{
@@ -841,7 +900,7 @@ class BasicComponentsPanel
rows[11].setGapAfter( zeroGap );
rows[12].setGapBefore( zeroGap );
rows[13].setGapBefore( zeroGap );
rows[15].setGapBefore( zeroGap );
rows[16].setGapBefore( zeroGap );
layout.setRowConstraints( ac );
// move two text field into same row as spinners
@@ -859,5 +918,8 @@ class BasicComponentsPanel
}
// 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
}

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

View File

@@ -71,8 +71,11 @@ public class FlatLafDemo
// create frame
DemoFrame frame = new DemoFrame();
if( FlatLafDemo.screenshotsMode )
frame.setPreferredSize( new Dimension( 1660, 840 ) );
if( FlatLafDemo.screenshotsMode ) {
frame.setPreferredSize( SystemInfo.isJava_9_orLater
? new Dimension( 830, 440 )
: new Dimension( 1660, 880 ) );
}
// show frame
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",
"licenseFile": "Hiberbee.LICENSE.txt",
"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": {
"name": "High contrast",
@@ -184,7 +184,7 @@
"license": "MIT",
"licenseFile": "nord.LICENSE.txt",
"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": {
"name": "One Dark",

View File

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

View File

@@ -43,6 +43,7 @@ import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableColumnModel;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.extras.components.FlatTextField;
import com.formdev.flatlaf.icons.FlatAbstractIcon;
import com.formdev.flatlaf.ui.FlatBorder;
import com.formdev.flatlaf.ui.FlatEmptyBorder;
@@ -557,7 +558,7 @@ public class FlatUIDefaultsInspector
panel = new JPanel();
filterPanel = new JPanel();
flterLabel = new JLabel();
filterField = new JTextField();
filterField = new FlatTextField();
valueTypeLabel = new JLabel();
valueTypeField = new JComboBox<>();
scrollPane = new JScrollPane();
@@ -588,7 +589,8 @@ public class FlatUIDefaultsInspector
new Insets(0, 0, 0, 10), 0, 0));
//---- 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,
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 10), 0, 0));
@@ -667,7 +669,7 @@ public class FlatUIDefaultsInspector
private JPanel panel;
private JPanel filterPanel;
private JLabel flterLabel;
private JTextField filterField;
private FlatTextField filterField;
private JLabel valueTypeLabel;
private JComboBox<String> valueTypeField;
private JScrollPane scrollPane;

View File

@@ -20,9 +20,10 @@ new FormModel {
"labelFor": new FormReference( "filterField" )
"displayedMnemonic": 70
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) )
add( new FormComponent( "javax.swing.JTextField" ) {
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTextField" ) {
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 ) {
"gridx": 1
} )

View File

@@ -20,6 +20,7 @@ import static com.formdev.flatlaf.FlatClientProperties.*;
import java.awt.Color;
import java.awt.Insets;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFormattedTextField;
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.
*/

View File

@@ -20,6 +20,7 @@ import static com.formdev.flatlaf.FlatClientProperties.*;
import java.awt.Color;
import java.awt.Insets;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPasswordField;
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.
*/

View File

@@ -20,6 +20,7 @@ import static com.formdev.flatlaf.FlatClientProperties.*;
import java.awt.Color;
import java.awt.Insets;
import javax.swing.Icon;
import javax.swing.JComponent;
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
public enum SelectAllOnFocusPolicy { never, once, always };

View File

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

View File

@@ -5,309 +5,350 @@
"editorScheme": "/colors/Dark.xml",
"colors": {
"black": "#000000",
"consoleBackground": "#191919",
"editorBackground": "#212121",
"panelBackground": "#333333",
"textColor": "#F9F6EF",
"border": "#3c3c3c",
"editorDarkerBg": "#2D2B29",
"shortcutForeground": "#2d2b29",
"editorBg": "#1B1A19",
"consoleBackground": "#171615",
"editorPaneBg": "#333231",
"panelBackground": "#333231",
"textColor": "#f9f6ef",
"textColorTransparent": "#f9f6ef7f",
"border": "#4d4c4b",
"redMac": "#fb3b45",
"redWin": "#ef6950",
"redMonokaiPro": "#ff6188",
"blueWinPalette": "#409AE1",
"blue": "#78dce8",
"deepBlue": "#3199b3",
"orangeMonokaiPro": "#fc9867",
"greenMonokaiPro": "#a9dc76",
"yellowWinPalette": "#ffc83d",
"yellowMac": "#faaa1f",
"yellow": "#FFB900",
"purpleWinPalette": "#b4a0ff",
"purpleMonokaiPro": "#ab9df2",
"greenWinPalette": "#40c5af",
"greyWinPalette": "#b2b2b2",
"panelText": "#a6a6a6",
"desaturatedBlue": "#1e282d",
"panelText": "#acacac",
"desaturatedOrange": "#8049117f",
"green": "#5B8021",
"greyDot15": "#d8d8d8",
"greyDot20": "#cccccc",
"green": "#92d923",
"greyDot15": "#f9f6ef",
"greyDot20": "#c0c0c0",
"greyDot25": "#bfbfbf",
"greyDot33": "#aaaaaa",
"greyDot50": "#7d7d7d",
"greyDot60": "#666666",
"greyDot65": "#5a5a5a",
"greyDot70": "#4d4d4d",
"greyDot75": "#434343",
"greyDot80": "#323232",
"greyDot85": "#252525",
"greyDot90": "#1f2021",
"greyDot70": "#4d4c4b",
"greyDot75": "#434241",
"greyDot80": "#333231",
"greyDot85": "#2d2b29",
"greyDot90": "#1f1e1d",
"greyDot95": "#242220",
"greyDot100": "#181615",
"lightBlue": "#70D7FF",
"navyDot85": "#191d21",
"navyDot90": "#1f2021",
"red": "#800040",
"transparentGreen": "#5B80217f",
"transparentRed": "#8000407f",
"transparentViolet": "#9478F67f",
"transparentYellow": "#8066357f",
"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"
}
"transparentRed": "#F250227f",
"transparentViolet": "#242221ff",
"transparentYellow": "#FFB9007f"
},
"ui": {
"*": {
"arc": "3",
"shadow": "greyDot75",
"background": "greyDot80",
"borderColor": "greyDot70",
"caretForeground": "yellowMac",
"color": "greyDot50",
"foreground": "greyDot20",
"hoverBackground": "greyDot70",
"selectedBackground": "greyDot85",
"selectedForeground": "greyDot15",
"selectedInactiveBackground": "greyDot70",
"selectionBackground": "navyDot85",
"selectionForeground": "yellowMac",
"separatorColor": "greyDot75",
"arc": 5,
"background": "panelBackground",
"borderColor": "border",
"caretForeground": "yellow",
"color": "greyDot60",
"foreground": "textColor",
"hoverBackground": "greyDot85",
"selectedBackground": "greyDot90",
"selectedForeground": "textColor",
"selectedInactiveBackground": "greyDot75",
"selectionBackground": "greyDot95",
"selectionForeground": "yellow",
"separatorColor": "border",
"underlineHeight": 1
},
"ActionButton": {
"hoverBorderColor": "greyDot50",
"pressedBackground": "greyDot65",
"pressedBorderColor": "greyDot50"
"pressedBackground": "greyDot95",
"hoverBorderColor": "greyDot65",
"pressedBorderColor": "greyDot60"
},
"Borders": {
"ContrastBorderColor": "greyDot65",
"ContrastBorderColor": "greyDot60",
"color": "border"
},
"Button.default.endBackground": "greyDot80",
"Button.default.endBorderColor": "greyDot65",
"Button.default.focusColor": "greyDot80",
"Button.default.focusedBorderColor": "greyDot15",
"Button.default.foreground": "greyDot15",
"Button.default.startBackground": "greyDot80",
"Button.default.startBorderColor": "greyDot65",
"Button.endBackground": "greyDot80",
"Button.endBorderColor": "greyDot65",
"Button.focusedBorderColor": "yellowMac",
"Button.startBackground": "greyDot80",
"Button.startBorderColor": "greyDot65",
"CheckBox.disabledText": "greyDot33",
"CheckBox.select": "greyDot50",
"CheckBoxMenuItem.disabledBackground": "greyDot80",
"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",
"Button": {
"arc": 5,
"default": {
"endBackground": "greyDot80",
"endBorderColor": "greyDot70",
"focusColor": "greyDot60",
"focusedBorderColor": "greyDot50",
"foreground": "greyDot33",
"startBackground": "greyDot80",
"startBorderColor": "greyDot70"
},
"shadowWidth": 1,
"endBackground": "greyDot80",
"endBorderColor": "greyDot70",
"focusedBorderColor": "greyDot50",
"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": {
"arc": "3",
"disabledBorderColor": "greyDot70",
"arc": "4",
"iconColor": "yellow",
"disabledBorderColor": "greyDot75",
"infoForeground": "greyDot50",
"errorFocusColor": "#F65F87",
"focusColor": "greyDot50",
"focusWidth": "0",
"focusedBorderColor": "greyDot50",
"hoverIconColor": "yellowMac",
"errorFocusColor": "red",
"focusColor": "greyDot60",
"focusWidth": 0,
"focusedBorderColor": "greyDot65",
"inactiveErrorFocusColor": "transparentRed",
"inactiveWarningFocusColor": "transparentYellow",
"warningFocusColor": "yellow"
},
"Debugger.Variables.changedValueForeground": "yellowMac",
"Debugger.Variables.changedValueForeground": "yellow",
"Debugger.Variables.evaluatingExpressionForeground": "lightBlue",
"DefaultTabs.underlineColor": "yellowMac",
"DefaultTabs.borderColor": "border",
"DefaultTabs.inactiveUnderlineColor": "border",
"DefaultTabs.underlineColor": "yellow",
"DefaultTabs.underlineHeight": 1,
"DefaultTabs.underlinedTabBackground": "greyDot75",
"DefaultTabs.underlinedTabForeground": "lightBlue",
"DefaultTabs.underlinedTabForeground": "yellow",
"DragAndDrop.areaBackground": "greyDot75",
"DragAndDrop.areaForeground": "greyDot25",
"Editor.background": "greyDot90",
"EditorPane.inactiveBackground": "greyDot85",
"EditorPane.inactiveForeground": "greyDot50",
"EditorTabs.underlineHeight": 1,
"FileColor.Blue": "#23282d",
"FileColor.Green": "#232d28",
"FileColor.Orange": "#2d2823",
"FileColor.Rose": "#2d2323",
"FileColor.Violet": "#2D232D",
"FileColor.Yellow": "#2d2d23",
"FormattedTextField.inactiveBackground": "greyDot80",
"FormattedTextField.background": "greyDot75",
"GutterTooltip.infoForeground": "greyDot50",
"Editor": {
"background": "editorPaneBg",
"foreground": "textColor",
"shortcutForeground": "greyDot20"
},
"EditorPane": {
"background": "editorPaneBg",
"inactiveBackground": "editorDarkerBg",
"inactiveForeground": "greyDot50",
"selectionBackground": "editorBg",
"selectionForeground": "textColor"
},
"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": {
"foreground": "greyDot25",
"disabledForeground": "greyDot33",
"disabledText": "greyDot33",
"foreground": "greyDot20",
"infoForeground": "greyDot50"
},
"Link.activeForeground": "lightBlue",
"Link.hoverForeground": "yellowMac",
"Link.pressedForeground": "lightBlue",
"Link.visitedForeground": "greyDot25",
"Link.hoverForeground": "yellow",
"MemoryIndicator.allocatedBackground": "green",
"MemoryIndicator.usedBackground": "red",
"Menu": {
"background": "greyDot80",
"disabledForeground": "greyDot70",
"separatorColor": "greyDot75",
"foreground": "textColor",
"borderColor": "greyDot70",
"acceleratorForeground": "greyDot25"
"acceleratorForeground": "greyDot33"
},
"Notification.MoreButton.innerBorderColor": "greyDot65",
"Notification.ToolWindow.errorBackground": "greyDot85",
"Notification.ToolWindow.errorBorderColor": "#ed005c",
"Notification.ToolWindow.errorForeground": "#F65F87",
"Notification.ToolWindow.informativeBackground": "greyDot85",
"Notification.ToolWindow.errorBackground": "greyDot95",
"Notification.ToolWindow.errorBorderColor": "red",
"Notification.ToolWindow.errorForeground": "#EE7762",
"Notification.ToolWindow.informativeBackground": "greyDot95",
"Notification.ToolWindow.informativeBorderColor": "#92D923",
"Notification.ToolWindow.informativeForeground": "#92D923",
"Notification.ToolWindow.warningBackground": "greyDot85",
"Notification.ToolWindow.warningBorderColor": "yellowMac",
"Notification.ToolWindow.warningForeground": "yellowMac",
"Notification.background": "greyDot85",
"Notification.errorBackground": "greyDot85",
"Notification.errorBorderColor": "#ed005c",
"Notification.errorForeground": "#F65F87",
"Notification.ToolWindow.warningBackground": "greyDot95",
"Notification.ToolWindow.warningBorderColor": "yellow",
"Notification.ToolWindow.warningForeground": "yellow",
"Notification.background": "greyDot95",
"Notification.errorBackground": "greyDot95",
"Notification.errorBorderColor": "red",
"Notification.errorForeground": "#EE7762",
"OptionPane": {
"background": "greyDot80",
"background": "editorPaneBg",
"foreground": "greyDot20"
},
"Panel": {
"background": "greyDot80",
"foreground": "greyDot20"
"background": "editorPaneBg",
"foreground": "textColor"
},
"Panel.foreground": "greyDot20",
"ParameterInfo.background": "greyDot85",
"ParameterInfo.foreground": "greyDot25",
"ParameterInfo.borderColor": "greyDot75",
"ParameterInfo.currentOverloadBackground": "greyDot65",
"ParameterInfo.currentParameterForeground": "yellowMac",
"ParameterInfo.currentParameterForeground": "yellow",
"ParameterInfo.foreground": "greyDot25",
"ParameterInfo.infoForeground": "greyDot33",
"ParameterInfo.lineSeparatorColor": "greyDot75",
"PasswordField.background": "greyDot75",
"Plugins.Button.installBackground": "greyDot80",
"Plugins.Button.installBorderColor": "greyDot65",
"Plugins.Button.installBorderColor": "greyDot60",
"Plugins.Button.installFillBackground": "greyDot80",
"Plugins.Button.installFillForeground": "greyDot25",
"Plugins.Button.installForeground": "yellowMac",
"Plugins.Button.installForeground": "yellow",
"Plugins.SearchField.background": "greyDot75",
"Plugins.SectionHeader.background": "greyDot75",
"Plugins.Tab.hoverBackground": "navyDot85",
"Plugins.Tab.selectedBackground": "greyDot85",
"Plugins.background": "greyDot80",
"Plugins.Tab.hoverBackground": "editorBg",
"Plugins.Tab.selectedBackground": "editorPaneBg",
"Plugins.background": "editorPaneBg",
"Plugins.lightSelectionBackground": "#242220",
"Plugins.disabledForeground": "greyDot50",
"Plugins.lightSelectionBackground": "navyDot85",
"Plugins.tagBackground": "greyDot85",
"Plugins.tagBackground": "editorBg",
"Plugins.tagForeground": "greyDot33",
"Plugins.hoverBackground": "editorBg",
"Popup.Advertiser.background": "greyDot85",
"Popup.Advertiser.foreground": "greyDot50",
"Popup.Header.activeBackground": "greyDot75",
"Popup.Header.inactiveBackground": "greyDot85",
"Popup.paintBorder": true,
"Popup.paintBorder": false,
"PopupMenu.background": "greyDot80",
"PopupMenuSeparator.stripeWidth": 1,
"ProgressBar.failedColor": "#ed005c",
"ProgressBar.failedColor": "red",
"ProgressBar.failedEndColor": "greyDot75",
"ProgressBar.indeterminateStartColor": "yellowMac",
"ProgressBar.indeterminateEndColor": "#FD971F",
"ProgressBar.passedColor": "#92D923",
"ProgressBar.indeterminateStartColor": "yellow",
"ProgressBar.passedColor": "green",
"ProgressBar.passedEndColor": "greyDot75",
"ProgressBar.progressColor": "yellowMac",
"ProgressBar.progressColor": "yellow",
"ProgressBar.trackColor": "greyDot75",
"RadioButton.background": "greyDot80",
"RadioButton.disabledText": "greyDot70",
"RadioButtonMenuItem.disabledBackground": "greyDot80",
"ScrollPane.background": "greyDot80",
"SearchEverywhere.Advertiser.foreground": "greyDot50",
"SearchEverywhere.List.separatorForeground": "greyDot50",
"SearchEverywhere.SearchField.infoForeground": "greyDot33",
"SearchEverywhere.SearchField.background": "greyDot75",
"SearchEverywhere.Header.background": "greyDot80",
"SearchEverywhere.Tab.selectedBackground": "greyDot85",
"SearchEverywhere.Tab.selectedForeground": "lightBlue",
"SearchMatch.endBackground": "yellowMac",
"SearchMatch.startBackground": "yellowMac",
"SearchEverywhere.List.separatorForeground": "greyDot50",
"SearchEverywhere.SearchField.background": "greyDot75",
"SearchEverywhere.SearchField.infoForeground": "greyDot33",
"SearchEverywhere.Tab.selectedBackground": "greyDot95",
"SearchEverywhere.Tab.selectedForeground": "yellow",
"SearchMatch.endBackground": "yellow",
"SearchMatch.startBackground": "yellow",
"SidePanel.background": "greyDot85",
"SpeedSearch.errorForeground": "#F65F87",
"SpeedSearch.foreground": "yellowMac",
"SplitPane.highlight": "yellowMac",
"PopupMenu.translucentBackground": "greyDot50",
"TabbedPane.disabledUnderlineColor": "greyDot65",
"TabbedPane.focusColor": "greyDot65",
"SpeedSearch.errorForeground": "red",
"SpeedSearch.foreground": "yellow",
"SplitPane.highlight": "yellow",
"TabbedPane.disabledUnderlineColor": "editorPaneBg",
"TabbedPane.focus": "greyDot75",
"TabbedPane.focusColor": "greyDot33",
"TabbedPane.tabSelectionHeight": 1,
"TabbedPane.underlineColor": "yellowMac",
"TabbedPane.underlineColor": "yellow",
"Table.dropLineColor": "greyDot75",
"Table.dropLineShortColor": "greyDot70",
"Table.focusCellBackground": "greyDot85",
"Table.focusCellForeground": "yellowMac",
"Table.sortIconColor": "yellowMac",
"Table.focusCellForeground": "yellow",
"Table.sortIconColor": "yellow",
"Table.stripeColor": "greyDot75",
"TableHeader.background": "greyDot85",
"TableHeader.bottomSeparatorColor": "greyDot65",
"TextArea.background": "greyDot75",
"TextArea.caretForeground": "yellowMac",
"TextArea.caretForeground": "yellow",
"TextArea.inactiveBackground": "greyDot80",
"TextArea.selectionBackground": "greyDot95",
"TextField.background": "greyDot75",
"TextField.foreground": "greyDot25",
"TextField.caretForeground": "yellowMac",
"TextField.highlight": "greyDot15",
"TextField.caretForeground": "yellow",
"TextField.foreground": "greyDot33",
"TextField.highlight": "yellow",
"TextField.inactiveForeground": "greyDot33",
"TextPane.inactiveBackground": "greyDot80",
"TextPane.inactiveForeground": "greyDot50",
"TitlePane.background": "greyDot85",
"ToggleButton.buttonColor": "greyDot65",
"ToggleButton.offBackground": "greyDot75",
"ToggleButton.offForeground": "greyDot25",
"ToggleButton.onBackground": "yellowMac",
"ToggleButton.onBackground": "yellow",
"ToggleButton.onForeground": "greyDot80",
"ToolBar.borderHandleColor": "greyDot65",
"ToolTip.Actions.background": "greyDot80",
"ToolTip.Actions.infoForeground": "greyDot50",
"ToolTip.background": "greyDot75",
"ToolTip.background": "greyDot80",
"ToolTip.borderColor": "border",
"ToolTip.infoForeground": "greyDot50",
"ToolWindow.Button.hoverBackground": "greyDot65",
"ToolWindow.Button.selectedBackground": "greyDot85",
"ToolWindow.Button.selectedForeground": "lightBlue",
"ToolWindow.Button.hoverBackground": "greyDot95",
"ToolWindow.Button.selectedBackground": "greyDot95",
"ToolWindow.Button.selectedForeground": "yellow",
"ToolWindow.Header.background": "greyDot85",
"ToolWindow.Header.inactiveBackground": "greyDot80",
"ToolWindow.HeaderTab.hoverBackground": "greyDot65",
"ToolWindow.HeaderTab.hoverInactiveBackground": "greyDot85",
"ToolWindow.HeaderTab.inactiveUnderlineColor": "greyDot75",
"ToolWindow.HeaderTab.underlineColor": "yellowMac",
"ToolWindow.Header.inactiveBackground": "editorPaneBg",
"ToolWindow.HeaderTab.hoverBackground": "consoleBackground",
"ToolWindow.HeaderTab.hoverInactiveBackground": "editorBg",
"ToolWindow.HeaderTab.underlineColor": "yellow",
"ToolWindow.HeaderTab.underlineHeight": 1,
"ToolWindow.HeaderTab.underlinedTabBackground": "greyDot90",
"ToolWindow.HeaderTab.underlinedTabInactiveBackground": "greyDot75",
"Tooltip.separatorColor": "border",
"Tree.background": "greyDot85",
"Tree.foreground": "greyDot15",
"Tree.modifiedItemForeground": "yellowMac",
"ValidationTooltip.errorBackground": "greyDot85",
"ValidationTooltip.errorBorderColor": "#ed005c",
"ValidationTooltip.warningBackground": "greyDot85",
"ValidationTooltip.warningBorderColor": "yellowMac",
"VersionControl.FileHistory.Commit.selectedBranchBackground": "greyDot70",
"Tree.foreground": "textColor",
"Tree.hoverBackground": "greyDot95",
"Tree.modifiedItemForeground": "yellow",
"Tree.selectionBackground": "greyDot95",
"Tree.selectionInactiveBackground": "greyDot95",
"ValidationTooltip.errorBackground": "greyDot95",
"ValidationTooltip.errorBorderColor": "red",
"ValidationTooltip.warningBackground": "greyDot95",
"ValidationTooltip.warningBorderColor": "yellow",
"VersionControl.FileHistory.Commit.selectedBranchBackground": "greyDot95",
"VersionControl.Log.Commit.currentBranchBackground": "greyDot85",
"VersionControl.Log.Commit.hoveredBackground": "greyDot95",
"VersionControl.Log.Commit.unmatchedForeground": "greyDot25",
"WelcomeScreen.Projects.selectionBackground": "navyDot85",
"WelcomeScreen.Projects.selectionInactiveBackground": "navyDot90",
"WelcomeScreen.separatorColor": "greyDot65",
"Window.border": "1,1,1,1,4d4d4d"
"WelcomeScreen.Details.background": "greyDot80",
"WelcomeScreen.Projects.background": "greyDot85",
"WelcomeScreen.Projects.selectionBackground": "greyDot95",
"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",
"colorSelectionForeground": "#C2C5BC",
"colorSelectionForegroundInactive": "#A9B3AE",
"colorHoverBackground": "#284E5B",
"colorHoverBackground": "#1B4755",
"colorHoverInactiveBackground": "#1B4755",
"colorBorder": "#04343F",
"colorDisabledForeground": "#657B83",
"colorAlternativeBackground": "#1B4854",
@@ -30,6 +31,8 @@
"disabledForeground": "colorDisabledForeground",
"disabledText": "colorDisabledForeground",
"foreground": "colorForeground",
"hoverBackground": "colorHoverBackground",
"hoverInactiveBackground": "colorHoverInactiveBackground",
"inactiveBackground": "colorBackground",
"inactiveForeground": "colorInactiveForeground",
"selectionBackground": "colorSelectionBackground",
@@ -42,11 +45,22 @@
"textForeground": "colorForeground"
},
"ActionButton": {
"hoverBackground": "colorHoverBackground",
"hoverBorderColor": "colorHoverBackground",
"hoverBackground": "#284E5B",
"hoverBorderColor": "#284E5B",
"pressedBackground": "#43616C",
"pressedBorderColor": "#43616C"
},
"AssignedMnemonic": {
"background": "#47573B",
"borderColor": "#47573B"
},
"AvailableMnemonic": {
"borderColor": "#456168"
},
"BigSpinner": {},
"BookmarkIcon": {
"background": "#73888C"
},
"Borders": {
"color": "colorBorder",
"ContrastBorderColor": "colorBorder"
@@ -111,6 +125,11 @@
"background": "#99A6A5B0",
"foreground": "#002B36"
},
"CurrentMnemonic": {
"background": "#175D8B",
"borderColor": "#175D8B",
"foreground": "#BEC2B9"
},
"Debugger": {
"Variables": {
"changedValueForeground": "#519AF2",
@@ -137,7 +156,8 @@
"DragAndDrop": {
"areaBackground": "#17475F",
"areaBorderColor": "#386FA8",
"areaForeground": "colorForeground"
"areaForeground": "colorForeground",
"borderColor": "#FA6060"
},
"Editor": {
"background": "#0E272F",
@@ -219,6 +239,7 @@
"FormattedTextField": {
"background": "colorAlternativeBackground"
},
"GotItTooltip": {},
"Group": {
"disabledSeparatorColor": "colorSeparator",
"separatorColor": "colorSeparator"
@@ -239,7 +260,18 @@
"Label": {
"errorForeground": "#FA6060",
"infoForeground": "#778A8F",
"selectedForeground": "colorForeground"
"selectedForeground": "colorForeground",
"successForeground": "#39A464"
},
"Lesson": {
"shortcutBackground": "#0C3340",
"stepNumberForeground": "#73888C",
"Tooltip": {
"background": "#005DCB",
"foreground": "#EEE8D5",
"spanBackground": "#004AA8",
"stepNumberForeground": "#629ADE"
}
},
"Link": {
"activeForeground": "#519AF2",
@@ -269,6 +301,10 @@
"acceleratorForeground": "colorForeground",
"disabledBackground": "colorBackground"
},
"MnemonicIcon": {
"background": "#36544C",
"borderColor": "#D0A244"
},
"NavBar": {
"borderColor": "colorSeparator"
},
@@ -297,7 +333,9 @@
"OptionPane": {
"messageForeground": "colorForeground"
},
"Panel": {},
"Panel": {
"mouseShortcutBackground": "#214C5A"
},
"ParameterInfo": {
"background": "#254C57",
"borderColor": "#415E69",
@@ -357,6 +395,7 @@
"PopupMenu": {
"translucentBackground": "colorBackground"
},
"ProblemsView": {},
"ProgressBar": {
"failedColor": "#DE4647",
"failedEndColor": "#EFA0A0",
@@ -432,6 +471,9 @@
"endBackground": "#FCCE40",
"startBackground": "#FFEAA2"
},
"SearchOption": {
"selectedBackground": "#456168"
},
"Separator": {
"separatorColor": "colorSeparator"
},
@@ -462,9 +504,12 @@
"SplitPaneDivider": {
"draggingColor": "#193E49"
},
"StateWidget": {
"activeBackground": "#FAC640"
},
"StatusBar": {
"borderColor": "#204550",
"hoverBackground": "colorHoverBackground"
"hoverBackground": "#284E5B"
},
"TabbedPane": {
"contentAreaColor": "#04343F",
@@ -475,6 +520,7 @@
"underlineColor": "#3985C7"
},
"Table": {
"alternativeRowBackground": "#013441",
"dropLineColor": "colorAcceleratorForeground",
"dropLineShortColor": "#0C3542",
"focusCellBackground": "colorAlternativeBackground",
@@ -605,6 +651,7 @@
"Log": {
"Commit": {
"currentBranchBackground": "#044452",
"hoveredBackground": "#124957",
"unmatchedForeground": "#657B83"
}
},
@@ -619,17 +666,27 @@
"borderColor": "#31535F",
"captionBackground": "#294953",
"captionForeground": "#C2C5BC",
"Details": {
"background": "#013441"
},
"footerBackground": "#294953",
"footerForeground": "#C2C5BC",
"groupIconBorderColor": "#0A3844",
"headerBackground": "#294953",
"headerForeground": "#C2C5BC",
"Projects": {
"actions": {
"background": "#195787",
"selectionBackground": "#206ABF"
},
"background": "#113842",
"selectionBackground": "#396AB0",
"selectionInactiveBackground": "#1E434E"
},
"separatorColor": "#244A57"
"separatorColor": "#244A57",
"SidePanel": {
"background": "colorBackground"
}
},
"Window": {
"border": "colorBorder"

View File

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

View File

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

View File

@@ -127,6 +127,36 @@
"hoverForeground": "blue1",
"pressedForeground": "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": {

View File

@@ -126,6 +126,36 @@
"hoverForeground": "blue1",
"pressedForeground": "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": {

View File

@@ -127,6 +127,36 @@
"hoverForeground": "blue1",
"pressedForeground": "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": {

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