diff --git a/CHANGELOG.md b/CHANGELOG.md index efcfcac3..dd42c9df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,92 @@ FlatLaf Change Log ================== -## Unreleased +## 0.25.1 + +Re-release of 0.25 because of problems with Maven Central. + + +## 0.25 + +- Hide menu mnemonics by default and show them only when Alt key is + pressed. (issue #43) +- Menu: Fixed vertical alignment of sub-menus. (issue #42) +- TabbedPane: In scroll-tab-layout, the cropped line is now hidden. (issue #40) +- Tree: UI default value `Tree.textBackground` now has a valid color and is no + longer `null`. +- Tree on macOS: Fixed Left and Right keys to collapse or + expand nodes. +- ComboBox on macOS: Fixed keyboard navigation and show/hide popup. +- Button and ToggleButton: Support per component minimum height (set client + property `JComponent.minimumHeight` to an integer). (issue #44) +- Button and ToggleButton: Do not apply minimum width if button border was + changed (is no longer an instance of `FlatButtonBorder`). +- ToggleButton: Renamed toggle button type "underline" to "tab" (value of client + property `JButton.buttonType` is now `tab`). +- ToggleButton: Support per component styling for tab-style toggle buttons with + client properties `JToggleButton.tab.underlineHeight` (integer), + `JToggleButton.tab.underlineColor` (Color) and + `JToggleButton.tab.selectedBackground` (Color). (issue #45) +- ToggleButton: No longer use focus width for tab-style toggle buttons to + compute component size, which reduces/fixes component size in "Flat IntelliJ" + and "Flat Darcula" themes. +- TabbedPane: Support per component tab height (set client property + `JTabbedPane.tabHeight` to an integer). +- ProgressBar: Support square painting (set client property + `JProgressBar.square` to `true`) and larger height even if no string is + painted (set client property `JProgressBar.largeHeight` to `true`). + + +## 0.24 + +- Support smooth scrolling with touchpads and high precision mouse wheels. + (issue #27) +- Changed `.properties` file loading order: Now all core `.properties` files are + loaded before loading addon `.properties` files. This makes it easier to + overwrite core values in addons. Also, addon loading order can be specified. +- TableHeader: Paint column borders if renderer has changed, but delegates to + the system default renderer (e.g. done in NetBeans). +- Label and ToolTip: Fixed font sizes for HTML headings. +- Button and ToggleButton: Support square button style (set client property + `JButton.buttonType` to `square`). +- ToggleButton: Support underline toggle button style (set client property + `JButton.buttonType` to `underline`). +- Button and TextComponent: Support per component minimum width (set client + property `JComponent.minimumWidth` to an integer). +- ScrollPane with Table: The border of buttons that are added to one of the four + scroll pane corners are now removed if the center component is a table. Also, + these corner buttons are made not focusable. +- Table: Replaced `Table.showGrid` with `Table.showHorizontalLines` and + `Table.showVerticalLines`. (issue #38) +- ProgressBar: Now uses blueish color for the progress part in "Flat Dark" + theme. In the "Flat Darcula" theme, it remains light gray. +- Improved Swing system colors `controlHighlight`, `controlLtHighlight`, + `controlShadow` and `controlDkShadow`. + + +## 0.23.1 + +- Tree: Fixed wide selection if scrolled horizontally. +- ComboBox: Fixed NPE in Oracle SQL Developer settings. +- IntelliJ Themes: Fixed checkbox colors in Material UI Lite dark themes. + + +## 0.23 - Updated colors in "Flat Light" and "Flat IntelliJ" themes with colors from - "IntelliJ Light Theme", which provides blue coloring that better match + "IntelliJ Light Theme", which provides blue coloring that better matches platform colors. - Tree: Support wide selection (enabled by default). - Table: Hide grid and changed intercell spacing to zero. -- List and Tree: Paint cell focus indicator (black rectangle) only if more than - one item is selected. +- List, Table and Tree: Added colors for drag-and-drop. Added "enable drag and + drop" checkbox to Demo on "Data Components" tab. +- List and Tree: Hide cell focus indicator (black rectangle) by default. Can be + enabled with `List.showCellFocusIndicator=true` / + `Tree.showCellFocusIndicator=true`, but then the cell focus indicator is shown + only if more than one item is selected. +- Table: Hide cell focus indicator (black rectangle) by default if none of the + selected cells is editable. Can be show always with + `Table.showCellFocusIndicator=true`. - Support basic color functions in `.properties` files: `rgb(red,green,blue)`, `rgba(red,green,blue,alpha)`, `hsl(hue,saturation,lightness)`, `hsla(hue,saturation,lightness,alpha)`, `lighten(color,amount[,options])` and @@ -18,6 +95,8 @@ FlatLaf Change Log - Fixed link color (in HTML text) and separator color in IntelliJ platform themes. - Use logging instead of printing errors to `System.err`. +- Updated IntelliJ Themes in demo to the latest versions. +- IntelliJ Themes: Fixed link and separator colors. ## 0.22 diff --git a/README.md b/README.md index 048379c0..9e2368f0 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ build script: groupId: com.formdev artifactId: flatlaf - version: 0.22 + version: 0.25.1 Otherwise download `flatlaf-.jar` here: diff --git a/build.gradle.kts b/build.gradle.kts index ee87feea..7bc57e70 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, @@ -14,7 +14,7 @@ * limitations under the License. */ -version = "0.22" +version = "0.25.1" allprojects { repositories { diff --git a/flatlaf-core/build.gradle.kts b/flatlaf-core/build.gradle.kts index 749c21da..b09ec33c 100644 --- a/flatlaf-core/build.gradle.kts +++ b/flatlaf-core/build.gradle.kts @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, @@ -106,7 +106,7 @@ publishing { licenses { license { name.set( "The Apache License, Version 2.0" ) - url.set( "http://www.apache.org/licenses/LICENSE-2.0.txt" ) + url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" ) } } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java index 10aebe50..98ca89c2 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java @@ -16,6 +16,7 @@ package com.formdev.flatlaf; +import java.awt.Color; import java.util.Objects; import javax.swing.JComponent; @@ -27,14 +28,34 @@ public interface FlatClientProperties /** * Specifies type of a button. *

- * Component {@link javax.swing.JButton}
+ * Components {@link javax.swing.JButton} and {@link javax.swing.JToggleButton}
* Value type {@link java.lang.String}
- * Allowed Values {@link BUTTON_TYPE_HELP} + * Allowed Values {@link #BUTTON_TYPE_SQUARE} and {@link #BUTTON_TYPE_HELP} */ String BUTTON_TYPE = "JButton.buttonType"; + /** + * Paint the button with square edges. + *

+ * Components {@link javax.swing.JButton} and {@link javax.swing.JToggleButton} + * + * @see #BUTTON_TYPE + */ + String BUTTON_TYPE_SQUARE = "square"; + + /** + * Paint the toggle button in tab style. + *

+ * Components {@link javax.swing.JToggleButton} + * + * @see #TOGGLE_BUTTON_TYPE + */ + String BUTTON_TYPE_TAB = "tab"; + /** * Paint a help button (circle with question mark). + *

+ * Components {@link javax.swing.JButton} * * @see #BUTTON_TYPE */ @@ -45,7 +66,7 @@ public interface FlatClientProperties *

* Component {@link javax.swing.JCheckBox}
* Value type {@link java.lang.String}
- * Allowed Values {@link SELECTED_STATE_INDETERMINATE} + * Allowed Values {@link #SELECTED_STATE_INDETERMINATE} */ String SELECTED_STATE = "JButton.selectedState"; @@ -56,6 +77,38 @@ public interface FlatClientProperties */ String SELECTED_STATE_INDETERMINATE = "indeterminate"; + /** + * Specifies minimum width of a component. + *

+ * Component {@link javax.swing.JButton}, {@link javax.swing.JToggleButton} and {@link javax.swing.text.JTextComponent}
+ * Value type {@link java.lang.Integer}
+ */ + String MINIMUM_WIDTH = "JComponent.minimumWidth"; + + /** + * Specifies minimum height of a component. + *

+ * Component {@link javax.swing.JButton} and {@link javax.swing.JToggleButton}
+ * Value type {@link java.lang.Integer}
+ */ + String MINIMUM_HEIGHT = "JComponent.minimumHeight"; + + /** + * Specifies whether the progress bar has always the larger height even if no string is painted. + *

+ * Component {@link javax.swing.JProgressBar}
+ * Value type {@link java.lang.Boolean} + */ + String PROGRESS_BAR_LARGE_HEIGHT = "JProgressBar.largeHeight"; + + /** + * Specifies whether the progress bar is paint with square edges. + *

+ * Component {@link javax.swing.JProgressBar}
+ * Value type {@link java.lang.Boolean} + */ + String PROGRESS_BAR_SQUARE = "JProgressBar.square"; + /** * Specifies whether the decrease/increase arrow buttons of a scrollbar are shown. *

@@ -80,6 +133,14 @@ public interface FlatClientProperties */ String TABBED_PANE_HAS_FULL_BORDER = "JTabbedPane.hasFullBorder"; + /** + * Specifies the height of a tab. + *

+ * Component {@link javax.swing.JTabbedPane}
+ * Value type {@link java.lang.Integer} + */ + String TABBED_PANE_TAB_HEIGHT = "JTabbedPane.tabHeight"; + /** * Placeholder text that is only painted if the text field is empty. *

@@ -88,6 +149,30 @@ public interface FlatClientProperties */ String PLACEHOLDER_TEXT = "JTextField.placeholderText"; + /** + * Height of underline if toggle button type is {@link #BUTTON_TYPE_TAB}. + *

+ * Component {@link javax.swing.JToggleButton}
+ * Value type {@link java.lang.Integer} + */ + String TAB_BUTTON_UNDERLINE_HEIGHT = "JToggleButton.tab.underlineHeight"; + + /** + * Color of underline if toggle button type is {@link #BUTTON_TYPE_TAB}. + *

+ * Component {@link javax.swing.JToggleButton}
+ * Value type {@link java.awt.Color} + */ + String TAB_BUTTON_UNDERLINE_COLOR = "JToggleButton.tab.underlineColor"; + + /** + * Background color if selected and toggle button type is {@link #BUTTON_TYPE_TAB}. + *

+ * Component {@link javax.swing.JToggleButton}
+ * Value type {@link java.awt.Color} + */ + String TAB_BUTTON_SELECTED_BACKGROUND = "JToggleButton.tab.selectedBackground"; + /** * Checks whether a client property of a component has the given value. */ @@ -103,4 +188,22 @@ public interface FlatClientProperties Object value = c.getClientProperty( key ); return (value instanceof Boolean) ? (boolean) value : defaultValue; } + + /** + * Checks whether a client property of a component is an integer and returns its value. + * If the client property is not set, or not an integer, defaultValue is returned. + */ + static int clientPropertyInt( JComponent c, String key, int defaultValue ) { + Object value = c.getClientProperty( key ); + return (value instanceof Integer) ? (int) value : defaultValue; + } + + /** + * Checks whether a client property of a component is a color and returns its value. + * If the client property is not set, or not a color, defaultValue is returned. + */ + static Color clientPropertyColor( JComponent c, String key, Color defaultValue ) { + Object value = c.getClientProperty( key ); + return (value instanceof Color) ? (Color) value : defaultValue; + } } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatDefaultsAddon.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatDefaultsAddon.java index ef7c03d0..4e469d8f 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatDefaultsAddon.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatDefaultsAddon.java @@ -23,11 +23,11 @@ import java.io.InputStream; * * Allows loading of additional .properties files from addon JARs. * {@link java.util.ServiceLoader} is used to load extensions of this class from addon JARs. - * + *

* If you extend this class in a addon JAR, you also have to add a text file named * {@code META-INF/services/com.formdev.flatlaf.FlatDefaultsAddon} * to the addon JAR. The file must contain a single line with the class name. - * + *

* See 'flatlaf-swingx' addon for an example * * @author Karl Tauber @@ -37,6 +37,26 @@ public abstract class FlatDefaultsAddon /** * Finds an addon .properties file for the given LaF class and returns * it as input stream. Or {@code null} if not found. + *

+ * This default implementation finds addon .properties file for the given LaF class + * in the same package as the subclass. + *

+ * Override this method to load addon .properties files from other locations. */ - public abstract InputStream getDefaults( Class lafClass ); + public InputStream getDefaults( Class lafClass ) { + Class addonClass = this.getClass(); + String propertiesName = '/' + addonClass.getPackage().getName().replace( '.', '/' ) + + '/' + lafClass.getSimpleName() + ".properties"; + return addonClass.getResourceAsStream( propertiesName ); + } + + /** + * Returns the priority used to sort addon loading. + * The order is only important if you want overwrite UI defaults of other addons. + * Lower numbers mean higher priority. + * Returns 10000 by default. + */ + public int getPriority() { + return 10000; + } } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java index 59fece80..09e6d512 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java @@ -28,17 +28,22 @@ import java.awt.Window; import java.awt.event.KeyEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.lang.ref.WeakReference; import java.util.List; import java.util.function.Consumer; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.AbstractButton; +import javax.swing.InputMap; import javax.swing.JLabel; +import javax.swing.JRootPane; import javax.swing.JTabbedPane; +import javax.swing.KeyStroke; import javax.swing.LookAndFeel; import javax.swing.PopupFactory; import javax.swing.SwingUtilities; import javax.swing.UIDefaults; +import javax.swing.UIDefaults.LazyValue; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.ColorUIResource; @@ -66,6 +71,7 @@ public abstract class FlatLaf private KeyEventPostProcessor mnemonicListener; private static boolean showMnemonics; + private static WeakReference lastShowMnemonicWindow; private Consumer postInitialization; @@ -229,6 +235,7 @@ public abstract class FlatLaf initFonts( defaults ); initIconColors( defaults, isDark() ); + initInputMaps( defaults ); // load defaults from properties List> lafClassesForDefaultsLoading = getLafClassesForDefaultsLoading(); @@ -335,6 +342,57 @@ public abstract class FlatLaf defaults.put( "Objects.BlackText", new ColorUIResource( 0x231F20 ) ); } + private void initInputMaps( UIDefaults defaults ) { + if( SystemInfo.IS_MAC ) { + // AquaLookAndFeel (the base for UI defaults on macOS) uses special + // action keys (e.g. "aquaExpandNode") for some macOS specific behaviour. + // Those action keys are not available in FlatLaf, which makes it + // necessary to make some modifications. + + // combobox + defaults.put( "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap( new Object[] { + "ESCAPE", "hidePopup", + "PAGE_UP", "pageUpPassThrough", + "PAGE_DOWN", "pageDownPassThrough", + "HOME", "homePassThrough", + "END", "endPassThrough", + "DOWN", "selectNext", + "KP_DOWN", "selectNext", + "SPACE", "spacePopup", + "ENTER", "enterPressed", + "UP", "selectPrevious", + "KP_UP", "selectPrevious" + } ) ); + + // tree node expanding/collapsing + modifyInputMap( defaults, "Tree.focusInputMap", + "RIGHT", "selectChild", + "KP_RIGHT", "selectChild", + "LEFT", "selectParent", + "KP_LEFT", "selectParent", + "shift RIGHT", null, + "shift KP_RIGHT", null, + "shift LEFT", null, + "shift KP_LEFT", null, + "ctrl LEFT", null, + "ctrl KP_LEFT", null, + "ctrl RIGHT", null, + "ctrl KP_RIGHT", null + ); + defaults.put( "Tree.focusInputMap.RightToLeft", new UIDefaults.LazyInputMap( new Object[] { + "RIGHT", "selectParent", + "KP_RIGHT", "selectParent", + "LEFT", "selectChild", + "KP_LEFT", "selectChild" + } ) ); + } + } + + private void modifyInputMap( UIDefaults defaults, String key, Object... bindings ) { + // Note: not using `defaults.get(key)` here because this would resolve the lazy value + defaults.put( key, new LazyModifyInputMap( defaults.remove( key ), bindings ) ); + } + private static void reSetLookAndFeel() { EventQueue.invokeLater( () -> { LookAndFeel lookAndFeel = UIManager.getLookAndFeel(); @@ -373,15 +431,15 @@ public abstract class FlatLaf if( SystemInfo.IS_MAC ) { // Ctrl+Alt keys must be pressed on Mac if( keyCode == KeyEvent.VK_CONTROL || keyCode == KeyEvent.VK_ALT ) - showMnemonics( e.getID() == KeyEvent.KEY_PRESSED && e.isControlDown() && e.isAltDown() ); + showMnemonics( e.getID() == KeyEvent.KEY_PRESSED && e.isControlDown() && e.isAltDown(), e.getComponent() ); } else { // Alt key must be pressed on Windows and Linux if( keyCode == KeyEvent.VK_ALT ) - showMnemonics( e.getID() == KeyEvent.KEY_PRESSED ); + showMnemonics( e.getID() == KeyEvent.KEY_PRESSED, e.getComponent() ); } } - private static void showMnemonics( boolean show ) { + private static void showMnemonics( boolean show, Component c ) { if( show == showMnemonics ) return; @@ -391,22 +449,35 @@ public abstract class FlatLaf if( !UIManager.getBoolean( "Component.hideMnemonics" ) ) return; - // get focus owner - Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); - if( focusOwner == null ) - return; + if( show ) { + // get root pane + JRootPane rootPane = SwingUtilities.getRootPane( c ); + if( rootPane == null ) + return; - // get focused window - Window window = SwingUtilities.windowForComponent( focusOwner ); - if( window == null ) - return; + // get window + Window window = SwingUtilities.getWindowAncestor( rootPane ); + if( window == null ) + return; - // repaint components with mnemonics in focused window - repaintMnemonics( window ); + // repaint components with mnemonics in focused window + repaintMnemonics( window ); + + lastShowMnemonicWindow = new WeakReference<>( window ); + } else if( lastShowMnemonicWindow != null ) { + Window window = lastShowMnemonicWindow.get(); + if( window != null ) + repaintMnemonics( window ); + + lastShowMnemonicWindow = null; + } } private static void repaintMnemonics( Container container ) { for( Component c : container.getComponents() ) { + if( !c.isVisible() ) + continue; + if( hasMnemonic( c ) ) c.repaint(); @@ -433,4 +504,40 @@ public abstract class FlatLaf return false; } + + //---- class LazyModifyInputMap ------------------------------------------- + + /** + * Takes a (lazy) base input map and lazily applies modifications to it specified in bindings. + */ + private static class LazyModifyInputMap + implements LazyValue + { + private final Object baseInputMap; + private final Object[] bindings; + + public LazyModifyInputMap( Object baseInputMap, Object[] bindings ) { + this.baseInputMap = baseInputMap; + this.bindings = bindings; + } + + @Override + public Object createValue( UIDefaults table ) { + // get base input map + InputMap inputMap = (baseInputMap instanceof LazyValue) + ? (InputMap) ((LazyValue)baseInputMap).createValue( table ) + : (InputMap) baseInputMap; + + // modify input map (replace or remove) + for( int i = 0; i < bindings.length; i += 2 ) { + KeyStroke keyStroke = KeyStroke.getKeyStroke( (String) bindings[i] ); + if( bindings[i + 1] != null ) + inputMap.put( keyStroke, bindings[i + 1] ); + else + inputMap.remove( keyStroke ); + } + + return inputMap; + } + } } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/IntelliJTheme.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/IntelliJTheme.java index fd241c5c..33f7dfdc 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/IntelliJTheme.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/IntelliJTheme.java @@ -355,33 +355,43 @@ public class IntelliJTheme value = "#ffffff"; } + String key2 = checkboxDuplicateColors.get( key ); + if( dark ) key = StringUtils.removeTrailing( key, ".Dark" ); String newKey = checkboxKeyMapping.get( key ); if( newKey != null ) { ColorUIResource color = toColor( (String) value ); - if( color != null ) + if( color != null ) { defaults.put( newKey, color ); + if( key2 != null ) { + // When IDEA replaces colors in SVGs it uses color values and not the keys + // from com.intellij.ide.ui.UITheme.colorPalette, but there are some keys that + // have same color value: + // - Checkbox.Background.Default.Dark has same color as Checkbox.Background.Selected.Dark + // - Checkbox.Border.Default.Dark has same color as Checkbox.Border.Selected.Dark + // - Checkbox.Focus.Thin.Default.Dark has same color as Checkbox.Focus.Thin.Selected.Dark + // + // So if only e.g. Checkbox.Background.Default.Dark is specified in .theme.json, + // then this color is also used for Checkbox.Background.Selected.Dark. + // + // If Checkbox.Background.Default.Dark and Checkbox.Background.Selected.Dark + // are specified in .theme.json, then the later specified is used for both. + if( dark ) + key2 = StringUtils.removeTrailing( key2, ".Dark" ); + + String newKey2 = checkboxKeyMapping.get( key2 ); + if( newKey2 != null ) + defaults.put( newKey2, color ); + } + } + checkboxModified = true; } } - // When IDEA replaces colors in SVGs it uses color values and not the keys - // from com.intellij.ide.ui.UITheme.colorPalette, but there are some keys that - // have same color value: - // - Checkbox.Background.Default.Dark has same color as Checkbox.Background.Selected.Dark - // - Checkbox.Border.Default.Dark has same color as Checkbox.Border.Selected.Dark - // - Checkbox.Focus.Thin.Default.Dark has same color as Checkbox.Focus.Thin.Selected.Dark - // - // So if only e.g. Checkbox.Background.Default.Dark is specified in .theme.json, - // then this color is also used for Checkbox.Background.Selected.Dark. - // Occurs e.g. in "Dark purple" theme. - fixCheckBoxColor( defaults, colorPalette, "Checkbox.Background.Default.Dark", "Checkbox.Background.Selected.Dark" ); - fixCheckBoxColor( defaults, colorPalette, "Checkbox.Border.Default.Dark", "Checkbox.Border.Selected.Dark" ); - fixCheckBoxColor( defaults, colorPalette, "Checkbox.Focus.Thin.Default.Dark", "Checkbox.Focus.Thin.Selected.Dark" ); - // remove hover and pressed colors if( checkboxModified ) { defaults.remove( "CheckBox.icon.hoverBorderColor" ); @@ -391,23 +401,17 @@ public class IntelliJTheme defaults.remove( "CheckBox.icon.selectedHoverBackground" ); defaults.remove( "CheckBox.icon.selectedPressedBackground" ); } - } - private void fixCheckBoxColor( UIDefaults defaults, Map colorPalette, String key1, String key2 ) { - if( colorPalette.containsKey( key1 ) == colorPalette.containsKey( key2 ) ) - return; - - String newKey1 = checkboxKeyMapping.get( StringUtils.removeTrailing( key1, ".Dark" ) ); - String newKey2 = checkboxKeyMapping.get( StringUtils.removeTrailing( key2, ".Dark" ) ); - if( colorPalette.containsKey( key1 ) ) - defaults.put( newKey2, defaults.get( newKey1 ) ); - else - defaults.put( newKey1, defaults.get( newKey2 ) ); + // copy values + for( Map.Entry e : uiKeyCopying.entrySet() ) + defaults.put( e.getKey(), defaults.get( e.getValue() ) ); } private static Map uiKeyMapping = new HashMap<>(); + private static Map uiKeyCopying = new HashMap<>(); private static Map uiKeyInverseMapping = new HashMap<>(); private static Map checkboxKeyMapping = new HashMap<>(); + private static Map checkboxDuplicateColors = new HashMap<>(); private static Set noWildcardReplace = new HashSet<>(); static { @@ -441,6 +445,12 @@ public class IntelliJTheme for( Map.Entry e : uiKeyMapping.entrySet() ) uiKeyInverseMapping.put( e.getValue(), e.getKey() ); + uiKeyCopying.put( "ToggleButton.tab.underlineColor", "TabbedPane.underlineColor" ); + uiKeyCopying.put( "ToggleButton.tab.disabledUnderlineColor", "TabbedPane.disabledUnderlineColor" ); + uiKeyCopying.put( "ToggleButton.tab.selectedBackground", "TabbedPane.selectedBackground" ); + uiKeyCopying.put( "ToggleButton.tab.hoverBackground", "TabbedPane.hoverColor" ); + uiKeyCopying.put( "ToggleButton.tab.focusBackground", "TabbedPane.focusColor" ); + checkboxKeyMapping.put( "Checkbox.Background.Default", "CheckBox.icon.background" ); checkboxKeyMapping.put( "Checkbox.Background.Disabled", "CheckBox.icon.disabledBackground" ); checkboxKeyMapping.put( "Checkbox.Border.Default", "CheckBox.icon.borderColor" ); @@ -453,6 +463,14 @@ public class IntelliJTheme checkboxKeyMapping.put( "Checkbox.Foreground.Selected", "CheckBox.icon.checkmarkColor" ); checkboxKeyMapping.put( "Checkbox.Focus.Thin.Selected", "CheckBox.icon.selectedFocusedBorderColor" ); + checkboxDuplicateColors.put( "Checkbox.Background.Default.Dark", "Checkbox.Background.Selected.Dark" ); + checkboxDuplicateColors.put( "Checkbox.Border.Default.Dark", "Checkbox.Border.Selected.Dark" ); + checkboxDuplicateColors.put( "Checkbox.Focus.Thin.Default.Dark", "Checkbox.Focus.Thin.Selected.Dark" ); + @SuppressWarnings( "unchecked" ) + Map.Entry[] entries = checkboxDuplicateColors.entrySet().toArray( new Map.Entry[checkboxDuplicateColors.size()] ); + for( Map.Entry e : entries ) + checkboxDuplicateColors.put( e.getValue(), e.getKey() ); + // because FlatLaf uses Button.background and Button.borderColor, // but IDEA uses Button.startBackground and Button.startBorderColor, // our default button background and border colors may be replaced by diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java index a1901142..b82ae296 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java @@ -84,32 +84,41 @@ class UIDefaultsLoader static void loadDefaultsFromProperties( List> lafClasses, UIDefaults defaults ) { try { - List addonClassLoaders = new ArrayList<>(); - - // load properties files + // load core properties files Properties properties = new Properties(); - ServiceLoader addonLoader = ServiceLoader.load( FlatDefaultsAddon.class ); for( Class lafClass : lafClasses ) { - // load core properties - String propertiesName = "/" + lafClass.getName().replace( '.', '/' ) + ".properties"; + String propertiesName = '/' + lafClass.getName().replace( '.', '/' ) + ".properties"; try( InputStream in = lafClass.getResourceAsStream( propertiesName ) ) { if( in != null ) properties.load( in ); } + } - // load properties from addons - for( FlatDefaultsAddon addon : addonLoader ) { + // get addons and sort them by priority + ServiceLoader addonLoader = ServiceLoader.load( FlatDefaultsAddon.class ); + List addonList = new ArrayList<>(); + for( FlatDefaultsAddon addon : addonLoader ) + addonList.add( addon ); + addonList.sort( (addon1, addon2) -> addon1.getPriority() - addon2.getPriority() ); + + // load properties from addons + for( FlatDefaultsAddon addon : addonList ) { + for( Class lafClass : lafClasses ) { try( InputStream in = addon.getDefaults( lafClass ) ) { if( in != null ) properties.load( in ); } - - ClassLoader addonClassLoader = addon.getClass().getClassLoader(); - if( !addonClassLoaders.contains( addonClassLoader ) ) - addonClassLoaders.add( addonClassLoader ); } } + // collect addon class loaders + List addonClassLoaders = new ArrayList<>(); + for( FlatDefaultsAddon addon : addonList ) { + ClassLoader addonClassLoader = addon.getClass().getClassLoader(); + if( !addonClassLoaders.contains( addonClassLoader ) ) + addonClassLoaders.add( addonClassLoader ); + } + // collect all platform specific keys (but do not modify properties) ArrayList platformSpecificKeys = new ArrayList<>(); for( Object key : properties.keySet() ) { @@ -212,7 +221,7 @@ class UIDefaultsLoader return resolveValue( properties, newValue ); } - private enum ValueType { UNKNOWN, STRING, INTEGER, BORDER, ICON, INSETS, DIMENSION, COLOR, SCALEDINTEGER, INSTANCE, CLASS } + private enum ValueType { UNKNOWN, STRING, INTEGER, FLOAT, BORDER, ICON, INSETS, DIMENSION, COLOR, SCALEDINTEGER, INSTANCE, CLASS } static Object parseValue( String key, String value ) { return parseValue( key, value, v -> v, Collections.emptyList() ); @@ -242,7 +251,10 @@ class UIDefaultsLoader // check whether value type is specified in the value if( value.startsWith( "#" ) ) valueType = ValueType.COLOR; - else if( value.startsWith( TYPE_PREFIX ) ) { + else if( value.startsWith( "\"" ) && value.endsWith( "\"" ) ) { + valueType = ValueType.STRING; + value = value.substring( 1, value.length() - 1 ); + } else if( value.startsWith( TYPE_PREFIX ) ) { int end = value.indexOf( TYPE_PREFIX_END ); if( end != -1 ) { try { @@ -280,6 +292,7 @@ class UIDefaultsLoader switch( valueType ) { case STRING: return value; case INTEGER: return parseInteger( value, true ); + case FLOAT: return parseFloat( value, true ); case BORDER: return parseBorder( value, resolver, addonClassLoaders ); case ICON: return parseInstance( value, addonClassLoaders ); case INSETS: return parseInsets( value ); @@ -300,6 +313,11 @@ class UIDefaultsLoader if( integer != null ) return integer; + // float + Float f = parseFloat( value, false ); + if( f != null ) + return f; + // string return value; } @@ -594,6 +612,16 @@ class UIDefaultsLoader return null; } + private static Float parseFloat( String value, boolean reportError ) { + try { + return Float.parseFloat( value ); + } catch( NumberFormatException ex ) { + if( reportError ) + throw new NumberFormatException( "invalid float '" + value + "'" ); + } + return null; + } + private static ActiveValue parseScaledInteger( String value ) { int val = parseInteger( value, true ); return (ActiveValue) t -> { diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatBorder.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatBorder.java index 1449eb2a..0cf2b7ea 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatBorder.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatBorder.java @@ -48,7 +48,7 @@ import javax.swing.text.JTextComponent; * {@link FlatUIUtils#paintParentBackground} to paint the empty space correctly. * * @uiDefault Component.focusWidth int - * @uiDefault Component.innerFocusWidth int + * @uiDefault Component.innerFocusWidth int or float * @uiDefault Component.focusColor Color * @uiDefault Component.borderColor Color * @uiDefault Component.disabledBorderColor Color @@ -60,7 +60,7 @@ public class FlatBorder extends BasicBorders.MarginBorder { protected final int focusWidth = UIManager.getInt( "Component.focusWidth" ); - protected final int innerFocusWidth = UIManager.getInt( "Component.innerFocusWidth" ); + protected final float innerFocusWidth = FlatUIUtils.getUIFloat( "Component.innerFocusWidth", 0 ); protected final Color focusColor = UIManager.getColor( "Component.focusColor" ); protected final Color borderColor = UIManager.getColor( "Component.borderColor" ); protected final Color disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" ); @@ -73,14 +73,16 @@ public class FlatBorder FlatUIUtils.setRenderingHints( g2 ); boolean isCellEditor = isTableCellEditor( c ); - float focusWidth = isCellEditor ? 0 : getFocusWidth(); + float focusWidth = isCellEditor ? 0 : getFocusWidth( c ); float borderWidth = getBorderWidth( c ); - float arc = isCellEditor ? 0 : getArc(); + float arc = isCellEditor ? 0 : getArc( c ); if( isFocused( c ) ) { + float innerFocusWidth = !(c instanceof JScrollPane) ? this.innerFocusWidth : 0; + g2.setColor( getFocusColor( c ) ); FlatUIUtils.paintComponentOuterBorder( g2, x, y, width, height, focusWidth, - getLineWidth() + scale( (float) innerFocusWidth ), arc ); + getLineWidth( c ) + scale( innerFocusWidth ), arc ); } g2.setPaint( getBorderColor( c ) ); @@ -151,7 +153,7 @@ public class FlatBorder @Override public Insets getBorderInsets( Component c, Insets insets ) { boolean isCellEditor = isTableCellEditor( c ); - float ow = (isCellEditor ? 0 : getFocusWidth()) + getLineWidth(); + float ow = (isCellEditor ? 0 : getFocusWidth( c )) + getLineWidth( c ); insets = super.getBorderInsets( c, insets ); insets.top = Math.round( scale( (float) insets.top ) + ow ); @@ -161,19 +163,19 @@ public class FlatBorder return insets; } - protected float getFocusWidth() { + protected float getFocusWidth( Component c ) { return scale( (float) focusWidth ); } - protected float getLineWidth() { + protected float getLineWidth( Component c ) { return scale( 1f ); } protected float getBorderWidth( Component c ) { - return getLineWidth(); + return getLineWidth( c ); } - protected float getArc() { + protected float getArc( Component c ) { return 0; } } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonBorder.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonBorder.java index 145565ef..f8ebe5a6 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonBorder.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonBorder.java @@ -65,7 +65,7 @@ public class FlatButtonBorder @Override public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) { - if( FlatButtonUI.isContentAreaFilled( c ) && !FlatButtonUI.isHelpButton( c ) ) + if( FlatButtonUI.isContentAreaFilled( c ) && !FlatButtonUI.isHelpButton( c ) && !FlatToggleButtonUI.isTabButton( c ) ) super.paintBorder( c, g, x, y, width, height ); } @@ -104,13 +104,18 @@ public class FlatButtonBorder return insets; } + @Override + protected float getFocusWidth( Component c ) { + return FlatToggleButtonUI.isTabButton( c ) ? 0 : super.getFocusWidth(c ); + } + @Override protected float getBorderWidth( Component c ) { return FlatButtonUI.isDefaultButton( c ) ? scale( (float) defaultBorderWidth ) : super.getBorderWidth( c ); } @Override - protected float getArc() { - return scale( (float) arc ); + protected float getArc( Component c ) { + return FlatButtonUI.isSquareButton( c ) ? 0 : scale( (float) arc ); } } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonUI.java index 922c6663..c8d0b2a9 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonUI.java @@ -28,6 +28,7 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.geom.RoundRectangle2D; +import java.beans.PropertyChangeEvent; import javax.swing.AbstractButton; import javax.swing.ButtonModel; import javax.swing.Icon; @@ -39,6 +40,7 @@ import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.UIResource; +import javax.swing.plaf.basic.BasicButtonListener; import javax.swing.plaf.basic.BasicButtonUI; import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.util.UIScale; @@ -180,7 +182,7 @@ public class FlatButtonUI LookAndFeel.installProperty( b, "opaque", false ); LookAndFeel.installProperty( b, "iconTextGap", scale( iconTextGap ) ); - MigLayoutVisualPadding.install( b, focusWidth ); + MigLayoutVisualPadding.install( b, getFocusWidth( b ) ); } @Override @@ -191,6 +193,26 @@ public class FlatButtonUI defaults_initialized = false; } + @Override + protected BasicButtonListener createButtonListener( AbstractButton b ) { + return new BasicButtonListener( b ) { + @Override + public void propertyChange( PropertyChangeEvent e ) { + super.propertyChange( e ); + FlatButtonUI.this.propertyChange( b, e ); + } + }; + } + + protected void propertyChange( AbstractButton b, PropertyChangeEvent e ) { + switch( e.getPropertyName() ) { + case MINIMUM_WIDTH: + case MINIMUM_HEIGHT: + b.revalidate(); + break; + } + } + static boolean isContentAreaFilled( Component c ) { return !(c instanceof AbstractButton) || ((AbstractButton)c).isContentAreaFilled(); } @@ -209,6 +231,10 @@ public class FlatButtonUI (icon == null && text != null && ("...".equals( text ) || text.length() == 1)); } + static boolean isSquareButton( Component c ) { + return c instanceof AbstractButton && clientPropertyEquals( (AbstractButton) c, BUTTON_TYPE, BUTTON_TYPE_SQUARE ); + } + static boolean isHelpButton( Component c ) { return c instanceof JButton && clientPropertyEquals( (JButton) c, BUTTON_TYPE, BUTTON_TYPE_HELP ); } @@ -228,43 +254,47 @@ public class FlatButtonUI return; } - if( isContentAreaFilled( c ) ) { - Color background = getBackground( c ); - if( background != null ) { - Graphics2D g2 = (Graphics2D) g.create(); - try { - FlatUIUtils.setRenderingHints( g2 ); - - Border border = c.getBorder(); - float focusWidth = (border instanceof FlatBorder) ? scale( (float) this.focusWidth ) : 0; - float arc = (border instanceof FlatButtonBorder || isToolBarButton( c )) ? scale( (float) this.arc ) : 0; - boolean def = isDefaultButton( c ); - - // paint shadow - Color shadowColor = def ? defaultShadowColor : this.shadowColor; - if( shadowColor != null && shadowWidth > 0 && focusWidth > 0 && !c.hasFocus() && c.isEnabled() ) { - g2.setColor( shadowColor ); - g2.fill( new RoundRectangle2D.Float( focusWidth, focusWidth + UIScale.scale( (float) shadowWidth ), - c.getWidth() - focusWidth * 2, c.getHeight() - focusWidth * 2, arc, arc ) ); - } - - // paint background - Color startBg = def ? defaultBackground : startBackground; - Color endBg = def ? defaultEndBackground : endBackground; - if( background == startBg && endBg != null && !startBg.equals( endBg ) ) - g2.setPaint( new GradientPaint( 0, 0, startBg, 0, c.getHeight(), endBg ) ); - else - FlatUIUtils.setColor( g2, background, def ? defaultBackground : c.getBackground() ); - FlatUIUtils.paintComponentBackground( g2, 0, 0, c.getWidth(), c.getHeight(), focusWidth, arc ); - } finally { - g2.dispose(); - } - } - } + if( isContentAreaFilled( c ) ) + paintBackground( g, c ); paint( g, c ); } + protected void paintBackground( Graphics g, JComponent c ) { + Color background = getBackground( c ); + if( background != null ) { + Graphics2D g2 = (Graphics2D) g.create(); + try { + FlatUIUtils.setRenderingHints( g2 ); + + Border border = c.getBorder(); + float focusWidth = (border instanceof FlatBorder) ? scale( (float) getFocusWidth( c ) ) : 0; + float arc = ((border instanceof FlatButtonBorder && !isSquareButton( c )) || isToolBarButton( c )) + ? scale( (float) this.arc ) : 0; + boolean def = isDefaultButton( c ); + + // paint shadow + Color shadowColor = def ? defaultShadowColor : this.shadowColor; + if( shadowColor != null && shadowWidth > 0 && focusWidth > 0 && !c.hasFocus() && c.isEnabled() ) { + g2.setColor( shadowColor ); + g2.fill( new RoundRectangle2D.Float( focusWidth, focusWidth + UIScale.scale( (float) shadowWidth ), + c.getWidth() - focusWidth * 2, c.getHeight() - focusWidth * 2, arc, arc ) ); + } + + // paint background + Color startBg = def ? defaultBackground : startBackground; + Color endBg = def ? defaultEndBackground : endBackground; + if( background == startBg && endBg != null && !startBg.equals( endBg ) ) + g2.setPaint( new GradientPaint( 0, 0, startBg, 0, c.getHeight(), endBg ) ); + else + FlatUIUtils.setColor( g2, background, def ? defaultBackground : c.getBackground() ); + FlatUIUtils.paintComponentBackground( g2, 0, 0, c.getWidth(), c.getHeight(), focusWidth, arc ); + } finally { + g2.dispose(); + } + } + } + @Override protected void paintText( Graphics g, AbstractButton b, Rectangle textRect, String text ) { if( isHelpButton( b ) ) @@ -354,9 +384,16 @@ public class FlatButtonUI // or apply minimum width, if not in toolbar and not a icon-only button if( isIconOnlyButton( c ) ) prefSize.width = Math.max( prefSize.width, prefSize.height ); - else if( !isToolBarButton( c ) ) - prefSize.width = Math.max( prefSize.width, scale( minimumWidth + (focusWidth * 2) ) ); + else if( !isToolBarButton( c ) && c.getBorder() instanceof FlatButtonBorder ) { + int focusWidth = getFocusWidth( c ); + prefSize.width = Math.max( prefSize.width, scale( FlatUIUtils.minimumWidth( c, minimumWidth ) + (focusWidth * 2) ) ); + prefSize.height = Math.max( prefSize.height, scale( FlatUIUtils.minimumHeight( c, 0 ) + (focusWidth * 2) ) ); + } return prefSize; } + + protected int getFocusWidth( JComponent c ) { + return focusWidth; + } } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatCheckBoxMenuItemUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatCheckBoxMenuItemUI.java index 5679af31..f1cb3767 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatCheckBoxMenuItemUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatCheckBoxMenuItemUI.java @@ -17,8 +17,11 @@ package com.formdev.flatlaf.ui; import static com.formdev.flatlaf.util.UIScale.scale; +import java.awt.Graphics; +import java.awt.Rectangle; import java.beans.PropertyChangeListener; import javax.swing.JComponent; +import javax.swing.JMenuItem; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI; @@ -74,4 +77,9 @@ public class FlatCheckBoxMenuItemUI defaultTextIconGap = scale( defaultTextIconGap ); }; } + + @Override + protected void paintText( Graphics g, JMenuItem menuItem, Rectangle textRect, String text ) { + FlatMenuItemUI.paintText( g, menuItem, textRect, text, disabledForeground, selectionForeground ); + } } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java index 07605de0..166efa36 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java @@ -28,6 +28,8 @@ import java.awt.Insets; import java.awt.LayoutManager; import java.awt.Rectangle; import java.awt.Shape; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.MouseListener; @@ -35,12 +37,16 @@ import java.awt.geom.Rectangle2D; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.ref.WeakReference; +import javax.swing.AbstractAction; import javax.swing.BorderFactory; +import javax.swing.DefaultListCellRenderer; +import javax.swing.InputMap; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JList; import javax.swing.JPanel; +import javax.swing.KeyStroke; import javax.swing.ListCellRenderer; import javax.swing.LookAndFeel; import javax.swing.SwingConstants; @@ -53,6 +59,7 @@ import javax.swing.plaf.basic.BasicComboPopup; import javax.swing.plaf.basic.ComboPopup; import javax.swing.text.JTextComponent; import com.formdev.flatlaf.FlatClientProperties; +import com.formdev.flatlaf.util.SystemInfo; import com.formdev.flatlaf.util.UIScale; /** @@ -270,6 +277,18 @@ public class FlatComboBoxUI editor.applyComponentOrientation( comboBox.getComponentOrientation() ); updateEditorColors(); + + // macOS + if( SystemInfo.IS_MAC && editor instanceof JTextComponent ) { + // delegate actions from editor text field to combobox, which is necessary + // because text field on macOS (based on Aqua LaF UI defaults) + // already handle those keys + InputMap inputMap = ((JTextComponent)editor).getInputMap(); + new EditorDelegateAction( inputMap, KeyStroke.getKeyStroke( "UP" ) ); + new EditorDelegateAction( inputMap, KeyStroke.getKeyStroke( "KP_UP" ) ); + new EditorDelegateAction( inputMap, KeyStroke.getKeyStroke( "DOWN" ) ); + new EditorDelegateAction( inputMap, KeyStroke.getKeyStroke( "KP_DOWN" ) ); + } } private void updateEditorColors() { @@ -348,6 +367,8 @@ public class FlatComboBoxUI public void paintCurrentValue( Graphics g, Rectangle bounds, boolean hasFocus ) { ListCellRenderer renderer = comboBox.getRenderer(); uninstallCellPaddingBorder( renderer ); + if( renderer == null ) + renderer = new DefaultListCellRenderer(); Component c = renderer.getListCellRendererComponent( listBox, comboBox.getSelectedItem(), -1, false, false ); c.setFont( comboBox.getFont() ); c.applyComponentOrientation( comboBox.getComponentOrientation() ); @@ -520,6 +541,8 @@ public class FlatComboBoxUI CellPaddingBorder.uninstall( renderer ); CellPaddingBorder.uninstall( lastRendererComponent ); + if( renderer == null ) + renderer = new DefaultListCellRenderer(); Component c = renderer.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus ); c.applyComponentOrientation( comboBox.getComponentOrientation() ); @@ -603,4 +626,31 @@ public class FlatComboBoxUI rendererBorder.paintBorder( c, g, x, y, width, height ); } } + + //---- class EditorDelegateAction ----------------------------------------- + + /** + * Delegates actions from editor text field to combobox. + */ + private class EditorDelegateAction + extends AbstractAction + { + private final KeyStroke keyStroke; + + EditorDelegateAction( InputMap inputMap, KeyStroke keyStroke ) { + this.keyStroke = keyStroke; + + // add to input map + inputMap.put( keyStroke, this ); + } + + @Override + public void actionPerformed( ActionEvent e ) { + ActionListener action = comboBox.getActionForKeyStroke( keyStroke ); + if( action != null ) { + action.actionPerformed( new ActionEvent( comboBox, e.getID(), + e.getActionCommand(), e.getWhen(), e.getModifiers() ) ); + } + } + } } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatEditorPaneUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatEditorPaneUI.java index 75dfde0f..0bfe034b 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatEditorPaneUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatEditorPaneUI.java @@ -98,6 +98,7 @@ public class FlatEditorPaneUI // and subtract 1px border line width. // Using "(scale( 1 ) * 2)" instead of "scale( 2 )" to deal with rounding // issues. E.g. at scale factor 1.5 the first returns 4, but the second 3. + int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth ); size.width = Math.max( size.width, scale( minimumWidth ) - (scale( 1 ) * 2) ); return size; } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatLabelUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatLabelUI.java index 66779db7..6ed86360 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatLabelUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatLabelUI.java @@ -20,12 +20,14 @@ import java.awt.Color; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Rectangle; +import java.beans.PropertyChangeEvent; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.basic.BasicHTML; import javax.swing.plaf.basic.BasicLabelUI; import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.util.UIScale; @@ -77,6 +79,51 @@ public class FlatLabelUI defaults_initialized = false; } + @Override + protected void installComponents( JLabel c ) { + super.installComponents( c ); + + // update HTML renderer if necessary + updateHTMLRenderer( c, c.getText(), false ); + } + + @Override + public void propertyChange( PropertyChangeEvent e ) { + String name = e.getPropertyName(); + if( name == "text" || name == "font" || name == "foreground" ) { + JLabel label = (JLabel) e.getSource(); + updateHTMLRenderer( label, label.getText(), true ); + } else + super.propertyChange( e ); + } + + /** + * Checks whether text contains HTML headings and adds a special CSS rule to + * re-calculate heading font sizes based on current component font size. + */ + static void updateHTMLRenderer( JComponent c, String text, boolean always ) { + if( BasicHTML.isHTMLString( text ) && + c.getClientProperty( "html.disable" ) != Boolean.TRUE && + text.contains( "" ); + + String style = ""; + if( headIndex < 0 ) + style = "" + style + ""; + + int insertIndex = headIndex >= 0 ? (headIndex + "".length()) : "".length(); + text = text.substring( 0, insertIndex ) + + style + + text.substring( insertIndex ); + } else if( !always ) + return; // not necessary to invoke BasicHTML.updateRenderer() + + BasicHTML.updateRenderer( c, text ); + } + @Override protected void paintEnabledText( JLabel l, Graphics g, String s, int textX, int textY ) { int mnemIndex = FlatLaf.isShowMnemonics() ? l.getDisplayedMnemonicIndex() : -1; diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatListCellBorder.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatListCellBorder.java index 823a448a..16d3a23d 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatListCellBorder.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatListCellBorder.java @@ -23,8 +23,9 @@ import javax.swing.SwingUtilities; import javax.swing.UIManager; /** - * Cell border for {@link javax.swing.DefaultListCellRenderer}. - * + * Cell border for {@link javax.swing.DefaultListCellRenderer} + * (used by {@link javax.swing.JList}). + *

* Uses separate cell margins from UI defaults to allow easy customizing. * * @author Karl Tauber @@ -32,23 +33,31 @@ import javax.swing.UIManager; public class FlatListCellBorder extends FlatLineBorder { + final boolean showCellFocusIndicator = UIManager.getBoolean( "List.showCellFocusIndicator" ); + protected FlatListCellBorder() { super( UIManager.getInsets( "List.cellMargins" ), UIManager.getColor( "List.cellFocusColor" ) ); } //---- class Default ------------------------------------------------------ + /** + * Border for unselected cell that uses margins, but does not paint focus indicator border. + */ public static class Default extends FlatListCellBorder { @Override public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) { - // do not paint border + // do not paint focus indicator border } } //---- class Focused ------------------------------------------------------ + /** + * Border for focused unselected cell that uses margins and paints focus indicator border. + */ public static class Focused extends FlatListCellBorder { @@ -56,12 +65,19 @@ public class FlatListCellBorder //---- class Selected ----------------------------------------------------- + /** + * Border for selected cell that uses margins and paints focus indicator border + * if enabled (List.showCellFocusIndicator=true) and exactly one item is selected. + */ public static class Selected extends FlatListCellBorder { @Override public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) { - // paint border only if exactly one item is selected + if( !showCellFocusIndicator ) + return; + + // paint focus indicator border only if exactly one item is selected JList list = (JList) SwingUtilities.getAncestorOfClass( JList.class, c ); if( list != null && list.getMinSelectionIndex() == list.getMaxSelectionIndex() ) return; diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatListUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatListUI.java index c5efd11f..329eca2b 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatListUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatListUI.java @@ -56,6 +56,7 @@ import javax.swing.plaf.basic.BasicListUI; * * @uiDefault List.cellMargins Insets * @uiDefault List.cellFocusColor Color + * @uiDefault List.showCellFocusIndicator boolean * * @author Karl Tauber */ diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuItemUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuItemUI.java index 205c75ca..28c76999 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuItemUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuItemUI.java @@ -17,10 +17,18 @@ package com.formdev.flatlaf.ui; import static com.formdev.flatlaf.util.UIScale.scale; +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Rectangle; import java.beans.PropertyChangeListener; +import javax.swing.ButtonModel; import javax.swing.JComponent; +import javax.swing.JMenu; +import javax.swing.JMenuItem; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicMenuItemUI; +import com.formdev.flatlaf.FlatLaf; /** * Provides the Flat LaF UI delegate for {@link javax.swing.JMenuItem}. @@ -74,4 +82,26 @@ public class FlatMenuItemUI defaultTextIconGap = scale( defaultTextIconGap ); }; } + + @Override + protected void paintText( Graphics g, JMenuItem menuItem, Rectangle textRect, String text ) { + paintText( g, menuItem, textRect, text, disabledForeground, selectionForeground ); + } + + public static void paintText( Graphics g, JMenuItem menuItem, Rectangle textRect, + String text, Color disabledForeground, Color selectionForeground ) + { + FontMetrics fm = menuItem.getFontMetrics( menuItem.getFont() ); + int mnemonicIndex = FlatLaf.isShowMnemonics() ? menuItem.getDisplayedMnemonicIndex() : -1; + + ButtonModel model = menuItem.getModel(); + g.setColor( !model.isEnabled() + ? disabledForeground + : (model.isArmed() || (menuItem instanceof JMenu && model.isSelected()) + ? selectionForeground + : menuItem.getForeground()) ); + + FlatUIUtils.drawStringUnderlineCharAt( menuItem, g, text, mnemonicIndex, + textRect.x, textRect.y + fm.getAscent() ); + } } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuUI.java index a1ab13e2..3706b564 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuUI.java @@ -17,8 +17,11 @@ package com.formdev.flatlaf.ui; import static com.formdev.flatlaf.util.UIScale.scale; +import java.awt.Graphics; +import java.awt.Rectangle; import java.beans.PropertyChangeListener; import javax.swing.JComponent; +import javax.swing.JMenuItem; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicMenuUI; @@ -77,4 +80,9 @@ public class FlatMenuUI defaultTextIconGap = scale( defaultTextIconGap ); }; } + + @Override + protected void paintText( Graphics g, JMenuItem menuItem, Rectangle textRect, String text ) { + FlatMenuItemUI.paintText( g, menuItem, textRect, text, disabledForeground, selectionForeground ); + } } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPasswordFieldUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPasswordFieldUI.java index 0894bc46..40fe9586 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPasswordFieldUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPasswordFieldUI.java @@ -147,6 +147,7 @@ public class FlatPasswordFieldUI } private Dimension applyMinimumWidth( Dimension size, JComponent c ) { + int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth ); int focusWidth = (c.getBorder() instanceof FlatBorder) ? this.focusWidth : 0; size.width = Math.max( size.width, scale( minimumWidth + (focusWidth * 2) ) ); return size; diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatProgressBarUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatProgressBarUI.java index 6fc00936..45d2c0ef 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatProgressBarUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatProgressBarUI.java @@ -16,6 +16,7 @@ package com.formdev.flatlaf.ui; +import static com.formdev.flatlaf.FlatClientProperties.*; import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; @@ -23,6 +24,7 @@ import java.awt.Graphics2D; import java.awt.Insets; import java.awt.geom.Area; import java.awt.geom.RoundRectangle2D; +import java.beans.PropertyChangeListener; import javax.swing.JComponent; import javax.swing.JProgressBar; import javax.swing.LookAndFeel; @@ -60,6 +62,8 @@ public class FlatProgressBarUI protected Dimension horizontalSize; protected Dimension verticalSize; + private PropertyChangeListener propertyChangeListener; + public static ComponentUI createUI( JComponent c ) { return new FlatProgressBarUI(); } @@ -75,11 +79,35 @@ public class FlatProgressBarUI verticalSize = UIManager.getDimension( "ProgressBar.verticalSize" ); } + @Override + protected void installListeners() { + super.installListeners(); + + propertyChangeListener = e -> { + switch( e.getPropertyName() ) { + case PROGRESS_BAR_LARGE_HEIGHT: + case PROGRESS_BAR_SQUARE: + progressBar.revalidate(); + progressBar.repaint(); + break; + } + }; + progressBar.addPropertyChangeListener( propertyChangeListener ); + } + + @Override + protected void uninstallListeners() { + super.uninstallListeners(); + + progressBar.removePropertyChangeListener( propertyChangeListener ); + propertyChangeListener = null; + } + @Override public Dimension getPreferredSize( JComponent c ) { Dimension size = super.getPreferredSize( c ); - if( progressBar.isStringPainted() ) { + if( progressBar.isStringPainted() || clientPropertyBoolean( c, PROGRESS_BAR_LARGE_HEIGHT, false ) ) { // recalculate progress height/width to make it smaller Insets insets = progressBar.getInsets(); FontMetrics fm = progressBar.getFontMetrics( progressBar.getFont() ); @@ -122,7 +150,9 @@ public class FlatProgressBarUI return; boolean horizontal = (progressBar.getOrientation() == JProgressBar.HORIZONTAL); - int arc = Math.min( UIScale.scale( this.arc ), horizontal ? height : width ); + int arc = clientPropertyBoolean( c, PROGRESS_BAR_SQUARE, false ) + ? 0 + : Math.min( UIScale.scale( this.arc ), horizontal ? height : width ); FlatUIUtils.setRenderingHints( (Graphics2D) g ); diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatRadioButtonMenuItemUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatRadioButtonMenuItemUI.java index 114525d2..ef55d3ec 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatRadioButtonMenuItemUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatRadioButtonMenuItemUI.java @@ -17,8 +17,11 @@ package com.formdev.flatlaf.ui; import static com.formdev.flatlaf.util.UIScale.scale; +import java.awt.Graphics; +import java.awt.Rectangle; import java.beans.PropertyChangeListener; import javax.swing.JComponent; +import javax.swing.JMenuItem; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicRadioButtonMenuItemUI; @@ -74,4 +77,9 @@ public class FlatRadioButtonMenuItemUI defaultTextIconGap = scale( defaultTextIconGap ); }; } + + @Override + protected void paintText( Graphics g, JMenuItem menuItem, Rectangle textRect, String text ) { + FlatMenuItemUI.paintText( g, menuItem, textRect, text, disabledForeground, selectionForeground ); + } } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatRoundBorder.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatRoundBorder.java index 66960f75..0eced1f2 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatRoundBorder.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatRoundBorder.java @@ -17,6 +17,7 @@ package com.formdev.flatlaf.ui; import static com.formdev.flatlaf.util.UIScale.scale; +import java.awt.Component; import javax.swing.UIManager; /** @@ -32,7 +33,7 @@ public class FlatRoundBorder protected final int arc = UIManager.getInt( "Component.arc" ); @Override - protected float getArc() { + protected float getArc( Component c ) { return scale( (float) arc ); } } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatScrollPaneUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatScrollPaneUI.java index 84fc4583..1a118dbb 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatScrollPaneUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatScrollPaneUI.java @@ -14,22 +14,37 @@ * limitations under the License. */ +/* + * Smooth scrolling code partly based on code from IntelliJ IDEA Community Edition, + * which is licensed under the Apache 2.0 license. Copyright 2000-2016 JetBrains s.r.o. + * See: https://github.com/JetBrains/intellij-community/blob/31e1b5a8e43219b9571951bab6457cfb3012e3ef/platform/platform-api/src/com/intellij/ui/components/SmoothScrollPane.java#L141-L185 + * + */ package com.formdev.flatlaf.ui; import java.awt.Component; import java.awt.Graphics; import java.awt.Insets; +import java.awt.Rectangle; import java.awt.event.ContainerEvent; import java.awt.event.ContainerListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import javax.swing.BorderFactory; +import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JScrollBar; import javax.swing.JScrollPane; +import javax.swing.JTable; import javax.swing.JViewport; import javax.swing.LookAndFeel; +import javax.swing.ScrollPaneConstants; +import javax.swing.Scrollable; +import javax.swing.SwingConstants; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicScrollPaneUI; @@ -46,6 +61,10 @@ import com.formdev.flatlaf.FlatClientProperties; * @uiDefault ScrollPane.border Border * @uiDefault ScrollPane.viewportBorder Border * + * + * + * @uiDefault ScrollPane.smoothScrolling boolean + * * @author Karl Tauber */ public class FlatScrollPaneUI @@ -90,6 +109,130 @@ public class FlatScrollPaneUI handler = null; } + @Override + protected MouseWheelListener createMouseWheelListener() { + return new BasicScrollPaneUI.MouseWheelHandler() { + @Override + public void mouseWheelMoved( MouseWheelEvent e ) { + // Note: Getting UI value "ScrollPane.smoothScrolling" here to allow + // applications to turn smooth scrolling on or off at any time + // (e.g. in application options dialog). + if( UIManager.getBoolean( "ScrollPane.smoothScrolling" ) && + scrollpane.isWheelScrollingEnabled() && + e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL && + e.getPreciseWheelRotation() != 0 && + e.getPreciseWheelRotation() != e.getWheelRotation() ) + { + mouseWheelMovedSmooth( e ); + } else + super.mouseWheelMoved( e ); + } + }; + } + + private static final double EPSILON = 1e-5d; + + private void mouseWheelMovedSmooth( MouseWheelEvent e ) { + // return if there is no viewport + JViewport viewport = scrollpane.getViewport(); + if( viewport == null ) + return; + + // find scrollbar to scroll + JScrollBar scrollbar = scrollpane.getVerticalScrollBar(); + if( scrollbar == null || !scrollbar.isVisible() || e.isShiftDown() ) { + scrollbar = scrollpane.getHorizontalScrollBar(); + if( scrollbar == null || !scrollbar.isVisible() ) + return; + } + + // consume event + e.consume(); + + // get precise wheel rotation + double rotation = e.getPreciseWheelRotation(); + + // get unit and block increment + int unitIncrement; + int blockIncrement; + int orientation = scrollbar.getOrientation(); + Component view = viewport.getView(); + if( view instanceof Scrollable ) { + Scrollable scrollable = (Scrollable) view; + + // Use (0, 0) view position to obtain constant unit increment of first item + // (which might otherwise be variable on smaller-than-unit scrolling). + Rectangle visibleRect = new Rectangle( viewport.getViewSize() ); + unitIncrement = scrollable.getScrollableUnitIncrement( visibleRect, orientation, 1 ); + blockIncrement = scrollable.getScrollableBlockIncrement( visibleRect, orientation, 1 ); + + if( unitIncrement > 0 ) { + // For the case that the first item (e.g. in a list) is larger + // than the other items, get the unit increment of the second item + // and use the smaller one. + if( orientation == SwingConstants.VERTICAL ) { + visibleRect.y += unitIncrement; + visibleRect.height -= unitIncrement; + } else { + visibleRect.x += unitIncrement; + visibleRect.width -= unitIncrement; + } + int unitIncrement2 = scrollable.getScrollableUnitIncrement( visibleRect, orientation, 1 ); + if( unitIncrement2 > 0 ) + unitIncrement = Math.min( unitIncrement, unitIncrement2 ); + } + } else { + int direction = rotation < 0 ? -1 : 1; + unitIncrement = scrollbar.getUnitIncrement( direction ); + blockIncrement = scrollbar.getBlockIncrement( direction ); + } + + // limit scroll amount (number of units to scroll) for small viewports + // (e.g. vertical scrolling in file chooser) + int scrollAmount = e.getScrollAmount(); + int viewportWH = (orientation == SwingConstants.VERTICAL) + ? viewport.getHeight() + : viewport.getWidth(); + if( unitIncrement * scrollAmount > viewportWH ) + scrollAmount = Math.max( viewportWH / unitIncrement, 1 ); + + // compute relative delta + double delta = rotation * scrollAmount * unitIncrement; + boolean adjustDelta = Math.abs( rotation ) < (1.0 + EPSILON); + double adjustedDelta = adjustDelta + ? Math.max( -blockIncrement, Math.min( delta, blockIncrement ) ) + : delta; + + // compute new value + int value = scrollbar.getValue(); + double minDelta = scrollbar.getMinimum() - value; + double maxDelta = scrollbar.getMaximum() - scrollbar.getModel().getExtent() - value; + double boundedDelta = Math.max( minDelta, Math.min( adjustedDelta, maxDelta ) ); + int newValue = value + (int) Math.round( boundedDelta ); + + // set new value + if( newValue != value ) + scrollbar.setValue( newValue ); + +/*debug + System.out.println( String.format( "%4d %9f / %4d %4d / %12f %5s %12f / %4d %4d %4d / %12f %12f %12f / %4d", + e.getWheelRotation(), + e.getPreciseWheelRotation(), + unitIncrement, + blockIncrement, + delta, + adjustDelta, + adjustedDelta, + value, + scrollbar.getMinimum(), + scrollbar.getMaximum(), + minDelta, + maxDelta, + boundedDelta, + newValue ) ); +*/ + } + @Override protected PropertyChangeListener createPropertyChangeListener() { return new BasicScrollPaneUI.PropertyChangeHandler() { @@ -97,17 +240,35 @@ public class FlatScrollPaneUI public void propertyChange( PropertyChangeEvent e ) { super.propertyChange( e ); - if( FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS.equals( e.getPropertyName() ) ) { - JScrollBar vsb = scrollpane.getVerticalScrollBar(); - JScrollBar hsb = scrollpane.getHorizontalScrollBar(); - if( vsb != null ) { - vsb.revalidate(); - vsb.repaint(); - } - if( hsb != null ) { - hsb.revalidate(); - hsb.repaint(); - } + switch( e.getPropertyName() ) { + case FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS: + JScrollBar vsb = scrollpane.getVerticalScrollBar(); + JScrollBar hsb = scrollpane.getHorizontalScrollBar(); + if( vsb != null ) { + vsb.revalidate(); + vsb.repaint(); + } + if( hsb != null ) { + hsb.revalidate(); + hsb.repaint(); + } + break; + + case ScrollPaneConstants.LOWER_LEFT_CORNER: + case ScrollPaneConstants.LOWER_RIGHT_CORNER: + case ScrollPaneConstants.UPPER_LEFT_CORNER: + case ScrollPaneConstants.UPPER_RIGHT_CORNER: + // remove border from buttons added to corners + Object corner = e.getNewValue(); + if( corner instanceof JButton && + ((JButton)corner).getBorder() instanceof FlatButtonBorder && + scrollpane.getViewport() != null && + scrollpane.getViewport().getView() instanceof JTable ) + { + ((JButton)corner).setBorder( BorderFactory.createEmptyBorder() ); + ((JButton)corner).setFocusable( false ); + } + break; } } }; diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSpinnerUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSpinnerUI.java index f64ce2b3..8c0e20ee 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSpinnerUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatSpinnerUI.java @@ -326,6 +326,7 @@ public class FlatSpinnerUI Dimension editorSize = (editor != null) ? editor.getPreferredSize() : new Dimension( 0, 0 ); // the arrows width is the same as the inner height so that the arrows area is square + int minimumWidth = FlatUIUtils.minimumWidth( spinner, FlatSpinnerUI.this.minimumWidth ); int innerHeight = editorSize.height + padding.top + padding.bottom; return new Dimension( Math.max( insets.left + insets.right + editorSize.width + padding.left + padding.right + innerHeight, scale( minimumWidth + (focusWidth * 2) ) ), diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java index 06d278d5..7d6415fb 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java @@ -169,6 +169,7 @@ public class FlatTabbedPaneUI switch( e.getPropertyName() ) { case TABBED_PANE_SHOW_TAB_SEPARATORS: case TABBED_PANE_HAS_FULL_BORDER: + case TABBED_PANE_TAB_HEIGHT: tabPane.revalidate(); tabPane.repaint(); break; @@ -181,7 +182,7 @@ public class FlatTabbedPaneUI protected JButton createScrollButton( int direction ) { // this method is invoked before installDefaults(), so we can not use color fields here return new FlatArrowButton( direction, UIManager.getString( "Component.arrowType" ), - UIManager.getColor( "TabbedPane.shadow" ), + UIManager.getColor( "TabbedPane.foreground" ), UIManager.getColor( "TabbedPane.disabledForeground" ), null, UIManager.getColor( "TabbedPane.hoverColor" ) ); } @@ -215,6 +216,7 @@ public class FlatTabbedPaneUI @Override protected int calculateTabHeight( int tabPlacement, int tabIndex, int fontHeight ) { + int tabHeight = clientPropertyInt( tabPane, TABBED_PANE_TAB_HEIGHT, this.tabHeight ); return Math.max( tabHeight, super.calculateTabHeight( tabPlacement, tabIndex, fontHeight ) - 2 /* was added by superclass */ ); } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTableCellBorder.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTableCellBorder.java new file mode 100644 index 00000000..05669edf --- /dev/null +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTableCellBorder.java @@ -0,0 +1,115 @@ +/* + * Copyright 2019 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.formdev.flatlaf.ui; + +import java.awt.Component; +import java.awt.Graphics; +import javax.swing.JTable; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +/** + * Cell border for {@link javax.swing.table.DefaultTableCellRenderer} + * (used by {@link javax.swing.JTable}). + *

+ * Uses separate cell margins from UI defaults to allow easy customizing. + * + * @author Karl Tauber + */ +public class FlatTableCellBorder + extends FlatLineBorder +{ + final boolean showCellFocusIndicator = UIManager.getBoolean( "Table.showCellFocusIndicator" ); + + protected FlatTableCellBorder() { + super( UIManager.getInsets( "Table.cellMargins" ), UIManager.getColor( "Table.cellFocusColor" ) ); + } + + //---- class Default ------------------------------------------------------ + + /** + * Border for unselected cell that uses margins, but does not paint focus indicator border. + */ + public static class Default + extends FlatTableCellBorder + { + @Override + public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) { + // do not paint focus indicator border + } + } + + //---- class Focused ------------------------------------------------------ + + /** + * Border for focused unselected cell that uses margins and paints focus indicator border. + */ + public static class Focused + extends FlatTableCellBorder + { + } + + //---- class Selected ----------------------------------------------------- + + /** + * Border for selected cell that uses margins and paints focus indicator border + * if enabled (Table.showCellFocusIndicator=true) or at least one selected cell is editable. + */ + public static class Selected + extends FlatTableCellBorder + { + @Override + public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) { + if( !showCellFocusIndicator ) { + JTable table = (JTable) SwingUtilities.getAncestorOfClass( JTable.class, c ); + if( table != null && !isSelectionEditable( table ) ) + return; + } + + super.paintBorder( c, g, x, y, width, height ); + } + + /** + * Checks whether at least one selected cell is editable. + */ + private boolean isSelectionEditable( JTable table ) { + if( table.getRowSelectionAllowed() ) { + int columnCount = table.getColumnCount(); + int[] selectedRows = table.getSelectedRows(); + for( int selectedRow : selectedRows ) { + for( int column = 0; column < columnCount; column++ ) { + if( table.isCellEditable( selectedRow, column ) ) + return true; + } + } + } + + if( table.getColumnSelectionAllowed() ) { + int rowCount = table.getRowCount(); + int[] selectedColumns = table.getSelectedColumns(); + for( int selectedColumn : selectedColumns ) { + for( int row = 0; row < rowCount; row++ ) { + if( table.isCellEditable( row, selectedColumn ) ) + return true; + } + } + } + + return false; + } + } +} diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTableHeaderUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTableHeaderUI.java index 71d4d31f..42ad87e3 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTableHeaderUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTableHeaderUI.java @@ -17,6 +17,7 @@ package com.formdev.flatlaf.ui; import java.awt.Color; +import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Graphics; @@ -29,6 +30,7 @@ import javax.swing.JTable; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicTableHeaderUI; +import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; import com.formdev.flatlaf.util.UIScale; @@ -81,10 +83,14 @@ public class FlatTableHeaderUI @Override public void paint( Graphics g, JComponent c ) { // do not paint borders if JTableHeader.setDefaultRenderer() was used - String rendererClassName = header.getDefaultRenderer().getClass().getName(); - boolean paintBorders = - rendererClassName.equals( "sun.swing.table.DefaultTableCellHeaderRenderer" ) || - rendererClassName.equals( "sun.swing.FilePane$AlignableTableHeaderRenderer" ); + TableCellRenderer defaultRenderer = header.getDefaultRenderer(); + boolean paintBorders = isSystemDefaultRenderer( defaultRenderer ); + if( !paintBorders && header.getColumnModel().getColumnCount() > 0 ) { + // check whether the renderer delegates to the system default renderer + Component rendererComponent = defaultRenderer.getTableCellRendererComponent( + header.getTable(), "", false, false, -1, 0 ); + paintBorders = isSystemDefaultRenderer( rendererComponent ); + } if( paintBorders ) paintColumnBorders( g, c ); @@ -95,6 +101,12 @@ public class FlatTableHeaderUI paintDraggedColumnBorders( g, c ); } + private boolean isSystemDefaultRenderer( Object headerRenderer ) { + String rendererClassName = headerRenderer.getClass().getName(); + return rendererClassName.equals( "sun.swing.table.DefaultTableCellHeaderRenderer" ) || + rendererClassName.equals( "sun.swing.FilePane$AlignableTableHeaderRenderer" ); + } + private void paintColumnBorders( Graphics g, JComponent c ) { int width = c.getWidth(); int height = c.getHeight(); diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTableUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTableUI.java index 27d9553a..bee64c09 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTableUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTableUI.java @@ -55,18 +55,26 @@ import com.formdev.flatlaf.util.UIScale; * * * - * @uiDefault Table.rowHeight int - * @uiDefault Table.showGrid boolean - * @uiDefault Table.intercellSpacing Dimension - * @uiDefault Table.selectionInactiveBackground Color - * @uiDefault Table.selectionInactiveForeground Color + * @uiDefault Table.rowHeight int + * @uiDefault Table.showHorizontalLines boolean + * @uiDefault Table.showVerticalLines boolean + * @uiDefault Table.intercellSpacing Dimension + * @uiDefault Table.selectionInactiveBackground Color + * @uiDefault Table.selectionInactiveForeground Color + * + * + * + * @uiDefault Table.cellMargins Insets + * @uiDefault Table.cellFocusColor Color + * @uiDefault Table.showCellFocusIndicator boolean * * @author Karl Tauber */ public class FlatTableUI extends BasicTableUI { - protected boolean showGrid; + protected boolean showHorizontalLines; + protected boolean showVerticalLines; protected Dimension intercellSpacing; protected Color selectionBackground; @@ -96,7 +104,8 @@ public class FlatTableUI protected void installDefaults() { super.installDefaults(); - showGrid = UIManager.getBoolean( "Table.showGrid" ); + showHorizontalLines = UIManager.getBoolean( "Table.showHorizontalLines" ); + showVerticalLines = UIManager.getBoolean( "Table.showVerticalLines" ); intercellSpacing = UIManager.getDimension( "Table.intercellSpacing" ); selectionBackground = UIManager.getColor( "Table.selectionBackground" ); @@ -110,10 +119,13 @@ public class FlatTableUI if( rowHeight > 0 ) LookAndFeel.installProperty( table, "rowHeight", UIScale.scale( rowHeight ) ); - if( !showGrid ) { + if( !showHorizontalLines ) { oldShowHorizontalLines = table.getShowHorizontalLines(); + table.setShowHorizontalLines( false ); + } + if( !showVerticalLines ) { oldShowVerticalLines = table.getShowVerticalLines(); - table.setShowGrid( false ); + table.setShowVerticalLines( false ); } if( intercellSpacing != null ) { @@ -131,19 +143,15 @@ public class FlatTableUI selectionInactiveBackground = null; selectionInactiveForeground = null; - // restore old show grid - if( !showGrid ) { - if( !table.getShowHorizontalLines() ) - table.setShowHorizontalLines( oldShowHorizontalLines ); - if( !table.getShowVerticalLines() ) - table.setShowVerticalLines( oldShowVerticalLines ); - } + // restore old show horizontal/vertical lines (if not modified) + if( !showHorizontalLines && oldShowHorizontalLines && !table.getShowHorizontalLines() ) + table.setShowHorizontalLines( true ); + if( !showVerticalLines && oldShowVerticalLines && !table.getShowVerticalLines() ) + table.setShowVerticalLines( true ); - // restore old intercell spacing - if( intercellSpacing != null ) { - if( table.getIntercellSpacing().equals( intercellSpacing ) ) - table.setIntercellSpacing( oldIntercellSpacing ); - } + // restore old intercell spacing (if not modified) + if( intercellSpacing != null && table.getIntercellSpacing().equals( intercellSpacing ) ) + table.setIntercellSpacing( oldIntercellSpacing ); } @Override diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextAreaUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextAreaUI.java index a7d2ffb7..4cc5c109 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextAreaUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextAreaUI.java @@ -117,6 +117,7 @@ public class FlatTextAreaUI // and subtract 1px border line width. // Using "(scale( 1 ) * 2)" instead of "scale( 2 )" to deal with rounding // issues. E.g. at scale factor 1.5 the first returns 4, but the second 3. + int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth ); size.width = Math.max( size.width, scale( minimumWidth ) - (scale( 1 ) * 2) ); return size; } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextFieldUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextFieldUI.java index d74dabf1..47f97005 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextFieldUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextFieldUI.java @@ -217,6 +217,7 @@ public class FlatTextFieldUI (parent != null && parent.getParent() instanceof JSpinner) ) return size; + int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth ); int focusWidth = (c.getBorder() instanceof FlatBorder) ? this.focusWidth : 0; size.width = Math.max( size.width, scale( minimumWidth + (focusWidth * 2) ) ); return size; diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextPaneUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextPaneUI.java index dc3a196c..b6c70926 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextPaneUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextPaneUI.java @@ -98,6 +98,7 @@ public class FlatTextPaneUI // and subtract 1px border line width. // Using "(scale( 1 ) * 2)" instead of "scale( 2 )" to deal with rounding // issues. E.g. at scale factor 1.5 the first returns 4, but the second 3. + int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth ); size.width = Math.max( size.width, scale( minimumWidth ) - (scale( 1 ) * 2) ); return size; } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToggleButtonUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToggleButtonUI.java index e35a390b..c664a7dd 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToggleButtonUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToggleButtonUI.java @@ -16,12 +16,18 @@ package com.formdev.flatlaf.ui; +import static com.formdev.flatlaf.FlatClientProperties.*; import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.beans.PropertyChangeEvent; import javax.swing.AbstractButton; import javax.swing.ButtonModel; import javax.swing.JComponent; +import javax.swing.JToggleButton; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; +import com.formdev.flatlaf.util.UIScale; /** * Provides the Flat LaF UI delegate for {@link javax.swing.JToggleButton}. @@ -55,6 +61,13 @@ import javax.swing.plaf.ComponentUI; * @uiDefault ToggleButton.disabledSelectedBackground Color * @uiDefault ToggleButton.toolbar.selectedBackground Color * + * @uiDefault ToggleButton.tab.underlineHeight int + * @uiDefault ToggleButton.tab.underlineColor Color + * @uiDefault ToggleButton.tab.disabledUnderlineColor Color + * @uiDefault ToggleButton.tab.selectedBackground Color optional + * @uiDefault ToggleButton.tab.hoverBackground Color + * @uiDefault ToggleButton.tab.focusBackground Color + * * * @author Karl Tauber */ @@ -67,6 +80,13 @@ public class FlatToggleButtonUI protected Color toolbarSelectedBackground; + protected int tabUnderlineHeight; + protected Color tabUnderlineColor; + protected Color tabDisabledUnderlineColor; + protected Color tabSelectedBackground; + protected Color tabHoverBackground; + protected Color tabFocusBackground; + private boolean defaults_initialized = false; private static ComponentUI instance; @@ -93,6 +113,13 @@ public class FlatToggleButtonUI toolbarSelectedBackground = UIManager.getColor( "ToggleButton.toolbar.selectedBackground" ); + tabUnderlineHeight = UIManager.getInt( "ToggleButton.tab.underlineHeight" ); + tabUnderlineColor = UIManager.getColor( "ToggleButton.tab.underlineColor" ); + tabDisabledUnderlineColor = UIManager.getColor( "ToggleButton.tab.disabledUnderlineColor" ); + tabSelectedBackground = UIManager.getColor( "ToggleButton.tab.selectedBackground" ); + tabHoverBackground = UIManager.getColor( "ToggleButton.tab.hoverBackground" ); + tabFocusBackground = UIManager.getColor( "ToggleButton.tab.focusBackground" ); + defaults_initialized = true; } } @@ -103,6 +130,61 @@ public class FlatToggleButtonUI defaults_initialized = false; } + @Override + protected void propertyChange( AbstractButton b, PropertyChangeEvent e ) { + super.propertyChange( b, e ); + + switch( e.getPropertyName() ) { + case BUTTON_TYPE: + if( BUTTON_TYPE_TAB.equals( e.getOldValue() ) || BUTTON_TYPE_TAB.equals( e.getNewValue() ) ) { + MigLayoutVisualPadding.uninstall( b ); + MigLayoutVisualPadding.install( b, getFocusWidth( b ) ); + b.revalidate(); + } + + b.repaint(); + break; + + case TAB_BUTTON_UNDERLINE_HEIGHT: + case TAB_BUTTON_UNDERLINE_COLOR: + case TAB_BUTTON_SELECTED_BACKGROUND: + b.repaint(); + break; + } + } + + static boolean isTabButton( Component c ) { + return c instanceof JToggleButton && clientPropertyEquals( (JToggleButton) c, BUTTON_TYPE, BUTTON_TYPE_TAB ); + } + + @Override + protected void paintBackground( Graphics g, JComponent c ) { + if( isTabButton( c ) ) { + int height = c.getHeight(); + int width = c.getWidth(); + boolean selected = ((AbstractButton)c).isSelected(); + + // paint background + Color background = buttonStateColor( c, + selected ? clientPropertyColor( c, TAB_BUTTON_SELECTED_BACKGROUND, tabSelectedBackground ) : null, + null, tabFocusBackground, tabHoverBackground, null ); + if( background != null ) { + g.setColor( background ); + g.fillRect( 0, 0, width, height ); + } + + // paint underline if selected + if( selected ) { + int underlineHeight = UIScale.scale( clientPropertyInt( c, TAB_BUTTON_UNDERLINE_HEIGHT, tabUnderlineHeight ) ); + g.setColor( c.isEnabled() + ? clientPropertyColor( c, TAB_BUTTON_UNDERLINE_COLOR, tabUnderlineColor ) + : tabDisabledUnderlineColor ); + g.fillRect( 0, height - underlineHeight, width, underlineHeight ); + } + } else + super.paintBackground( g, c ); + } + @Override protected Color getBackground( JComponent c ) { ButtonModel model = ((AbstractButton)c).getModel(); @@ -130,4 +212,9 @@ public class FlatToggleButtonUI return super.getForeground( c ); } + + @Override + protected int getFocusWidth( JComponent c ) { + return isTabButton( c ) ? 0 : super.getFocusWidth( c ); + } } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToolTipUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToolTipUI.java index ad3b501e..ee42b6e8 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToolTipUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToolTipUI.java @@ -21,6 +21,7 @@ import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; +import java.beans.PropertyChangeListener; import java.util.List; import javax.swing.JComponent; import javax.swing.JToolTip; @@ -47,6 +48,8 @@ import com.formdev.flatlaf.util.StringUtils; public class FlatToolTipUI extends BasicToolTipUI { + private static PropertyChangeListener sharedPropertyChangedListener; + private static ComponentUI instance; public static ComponentUI createUI( JComponent c ) { @@ -55,6 +58,38 @@ public class FlatToolTipUI return instance; } + @Override + public void installUI( JComponent c ) { + super.installUI( c ); + + // update HTML renderer if necessary + FlatLabelUI.updateHTMLRenderer( c, ((JToolTip)c).getTipText(), false ); + } + + @Override + protected void installListeners( JComponent c ) { + super.installListeners( c ); + + if( sharedPropertyChangedListener == null ) { + sharedPropertyChangedListener = e -> { + String name = e.getPropertyName(); + if( name == "text" || name == "font" || name == "foreground" ) { + JToolTip toolTip = (JToolTip) e.getSource(); + FlatLabelUI.updateHTMLRenderer( toolTip, toolTip.getTipText(), false ); + } + }; + } + + c.addPropertyChangeListener( sharedPropertyChangedListener ); + } + + @Override + protected void uninstallListeners( JComponent c ) { + super.uninstallListeners( c ); + + c.removePropertyChangeListener( sharedPropertyChangedListener ); + } + @Override public Dimension getPreferredSize( JComponent c ) { if( isMultiLine( c ) ) { diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTreeUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTreeUI.java index 57e719a3..141dd2a7 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTreeUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTreeUI.java @@ -83,6 +83,7 @@ import com.formdev.flatlaf.util.UIScale; * @uiDefault Tree.selectionInactiveBackground Color * @uiDefault Tree.selectionInactiveForeground Color * @uiDefault Tree.wideSelection boolean + * @uiDefault Tree.showCellFocusIndicator boolean * * @author Karl Tauber */ @@ -95,6 +96,7 @@ public class FlatTreeUI protected Color selectionInactiveForeground; protected Color selectionBorderColor; protected boolean wideSelection; + protected boolean showCellFocusIndicator; public static ComponentUI createUI( JComponent c ) { return new FlatTreeUI(); @@ -112,6 +114,7 @@ public class FlatTreeUI selectionInactiveForeground = UIManager.getColor( "Tree.selectionInactiveForeground" ); selectionBorderColor = UIManager.getColor( "Tree.selectionBorderColor" ); wideSelection = UIManager.getBoolean( "Tree.wideSelection" ); + showCellFocusIndicator = UIManager.getBoolean( "Tree.showCellFocusIndicator" ); // scale int rowHeight = FlatUIUtils.getUIInt( "Tree.rowHeight", 16 ); @@ -217,9 +220,7 @@ public class FlatTreeUI protected void paintRow( Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf ) { - if( editingComponent != null && editingRow == row ) - return; - + boolean isEditing = (editingComponent != null && editingRow == row); boolean hasFocus = tree.hasFocus(); boolean cellHasFocus = hasFocus && (row == getLeadSelectionRow()); boolean isSelected = tree.isRowSelected( row ); @@ -231,7 +232,7 @@ public class FlatTreeUI g.setColor( isDropRow ? UIManager.getColor( "Tree.dropCellBackground" ) : (hasFocus ? selectionBackground : selectionInactiveBackground) ); - g.fillRect( 0, bounds.y, clipBounds.width, bounds.height ); + g.fillRect( 0, bounds.y, tree.getWidth(), bounds.height ); // paint expand/collapse icon if( shouldPaintExpandControl( path, row, isExpanded, hasBeenExpanded, isLeaf ) ) { @@ -240,6 +241,9 @@ public class FlatTreeUI } } + if( isEditing ) + return; + // get renderer component Component rendererComponent = currentCellRenderer.getTreeCellRendererComponent( tree, path.getLastPathComponent(), isSelected, isExpanded, isLeaf, row, cellHasFocus ); @@ -262,10 +266,10 @@ public class FlatTreeUI rendererComponent.setForeground( selectionInactiveForeground ); } - // remove selection border if exactly one item is selected + // remove focus selection border if exactly one item is selected Color oldBorderSelectionColor = null; if( isSelected && hasFocus && - tree.getMinSelectionRow() == tree.getMaxSelectionRow() && + (!showCellFocusIndicator || tree.getMinSelectionRow() == tree.getMaxSelectionRow()) && rendererComponent instanceof DefaultTreeCellRenderer ) { DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) rendererComponent; diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java index 386cac0a..e8e1dec1 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java @@ -38,6 +38,7 @@ import javax.swing.JComponent; import javax.swing.LookAndFeel; import javax.swing.UIManager; import javax.swing.plaf.ColorUIResource; +import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.util.DerivedColor; import com.formdev.flatlaf.util.HiDPIUtils; import com.formdev.flatlaf.util.JavaCompatibility; @@ -102,10 +103,23 @@ public class FlatUIUtils return (value instanceof Integer) ? (Integer) value : defaultValue; } + public static float getUIFloat( String key, float defaultValue ) { + Object value = UIManager.get( key ); + return (value instanceof Number) ? ((Number)value).floatValue() : defaultValue; + } + public static Color nonUIResource( Color c ) { return (c instanceof ColorUIResource) ? new Color( c.getRGB(), true ) : c; } + public static int minimumWidth( JComponent c, int minimumWidth ) { + return FlatClientProperties.clientPropertyInt( c, FlatClientProperties.MINIMUM_WIDTH, minimumWidth ); + } + + public static int minimumHeight( JComponent c, int minimumHeight ) { + return FlatClientProperties.clientPropertyInt( c, FlatClientProperties.MINIMUM_HEIGHT, minimumHeight ); + } + public static boolean isTableCellEditor( Component c ) { return c instanceof JComponent && Boolean.TRUE.equals( ((JComponent)c).getClientProperty( "JComboBox.isTableCellEditor" ) ); } diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarculaLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarculaLaf.properties index b01fd35a..b7dcf057 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarculaLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarculaLaf.properties @@ -30,6 +30,12 @@ Component.innerFocusWidth=0 Component.arrowType=triangle +#---- ProgressBar ---- + +ProgressBar.foreground=#a0a0a0 +ProgressBar.selectionForeground=@background + + #---- RadioButton ---- RadioButton.icon.centerDiameter=5 diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties index c66fb7f6..e3245f58 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties @@ -64,10 +64,9 @@ activeCaption=#434E60 inactiveCaption=#393C3D -controlHighlight=#616669 -controlLtHighlight=#303234 -controlShadow=#afb3b5 -controlDkShadow=#d7d9da +controlHighlight=darken($controlShadow,20%) +controlLtHighlight=darken($controlShadow,25%) +controlDkShadow=lighten($controlShadow,10%) #---- Button ---- @@ -155,14 +154,14 @@ MenuItemCheckBox.icon.disabledCheckmarkColor=#606060 #---- PopupMenu ---- -PopupMenu.borderColor=#515151 +PopupMenu.borderColor=#5e5e5e #---- ProgressBar ---- ProgressBar.background=#555555 -ProgressBar.foreground=#a0a0a0 -ProgressBar.selectionForeground=@background +ProgressBar.foreground=#4A88C7 +ProgressBar.selectionForeground=@foreground ProgressBar.selectionBackground=@foreground diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties index c4f72247..e7505ba1 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -80,6 +80,7 @@ textHighlightText=@selectionForeground textInactiveText=@disabledText control=@background controlText=@foreground +controlShadow=$Component.borderColor scrollbar=$ScrollBar.track info=$ToolTip.background infoText=@foreground @@ -137,7 +138,7 @@ ComboBox.padding=2,6,2,6 #---- Component ---- Component.focusWidth=0 -Component.innerFocusWidth=0 +Component.innerFocusWidth={float}0.5 Component.arc=5 Component.minimumWidth=64 Component.arrowType=chevron @@ -196,6 +197,7 @@ HelpButton.disabledQuestionMarkColor=$CheckBox.icon.disabledCheckmarkColor #---- List ---- List.border=1,0,1,0 +List.border=0,0,0,0 List.cellMargins=1,6,1,6 List.cellFocusColor=@cellFocusColor List.cellNoFocusBorder=com.formdev.flatlaf.ui.FlatListCellBorder$Default @@ -213,6 +215,8 @@ List.dropLineColor=@dropLineColor Menu.border=com.formdev.flatlaf.ui.FlatMarginBorder Menu.arrowIcon=com.formdev.flatlaf.icons.FlatMenuArrowIcon Menu.margin=2,2,2,2 +Menu.submenuPopupOffsetX={scaledInteger}-4 +Menu.submenuPopupOffsetY={scaledInteger}-1 #---- MenuBar ---- @@ -311,6 +315,7 @@ ScrollBar.buttonDisabledArrowColor=$ComboBox.buttonDisabledArrowColor ScrollPane.border=com.formdev.flatlaf.ui.FlatBorder ScrollPane.background=$ScrollBar.track ScrollPane.fillUpperCorner=true +ScrollPane.smoothScrolling=true #---- Separator ---- @@ -363,20 +368,24 @@ TabbedPane.tabAreaInsets=0,0,0,0 TabbedPane.selectedTabPadInsets=0,0,0,0 TabbedPane.tabRunOverlay=0 TabbedPane.tabsOverlapBorder=true -TabbedPane.shadow=$ComboBox.buttonArrowColor +TabbedPane.shadow=@background #---- Table ---- Table.rowHeight=20 -Table.showGrid=false +Table.showHorizontalLines=false +Table.showVerticalLines=false Table.intercellSpacing={dimension}0,0 Table.scrollPaneBorder=com.formdev.flatlaf.ui.FlatBorder Table.ascendingSortIcon=com.formdev.flatlaf.icons.FlatAscendingSortIcon Table.descendingSortIcon=com.formdev.flatlaf.icons.FlatDescendingSortIcon Table.sortIconColor=@icon -Table.cellNoFocusBorder=2,3,2,3 -Table.focusSelectedCellHighlightBorder=2,3,2,3,@cellFocusColor +Table.cellMargins=2,3,2,3 +Table.cellFocusColor=@cellFocusColor +Table.cellNoFocusBorder=com.formdev.flatlaf.ui.FlatTableCellBorder$Default +Table.focusCellHighlightBorder=com.formdev.flatlaf.ui.FlatTableCellBorder$Focused +Table.focusSelectedCellHighlightBorder=com.formdev.flatlaf.ui.FlatTableCellBorder$Selected Table.selectionInactiveBackground=@selectionInactiveBackground Table.selectionInactiveForeground=@selectionInactiveForeground Table.dropCellBackground=@dropCellBackground @@ -432,6 +441,14 @@ ToggleButton.pressedBackground=$Button.pressedBackground ToggleButton.toolbar.hoverBackground=$Button.toolbar.hoverBackground ToggleButton.toolbar.pressedBackground=$Button.toolbar.pressedBackground +# button type "tab" +ToggleButton.tab.underlineHeight=2 +ToggleButton.tab.underlineColor=$TabbedPane.underlineColor +ToggleButton.tab.disabledUnderlineColor=$TabbedPane.disabledUnderlineColor +ToggleButton.tab.selectedBackground=$?TabbedPane.selectedBackground +ToggleButton.tab.hoverBackground=$TabbedPane.hoverColor +ToggleButton.tab.focusBackground=$TabbedPane.focusColor + #---- ToolBar ---- @@ -460,11 +477,12 @@ ToolTip.foregroundInactive=@disabledText Tree.border=1,1,1,1 Tree.selectionInactiveBackground=@selectionInactiveBackground Tree.selectionInactiveForeground=@selectionInactiveForeground -Tree.textBackground=null +Tree.textBackground=$Tree.background Tree.selectionBorderColor=@cellFocusColor Tree.dropCellBackground=@dropCellBackground Tree.dropCellForeground=@dropCellForeground Tree.dropLineColor=@dropLineColor +Tree.rendererFillBackground=false Tree.rendererMargins=1,2,1,2 Tree.wideSelection=true Tree.paintLines=false diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties index 9733a667..91bc1207 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties @@ -66,8 +66,7 @@ activeCaption=#99b4d1 inactiveCaption=#bfcddb controlHighlight=#e3e3e3 controlLtHighlight=#fff -controlShadow=#a0a0a0 -controlDkShadow=#696969 +controlDkShadow=darken($controlShadow,15%) #---- Button ---- diff --git a/flatlaf-demo/build.gradle.kts b/flatlaf-demo/build.gradle.kts index 20308a34..7eb88a8b 100644 --- a/flatlaf-demo/build.gradle.kts +++ b/flatlaf-demo/build.gradle.kts @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.java index 7ed32f2b..b7ca8714 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.java @@ -37,6 +37,8 @@ class BasicComponentsPanel JLabel buttonLabel = new JLabel(); JButton button1 = new JButton(); JButton button2 = new JButton(); + JButton button5 = new JButton(); + JButton button6 = new JButton(); JButton button3 = new JButton(); JButton button4 = new JButton(); JButton button13 = new JButton(); @@ -166,10 +168,21 @@ class BasicComponentsPanel button2.setEnabled(false); add(button2, "cell 2 1"); + //---- button5 ---- + button5.setText("square"); + button5.putClientProperty("JButton.buttonType", "square"); + add(button5, "cell 3 1"); + + //---- button6 ---- + button6.setText("square"); + button6.setEnabled(false); + button6.putClientProperty("JButton.buttonType", "square"); + add(button6, "cell 4 1"); + //---- button3 ---- button3.setText("Help"); button3.putClientProperty("JButton.buttonType", "help"); - add(button3, "cell 3 1"); + add(button3, "cell 4 1"); //---- button4 ---- button4.setText("Help"); diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd index c778d423..469a8884 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8" +JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -54,12 +54,27 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 2 1" } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button5" + "text": "square" + "$client.JButton.buttonType": "square" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 1" + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button6" + "text": "square" + "enabled": false + "$client.JButton.buttonType": "square" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 1" + } ) add( new FormComponent( "javax.swing.JButton" ) { name: "button3" "text": "Help" "$client.JButton.buttonType": "help" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 3 1" + "value": "cell 4 1" } ) add( new FormComponent( "javax.swing.JButton" ) { name: "button4" diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DataComponentsPanel.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DataComponentsPanel.java index c46a0622..48344b26 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DataComponentsPanel.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DataComponentsPanel.java @@ -21,6 +21,7 @@ import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.Transferable; import javax.swing.*; import javax.swing.table.*; +import javax.swing.tree.*; import net.miginfocom.swing.*; /** @@ -171,6 +172,32 @@ class DataComponentsPanel //---- tree1 ---- tree1.setShowsRootHandles(true); tree1.setEditable(true); + tree1.setModel(new DefaultTreeModel( + new DefaultMutableTreeNode("JTree") { + { + DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("colors"); + node1.add(new DefaultMutableTreeNode("blue")); + node1.add(new DefaultMutableTreeNode("violet")); + node1.add(new DefaultMutableTreeNode("red")); + node1.add(new DefaultMutableTreeNode("yellow")); + add(node1); + node1 = new DefaultMutableTreeNode("sports"); + node1.add(new DefaultMutableTreeNode("basketball")); + node1.add(new DefaultMutableTreeNode("soccer")); + node1.add(new DefaultMutableTreeNode("football")); + node1.add(new DefaultMutableTreeNode("hockey")); + add(node1); + node1 = new DefaultMutableTreeNode("food"); + node1.add(new DefaultMutableTreeNode("hot dogs")); + DefaultMutableTreeNode node2 = new DefaultMutableTreeNode("pizza"); + node2.add(new DefaultMutableTreeNode("pizza aglio e olio")); + node2.add(new DefaultMutableTreeNode("pizza margherita bianca")); + node1.add(node2); + node1.add(new DefaultMutableTreeNode("ravioli")); + node1.add(new DefaultMutableTreeNode("bananas")); + add(node1); + } + })); scrollPane3.setViewportView(tree1); } add(scrollPane3, "cell 1 1,growx"); diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DataComponentsPanel.jfd b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DataComponentsPanel.jfd index 42599f18..1c263544 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DataComponentsPanel.jfd +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DataComponentsPanel.jfd @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8" +JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -89,6 +89,60 @@ new FormModel { name: "tree1" "showsRootHandles": true "editable": true + "model": new javax.swing.tree.DefaultTreeModel( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "JTree" + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "colors" + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "blue" + } ) + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "violet" + } ) + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "red" + } ) + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "yellow" + } ) + } ) + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "sports" + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "basketball" + } ) + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "soccer" + } ) + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "football" + } ) + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "hockey" + } ) + } ) + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "food" + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "hot dogs" + } ) + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "pizza" + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "pizza aglio e olio" + } ) + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "pizza margherita bianca" + } ) + } ) + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "ravioli" + } ) + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "bananas" + } ) + } ) + } ) auxiliary() { "JavaCodeGenerator.variableLocal": false } diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java index 11fcd6af..9a7c5208 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java @@ -51,6 +51,12 @@ class DemoFrame DemoPrefs.getState().putInt( FlatLafDemo.KEY_TAB, tabbedPane.getSelectedIndex() ); } + private void menuItemActionPerformed(ActionEvent e) { + SwingUtilities.invokeLater( () -> { + JOptionPane.showMessageDialog( this, e.getActionCommand(), "Menu Item", JOptionPane.PLAIN_MESSAGE ); + } ); + } + private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents JMenuBar menuBar1 = new JMenuBar(); @@ -68,6 +74,14 @@ class DemoFrame JMenuItem deleteMenuItem = new JMenuItem(); JMenu viewMenu = new JMenu(); JCheckBoxMenuItem checkBoxMenuItem1 = new JCheckBoxMenuItem(); + JMenu menu1 = new JMenu(); + JMenu subViewsMenu = new JMenu(); + JMenu subSubViewsMenu = new JMenu(); + JMenuItem errorLogViewMenuItem = new JMenuItem(); + JMenuItem searchViewMenuItem = new JMenuItem(); + JMenuItem projectViewMenuItem = new JMenuItem(); + JMenuItem structureViewMenuItem = new JMenuItem(); + JMenuItem propertiesViewMenuItem = new JMenuItem(); JRadioButtonMenuItem radioButtonMenuItem1 = new JRadioButtonMenuItem(); JRadioButtonMenuItem radioButtonMenuItem2 = new JRadioButtonMenuItem(); JRadioButtonMenuItem radioButtonMenuItem3 = new JRadioButtonMenuItem(); @@ -103,27 +117,35 @@ class DemoFrame //======== fileMenu ======== { fileMenu.setText("File"); + fileMenu.setMnemonic('F'); //---- newMenuItem ---- newMenuItem.setText("New"); newMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); + newMenuItem.setMnemonic('N'); + newMenuItem.addActionListener(e -> menuItemActionPerformed(e)); fileMenu.add(newMenuItem); //---- openMenuItem ---- openMenuItem.setText("Open"); openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); + openMenuItem.setMnemonic('O'); + openMenuItem.addActionListener(e -> menuItemActionPerformed(e)); fileMenu.add(openMenuItem); fileMenu.addSeparator(); //---- closeMenuItem ---- closeMenuItem.setText("Close"); closeMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); + closeMenuItem.setMnemonic('C'); + closeMenuItem.addActionListener(e -> menuItemActionPerformed(e)); fileMenu.add(closeMenuItem); fileMenu.addSeparator(); //---- exitMenuItem ---- exitMenuItem.setText("Exit"); exitMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); + exitMenuItem.setMnemonic('X'); exitMenuItem.addActionListener(e -> exitActionPerformed()); fileMenu.add(exitMenuItem); } @@ -132,37 +154,50 @@ class DemoFrame //======== editMenu ======== { editMenu.setText("Edit"); + editMenu.setMnemonic('E'); //---- undoMenuItem ---- undoMenuItem.setText("Undo"); undoMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); + undoMenuItem.setMnemonic('U'); + undoMenuItem.addActionListener(e -> menuItemActionPerformed(e)); editMenu.add(undoMenuItem); //---- redoMenuItem ---- redoMenuItem.setText("Redo"); redoMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); + redoMenuItem.setMnemonic('R'); + redoMenuItem.addActionListener(e -> menuItemActionPerformed(e)); editMenu.add(redoMenuItem); editMenu.addSeparator(); //---- cutMenuItem ---- cutMenuItem.setText("Cut"); cutMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); + cutMenuItem.setMnemonic('C'); + cutMenuItem.addActionListener(e -> menuItemActionPerformed(e)); editMenu.add(cutMenuItem); //---- copyMenuItem ---- copyMenuItem.setText("Copy"); copyMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); + copyMenuItem.setMnemonic('O'); + copyMenuItem.addActionListener(e -> menuItemActionPerformed(e)); editMenu.add(copyMenuItem); //---- pasteMenuItem ---- pasteMenuItem.setText("Paste"); pasteMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); + pasteMenuItem.setMnemonic('P'); + pasteMenuItem.addActionListener(e -> menuItemActionPerformed(e)); editMenu.add(pasteMenuItem); editMenu.addSeparator(); //---- deleteMenuItem ---- deleteMenuItem.setText("Delete"); deleteMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)); + deleteMenuItem.setMnemonic('D'); + deleteMenuItem.addActionListener(e -> menuItemActionPerformed(e)); editMenu.add(deleteMenuItem); } menuBar1.add(editMenu); @@ -170,24 +205,84 @@ class DemoFrame //======== viewMenu ======== { viewMenu.setText("View"); + viewMenu.setMnemonic('V'); //---- checkBoxMenuItem1 ---- checkBoxMenuItem1.setText("Show Toolbar"); checkBoxMenuItem1.setSelected(true); + checkBoxMenuItem1.setMnemonic('T'); + checkBoxMenuItem1.addActionListener(e -> menuItemActionPerformed(e)); viewMenu.add(checkBoxMenuItem1); + + //======== menu1 ======== + { + menu1.setText("Show View"); + menu1.setMnemonic('V'); + + //======== subViewsMenu ======== + { + subViewsMenu.setText("Sub Views"); + subViewsMenu.setMnemonic('S'); + + //======== subSubViewsMenu ======== + { + subSubViewsMenu.setText("Sub sub Views"); + subSubViewsMenu.setMnemonic('U'); + + //---- errorLogViewMenuItem ---- + errorLogViewMenuItem.setText("Error Log"); + errorLogViewMenuItem.setMnemonic('E'); + errorLogViewMenuItem.addActionListener(e -> menuItemActionPerformed(e)); + subSubViewsMenu.add(errorLogViewMenuItem); + } + subViewsMenu.add(subSubViewsMenu); + + //---- searchViewMenuItem ---- + searchViewMenuItem.setText("Search"); + searchViewMenuItem.setMnemonic('S'); + searchViewMenuItem.addActionListener(e -> menuItemActionPerformed(e)); + subViewsMenu.add(searchViewMenuItem); + } + menu1.add(subViewsMenu); + + //---- projectViewMenuItem ---- + projectViewMenuItem.setText("Project"); + projectViewMenuItem.setMnemonic('P'); + projectViewMenuItem.addActionListener(e -> menuItemActionPerformed(e)); + menu1.add(projectViewMenuItem); + + //---- structureViewMenuItem ---- + structureViewMenuItem.setText("Structure"); + structureViewMenuItem.setMnemonic('T'); + structureViewMenuItem.addActionListener(e -> menuItemActionPerformed(e)); + menu1.add(structureViewMenuItem); + + //---- propertiesViewMenuItem ---- + propertiesViewMenuItem.setText("Properties"); + propertiesViewMenuItem.setMnemonic('O'); + propertiesViewMenuItem.addActionListener(e -> menuItemActionPerformed(e)); + menu1.add(propertiesViewMenuItem); + } + viewMenu.add(menu1); viewMenu.addSeparator(); //---- radioButtonMenuItem1 ---- radioButtonMenuItem1.setText("Details"); radioButtonMenuItem1.setSelected(true); + radioButtonMenuItem1.setMnemonic('D'); + radioButtonMenuItem1.addActionListener(e -> menuItemActionPerformed(e)); viewMenu.add(radioButtonMenuItem1); //---- radioButtonMenuItem2 ---- radioButtonMenuItem2.setText("Small Icons"); + radioButtonMenuItem2.setMnemonic('S'); + radioButtonMenuItem2.addActionListener(e -> menuItemActionPerformed(e)); viewMenu.add(radioButtonMenuItem2); //---- radioButtonMenuItem3 ---- radioButtonMenuItem3.setText("Large Icons"); + radioButtonMenuItem3.setMnemonic('L'); + radioButtonMenuItem3.addActionListener(e -> menuItemActionPerformed(e)); viewMenu.add(radioButtonMenuItem3); } menuBar1.add(viewMenu); @@ -195,9 +290,11 @@ class DemoFrame //======== helpMenu ======== { helpMenu.setText("Help"); + helpMenu.setMnemonic('H'); //---- aboutMenuItem ---- aboutMenuItem.setText("About"); + aboutMenuItem.setMnemonic('A'); aboutMenuItem.addActionListener(e -> aboutActionPerformed()); helpMenu.add(aboutMenuItem); } diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.jfd b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.jfd index 7c652832..4912b254 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.jfd +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.jfd @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8" +JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -117,15 +117,20 @@ new FormModel { add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { name: "fileMenu" "text": "File" + "mnemonic": 70 add( new FormComponent( "javax.swing.JMenuItem" ) { name: "newMenuItem" "text": "New" "accelerator": static javax.swing.KeyStroke getKeyStroke( 78, 4226, false ) + "mnemonic": 78 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) } ) add( new FormComponent( "javax.swing.JMenuItem" ) { name: "openMenuItem" "text": "Open" "accelerator": static javax.swing.KeyStroke getKeyStroke( 79, 4226, false ) + "mnemonic": 79 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) } ) add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { name: "separator2" @@ -134,6 +139,8 @@ new FormModel { name: "closeMenuItem" "text": "Close" "accelerator": static javax.swing.KeyStroke getKeyStroke( 87, 4226, false ) + "mnemonic": 67 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) } ) add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { name: "separator1" @@ -142,21 +149,27 @@ new FormModel { name: "exitMenuItem" "text": "Exit" "accelerator": static javax.swing.KeyStroke getKeyStroke( 81, 4226, false ) + "mnemonic": 88 addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "exitActionPerformed", false ) ) } ) } ) add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { name: "editMenu" "text": "Edit" + "mnemonic": 69 add( new FormComponent( "javax.swing.JMenuItem" ) { name: "undoMenuItem" "text": "Undo" "accelerator": static javax.swing.KeyStroke getKeyStroke( 90, 4226, false ) + "mnemonic": 85 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) } ) add( new FormComponent( "javax.swing.JMenuItem" ) { name: "redoMenuItem" "text": "Redo" "accelerator": static javax.swing.KeyStroke getKeyStroke( 89, 4226, false ) + "mnemonic": 82 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) } ) add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { name: "separator4" @@ -165,16 +178,22 @@ new FormModel { name: "cutMenuItem" "text": "Cut" "accelerator": static javax.swing.KeyStroke getKeyStroke( 88, 4226, false ) + "mnemonic": 67 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) } ) add( new FormComponent( "javax.swing.JMenuItem" ) { name: "copyMenuItem" "text": "Copy" "accelerator": static javax.swing.KeyStroke getKeyStroke( 67, 4226, false ) + "mnemonic": 79 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) } ) add( new FormComponent( "javax.swing.JMenuItem" ) { name: "pasteMenuItem" "text": "Paste" "accelerator": static javax.swing.KeyStroke getKeyStroke( 86, 4226, false ) + "mnemonic": 80 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) } ) add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { name: "separator3" @@ -183,15 +202,65 @@ new FormModel { name: "deleteMenuItem" "text": "Delete" "accelerator": static javax.swing.KeyStroke getKeyStroke( 127, 0, false ) + "mnemonic": 68 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) } ) } ) add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { name: "viewMenu" "text": "View" + "mnemonic": 86 add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) { name: "checkBoxMenuItem1" "text": "Show Toolbar" "selected": true + "mnemonic": 84 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) + } ) + add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { + name: "menu1" + "text": "Show View" + "mnemonic": 86 + add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { + name: "subViewsMenu" + "text": "Sub Views" + "mnemonic": 83 + add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { + name: "subSubViewsMenu" + "text": "Sub sub Views" + "mnemonic": 85 + add( new FormComponent( "javax.swing.JMenuItem" ) { + name: "errorLogViewMenuItem" + "text": "Error Log" + "mnemonic": 69 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) + } ) + } ) + add( new FormComponent( "javax.swing.JMenuItem" ) { + name: "searchViewMenuItem" + "text": "Search" + "mnemonic": 83 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) + } ) + } ) + add( new FormComponent( "javax.swing.JMenuItem" ) { + name: "projectViewMenuItem" + "text": "Project" + "mnemonic": 80 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) + } ) + add( new FormComponent( "javax.swing.JMenuItem" ) { + name: "structureViewMenuItem" + "text": "Structure" + "mnemonic": 84 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) + } ) + add( new FormComponent( "javax.swing.JMenuItem" ) { + name: "propertiesViewMenuItem" + "text": "Properties" + "mnemonic": 79 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) + } ) } ) add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { name: "separator8" @@ -201,24 +270,32 @@ new FormModel { "text": "Details" "selected": true "$buttonGroup": new FormReference( "buttonGroup1" ) + "mnemonic": 68 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) } ) add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) { name: "radioButtonMenuItem2" "text": "Small Icons" "$buttonGroup": new FormReference( "buttonGroup1" ) + "mnemonic": 83 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) } ) add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) { name: "radioButtonMenuItem3" "text": "Large Icons" "$buttonGroup": new FormReference( "buttonGroup1" ) + "mnemonic": 76 + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) } ) } ) add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { name: "helpMenu" "text": "Help" + "mnemonic": 72 add( new FormComponent( "javax.swing.JMenuItem" ) { name: "aboutMenuItem" "text": "About" + "mnemonic": 65 addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "aboutActionPerformed", false ) ) } ) } ) diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/Dracula.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/Dracula.theme.json index eadab125..d48f1c58 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/Dracula.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/Dracula.theme.json @@ -160,22 +160,6 @@ "inactiveBackground": "#44475a" } }, - "ScrollBar": { - "thumbColor": "#bd93f9", - "hoverThumbColor": "#bd93f9", - "Transparent": { - "thumbColor": "#bd93f9", - "hoverThumbColor": "#bd93f9" - }, - "Mac": { - "thumbColor": "#bd93f9", - "hoverThumbColor": "#bd93f9", - "Transparent": { - "thumbColor": "#bd93f9", - "hoverThumbColor": "#bd93f9" - } - } - }, "SearchEverywhere": { "SearchField": { "background": "#44475a" diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/Hiberbee.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/Hiberbee.theme.json index 4ec97633..d2dafd0b 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/Hiberbee.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/Hiberbee.theme.json @@ -1,17 +1,29 @@ { "author": "Vlad Volkov", "colors": { - "border": "#434343", - "focused": "#5a5a5a", - "separator": "#434343", - "background": "#191919", - "paneBackground": "#252525", - "lightBackground": "#323232", - "headerBackground": "#3c3c3c", - "darkerForeground": "#7d7d7d", - "foreground": "#c8c8c8", - "shadow": "#252525", - "accent": "#FFC83C" + "accent": "#FFC83C", + "greyDot15": "#d8d8d8", + "greyDot25": "#bfbfbf", + "greyDot33": "#aaaaaa", + "greyDot50": "#7d7d7d", + "greyDot65": "#5a5a5a", + "greyDot70": "#4d4d4d", + "greyDot75": "#434343", + "greyDot80": "#323232", + "greyDot85": "#252525", + "greyDot90": "#191919", + "navyDot85": "#191d21", + "navyDot90": "#1f2021", + "lightBlue": "#90dae6", + "green": "#5B8021", + "red": "#800040", + "desaturatedBlue": "#1e282d", + "desaturatedOrange": "#8049117f", + "transparentGreen": "#5B80217f", + "transparentRed": "#8000407f", + "transparentYellow": "#8066357f", + "transparentViolet": "#9478F67f", + "yellow": "#806635" }, "dark": true, "editorScheme": "/Hiberbee.xml", @@ -31,7 +43,7 @@ "Objects.Yellow": "#f7cd46", "Objects.Green": "#78b756", "Objects.Purple": "#9478f6", - "Objects.BlackText": "#4b4b4b", + "Objects.BlackText": "#4d4d4d", "Objects.Blue": "#49b0f1", "Objects.YellowDark": "#fd971f", "Objects.GreenAndroid": "#78c856" @@ -39,76 +51,78 @@ }, "name": "Hiberbee", "ui": { - "ActionButton.hoverBackground": "separator", - "ActionButton.hoverBorderColor": "focused", - "ActionButton.pressedBackground": "focused", - "Borders.ContrastBorderColor": "separator", - "Borders.color": "border", + "ActionButton.hoverBackground": "greyDot65", + "ActionButton.hoverBorderColor": "greyDot50", + "ActionButton.pressedBackground": "greyDot65", + "Borders.ContrastBorderColor": "greyDot65", + "ActionButton.pressedBorderColor": "lightBlue", + "Borders.color": "greyDot65", "Button.arc": "5", - "Button.background": "lightBackground", - "Button.default.endBackground": "lightBackground", - "Button.default.endBorderColor": "border", - "Button.default.focusColor": "headerBackground", - "Button.default.focusedBorderColor": "accent", - "Button.default.foreground": "accent", - "Button.default.shadowColor": "shadow", - "Button.default.startBackground": "lightBackground", - "Button.default.startBorderColor": "border", - "Button.endBackground": "lightBackground", - "Button.endBorderColor": "border", + "Button.background": "greyDot80", + "Button.default.endBackground": "greyDot80", + "Button.default.endBorderColor": "greyDot65", + "Button.default.startBorderColor": "greyDot65", + "Button.default.focusColor": "greyDot50", + "Button.default.focusedBorderColor": "lightBlue", + "Button.default.foreground": "greyDot25", + "Button.default.shadowColor": "navyDot90", + "Button.default.startBackground": "greyDot80", + "Button.endBackground": "greyDot80", + "Button.startBorderColor": "greyDot65", + "Button.endBorderColor": "greyDot65", "Button.focusedBorderColor": "accent", - "Button.foreground": "foreground", - "Button.shadowColor": "shadow", + "Button.foreground": "greyDot25", + "Button.shadowColor": "navyDot90", "Button.shadowWidth": "0", - "Button.startBackground": "lightBackground", - "Button.startBorderColor": "border", - "CheckBox.background": "lightBackground", - "CheckBoxMenuItem.background": "lightBackground", - "CheckBoxMenuItem.disabledBackground": "darkBackground", + "Button.startBackground": "greyDot80", + "CheckBox.background": "greyDot80", + "CheckBoxMenuItem.background": "greyDot80", + "CheckBoxMenuItem.disabledBackground": "greyDot85", "CheckBoxMenuItem.selectionForeground": "accent", - "ComboBox.ArrowButton.disabledIconColor": "separator", + "ComboBox.ArrowButton.disabledIconColor": "greyDot50", "ComboBox.ArrowButton.iconColor": "accent", - "ComboBox.ArrowButton.nonEditableBackground": "separator", - "ComboBox.background": "lightBackground", + "ComboBox.ArrowButton.nonEditableBackground": "greyDot70", + "ComboBox.background": "greyDot80", "ComboBox.modifiedItemForeground": "accent", - "ComboBox.nonEditableBackground": "headerBackground", - "ComboPopup.border": "0,0,0,0,4b4b4b", - "CompletionPopup.foreground": "foreground", + "ComboBox.nonEditableBackground": "greyDot75", + "ComboPopup.border": "1,1,1,1,5a5a5a", + "CompletionPopup.foreground": "greyDot25", "CompletionPopup.matchForeground": "accent", - "CompletionPopup.selectionBackground": "separator", - "CompletionPopup.selectionInactiveBackground": "lightBackground", + "CompletionPopup.selectionBackground": "navyDot85", + "CompletionPopup.selectionInactiveBackground": "greyDot80", "Component.arc": "5", - "Component.borderColor": "focused", - "Component.errorFocusColor": "#501428", - "Component.focusColor": "#595959", + "Component.borderColor": "greyDot65", + "Component.errorFocusColor": "red", + "Component.focusColor": "accent", "Component.focusWidth": "0", - "Component.focusedBorderColor": "#666666", - "Component.hoverIconColor": "foreground", - "Component.iconColor": "accent", - "Component.inactiveErrorFocusColor": "#3c0a14", - "Component.inactiveWarningFocusColor": "#4b3219", - "Component.warningFocusColor": "#966432", - "Counter.background": "lightBackground", - "Counter.foreground": "foreground", - "Debugger.Variables.evaluatingExpressionForeground": "#6782cd", - "Debugger.Variables.changedValueForeground": "#F9D778", - "DebuggerPopup.borderColor": "border", - "DefaultTabs.background": "lightBackground", - "DefaultTabs.hoverBackground": "#191C21", + "Component.focusedBorderColor": "greyDot50", + "Component.hoverIconColor": "accent", + "Component.iconColor": "lightBlue", + "Component.inactiveErrorFocusColor": "transparentRed", + "Component.inactiveWarningFocusColor": "transparentYellow", + "Component.warningFocusColor": "yellow", + "Counter.background": "greyDot80", + "Counter.foreground": "greyDot25", + "Debugger.Variables.changedValueForeground": "accent", + "Debugger.Variables.evaluatingExpressionForeground": "lightBlue", + "DebuggerPopup.borderColor": "greyDot65", + "DefaultTabs.background": "greyDot80", + "DefaultTabs.borderColor": "greyDot65", + "DefaultTabs.hoverBackground": "navyDot85", "DefaultTabs.underlineColor": "accent", "DefaultTabs.underlineHeight": 1, - "DefaultTabs.underlinedTabBackground": "border", - "DefaultTabs.underlinedTabForeground": "accent", - "DragAndDrop.areaBackground": "#666666", - "DragAndDrop.areaForeground": "foreground", - "Editor.background": "background", - "Editor.foreground": "foreground", - "EditorPane.background": "lightBackground", + "DefaultTabs.underlinedTabBackground": "greyDot75", + "DefaultTabs.underlinedTabForeground": "lightBlue", + "DragAndDrop.areaBackground": "greyDot75", + "DragAndDrop.areaForeground": "greyDot25", + "Editor.background": "greyDot90", + "Editor.foreground": "greyDot25", + "EditorPane.background": "greyDot80", "EditorPane.caretForeground": "accent", - "EditorPane.foreground": "foreground", - "EditorPane.inactiveBackground": "paneBackground", - "EditorPane.inactiveForeground": "#808080", - "EditorPane.selectionBackground": "#191C21", + "EditorPane.foreground": "greyDot25", + "EditorPane.inactiveBackground": "greyDot85", + "EditorPane.inactiveForeground": "greyDot50", + "EditorPane.selectionBackground": "navyDot85", "EditorPane.selectionForeground": "accent", "EditorTabs.underlineHeight": 1, "FileColor.Blue": "#23282d", @@ -117,188 +131,192 @@ "FileColor.Rose": "#2d2323", "FileColor.Violet": "#2D232D", "FileColor.Yellow": "#2d2d23", - "GutterTooltip.infoForeground": "darkerForeground", - "InplaceRefactoringPopup.borderColor": "focused", - "Label.background": "lightBackground", - "Link.activeForeground": "#7da5f0", + "GutterTooltip.infoForeground": "greyDot50", + "InplaceRefactoringPopup.borderColor": "lightBlue", + "Label.background": "greyDot80", + "Link.activeForeground": "lightBlue", "Link.hoverForeground": "accent", - "Link.pressedForeground": "#6782cd", - "Link.visitedForeground": "foreground", - "List.background": "lightBackground", - "List.selectionBackground": "#23262B", + "Link.pressedForeground": "lightBlue", + "Link.visitedForeground": "greyDot25", + "List.background": "greyDot80", + "List.selectionBackground": "navyDot85", "List.selectionForeground": "accent", - "MemoryIndicator.allocatedBackground": "#0a3c14", - "MemoryIndicator.usedBackground": "#320a19", - "Menu.acceleratorForeground": "foreground", + "MemoryIndicator.allocatedBackground": "green", + "MemoryIndicator.usedBackground": "red", + "Menu.acceleratorForeground": "greyDot25", "Menu.acceleratorSelectionForeground": "accent", - "Menu.background": "lightBackground", - "Menu.foreground": "foreground", + "Menu.background": "greyDot80", + "Menu.borderColor": "greyDot65", + "Menu.foreground": "greyDot25", "Menu.selectionForeground": "accent", - "Menu.separatorColor": "separator", - "MenuBar.selectionBackground": "focused", - "MenuBar.shadow": "shadow", + "Menu.separatorColor": "greyDot65", + "MenuBar.borderColor": "greyDot65", + "MenuBar.selectionBackground": "navyDot85", + "MenuBar.shadow": "navyDot90", "MenuItem.selectionForeground": "accent", - "Notification.MoreButton.background": "paneBackground", - "Notification.MoreButton.innerBorderColor": "separator", - "Notification.ToolWindow.errorBackground": "#37160b", - "Notification.ToolWindow.errorBorderColor": "#ed6b88", - "Notification.ToolWindow.errorForeground": "#e1e1e1", - "Notification.ToolWindow.informativeBackground": "#3c5014", - "Notification.ToolWindow.informativeBorderColor": "#556914", - "Notification.ToolWindow.informativeForeground": "darkerForeground", - "Notification.ToolWindow.warningBackground": "#372c0b", - "Notification.ToolWindow.warningBorderColor": "accent", - "Notification.ToolWindow.warningForeground": "#e1e1e1", - "Notification.background": "paneBackground", - "Notification.errorBackground": "#37160b", - "Notification.errorBorderColor": "#ed6b88", - "Notification.errorForeground": "foreground", - "Notification.foreground": "foreground", - "OptionPane.background": "lightBackground", - "OptionPane.foreground": "foreground", - "Panel.background": "lightBackground", - "Panel.foreground": "foreground", - "ParameterInfo.background": "paneBackground", - "ParameterInfo.currentOverloadBackground": "foreground", + "Notification.MoreButton.background": "greyDot85", + "Notification.MoreButton.innerBorderColor": "greyDot65", + "Notification.ToolWindow.errorBackground": "red", + "Notification.ToolWindow.errorBorderColor": "greyDot50", + "Notification.ToolWindow.errorForeground": "greyDot15", + "Notification.ToolWindow.informativeBackground": "#304000", + "Notification.ToolWindow.informativeBorderColor": "greyDot65", + "Notification.ToolWindow.informativeForeground": "greyDot15", + "Notification.ToolWindow.warningBackground": "yellow", + "Notification.ToolWindow.warningBorderColor": "greyDot65", + "Notification.ToolWindow.warningForeground": "greyDot15", + "Notification.background": "greyDot85", + "Notification.errorBackground": "red", + "Notification.errorBorderColor": "greyDot65", + "Notification.errorForeground": "greyDot15", + "Notification.foreground": "greyDot25", + "OptionPane.background": "greyDot80", + "OptionPane.foreground": "greyDot25", + "Panel.background": "greyDot80", + "Panel.foreground": "greyDot25", + "ParameterInfo.background": "greyDot85", + "ParameterInfo.currentOverloadBackground": "lightBlue", "ParameterInfo.currentParameterForeground": "accent", - "ParameterInfo.foreground": "foreground", - "ParameterInfo.infoForeground": "darkerForeground", - "ParameterInfo.lineSeparatorColor": "separator", - "Plugins.Button.installBackground": "lightBackground", - "Plugins.Button.installBorderColor": "border", - "Plugins.Button.installFillBackground": "lightBackground", - "Plugins.Button.installFillForeground": "foreground", + "ParameterInfo.foreground": "greyDot25", + "ParameterInfo.infoForeground": "greyDot33", + "ParameterInfo.lineSeparatorColor": "greyDot70", + "Plugins.Button.installBackground": "greyDot80", + "Plugins.Button.installBorderColor": "greyDot65", + "Plugins.Button.installFillBackground": "greyDot80", + "Plugins.Button.installFillForeground": "greyDot25", "Plugins.Button.installForeground": "accent", - "Plugins.SearchField.background": "headerBackground", - "Plugins.SectionHeader.background": "headerBackground", - "Plugins.SectionHeader.foreground": "foreground", - "Plugins.Tab.hoverBackground": "paneBackground", - "Plugins.Tab.selectedBackground": "#191C21", - "Plugins.background": "lightBackground", - "Plugins.disabledForeground": "darkerForeground", - "Plugins.lightSelectionBackground": "separator", - "Plugins.tagBackground": "paneBackground", - "Plugins.tagForeground": "foreground", - "Popup.Advertiser.background": "paneBackground", - "Popup.Advertiser.foreground": "darkerForeground", - "Popup.Header.activeBackground": "headerBackground", - "Popup.Header.inactiveBackground": "paneBackground", - "Popup.paintBorder": false, - "PopupMenu.background": "lightBackground", - "PopupMenu.foreground": "foreground", - "PopupMenu.selectionBackground": "#191C21", - "PopupMenu.selectionForeground": "accent", + "Plugins.SearchField.background": "greyDot75", + "Plugins.SectionHeader.background": "greyDot75", + "Plugins.SectionHeader.foreground": "greyDot25", + "Plugins.Tab.hoverBackground": "navyDot85", + "Plugins.Tab.selectedBackground": "greyDot85", + "Plugins.background": "greyDot80", + "Plugins.disabledForeground": "greyDot50", + "Plugins.lightSelectionBackground": "greyDot70", + "Plugins.tagBackground": "greyDot85", + "Plugins.tagForeground": "greyDot25", + "Popup.Advertiser.background": "greyDot85", + "Popup.Advertiser.foreground": "greyDot50", + "Popup.Header.activeBackground": "greyDot75", + "Popup.Header.inactiveBackground": "greyDot85", + "Popup.paintBorder": true, + "PopupMenu.background": "greyDot80", + "PopupMenu.foreground": "greyDot25", + "PopupMenu.selectionBackground": "navyDot85", + "PopupMenu.selectionForeground": "lightBlue", "PopupMenuSeparator.stripeWidth": 1, - "ProgressBar.failedColor": "#ec5f5d", - "ProgressBar.failedEndColor": "#ffa9ca", - "ProgressBar.indeterminateEndColor": "#f9d778", - "ProgressBar.indeterminateStartColor": "#ee9b70", - "ProgressBar.passedColor": "#78b756", - "ProgressBar.passedEndColor": "#b4da82", - "ProgressBar.progressColor": "#ffe499", - "ProgressBar.trackColor": "accent", - "RadioButton.background": "lightBackground", - "ScrollBar.Mac.hoverTrackColor": "headerBackground", - "Slider.background": "lightBackground", - "ScrollBar.Mac.trackColor": "lightBackground", - "ScrollPane.background": "paneBackground", - "ScrollPane.foreground": "darkerForeground", - "SearchEverywhere.Advertiser.background": "paneBackground", - "SearchEverywhere.Advertiser.foreground": "darkerForeground", - "SearchEverywhere.Header.background": "paneBackground", - "SearchEverywhere.List.separatorColor": "separator", - "SearchEverywhere.List.separatorForeground": "separator", - "SearchEverywhere.SearchField.background": "headerBackground", - "SearchEverywhere.SearchField.borderColor": "border", - "SearchEverywhere.SearchField.infoForeground": "darkerForeground", - "SearchEverywhere.Tab.selectedBackground": "separator", + "ProgressBar.failedColor": "red", + "ProgressBar.failedEndColor": "greyDot65", + "ProgressBar.indeterminateEndColor": "greyDot25", + "ProgressBar.indeterminateStartColor": "accent", + "ProgressBar.passedColor": "green", + "ProgressBar.passedEndColor": "greyDot65", + "ProgressBar.progressColor": "accent", + "ProgressBar.trackColor": "greyDot75", + "RadioButton.background": "greyDot75", + "ScrollBar.Mac.hoverTrackColor": "greyDot75", + "ScrollBar.Mac.trackColor": "greyDot75", + "ScrollPane.background": "greyDot85", + "ScrollPane.foreground": "greyDot25", + "SearchEverywhere.Advertiser.background": "greyDot85", + "SearchEverywhere.Advertiser.foreground": "greyDot33", + "SearchEverywhere.Header.background": "greyDot85", + "SearchEverywhere.List.separatorColor": "greyDot70", + "SearchEverywhere.List.separatorForeground": "greyDot70", + "SearchEverywhere.SearchField.background": "greyDot75", + "SearchEverywhere.SearchField.borderColor": "greyDot70", + "SearchEverywhere.SearchField.infoForeground": "greyDot50", + "SearchEverywhere.Tab.selectedBackground": "greyDot70", "SearchEverywhere.Tab.selectedForeground": "accent", "SearchMatch.endBackground": "accent", "SearchMatch.startBackground": "accent", - "Separator.separatorColor": "separator", - "SidePanel.background": "paneBackground", - "Slider.focus": "focused", - "SpeedSearch.background": "lightBackground", - "SpeedSearch.borderColor": "border", - "SpeedSearch.errorForeground": "#ed6b88", + "Separator.separatorColor": "greyDot70", + "SidePanel.background": "greyDot85", + "Slider.background": "greyDot80", + "Slider.focus": "greyDot65", + "SpeedSearch.background": "greyDot80", + "SpeedSearch.borderColor": "greyDot70", + "SpeedSearch.errorForeground": "red", "SpeedSearch.foreground": "accent", - "SplitPane.background": "lightBackground", - "SplitPane.darkShadow": "shadow", + "SplitPane.background": "greyDot80", + "SplitPane.darkShadow": "navyDot90", "SplitPane.highlight": "accent", - "SplitPane.shadow": "shadow", - "TabbedPane.background": "lightBackground", - "TabbedPane.contentAreaColor": "lightBackground", - "TabbedPane.disabledUnderlineColor": "border", - "TabbedPane.focusColor": "focused", - "TabbedPane.foreground": "foreground", - "TabbedPane.hoverColor": "separator", + "SplitPane.shadow": "navyDot90", + "TabbedPane.background": "greyDot80", + "TabbedPane.contentAreaColor": "greyDot80", + "TabbedPane.disabledUnderlineColor": "greyDot75", + "TabbedPane.focusColor": "greyDot65", + "TabbedPane.foreground": "greyDot25", + "TabbedPane.hoverColor": "navyDot85", "TabbedPane.tabSelectionHeight": 1, "TabbedPane.underlineColor": "accent", - "Table.background": "lightBackground", - "Table.dropLineColor": "border", - "Table.dropLineShortColor": "separator", + "Table.background": "greyDot80", + "Table.dropLineColor": "greyDot75", + "Table.dropLineShortColor": "greyDot70", "Table.focusCellForeground": "accent", - "Table.selectionBackground": "#191C21", + "Table.selectionBackground": "navyDot85", "Table.selectionForeground": "accent", "Table.sortIconColor": "accent", - "Table.stripeColor": "border", - "TableHeader.background": "paneBackground", - "TableHeader.bottomSeparatorColor": "border", - "TableHeader.separatorColor": "separator", - "TextArea.background": "paneBackground", + "Table.stripeColor": "greyDot75", + "TableHeader.background": "greyDot85", + "TableHeader.bottomSeparatorColor": "greyDot75", + "TableHeader.separatorColor": "greyDot70", + "TextArea.background": "greyDot85", "TextArea.caretForeground": "accent", - "TextArea.foreground": "foreground", - "TextArea.selectionBackground": "#191C21", - "TextField.background": "headerBackground", + "TextArea.foreground": "greyDot25", + "TextArea.selectionBackground": "navyDot85", + "TextField.background": "greyDot75", "TextField.caretForeground": "accent", - "TextField.darkShadow": "shadow", - "TextField.foreground": "foreground", - "TextField.highlight": "#ffffff", - "TextField.selectionBackground": "#191C21", - "TextPane.background": "lightBackground", - "TitlePane.background": "paneBackground", - "ToggleButton.borderColor": "separator", - "ToggleButton.buttonColor": "headerBackground", - "ToggleButton.offBackground": "#232323", - "ToggleButton.offForeground": "darkerForeground", - "ToggleButton.onBackground": "focused", + "TextField.darkShadow": "navyDot90", + "TextField.foreground": "greyDot25", + "TextField.highlight": "greyDot15", + "TextField.selectionBackground": "navyDot85", + "TextPane.background": "greyDot80", + "TitlePane.background": "greyDot85", + "ToggleButton.borderColor": "greyDot70", + "ToggleButton.buttonColor": "greyDot75", + "ToggleButton.offBackground": "greyDot75", + "ToggleButton.offForeground": "greyDot25", + "ToggleButton.onBackground": "greyDot50", "ToggleButton.onForeground": "accent", - "ToolBar.background": "lightBackground", - "ToolBar.borderHandleColor": "separator", - "ToolBar.shadow": "shadow", - "ToolTip.Actions.background": "lightBackground", - "ToolTip.Actions.infoForeground": "darkerForeground", - "ToolTip.background": "headerBackground", - "ToolTip.foreground": "foreground", - "ToolTip.infoForeground": "darkerForeground", - "ToolWindow.Button.hoverBackground": "focused", - "ToolWindow.Button.selectedBackground": "separator", + "ToolBar.background": "greyDot80", + "ToolBar.borderHandleColor": "greyDot70", + "ToolBar.darkShadow": "navyDot90", + "ToolBar.shadow": "navyDot90", + "ToolTip.Actions.background": "greyDot80", + "ToolTip.Actions.infoForeground": "greyDot50", + "ToolTip.background": "greyDot75", + "ToolTip.foreground": "greyDot25", + "ToolTip.infoForeground": "greyDot50", + "ToolWindow.Button.hoverBackground": "navyDot85", + "ToolWindow.Button.selectedBackground": "greyDot70", "ToolWindow.Button.selectedForeground": "accent", - "ToolWindow.Header.background": "paneBackground", - "ToolWindow.Header.inactiveBackground": "lightBackground", - "ToolWindow.HeaderTab.hoverBackground": "border", - "ToolWindow.HeaderTab.hoverInactiveBackground": "headerBackground", - "ToolWindow.HeaderTab.inactiveUnderlineColor": "border", - "ToolWindow.HeaderTab.selectedInactiveBackground": "headerBackground", + "ToolWindow.Header.background": "greyDot85", + "ToolWindow.Header.inactiveBackground": "greyDot80", + "ToolWindow.HeaderTab.hoverBackground": "navyDot85", + "ToolWindow.HeaderTab.hoverInactiveBackground": "navyDot90", + "ToolWindow.HeaderTab.inactiveUnderlineColor": "greyDot75", + "ToolWindow.HeaderTab.selectedInactiveBackground": "greyDot80", "ToolWindow.HeaderTab.underlineColor": "accent", "ToolWindow.HeaderTab.underlineHeight": 1, - "ToolWindow.HeaderTab.underlinedTabInactiveBackground": "border", - "Tree.background": "paneBackground", + "ToolWindow.HeaderTab.underlinedTabInactiveBackground": "greyDot75", + "Tree.background": "greyDot85", "Tree.modifiedItemForeground": "accent", "Tree.paintLines": 0, - "Tree.selectionBackground": "#191C21", + "Tree.rowHeight": 20, + "Tree.selectionBackground": "navyDot85", "Tree.selectionForeground": "accent", - "Tree.selectionInactiveBackground": "#191C217f", - "ValidationTooltip.errorBackground": "#261313", - "ValidationTooltip.errorBorderColor": "#ff0072", - "ValidationTooltip.warningBackground": "#372c0b", - "ValidationTooltip.warningBorderColor": "accent", - "VersionControl.FileHistory.Commit.selectedBranchBackground": "separator", - "VersionControl.Log.Commit.currentBranchBackground": "#232323", - "VersionControl.Log.Commit.unmatchedForeground": "foreground", - "WelcomeScreen.Projects.selectionBackground": "#191C21", - "WelcomeScreen.Projects.selectionInactiveBackground": "#191C217f", - "WelcomeScreen.separatorColor": "separator", - "Window.border": "1,1,1,1,4b4b4b" + "Tree.selectionInactiveBackground": "navyDot90", + "ValidationTooltip.errorBackground": "red", + "ValidationTooltip.errorBorderColor": "greyDot65", + "ValidationTooltip.warningBackground": "#805e00", + "ValidationTooltip.warningBorderColor": "greyDot65", + "VersionControl.FileHistory.Commit.selectedBranchBackground": "greyDot70", + "VersionControl.Log.Commit.currentBranchBackground": "greyDot85", + "VersionControl.Log.Commit.unmatchedForeground": "greyDot25", + "WelcomeScreen.Projects.selectionBackground": "navyDot85", + "WelcomeScreen.Projects.selectionInactiveBackground": "navyDot90", + "WelcomeScreen.separatorColor": "greyDot65", + "Window.border": "0,0,0,0,5a5a5a" } } diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Arc Dark Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Arc Dark Contrast.theme.json index 78e34cef..cbc7b980 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Arc Dark Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Arc Dark Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#393f4c", "foreground": "#D3DAE3", "infoForeground": "#8b9eb5", - "matchForeground": "#42A5F52", + "matchForeground": "#42A5F5", "matchSelectionForeground": "#42A5F5", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Arc Dark.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Arc Dark.theme.json index e8fee7ae..ea2806af 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Arc Dark.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Arc Dark.theme.json @@ -110,7 +110,7 @@ "background": "#393f4c", "foreground": "#D3DAE3", "infoForeground": "#8b9eb5", - "matchForeground": "#42A5F52", + "matchForeground": "#42A5F5", "matchSelectionForeground": "#42A5F5", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Dark Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Dark Contrast.theme.json index 2fd5f7d7..48c3e072 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Dark Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Dark Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#2F333D", "foreground": "#979FAD", "infoForeground": "#979FAD", - "matchForeground": "#2979ff2", + "matchForeground": "#2979ff", "matchSelectionForeground": "#2979ff", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Dark.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Dark.theme.json index b00b0178..d62bac34 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Dark.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Dark.theme.json @@ -110,7 +110,7 @@ "background": "#2F333D", "foreground": "#979FAD", "infoForeground": "#979FAD", - "matchForeground": "#2979ff2", + "matchForeground": "#2979ff", "matchSelectionForeground": "#2979ff", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Light Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Light Contrast.theme.json index 82fbf951..e5ecc3c9 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Light Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Light Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#EAEAEB", "foreground": "#232324", "infoForeground": "#7f7f7f", - "matchForeground": "#2979ff2", + "matchForeground": "#2979ff", "matchSelectionForeground": "#2979ff", "nonFocusedState": "false", "selectedGrayedForeground": "#232324", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Light.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Light.theme.json index cc2555bf..2b9ac237 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Light.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Atom One Light.theme.json @@ -110,7 +110,7 @@ "background": "#EAEAEB", "foreground": "#232324", "infoForeground": "#7f7f7f", - "matchForeground": "#2979ff2", + "matchForeground": "#2979ff", "matchSelectionForeground": "#2979ff", "nonFocusedState": "false", "selectedGrayedForeground": "#232324", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Dracula Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Dracula Contrast.theme.json index 4fd31518..97561c5f 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Dracula Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Dracula Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#282A36", "foreground": "#F8F8F2", "infoForeground": "#6272A4", - "matchForeground": "#FF79C52", + "matchForeground": "#FF79C5", "matchSelectionForeground": "#FF79C5", "nonFocusedState": "false", "selectedGrayedForeground": "#8BE9FD", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Dracula.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Dracula.theme.json index 89e354d6..fea5d31a 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Dracula.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Dracula.theme.json @@ -110,7 +110,7 @@ "background": "#282A36", "foreground": "#F8F8F2", "infoForeground": "#6272A4", - "matchForeground": "#FF79C52", + "matchForeground": "#FF79C5", "matchSelectionForeground": "#FF79C5", "nonFocusedState": "false", "selectedGrayedForeground": "#8BE9FD", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/GitHub Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/GitHub Contrast.theme.json index 3700e2d7..1706d1ff 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/GitHub Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/GitHub Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#f3f3f3", "foreground": "#5B6168", "infoForeground": "#292D31", - "matchForeground": "#79CB602", + "matchForeground": "#79CB60", "matchSelectionForeground": "#79CB60", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/GitHub.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/GitHub.theme.json index 306027a0..fa83c69b 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/GitHub.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/GitHub.theme.json @@ -110,7 +110,7 @@ "background": "#f3f3f3", "foreground": "#5B6168", "infoForeground": "#292D31", - "matchForeground": "#79CB602", + "matchForeground": "#79CB60", "matchSelectionForeground": "#79CB60", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Light Owl Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Light Owl Contrast.theme.json index e170cb02..50012dad 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Light Owl Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Light Owl Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#FBFBFB", "foreground": "#403f53", "infoForeground": "#90A7B2", - "matchForeground": "#2AA2982", + "matchForeground": "#2AA298", "matchSelectionForeground": "#2AA298", "nonFocusedState": "false", "selectedGrayedForeground": "#403f53", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Light Owl.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Light Owl.theme.json index ca55fcc9..bd72ec1d 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Light Owl.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Light Owl.theme.json @@ -110,7 +110,7 @@ "background": "#FBFBFB", "foreground": "#403f53", "infoForeground": "#90A7B2", - "matchForeground": "#2AA2982", + "matchForeground": "#2AA298", "matchSelectionForeground": "#2AA298", "nonFocusedState": "false", "selectedGrayedForeground": "#403f53", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Darker Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Darker Contrast.theme.json index 375b8d65..226b14d3 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Darker Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Darker Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#292929", "foreground": "#B0BEC5", "infoForeground": "#727272", - "matchForeground": "#FF98002", + "matchForeground": "#FF9800", "matchSelectionForeground": "#FF9800", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", @@ -294,7 +294,7 @@ "selectionBackground": "#40404050", "selectionForeground": "#FFFFFF", "selectionInactiveForeground": "#FFFFFF", - "selectionInactiveBackground": "#3232327025" + "selectionInactiveBackground": "#32323225" }, "material": { "background": "#212121", @@ -746,10 +746,10 @@ "hash": "#292929", "modifiedItemForeground": "#FF9800", "rowHeight": 28, - "selectionBackground": "#3232327070", + "selectionBackground": "#32323270", "selectionForeground": "#FFFFFF", "selectionInactiveForeground": "#FFFFFF", - "selectionInactiveBackground": "#3232327025", + "selectionInactiveBackground": "#32323225", "textBackground": "#1A1A1A" }, "Tree.leftChildIndent": 10, diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Darker.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Darker.theme.json index 14679bf8..9b1c3dc6 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Darker.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Darker.theme.json @@ -110,7 +110,7 @@ "background": "#292929", "foreground": "#B0BEC5", "infoForeground": "#727272", - "matchForeground": "#FF98002", + "matchForeground": "#FF9800", "matchSelectionForeground": "#FF9800", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", @@ -294,7 +294,7 @@ "selectionBackground": "#40404050", "selectionForeground": "#FFFFFF", "selectionInactiveForeground": "#FFFFFF", - "selectionInactiveBackground": "#3232327025" + "selectionInactiveBackground": "#32323225" }, "material": { "background": "#212121", @@ -746,10 +746,10 @@ "hash": "#292929", "modifiedItemForeground": "#FF9800", "rowHeight": 28, - "selectionBackground": "#3232327070", + "selectionBackground": "#32323270", "selectionForeground": "#FFFFFF", "selectionInactiveForeground": "#FFFFFF", - "selectionInactiveBackground": "#3232327025", + "selectionInactiveBackground": "#32323225", "textBackground": "#212121" }, "Tree.leftChildIndent": 10, diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Deep Ocean Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Deep Ocean Contrast.theme.json index cba304d4..8012bf05 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Deep Ocean Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Deep Ocean Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#181A1F", "foreground": "#8F93A2", "infoForeground": "#4B526D", - "matchForeground": "#84ffff2", + "matchForeground": "#84ffff", "matchSelectionForeground": "#84ffff", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Deep Ocean.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Deep Ocean.theme.json index f0ac1e5f..6c229e25 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Deep Ocean.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Deep Ocean.theme.json @@ -110,7 +110,7 @@ "background": "#181A1F", "foreground": "#8F93A2", "infoForeground": "#4B526D", - "matchForeground": "#84ffff2", + "matchForeground": "#84ffff", "matchSelectionForeground": "#84ffff", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Lighter Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Lighter Contrast.theme.json index 5fc834f2..054f7a40 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Lighter Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Lighter Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#FFFFFF", "foreground": "#546E7A", "infoForeground": "#94A7B0", - "matchForeground": "#00BCD42", + "matchForeground": "#00BCD4", "matchSelectionForeground": "#00BCD4", "nonFocusedState": "false", "selectedGrayedForeground": "#546e7a", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Lighter.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Lighter.theme.json index 2c98b09a..c2994fb9 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Lighter.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Lighter.theme.json @@ -110,7 +110,7 @@ "background": "#FFFFFF", "foreground": "#546E7A", "infoForeground": "#94A7B0", - "matchForeground": "#00BCD42", + "matchForeground": "#00BCD4", "matchSelectionForeground": "#00BCD4", "nonFocusedState": "false", "selectedGrayedForeground": "#546e7a", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Oceanic Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Oceanic Contrast.theme.json index 78bda9f5..c1a6ecdf 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Oceanic Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Oceanic Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#32424A", "foreground": "#B0BEC5", "infoForeground": "#607D8B", - "matchForeground": "#0096882", + "matchForeground": "#009688", "matchSelectionForeground": "#009688", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Oceanic.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Oceanic.theme.json index d68f0007..21a6762c 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Oceanic.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Oceanic.theme.json @@ -110,7 +110,7 @@ "background": "#32424A", "foreground": "#B0BEC5", "infoForeground": "#607D8B", - "matchForeground": "#0096882", + "matchForeground": "#009688", "matchSelectionForeground": "#009688", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Palenight Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Palenight Contrast.theme.json index 52c4a332..95638985 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Palenight Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Palenight Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#34324a", "foreground": "#A6ACCD", "infoForeground": "#676E95", - "matchForeground": "#ab47bc2", + "matchForeground": "#ab47bc", "matchSelectionForeground": "#ab47bc", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Palenight.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Palenight.theme.json index 6b20cc6a..38e4fc3f 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Palenight.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Material Palenight.theme.json @@ -110,7 +110,7 @@ "background": "#34324a", "foreground": "#A6ACCD", "infoForeground": "#676E95", - "matchForeground": "#ab47bc2", + "matchForeground": "#ab47bc", "matchSelectionForeground": "#ab47bc", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Monokai Pro Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Monokai Pro Contrast.theme.json index 7822a9a4..50e4f111 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Monokai Pro Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Monokai Pro Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#403E41", "foreground": "#fcfcfa", "infoForeground": "#939293", - "matchForeground": "#ffd8662", + "matchForeground": "#ffd866", "matchSelectionForeground": "#ffd866", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Monokai Pro.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Monokai Pro.theme.json index a86d0b28..6730e306 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Monokai Pro.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Monokai Pro.theme.json @@ -110,7 +110,7 @@ "background": "#403E41", "foreground": "#fcfcfa", "infoForeground": "#939293", - "matchForeground": "#ffd8662", + "matchForeground": "#ffd866", "matchSelectionForeground": "#ffd866", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Night Owl Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Night Owl Contrast.theme.json index 259eb4ce..fad9dd49 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Night Owl Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Night Owl Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#0b2942", "foreground": "#d6deeb", "infoForeground": "#5f7e97", - "matchForeground": "#7e57c22", + "matchForeground": "#7e57c2", "matchSelectionForeground": "#7e57c2", "nonFocusedState": "false", "selectedGrayedForeground": "#ffffff", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Night Owl.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Night Owl.theme.json index 925eaf39..cd666916 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Night Owl.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Night Owl.theme.json @@ -110,7 +110,7 @@ "background": "#0b2942", "foreground": "#d6deeb", "infoForeground": "#5f7e97", - "matchForeground": "#7e57c22", + "matchForeground": "#7e57c2", "matchSelectionForeground": "#7e57c2", "nonFocusedState": "false", "selectedGrayedForeground": "#ffffff", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Dark Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Dark Contrast.theme.json index 4a13987b..7af69ed7 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Dark Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Dark Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#003745", "foreground": "#839496", "infoForeground": "#586e75", - "matchForeground": "#d336822", + "matchForeground": "#d33682", "matchSelectionForeground": "#d33682", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Dark.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Dark.theme.json index 501c5bf5..81d11a16 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Dark.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Dark.theme.json @@ -110,7 +110,7 @@ "background": "#003745", "foreground": "#839496", "infoForeground": "#586e75", - "matchForeground": "#d336822", + "matchForeground": "#d33682", "matchSelectionForeground": "#d33682", "nonFocusedState": "false", "selectedGrayedForeground": "#FFFFFF", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Light Contrast.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Light Contrast.theme.json index aa800af0..1a6deefc 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Light Contrast.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Light Contrast.theme.json @@ -110,7 +110,7 @@ "background": "#F6F0DE", "foreground": "#586e75", "infoForeground": "#93a1a1", - "matchForeground": "#d336822", + "matchForeground": "#d33682", "matchSelectionForeground": "#d33682", "nonFocusedState": "false", "selectedGrayedForeground": "#002b36", diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Light.theme.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Light.theme.json index 1d914ad1..b07c9efe 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Light.theme.json +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/material-theme-ui-lite/Solarized Light.theme.json @@ -110,7 +110,7 @@ "background": "#F6F0DE", "foreground": "#586e75", "infoForeground": "#93a1a1", - "matchForeground": "#d336822", + "matchForeground": "#d33682", "matchSelectionForeground": "#d33682", "nonFocusedState": "false", "selectedGrayedForeground": "#002b36", diff --git a/flatlaf-extras/build.gradle.kts b/flatlaf-extras/build.gradle.kts index 4e3e4025..ad3cabc1 100644 --- a/flatlaf-extras/build.gradle.kts +++ b/flatlaf-extras/build.gradle.kts @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, diff --git a/flatlaf-jide-oss/README.md b/flatlaf-jide-oss/README.md index 5ffc94d5..04416ec4 100644 --- a/flatlaf-jide-oss/README.md +++ b/flatlaf-jide-oss/README.md @@ -26,7 +26,7 @@ build script: groupId: com.formdev artifactId: flatlaf-jide-oss - version: 0.22 + version: 0.25.1 Otherwise download `flatlaf-jide-oss-.jar` here: diff --git a/flatlaf-jide-oss/build.gradle.kts b/flatlaf-jide-oss/build.gradle.kts index 30da1764..c1394ef9 100644 --- a/flatlaf-jide-oss/build.gradle.kts +++ b/flatlaf-jide-oss/build.gradle.kts @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, @@ -80,7 +80,7 @@ publishing { licenses { license { name.set( "The Apache License, Version 2.0" ) - url.set( "http://www.apache.org/licenses/LICENSE-2.0.txt" ) + url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" ) } } diff --git a/flatlaf-jide-oss/src/main/java/com/formdev/flatlaf/jideoss/FlatJideOssDefaultsAddon.java b/flatlaf-jide-oss/src/main/java/com/formdev/flatlaf/jideoss/FlatJideOssDefaultsAddon.java index 1f2902a9..cb0494d5 100644 --- a/flatlaf-jide-oss/src/main/java/com/formdev/flatlaf/jideoss/FlatJideOssDefaultsAddon.java +++ b/flatlaf-jide-oss/src/main/java/com/formdev/flatlaf/jideoss/FlatJideOssDefaultsAddon.java @@ -43,10 +43,12 @@ public class FlatJideOssDefaultsAddon LookAndFeelFactory.registerDefaultInitializer( FlatLaf.class.getName(), FlatJideUIDefaultsCustomizer.class.getName() ); LookAndFeelFactory.registerDefaultCustomizer( FlatLaf.class.getName(), FlatJideUIDefaultsCustomizer.class.getName() ); - Class addonClass = this.getClass(); - String propertiesName = "/" + addonClass.getPackage().getName().replace( '.', '/' ) - + '/' + lafClass.getSimpleName() + ".properties"; - return addonClass.getResourceAsStream( propertiesName ); + return super.getDefaults( lafClass ); + } + + @Override + public int getPriority() { + return 11; } //---- class FlatJideUIDefaultsCustomizer --------------------------------- diff --git a/flatlaf-swingx/README.md b/flatlaf-swingx/README.md index 84e29701..871f6068 100644 --- a/flatlaf-swingx/README.md +++ b/flatlaf-swingx/README.md @@ -33,7 +33,7 @@ build script: groupId: com.formdev artifactId: flatlaf-swingx - version: 0.22 + version: 0.25.1 Otherwise download `flatlaf-swingx-.jar` here: diff --git a/flatlaf-swingx/build.gradle.kts b/flatlaf-swingx/build.gradle.kts index e91135ed..25d2a07f 100644 --- a/flatlaf-swingx/build.gradle.kts +++ b/flatlaf-swingx/build.gradle.kts @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, @@ -80,7 +80,7 @@ publishing { licenses { license { name.set( "The Apache License, Version 2.0" ) - url.set( "http://www.apache.org/licenses/LICENSE-2.0.txt" ) + url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" ) } } diff --git a/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/FlatSwingXDefaultsAddon.java b/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/FlatSwingXDefaultsAddon.java index e17f121a..c708c034 100644 --- a/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/FlatSwingXDefaultsAddon.java +++ b/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/FlatSwingXDefaultsAddon.java @@ -16,26 +16,21 @@ package com.formdev.flatlaf.swingx; -import java.io.InputStream; import com.formdev.flatlaf.FlatDefaultsAddon; /** * SwingX addon for FlatLaf. + *

+ * Finds SwingX addon .properties file for the given LaF class + * in the same package as this class. * * @author Karl Tauber */ public class FlatSwingXDefaultsAddon extends FlatDefaultsAddon { - /** - * Finds SwingX addon .properties file for the given LaF class - * in the same package as this class. - */ @Override - public InputStream getDefaults( Class lafClass ) { - Class addonClass = this.getClass(); - String propertiesName = "/" + addonClass.getPackage().getName().replace( '.', '/' ) - + '/' + lafClass.getSimpleName() + ".properties"; - return addonClass.getResourceAsStream( propertiesName ); + public int getPriority() { + return 10; } } diff --git a/flatlaf-testing/build.gradle.kts b/flatlaf-testing/build.gradle.kts index 4fd94cba..e88cf2bf 100644 --- a/flatlaf-testing/build.gradle.kts +++ b/flatlaf-testing/build.gradle.kts @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, @@ -33,6 +33,10 @@ dependencies { implementation( "org.swinglabs.swingx:swingx-beaninfo:1.6.5-1" ) implementation( "com.jidesoft:jide-oss:3.6.18" ) implementation( "org.netbeans.api:org-openide-awt:RELEASE112" ) + +// implementation( "org.pushing-pixels:radiance-substance:2.5.1" ) +// implementation( "com.weblookandfeel:weblaf-ui:1.2.12" ) +// implementation( "com.jgoodies:jgoodies-looks:2.7.0" ) } java { diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.java index f050e511..56d3f67c 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.java @@ -21,6 +21,7 @@ import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.Transferable; import javax.swing.*; import javax.swing.table.*; +import com.formdev.flatlaf.icons.FlatMenuArrowIcon; import net.miginfocom.swing.*; /** @@ -70,6 +71,18 @@ public class FlatComponents2Test } } + private void tableHeaderButtonChanged() { + boolean show = tableHeaderButtonCheckBox.isSelected(); + JButton button = null; + if( show ) { + button = new JButton( new FlatMenuArrowIcon() ); + button.addActionListener( e -> { + JOptionPane.showMessageDialog( this, "hello" ); + } ); + } + scrollPane5.setCorner( JScrollPane.UPPER_TRAILING_CORNER, button ); + } + @SuppressWarnings( { "unchecked", "rawtypes" } ) private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @@ -87,9 +100,10 @@ public class FlatComponents2Test JScrollPane scrollPane4 = new JScrollPane(); tree2 = new JTree(); JLabel tableLabel = new JLabel(); - JScrollPane scrollPane5 = new JScrollPane(); + scrollPane5 = new JScrollPane(); table1 = new JTable(); dndCheckBox = new JCheckBox(); + tableHeaderButtonCheckBox = new JCheckBox(); //======== this ======== setLayout(new MigLayout( @@ -102,7 +116,7 @@ public class FlatComponents2Test "[]" + "[]" + "[::200]" + - "[::150]" + + "[150,grow]" + "[]")); //---- textFieldLabel ---- @@ -293,6 +307,11 @@ public class FlatComponents2Test dndCheckBox.setMnemonic('D'); dndCheckBox.addActionListener(e -> dndChanged()); add(dndCheckBox, "cell 0 4 3 1"); + + //---- tableHeaderButtonCheckBox ---- + tableHeaderButtonCheckBox.setText("show button in table header"); + tableHeaderButtonCheckBox.addActionListener(e -> tableHeaderButtonChanged()); + add(tableHeaderButtonCheckBox, "cell 0 4 3 1"); // JFormDesigner - End of component initialization //GEN-END:initComponents ((JComboBox)((DefaultCellEditor)table1.getColumnModel().getColumn( 3 ).getCellEditor()).getComponent()).setEditable( true ); @@ -303,8 +322,10 @@ public class FlatComponents2Test private JList list2; private JTree tree1; private JTree tree2; + private JScrollPane scrollPane5; private JTable table1; private JCheckBox dndCheckBox; + private JCheckBox tableHeaderButtonCheckBox; // JFormDesigner - End of variables declaration //GEN-END:variables //---- class DummyTransferHandler ----------------------------------------- diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.jfd index 62f281b8..7b992ea7 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.jfd @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8" +JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -9,7 +9,7 @@ new FormModel { add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "ltr,insets dialog,hidemode 3" "$columnConstraints": "[][200][200]" - "$rowConstraints": "[][][::200][::150][]" + "$rowConstraints": "[][][::200][150,grow][]" } ) { name: "this" add( new FormComponent( "javax.swing.JLabel" ) { @@ -135,6 +135,9 @@ new FormModel { } ) add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { name: "scrollPane5" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } add( new FormComponent( "javax.swing.JTable" ) { name: "table1" "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector { @@ -282,6 +285,16 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 4 3 1" } ) + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "tableHeaderButtonCheckBox" + "text": "show button in table header" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tableHeaderButtonChanged", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 4 3 1" + } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 0, 0 ) "size": new java.awt.Dimension( 790, 715 ) diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.java index 89eb57d7..9c3c9ffe 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.java @@ -61,7 +61,9 @@ public class FlatComponentsTest JLabel label2 = new JLabel(); JLabel buttonLabel = new JLabel(); JButton button1 = new JButton(); + JButton button17 = new JButton(); JButton button2 = new JButton(); + JButton button18 = new JButton(); FlatComponentsTest.TestDefaultButton button5 = new FlatComponentsTest.TestDefaultButton(); JButton button3 = new JButton(); JButton button12 = new JButton(); @@ -71,9 +73,13 @@ public class FlatComponentsTest JButton button16 = new JButton(); JLabel toggleButtonLabel = new JLabel(); JToggleButton toggleButton1 = new JToggleButton(); + JToggleButton toggleButton9 = new JToggleButton(); JToggleButton toggleButton2 = new JToggleButton(); + JToggleButton toggleButton10 = new JToggleButton(); JToggleButton toggleButton3 = new JToggleButton(); JToggleButton toggleButton4 = new JToggleButton(); + JToggleButton toggleButton5 = new JToggleButton(); + JToggleButton toggleButton8 = new JToggleButton(); JLabel checkBoxLabel = new JLabel(); JCheckBox checkBox1 = new JCheckBox(); JCheckBox checkBox2 = new JCheckBox(); @@ -162,14 +168,7 @@ public class FlatComponentsTest JToggleButton toggleButton7 = new JToggleButton(); JLabel scrollBarLabel = new JLabel(); JScrollBar scrollBar1 = new JScrollBar(); - JLabel label4 = new JLabel(); JScrollBar scrollBar4 = new JScrollBar(); - JPanel panel3 = new JPanel(); - JLabel label3 = new JLabel(); - JScrollPane scrollPane15 = new JScrollPane(); - JEditorPane editorPane6 = new JEditorPane(); - JScrollPane scrollPane16 = new JScrollPane(); - JTextPane textPane6 = new JTextPane(); JScrollBar scrollBar5 = new JScrollBar(); JScrollBar scrollBar6 = new JScrollBar(); JLabel separatorLabel = new JLabel(); @@ -256,6 +255,12 @@ public class FlatComponentsTest button1.setToolTipText("This button is enabled."); add(button1, "cell 1 1"); + //---- button17 ---- + button17.setText("square"); + button17.putClientProperty("JButton.buttonType", "square"); + button17.putClientProperty("JComponent.minimumWidth", 0); + add(button17, "cell 1 1"); + //---- button2 ---- button2.setText("disabled"); button2.setDisplayedMnemonicIndex(0); @@ -263,6 +268,13 @@ public class FlatComponentsTest button2.setToolTipText("This button is disabled."); add(button2, "cell 2 1"); + //---- button18 ---- + button18.setText("square"); + button18.putClientProperty("JButton.buttonType", "square"); + button18.setEnabled(false); + button18.putClientProperty("JComponent.minimumWidth", 0); + add(button18, "cell 2 1"); + //---- button5 ---- button5.setText("default"); button5.setDisplayedMnemonicIndex(0); @@ -304,11 +316,22 @@ public class FlatComponentsTest toggleButton1.setText("enabled"); add(toggleButton1, "cell 1 2"); + //---- toggleButton9 ---- + toggleButton9.setText("square"); + toggleButton9.putClientProperty("JButton.buttonType", "square"); + add(toggleButton9, "cell 1 2"); + //---- toggleButton2 ---- toggleButton2.setText("disabled"); toggleButton2.setEnabled(false); add(toggleButton2, "cell 2 2"); + //---- toggleButton10 ---- + toggleButton10.setText("square"); + toggleButton10.putClientProperty("JButton.buttonType", "square"); + toggleButton10.setEnabled(false); + add(toggleButton10, "cell 2 2"); + //---- toggleButton3 ---- toggleButton3.setText("selected"); toggleButton3.setSelected(true); @@ -320,6 +343,19 @@ public class FlatComponentsTest toggleButton4.setSelected(true); add(toggleButton4, "cell 4 2"); + //---- toggleButton5 ---- + toggleButton5.setText("tab"); + toggleButton5.putClientProperty("JButton.buttonType", "tab"); + toggleButton5.setSelected(true); + add(toggleButton5, "cell 5 2"); + + //---- toggleButton8 ---- + toggleButton8.setText("tab"); + toggleButton8.putClientProperty("JButton.buttonType", "tab"); + toggleButton8.setEnabled(false); + toggleButton8.setSelected(true); + add(toggleButton8, "cell 5 2"); + //---- checkBoxLabel ---- checkBoxLabel.setText("JCheckBox"); add(checkBoxLabel, "cell 0 3"); @@ -806,53 +842,11 @@ public class FlatComponentsTest scrollBar1.setOrientation(Adjustable.HORIZONTAL); add(scrollBar1, "cell 1 14,growx"); - //---- label4 ---- - label4.setText("HTML:"); - add(label4, "cell 5 14"); - //---- scrollBar4 ---- scrollBar4.setOrientation(Adjustable.HORIZONTAL); scrollBar4.setEnabled(false); add(scrollBar4, "cell 1 15,growx"); - //======== panel3 ======== - { - panel3.setOpaque(false); - panel3.setLayout(new MigLayout( - "ltr,insets 0,hidemode 3", - // columns - "[]", - // rows - "[]" + - "[]" + - "[]")); - - //---- label3 ---- - label3.setText("JLabel HTML
Sample content
text with link"); - panel3.add(label3, "cell 0 0"); - - //======== scrollPane15 ======== - { - - //---- editorPane6 ---- - editorPane6.setContentType("text/html"); - editorPane6.setText("JEditorPane HTML
Sample content
text with link"); - scrollPane15.setViewportView(editorPane6); - } - panel3.add(scrollPane15, "cell 0 1,grow"); - - //======== scrollPane16 ======== - { - - //---- textPane6 ---- - textPane6.setContentType("text/html"); - textPane6.setText("JTextPane HTML
Sample content
text with link"); - scrollPane16.setViewportView(textPane6); - } - panel3.add(scrollPane16, "cell 0 2,grow"); - } - add(panel3, "cell 5 15 1 9,aligny top,grow 100 0"); - //---- scrollBar5 ---- scrollBar5.setOrientation(Adjustable.HORIZONTAL); scrollBar5.putClientProperty("JScrollBar.showButtons", true); diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.jfd index 9cc96640..48ccc963 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.jfd @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8" +JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -47,6 +47,14 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 1" } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button17" + "text": "square" + "$client.JButton.buttonType": "square" + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 1" + } ) add( new FormComponent( "javax.swing.JButton" ) { name: "button2" "text": "disabled" @@ -56,6 +64,15 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 2 1" } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button18" + "text": "square" + "$client.JButton.buttonType": "square" + "enabled": false + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 1" + } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatComponentsTest$TestDefaultButton" ) { name: "button5" "text": "default" @@ -115,6 +132,13 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 2" } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "toggleButton9" + "text": "square" + "$client.JButton.buttonType": "square" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 2" + } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "toggleButton2" "text": "disabled" @@ -122,6 +146,14 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 2 2" } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "toggleButton10" + "text": "square" + "$client.JButton.buttonType": "square" + "enabled": false + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 2" + } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "toggleButton3" "text": "selected" @@ -137,6 +169,23 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 4 2" } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "toggleButton5" + "text": "tab" + "$client.JButton.buttonType": "tab" + "selected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 2" + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "toggleButton8" + "text": "tab" + "$client.JButton.buttonType": "tab" + "enabled": false + "selected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 2" + } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "checkBoxLabel" "text": "JCheckBox" @@ -756,12 +805,6 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 14,growx" } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "label4" - "text": "HTML:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 5 14" - } ) add( new FormComponent( "javax.swing.JScrollBar" ) { name: "scrollBar4" "orientation": 0 @@ -769,42 +812,6 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 15,growx" } ) - add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { - "$columnConstraints": "[]" - "$rowConstraints": "[][][]" - "$layoutConstraints": "ltr,insets 0,hidemode 3" - } ) { - name: "panel3" - "opaque": false - add( new FormComponent( "javax.swing.JLabel" ) { - name: "label3" - "text": "JLabel HTML
Sample content
text with link" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 0" - } ) - add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { - name: "scrollPane15" - add( new FormComponent( "javax.swing.JEditorPane" ) { - name: "editorPane6" - "contentType": "text/html" - "text": "JEditorPane HTML
Sample content
text with link" - } ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 1,grow" - } ) - add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { - name: "scrollPane16" - add( new FormComponent( "javax.swing.JTextPane" ) { - name: "textPane6" - "contentType": "text/html" - "text": "JTextPane HTML
Sample content
text with link" - } ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 2,grow" - } ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 5 15 1 9,aligny top,grow 100 0" - } ) add( new FormComponent( "javax.swing.JScrollBar" ) { name: "scrollBar5" "orientation": 0 @@ -977,7 +984,7 @@ new FormModel { } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 0, 0 ) - "size": new java.awt.Dimension( 865, 750 ) + "size": new java.awt.Dimension( 1005, 800 ) } ) } } diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatHtmlTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatHtmlTest.java new file mode 100644 index 00000000..cfd48649 --- /dev/null +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatHtmlTest.java @@ -0,0 +1,186 @@ +/* + * Copyright 2020 FormDev Software GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://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.testing; + +import java.awt.*; +import javax.swing.*; +import com.formdev.flatlaf.util.UIScale; +import net.miginfocom.swing.*; + +/** + * @author Karl Tauber + */ +public class FlatHtmlTest + extends FlatTestPanel +{ + public static void main( String[] args ) { + SwingUtilities.invokeLater( () -> { + FlatTestFrame frame = FlatTestFrame.create( args, "FlatHtmlTest" ); + frame.showFrame( FlatHtmlTest::new ); + } ); + } + + FlatHtmlTest() { + initComponents(); + increaseFontSize(); + } + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents + labelLabel = new JLabel(); + editorPaneLabel = new JLabel(); + textPaneLabel = new JLabel(); + toolTipLabel = new JLabel(); + label1 = new JLabel(); + scrollPane15 = new JScrollPane(); + editorPane1 = new JEditorPane(); + scrollPane16 = new JScrollPane(); + textPane1 = new JTextPane(); + toolTip1 = new JToolTip(); + label2 = new JLabel(); + scrollPane17 = new JScrollPane(); + editorPane2 = new JEditorPane(); + scrollPane18 = new JScrollPane(); + textPane2 = new JTextPane(); + toolTip2 = new JToolTip(); + + //======== this ======== + setLayout(new MigLayout( + "ltr,insets dialog,hidemode 3", + // columns + "[fill]" + + "[fill]" + + "[fill]" + + "[fill]", + // rows + "[]" + + "[top]" + + "[top]")); + + //---- labelLabel ---- + labelLabel.setText("JLabel:"); + add(labelLabel, "cell 0 0"); + + //---- editorPaneLabel ---- + editorPaneLabel.setText("JEditorPane:"); + add(editorPaneLabel, "cell 1 0"); + + //---- textPaneLabel ---- + textPaneLabel.setText("JTextPane:"); + add(textPaneLabel, "cell 2 0"); + + //---- toolTipLabel ---- + toolTipLabel.setText("JToolTip:"); + add(toolTipLabel, "cell 3 0"); + + //---- label1 ---- + label1.setText("HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

"); + add(label1, "cell 0 1"); + + //======== scrollPane15 ======== + { + + //---- editorPane1 ---- + editorPane1.setContentType("text/html"); + editorPane1.setText("HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

"); + scrollPane15.setViewportView(editorPane1); + } + add(scrollPane15, "cell 1 1,grow"); + + //======== scrollPane16 ======== + { + + //---- textPane1 ---- + textPane1.setContentType("text/html"); + textPane1.setText("HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

"); + scrollPane16.setViewportView(textPane1); + } + add(scrollPane16, "cell 2 1"); + + //---- toolTip1 ---- + toolTip1.setTipText("HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

"); + add(toolTip1, "cell 3 1"); + + //---- label2 ---- + label2.setText("HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

"); + add(label2, "cell 0 2"); + + //======== scrollPane17 ======== + { + + //---- editorPane2 ---- + editorPane2.setContentType("text/html"); + editorPane2.setText("HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

"); + scrollPane17.setViewportView(editorPane2); + } + add(scrollPane17, "cell 1 2,grow"); + + //======== scrollPane18 ======== + { + + //---- textPane2 ---- + textPane2.setContentType("text/html"); + textPane2.setText("HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

"); + scrollPane18.setViewportView(textPane2); + } + add(scrollPane18, "cell 2 2"); + + //---- toolTip2 ---- + toolTip2.setTipText("HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

"); + add(toolTip2, "cell 3 2"); + // JFormDesigner - End of component initialization //GEN-END:initComponents + } + + @Override + public void updateUI() { + super.updateUI(); + + EventQueue.invokeLater( () -> { + increaseFontSize(); + } ); + } + + private void increaseFontSize() { + increaseFontSize( label2, label1.getFont() ); + increaseFontSize( editorPane2, editorPane1.getFont() ); + increaseFontSize( textPane2, textPane1.getFont() ); + increaseFontSize( toolTip2, toolTip1.getFont() ); + } + + private void increaseFontSize( JComponent c, Font baseFont ) { + c.setFont( baseFont.deriveFont( Font.PLAIN, baseFont.getSize() + UIScale.scale( 10f ) ) ); + } + + // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables + private JLabel labelLabel; + private JLabel editorPaneLabel; + private JLabel textPaneLabel; + private JLabel toolTipLabel; + private JLabel label1; + private JScrollPane scrollPane15; + private JEditorPane editorPane1; + private JScrollPane scrollPane16; + private JTextPane textPane1; + private JToolTip toolTip1; + private JLabel label2; + private JScrollPane scrollPane17; + private JEditorPane editorPane2; + private JScrollPane scrollPane18; + private JTextPane textPane2; + private JToolTip toolTip2; + // JFormDesigner - End of variables declaration //GEN-END:variables +} diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatHtmlTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatHtmlTest.jfd new file mode 100644 index 00000000..df2c31ec --- /dev/null +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatHtmlTest.jfd @@ -0,0 +1,105 @@ +JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8" + +new FormModel { + contentType: "form/swing" + root: new FormRoot { + add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "ltr,insets dialog,hidemode 3" + "$columnConstraints": "[fill][fill][fill][fill]" + "$rowConstraints": "[][top][top]" + } ) { + name: "this" + add( new FormComponent( "javax.swing.JLabel" ) { + name: "labelLabel" + "text": "JLabel:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "editorPaneLabel" + "text": "JEditorPane:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "textPaneLabel" + "text": "JTextPane:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "toolTipLabel" + "text": "JToolTip:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label1" + "text": "HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 1" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane15" + add( new FormComponent( "javax.swing.JEditorPane" ) { + name: "editorPane1" + "contentType": "text/html" + "text": "HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

" + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 1,grow" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane16" + add( new FormComponent( "javax.swing.JTextPane" ) { + name: "textPane1" + "contentType": "text/html" + "text": "HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

" + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 1" + } ) + add( new FormComponent( "javax.swing.JToolTip" ) { + name: "toolTip1" + "tipText": "HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label2" + "text": "HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 2" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane17" + add( new FormComponent( "javax.swing.JEditorPane" ) { + name: "editorPane2" + "contentType": "text/html" + "text": "HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

" + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 2,grow" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane18" + add( new FormComponent( "javax.swing.JTextPane" ) { + name: "textPane2" + "contentType": "text/html" + "text": "HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

" + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 2" + } ) + add( new FormComponent( "javax.swing.JToolTip" ) { + name: "toolTip2" + "tipText": "HTML
Sample content
text with link

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Paragraph

" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 2" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 0, 0 ) + "size": new java.awt.Dimension( 695, 755 ) + } ) + } +} diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatInspector.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatInspector.java index 8dba383d..9bd3b9b8 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatInspector.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatInspector.java @@ -71,7 +71,7 @@ public class FlatInspector private Component lastComponent; private int lastX; private int lastY; - private boolean inspectParent; + private int inspectParentLevel; private JComponent highlightFigure; private JToolTip tip; @@ -112,7 +112,9 @@ public class FlatInspector public void mouseMoved( MouseEvent e ) { lastX = e.getX(); lastY = e.getY(); - inspectParent = e.isShiftDown(); + inspectParentLevel = (e.isControlDown() ? 1 : 0) + + (e.isShiftDown() ? 2 : 0) + + (e.isAltDown() ? 4 : 0); inspect( lastX, lastY ); } }; @@ -157,10 +159,9 @@ public class FlatInspector Container contentPane = rootPane.getContentPane(); Point pt = SwingUtilities.convertPoint( rootPane.getGlassPane(), x, y, contentPane ); Component c = SwingUtilities.getDeepestComponentAt( contentPane, pt.x, pt.y ); - if( inspectParent && c != null && c != contentPane ) + for( int i = 0; i < inspectParentLevel && c != null; i++ ) { c = c.getParent(); - if( c == contentPane || (c != null && c.getParent() == contentPane) ) - c = null; + } if( c == lastComponent ) return; @@ -245,12 +246,8 @@ public class FlatInspector } private String buildToolTipText( Component c ) { - String name = c.getClass().getSimpleName(); - if( name.isEmpty() ) { - // anonymous class - name = c.getClass().getName(); - name = name.substring( name.lastIndexOf( '.' ) + 1 ); - } + String name = c.getClass().getName(); + name = name.substring( name.lastIndexOf( '.' ) + 1 ); String text = "Class: " + name + " (" + c.getClass().getPackage().getName() + ")\n" + @@ -304,6 +301,9 @@ public class FlatInspector text += "Left-to-right: " + c.getComponentOrientation().isLeftToRight() + '\n'; text += "Parent: " + c.getParent().getClass().getName(); + if( inspectParentLevel > 0 ) + text += "\n\nParent level: " + inspectParentLevel; + return text; } diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatMenusTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatMenusTest.java index 908f89cc..52d8390a 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatMenusTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatMenusTest.java @@ -126,13 +126,16 @@ public class FlatMenusTest //======== menu5 ======== { menu5.setText("text"); + menu5.setMnemonic('T'); //---- menuItem7 ---- menuItem7.setText("text"); + menuItem7.setMnemonic('X'); menu5.add(menuItem7); //---- menuItem8 ---- menuItem8.setText("text"); + menuItem8.setMnemonic('E'); menu5.add(menuItem8); } menuBar1.add(menu5); @@ -175,6 +178,7 @@ public class FlatMenusTest //======== menu1 ======== { menu1.setText("enabled"); + menu1.setMnemonic('E'); } panel1.add(menu1, "cell 1 0"); @@ -185,6 +189,7 @@ public class FlatMenusTest //---- menuItem1 ---- menuItem1.setText("enabled"); menuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.CTRL_MASK)); + menuItem1.setMnemonic('N'); panel1.add(menuItem1, "cell 1 1"); //---- checkBoxMenuItemLabel ---- @@ -194,6 +199,7 @@ public class FlatMenusTest //---- checkBoxMenuItem1 ---- checkBoxMenuItem1.setText("enabled"); checkBoxMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)); + checkBoxMenuItem1.setMnemonic('A'); panel1.add(checkBoxMenuItem1, "cell 1 2"); //---- radioButtonMenuItemLabel ---- @@ -203,6 +209,7 @@ public class FlatMenusTest //---- radioButtonMenuItem1 ---- radioButtonMenuItem1.setText("enabled"); radioButtonMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)); + radioButtonMenuItem1.setMnemonic('B'); panel1.add(radioButtonMenuItem1, "cell 1 3"); //---- popupMenuSeparatorLabel ---- @@ -230,6 +237,7 @@ public class FlatMenusTest { menu2.setText("disabled"); menu2.setEnabled(false); + menu2.setMnemonic('D'); } panel2.add(menu2, "cell 0 0"); @@ -237,18 +245,21 @@ public class FlatMenusTest menuItem2.setText("disabled"); menuItem2.setEnabled(false); menuItem2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, KeyEvent.ALT_MASK|KeyEvent.SHIFT_MASK)); + menuItem2.setMnemonic('I'); panel2.add(menuItem2, "cell 0 1"); //---- checkBoxMenuItem2 ---- checkBoxMenuItem2.setText("disabled"); checkBoxMenuItem2.setEnabled(false); checkBoxMenuItem2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)); + checkBoxMenuItem2.setMnemonic('S'); panel2.add(checkBoxMenuItem2, "cell 0 2"); //---- radioButtonMenuItem2 ---- radioButtonMenuItem2.setText("disabled"); radioButtonMenuItem2.setEnabled(false); radioButtonMenuItem2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)); + radioButtonMenuItem2.setMnemonic('L'); panel2.add(radioButtonMenuItem2, "cell 0 3"); } add(panel2, "cell 2 1"); diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatMenusTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatMenusTest.jfd index bc2ff51b..2700ef0b 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatMenusTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatMenusTest.jfd @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8" +JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -23,13 +23,16 @@ new FormModel { add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { name: "menu5" "text": "text" + "mnemonic": 84 add( new FormComponent( "javax.swing.JMenuItem" ) { name: "menuItem7" "text": "text" + "mnemonic": 88 } ) add( new FormComponent( "javax.swing.JMenuItem" ) { name: "menuItem8" "text": "text" + "mnemonic": 69 } ) } ) add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { @@ -63,6 +66,7 @@ new FormModel { add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { name: "menu1" "text": "enabled" + "mnemonic": 69 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 0" } ) @@ -76,6 +80,7 @@ new FormModel { name: "menuItem1" "text": "enabled" "accelerator": static javax.swing.KeyStroke getKeyStroke( 65, 130, false ) + "mnemonic": 78 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 1" } ) @@ -89,6 +94,7 @@ new FormModel { name: "checkBoxMenuItem1" "text": "enabled" "accelerator": &KeyStroke0 static javax.swing.KeyStroke getKeyStroke( 112, 0, false ) + "mnemonic": 65 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 2" } ) @@ -102,6 +108,7 @@ new FormModel { name: "radioButtonMenuItem1" "text": "enabled" "accelerator": #KeyStroke0 + "mnemonic": 66 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 3" } ) @@ -130,6 +137,7 @@ new FormModel { name: "menu2" "text": "disabled" "enabled": false + "mnemonic": 68 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 0" } ) @@ -138,6 +146,7 @@ new FormModel { "text": "disabled" "enabled": false "accelerator": static javax.swing.KeyStroke getKeyStroke( 68, 585, false ) + "mnemonic": 73 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 1" } ) @@ -146,6 +155,7 @@ new FormModel { "text": "disabled" "enabled": false "accelerator": #KeyStroke0 + "mnemonic": 83 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 2" } ) @@ -154,6 +164,7 @@ new FormModel { "text": "disabled" "enabled": false "accelerator": #KeyStroke0 + "mnemonic": 76 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 3" } ) diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.java index 36ac6541..97f8c5da 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.java @@ -111,6 +111,30 @@ public class FlatTestFrame lafModel.addElement( new LookAndFeelInfo( name, className ) ); } + String substanceClassName = "org.pushingpixels.substance.api.skin.SubstanceGraphiteAquaLookAndFeel"; + if( SystemInfo.IS_JAVA_9_OR_LATER && isClassAvailable( substanceClassName ) ) { + lafModel.addElement( new LookAndFeelInfo( "Substance (F5)", substanceClassName ) ); + registerSwitchToLookAndFeel( KeyEvent.VK_F5, substanceClassName ); + } + + String webLafClassName = "com.alee.laf.WebLookAndFeel"; + if( isClassAvailable( webLafClassName ) ) { + lafModel.addElement( new LookAndFeelInfo( "WebLaf (F12)", webLafClassName ) ); + registerSwitchToLookAndFeel( KeyEvent.VK_F12, webLafClassName ); + } + + String looksPlasticClassName = "com.jgoodies.looks.plastic.PlasticLookAndFeel"; + if( isClassAvailable( looksPlasticClassName ) ) { + lafModel.addElement( new LookAndFeelInfo( "JGoodies Looks Plastic (F6)", looksPlasticClassName ) ); + registerSwitchToLookAndFeel( KeyEvent.VK_F6, looksPlasticClassName ); + } + + String looksWindowsClassName = "com.jgoodies.looks.windows.WindowsLookAndFeel"; + if( isClassAvailable( looksWindowsClassName ) ) { + lafModel.addElement( new LookAndFeelInfo( "JGoodies Looks Windows (F7)", looksWindowsClassName ) ); + registerSwitchToLookAndFeel( KeyEvent.VK_F7, looksWindowsClassName ); + } + lookAndFeelComboBox.setModel( lafModel ); updateScaleFactorComboBox(); @@ -203,6 +227,15 @@ public class FlatTestFrame JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ); } + private boolean isClassAvailable( String className ) { + try { + Class.forName( className ); + return true; + } catch( ClassNotFoundException ex ) { + return false; + } + } + public void showFrame( Supplier contentFactory ) { this.contentFactory = contentFactory; this.content = contentFactory.get(); @@ -481,6 +514,7 @@ public class FlatTestFrame null)); //---- lookAndFeelComboBox ---- + lookAndFeelComboBox.setMaximumRowCount(20); lookAndFeelComboBox.addActionListener(e -> lookAndFeelChanged()); buttonBar.add(lookAndFeelComboBox, "cell 0 0"); diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.jfd index 4a57d740..f92a2a2f 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.jfd @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8" +JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -27,6 +27,7 @@ new FormModel { name: "buttonBar" add( new FormComponent( "com.formdev.flatlaf.demo.LookAndFeelsComboBox" ) { name: "lookAndFeelComboBox" + "maximumRowCount": 20 addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "lookAndFeelChanged", false ) ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 0" diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/swingx/FlatSwingXDefaultsTestAddon.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/swingx/FlatSwingXDefaultsTestAddon.java index 3ce87f7d..784afc9a 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/swingx/FlatSwingXDefaultsTestAddon.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/swingx/FlatSwingXDefaultsTestAddon.java @@ -16,26 +16,17 @@ package com.formdev.flatlaf.testing.swingx; -import java.io.InputStream; import com.formdev.flatlaf.FlatDefaultsAddon; /** * SwingX addon for FlatLaf for testing. + *

+ * Finds SwingX addon .properties file for the given LaF class + * in the same package as this class. * * @author Karl Tauber */ public class FlatSwingXDefaultsTestAddon extends FlatDefaultsAddon { - /** - * Finds SwingX addon .properties file for the given LaF class - * in the same package as this class. - */ - @Override - public InputStream getDefaults( Class lafClass ) { - Class addonClass = this.getClass(); - String propertiesName = "/" + addonClass.getPackage().getName().replace( '.', '/' ) - + '/' + lafClass.getSimpleName() + ".properties"; - return addonClass.getResourceAsStream( propertiesName ); - } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf0..f3d88b1c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5028f28f..ba94df84 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 83f2acfd..2fe81a7d 100755 --- a/gradlew +++ b/gradlew @@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -175,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@"