Compare commits

...

46 Commits
0.33 ... 0.34

Author SHA1 Message Date
Karl Tauber
8e423b4552 release 0.34 2020-05-08 14:53:16 +02:00
Karl Tauber
0e288c955c Extras: added publishing tasks to build.gradle.kts 2020-05-08 14:44:41 +02:00
Karl Tauber
7e5c599cc0 added user scale factor to UI defaults to allow layout managers (e.g. MigLayout) to use it
(see https://github.com/mikaelgrev/miglayout/pull/76)
2020-05-07 23:28:57 +02:00
Karl Tauber
a961001a4b reorder entries in JAR file to fix issues #13 and #93 2020-05-07 14:45:22 +02:00
Karl Tauber
27a347db34 PopupMenu on macOS: enabled drop shadows for popup menus and combobox popups (issue #94) 2020-05-05 19:20:48 +02:00
Karl Tauber
b228dbb2df Demo on macOS: enabled screen menu bar by default 2020-05-05 19:10:57 +02:00
Karl Tauber
09cffc4340 UIDefaultsDump: avoid locale specific decimal separators in dumps 2020-05-05 18:53:31 +02:00
Karl Tauber
e79880d305 ToolTip: made border darker (to make it better and no longer paint disabled tips (issue #94) 2020-05-05 18:44:54 +02:00
Karl Tauber
34266761d1 UIDefaultsDump: dump FlatLineBorder parameters because they may be specified in properties files 2020-05-05 16:34:30 +02:00
Karl Tauber
77f17eaa3e FlatPropertiesLaf class added that allows creating FlatLaf theme from properties (issue #97) 2020-05-05 15:13:21 +02:00
Karl Tauber
ac70342cb3 Menus: made check background margin smaller (issue #96) 2020-05-05 13:56:41 +02:00
Karl Tauber
d2f16dcaf3 Menus:
- added 1px to menu item top and bottom margin
- changed gap between menu item icon and text from 4 to 6
- improved colors of checked menu items that have a icon

(issue #96)
2020-05-05 12:31:33 +02:00
Karl Tauber
abcce2bf68 Table: fixed inconsistent table selection / move shortcuts (issue #95) 2020-05-04 13:30:42 +02:00
Karl Tauber
514487074b Menus: after Alt+Tab to other window and back, activating menu with Alt key did not always work (issue #43) 2020-05-04 12:08:47 +02:00
Karl Tauber
f014e2473f Menus: on Windows, releasing Alt key now activates the menu bar (issue #43) 2020-05-04 10:57:10 +02:00
Karl Tauber
80981f7027 Demo: added "Extras" tab 2020-05-03 19:34:21 +02:00
Karl Tauber
8e6e971b51 IntelliJ Themes Demo: theme save and github buttons were not enabled when starting demo with active IntelliJ theme 2020-05-03 18:23:16 +02:00
Karl Tauber
4bd3b889dc FlatSVGIcon: support color filtering 2020-05-03 18:21:00 +02:00
Karl Tauber
464787dc1e FlatSVGIcon: use grayFilter and graphics proxy to paint disabled icons without bitmaps 2020-05-02 23:48:46 +02:00
Karl Tauber
a2541a9659 Menus: added gap between accelerator and arrow in menu items (issue #91) 2020-05-02 19:16:33 +02:00
Karl Tauber
099dd87241 UIDefaultsLoader: removed support for deprecated variable prefix '@@' 2020-05-02 16:20:17 +02:00
Karl Tauber
38eb914420 Mnemonics: scale underline; added mnemonic test app
FlatTestFrame: Metal Laf is now at F12 so that F10 is unused because F10 is a standard key to move focus to menu bar
2020-05-02 14:38:54 +02:00
Karl Tauber
162215b1cf UIDefaultsLoader:
- support percentage in rgb() and rgba() functions
- support rgba(color,alpha) to add alpha to any color
2020-05-02 11:52:53 +02:00
Karl Tauber
c6883f7a92 ToolTip: use BasicHTML.propertyKey to check whether tooltip contains HTML 2020-05-02 00:41:11 +02:00
Karl Tauber
584286b794 Demo: wrap OptionPanePanel in JPanel to avoid that JFormDesigner tries to convert it to a container when opening DemoFrame.jfd 2020-05-02 00:33:47 +02:00
Karl Tauber
a48713b7ca no longer always show mnemonics when a menu bar is active or a popup menu is visible (issue #43) 2020-05-01 00:22:04 +02:00
Karl Tauber
8f10c2d8bf Menus: removed now unused *.evenHeight from list of UI defaults 2020-04-30 22:33:42 +02:00
Karl Tauber
5c0de9aa1c macOS: Fixed NPE if using JMenuBar in JInternalFrame and macOS screen menu bar is enabled (issue #90) 2020-04-30 13:38:23 +02:00
Karl Tauber
5553fd6538 CHANGELOG.md: added changes made in 'menu-layout' branch 2020-04-30 00:54:36 +02:00
Karl Tauber
e3ed47b37c show mnemonics always when a menu bar is active or a popup menu is visible 2020-04-29 23:56:15 +02:00
Karl Tauber
976353d770 Menus: on Windows, pressing F10 now activates the menu bar without showing a menu popup 2020-04-29 23:29:34 +02:00
Karl Tauber
6fc216dff5 Menus: fixed text color of selected menu items that use HTML (issue #87) 2020-04-29 19:22:09 +02:00
Karl Tauber
3f3961d255 fixed broken FlatTestLaf.properties 2020-04-29 19:14:18 +02:00
Karl Tauber
875637bc6d Menus: support switching "underline" menu selection type at any time without updating UI (issue #49) 2020-04-29 14:46:33 +02:00
Karl Tauber
395333cb3d Merge branch 'origin/menu-layout' into master 2020-04-29 13:39:51 +02:00
Karl Tauber
870d039541 hide mnemonics if window is deactivated (e.g. Alt+Tab to another window) (issue #43) 2020-04-29 12:06:00 +02:00
Karl Tauber
e8c8bece3f Menus: support "underline" menu selection type (suggested in issue #49) 2020-04-29 00:26:25 +02:00
Karl Tauber
bd2f5dd6fe Menus: if checkbox/radiobutton menu item is selected and also has a custom icon, then use filled icon background to indicate selection (instead of using checkIcon) (issue #3) 2020-04-28 18:00:01 +02:00
Karl Tauber
73f78d47ae refactored mnemonic code into own class 2020-04-28 12:02:10 +02:00
Karl Tauber
dd2cf50a39 Menus: use simpler method to compute center offset (same as in SwingUtilities.layoutCompoundLabel()), which gives same results and avoids floats 2020-04-27 13:14:11 +02:00
Karl Tauber
06eeced5b2 Menus: made accelerator text in dark themes brighter; updated UI defaults dumps (issue #3) 2020-04-27 12:07:06 +02:00
Karl Tauber
be23e5709d Menus: support alignment and text position properties (issue #3) 2020-04-27 11:52:11 +02:00
Karl Tauber
2735185eb9 Menus: fixed icon in top-level JMenu (issue #3) 2020-04-26 14:20:09 +02:00
Karl Tauber
41dd0acfa3 Menus: use disabled and pressed icons (issue #3) 2020-04-26 11:27:59 +02:00
Karl Tauber
115a2df2b0 Menus: support HTML in new layout (issue #3) 2020-04-26 10:35:23 +02:00
Karl Tauber
fcbb3aeed1 Menus: new menu item layout and renderer
- stable left margin (always space for one icon)
- right aligned accelerators
- larger gap between text and accelerator

current limitations:
- no HTML text support
- text not vertically aligned with other menu items if icons have different sizes
- vertical/horizontal alignment/textPosition properties are ignored

(issues #3 and #54)
2020-04-26 10:13:52 +02:00
87 changed files with 4857 additions and 1034 deletions

View File

@@ -1,6 +1,30 @@
FlatLaf Change Log FlatLaf Change Log
================== ==================
## 0.34
- Menus: New menu item renderer brings stable left margins, right aligned
accelerators and larger gap between text and accelerator. This makes menus
look more modern and more similar to native platform menus.
- New underline menu selection style that displays selected menu items similar
to tabs (to enable use `UIManager.put( "MenuItem.selectionType", "underline"
);`).
- Menus: Fixed text color of selected menu items that use HTML. (issue #87)
- Menus: On Windows, pressing <kbd>F10</kbd> now activates the menu bar without
showing a menu popup (as usual on Windows platform). On other platforms the
first menu popup is shown.
- Menus: On Windows, releasing <kbd>Alt</kbd> key now activates the menu bar (as
usual on Windows platform). (issue #43)
- Menus: Fixed inconsistent left padding in menu items. (issue #3)
- Menus: Fixed: Setting `iconTextGap` property on a menu item did increase left
and right margins. (issue #54)
- Hide mnemonics if window is deactivated (e.g. <kbd>Alt+Tab</kbd> to another
window). (issue #43)
- macOS: Enabled drop shadows for popup menus and combobox popups. (issue #94)
- macOS: Fixed NPE if using `JMenuBar` in `JInternalFrame` and macOS screen menu
bar is enabled (with `-Dapple.laf.useScreenMenuBar=true`). (issue #90)
## 0.33 ## 0.33
- Improved creation of disabled grayscale icons used in disabled buttons, labels - Improved creation of disabled grayscale icons used in disabled buttons, labels

View File

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

View File

@@ -0,0 +1,80 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.function.Predicate;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
/**
* Reorders entries in a JAR file so that .properties files are placed before .class files,
* which is necessary to workaround an issue in NetBeans 11.3 (and older).
* See issues #13 and #93.
*
* @author Karl Tauber
*/
public class ReorderJarEntries
{
public static void reorderJarEntries( File jarFile )
throws IOException
{
ByteArrayOutputStream outStream = new ByteArrayOutputStream( (int) jarFile.length() + 1000 );
try( ZipOutputStream zipOutStream = new ZipOutputStream( outStream ) ) {
// 1st pass: copy .properties files
copyFiles( zipOutStream, jarFile, name -> name.endsWith( ".properties" ) );
// 2st pass: copy other files
copyFiles( zipOutStream, jarFile, name -> !name.endsWith( ".properties" ) );
}
// replace JAR
Files.write( jarFile.toPath(), outStream.toByteArray(),
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING );
}
private static void copyFiles( ZipOutputStream dest, File jarFile, Predicate<String> filter )
throws IOException
{
try( ZipInputStream zipInputStream = new ZipInputStream( new FileInputStream( jarFile ) ) ) {
ZipEntry entry;
while( (entry = zipInputStream.getNextEntry()) != null ) {
if( filter.test( entry.getName() ) ) {
dest.putNextEntry( entry );
copyFile( zipInputStream, dest );
}
}
}
}
private static void copyFile( InputStream src, OutputStream dest )
throws IOException
{
byte[] buf = new byte[8*1024];
int len;
while( (len = src.read( buf )) > 0 )
dest.write( buf, 0, len );
dest.flush();
}
}

View File

@@ -67,6 +67,10 @@ tasks {
include( "module-info.class" ) include( "module-info.class" )
} }
} }
doLast {
ReorderJarEntries.reorderJarEntries( outputs.files.singleFile );
}
} }
javadoc { javadoc {

View File

@@ -0,0 +1,89 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formdev.flatlaf;
/**
* Default color palette for action icons and object icons.
* <p>
* The idea is to use only this well defined set of colors in SVG icons and
* then they are replaced at runtime to dark variants or to other theme colors.
* Then a single SVG icon (light variant) can be used for dark themes too.
* IntelliJ Platform uses this mechanism to allow themes to change IntelliJ Platform icons.
* <p>
* Use the {@code *_DARK} colors only in {@code *_dark.svg} files.
* <p>
* The colors are based on IntelliJ Platform
* <a href="https://jetbrains.design/intellij/principles/icons/#action-icons">Action icons</a>
* and
* <a href="https://jetbrains.design/intellij/principles/icons/#noun-icons">Noun icons</a>
* <p>
* These colors may be changed by IntelliJ Platform themes.
* <p>
* You may use these colors also in your application (outside of SVG icons), but do
* not use the RGB values defined in this enum.<br>
* Instead use {@code UIManager.getColor( FlatIconColors.ACTIONS_GREY.key )}.
*
* @author Karl Tauber
*/
public enum FlatIconColors
{
// colors for action icons
// see https://jetbrains.design/intellij/principles/icons/#action-icons
ACTIONS_RED ( 0xDB5860, "Actions.Red", true, false ),
ACTIONS_RED_DARK ( 0xC75450, "Actions.Red", false, true ),
ACTIONS_YELLOW ( 0xEDA200, "Actions.Yellow", true, false ),
ACTIONS_YELLOW_DARK ( 0xF0A732, "Actions.Yellow", false, true ),
ACTIONS_GREEN ( 0x59A869, "Actions.Green", true, false ),
ACTIONS_GREEN_DARK ( 0x499C54, "Actions.Green", false, true ),
ACTIONS_BLUE ( 0x389FD6, "Actions.Blue", true, false ),
ACTIONS_BLUE_DARK ( 0x3592C4, "Actions.Blue", false, true ),
ACTIONS_GREY ( 0x6E6E6E, "Actions.Grey", true, false ),
ACTIONS_GREY_DARK ( 0xAFB1B3, "Actions.Grey", false, true ),
ACTIONS_GREYINLINE ( 0x7F8B91, "Actions.GreyInline", true, false ),
ACTIONS_GREYINLINE_DARK ( 0x7F8B91, "Actions.GreyInline", false, true ),
// colors for object icons
// see https://jetbrains.design/intellij/principles/icons/#noun-icons
OBJECTS_GREY ( 0x9AA7B0, "Objects.Grey" ),
OBJECTS_BLUE ( 0x40B6E0, "Objects.Blue" ),
OBJECTS_GREEN ( 0x62B543, "Objects.Green" ),
OBJECTS_YELLOW ( 0xF4AF3D, "Objects.Yellow" ),
OBJECTS_YELLOW_DARK ( 0xD9A343, "Objects.YellowDark" ),
OBJECTS_PURPLE ( 0xB99BF8, "Objects.Purple" ),
OBJECTS_PINK ( 0xF98B9E, "Objects.Pink" ),
OBJECTS_RED ( 0xF26522, "Objects.Red" ),
OBJECTS_RED_STATUS ( 0xE05555, "Objects.RedStatus" ),
OBJECTS_GREEN_ANDROID ( 0xA4C639, "Objects.GreenAndroid" ),
OBJECTS_BLACK_TEXT ( 0x231F20, "Objects.BlackText" );
public final int rgb;
public final String key;
public final boolean light;
public final boolean dark;
FlatIconColors( int rgb, String key ) {
this( rgb, key, true, true );
}
FlatIconColors( int rgb, String key, boolean light, boolean dark ) {
this.rgb = rgb;
this.key = key;
this.light = light;
this.dark = dark;
}
}

View File

@@ -85,8 +85,12 @@ class FlatInputMaps
// swap to make it consistent with List and Tree // swap to make it consistent with List and Tree
"HOME", "selectFirstRow", "HOME", "selectFirstRow",
"END", "selectLastRow", "END", "selectLastRow",
"shift HOME", "selectFirstRowExtendSelection",
"shift END", "selectLastRowExtendSelection",
mac( "ctrl HOME", null ), "selectFirstColumn", mac( "ctrl HOME", null ), "selectFirstColumn",
mac( "ctrl END", null ), "selectLastColumn" mac( "ctrl END", null ), "selectLastColumn",
mac( "shift ctrl HOME", null ), "selectFirstColumnExtendSelection",
mac( "shift ctrl END", null ), "selectLastColumnExtendSelection"
); );
if( !SystemInfo.IS_MAC ) { if( !SystemInfo.IS_MAC ) {
@@ -501,6 +505,9 @@ class FlatInputMaps
"alt KP_LEFT", "selectParent", "alt KP_LEFT", "selectParent",
"alt KP_RIGHT", "selectChild", "alt KP_RIGHT", "selectChild",
"shift HOME", "selectFirstExtendSelection",
"shift END", "selectLastExtendSelection",
"meta A", "selectAll", "meta A", "selectAll",
"meta C", "copy", "meta C", "copy",
"meta V", "paste", "meta V", "paste",
@@ -545,8 +552,6 @@ class FlatInputMaps
"shift ctrl SPACE", null, "shift ctrl SPACE", null,
"shift ctrl UP", null, "shift ctrl UP", null,
"shift DELETE", null, "shift DELETE", null,
"shift END", null,
"shift HOME", null,
"shift INSERT", null, "shift INSERT", null,
"shift PAGE_DOWN", null, "shift PAGE_DOWN", null,
"shift PAGE_UP", null, "shift PAGE_UP", null,

View File

@@ -18,22 +18,17 @@ package com.formdev.flatlaf;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Container;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.awt.Font; import java.awt.Font;
import java.awt.Image; import java.awt.Image;
import java.awt.KeyEventPostProcessor;
import java.awt.KeyboardFocusManager;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.Window; import java.awt.Window;
import java.awt.event.KeyEvent;
import java.awt.image.FilteredImageSource; import java.awt.image.FilteredImageSource;
import java.awt.image.ImageFilter; import java.awt.image.ImageFilter;
import java.awt.image.ImageProducer; import java.awt.image.ImageProducer;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -44,13 +39,10 @@ import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.swing.AbstractButton; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JRootPane;
import javax.swing.JTabbedPane;
import javax.swing.LookAndFeel; import javax.swing.LookAndFeel;
import javax.swing.PopupFactory; import javax.swing.PopupFactory;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
@@ -86,9 +78,7 @@ public abstract class FlatLaf
private static boolean aquaLoaded; private static boolean aquaLoaded;
private static boolean updateUIPending; private static boolean updateUIPending;
private KeyEventPostProcessor mnemonicListener; private MnemonicHandler mnemonicHandler;
private static boolean showMnemonics;
private static WeakReference<Window> lastShowMnemonicWindow;
private Consumer<UIDefaults> postInitialization; private Consumer<UIDefaults> postInitialization;
@@ -131,14 +121,10 @@ public abstract class FlatLaf
public Icon getDisabledIcon( JComponent component, Icon icon ) { public Icon getDisabledIcon( JComponent component, Icon icon ) {
if( icon instanceof ImageIcon ) { if( icon instanceof ImageIcon ) {
Object grayFilter = UIManager.get( "Component.grayFilter" ); Object grayFilter = UIManager.get( "Component.grayFilter" );
if( !(grayFilter instanceof ImageFilter) ) { ImageFilter filter = (grayFilter instanceof ImageFilter)
// fallback ? (ImageFilter) grayFilter
grayFilter = isDark() : GrayFilter.createDisabledIconFilter( isDark() ); // fallback
? new GrayFilter( -20, -70, 100 )
: new GrayFilter( 25, -25, 100 );
}
ImageFilter filter = (ImageFilter) grayFilter;
Function<Image, Image> mapper = img -> { Function<Image, Image> mapper = img -> {
ImageProducer producer = new FilteredImageSource( img.getSource(), filter ); ImageProducer producer = new FilteredImageSource( img.getSource(), filter );
return Toolkit.getDefaultToolkit().createImage( producer ); return Toolkit.getDefaultToolkit().createImage( producer );
@@ -158,12 +144,9 @@ public abstract class FlatLaf
super.initialize(); super.initialize();
// add mnemonic listener // install mnemonic handler
mnemonicListener = e -> { mnemonicHandler = new MnemonicHandler();
checkShowMnemonics( e ); mnemonicHandler.install();
return false;
};
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventPostProcessor( mnemonicListener );
// listen to desktop property changes to update UI if system font or scaling changes // listen to desktop property changes to update UI if system font or scaling changes
if( SystemInfo.IS_WINDOWS ) { if( SystemInfo.IS_WINDOWS ) {
@@ -217,10 +200,10 @@ public abstract class FlatLaf
desktopPropertyListener = null; desktopPropertyListener = null;
} }
// remove mnemonic listener // uninstall mnemonic handler
if( mnemonicListener != null ) { if( mnemonicHandler != null ) {
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventPostProcessor( mnemonicListener ); mnemonicHandler.uninstall();
mnemonicListener = null; mnemonicHandler = null;
} }
// restore default link color // restore default link color
@@ -321,9 +304,13 @@ public abstract class FlatLaf
UIDefaultsLoader.loadDefaultsFromProperties( getClass(), addons, getAdditionalDefaults(), isDark(), defaults ); UIDefaultsLoader.loadDefaultsFromProperties( getClass(), addons, getAdditionalDefaults(), isDark(), defaults );
// use Aqua MenuBarUI if Mac screen menubar is enabled // use Aqua MenuBarUI if Mac screen menubar is enabled
if( SystemInfo.IS_MAC && Boolean.getBoolean( "apple.laf.useScreenMenuBar" ) ) if( SystemInfo.IS_MAC && Boolean.getBoolean( "apple.laf.useScreenMenuBar" ) ) {
defaults.put( "MenuBarUI", "com.apple.laf.AquaMenuBarUI" ); defaults.put( "MenuBarUI", "com.apple.laf.AquaMenuBarUI" );
// add defaults necessary for AquaMenuBarUI
defaults.put( "MenuBar.backgroundPainter", BorderFactory.createEmptyBorder() );
}
// initialize text antialiasing // initialize text antialiasing
putAATextInfo( defaults ); putAATextInfo( defaults );
@@ -334,6 +321,11 @@ public abstract class FlatLaf
for( FlatDefaultsAddon addon : addons ) for( FlatDefaultsAddon addon : addons )
addon.afterDefaultsLoading( this, defaults ); addon.afterDefaultsLoading( this, defaults );
// add user scale factor to allow layout managers (e.g. MigLayout) to use it
defaults.put( "laf.scaleFactor", (ActiveValue) t -> {
return UIScale.getUserScaleFactor();
} );
if( postInitialization != null ) { if( postInitialization != null ) {
postInitialization.accept( defaults ); postInitialization.accept( defaults );
postInitialization = null; postInitialization = null;
@@ -422,30 +414,14 @@ public abstract class FlatLaf
* <a href="https://jetbrains.design/intellij/principles/icons/#action-icons">Action icons</a> * <a href="https://jetbrains.design/intellij/principles/icons/#action-icons">Action icons</a>
* and * and
* <a href="https://jetbrains.design/intellij/principles/icons/#noun-icons">Noun icons</a> * <a href="https://jetbrains.design/intellij/principles/icons/#noun-icons">Noun icons</a>
* <p>
* These colors may be changed by IntelliJ Platform themes.
*/ */
public static void initIconColors( UIDefaults defaults, boolean dark ) { public static void initIconColors( UIDefaults defaults, boolean dark ) {
// colors for action icons for( FlatIconColors c : FlatIconColors.values() ) {
// see https://jetbrains.design/intellij/principles/icons/#action-icons if( c.light == !dark || c.dark == dark )
defaults.put( "Actions.Red", new ColorUIResource( !dark ? 0xDB5860 : 0xC75450 ) ); defaults.put( c.key, new ColorUIResource( c.rgb ) );
defaults.put( "Actions.Yellow", new ColorUIResource( !dark ? 0xEDA200 : 0xF0A732 ) ); }
defaults.put( "Actions.Green", new ColorUIResource( !dark ? 0x59A869 : 0x499C54 ) );
defaults.put( "Actions.Blue", new ColorUIResource( !dark ? 0x389FD6 : 0x3592C4 ) );
defaults.put( "Actions.Grey", new ColorUIResource( !dark ? 0x6E6E6E : 0xAFB1B3 ) );
defaults.put( "Actions.GreyInline", new ColorUIResource( !dark ? 0x7F8B91 : 0x7F8B91 ) );
// colors for object icons
// see https://jetbrains.design/intellij/principles/icons/#noun-icons
defaults.put( "Objects.Grey", new ColorUIResource( 0x9AA7B0 ) );
defaults.put( "Objects.Blue", new ColorUIResource( 0x40B6E0 ) );
defaults.put( "Objects.Green", new ColorUIResource( 0x62B543 ) );
defaults.put( "Objects.Yellow", new ColorUIResource( 0xF4AF3D ) );
defaults.put( "Objects.YellowDark", new ColorUIResource( 0xD9A343 ) );
defaults.put( "Objects.Purple", new ColorUIResource( 0xB99BF8 ) );
defaults.put( "Objects.Pink", new ColorUIResource( 0xF98B9E ) );
defaults.put( "Objects.Red", new ColorUIResource( 0xF26522 ) );
defaults.put( "Objects.RedStatus", new ColorUIResource( 0xE05555 ) );
defaults.put( "Objects.GreenAndroid", new ColorUIResource( 0xA4C639 ) );
defaults.put( "Objects.BlackText", new ColorUIResource( 0x231F20 ) );
} }
private void putAATextInfo( UIDefaults defaults ) { private void putAATextInfo( UIDefaults defaults ) {
@@ -535,86 +511,15 @@ public abstract class FlatLaf
} }
public static boolean isShowMnemonics() { public static boolean isShowMnemonics() {
return showMnemonics || !UIManager.getBoolean( "Component.hideMnemonics" ); return MnemonicHandler.isShowMnemonics();
} }
private static void checkShowMnemonics( KeyEvent e ) { public static void showMnemonics( Component c ) {
int keyCode = e.getKeyCode(); MnemonicHandler.showMnemonics( true, c );
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(), e.getComponent() );
} else {
// Alt key must be pressed on Windows and Linux
if( keyCode == KeyEvent.VK_ALT )
showMnemonics( e.getID() == KeyEvent.KEY_PRESSED, e.getComponent() );
}
} }
private static void showMnemonics( boolean show, Component c ) { public static void hideMnemonics() {
if( show == showMnemonics ) MnemonicHandler.showMnemonics( false, null );
return;
showMnemonics = show;
// check whether it is necessary to repaint
if( !UIManager.getBoolean( "Component.hideMnemonics" ) )
return;
if( show ) {
// get root pane
JRootPane rootPane = SwingUtilities.getRootPane( c );
if( rootPane == null )
return;
// get window
Window window = SwingUtilities.getWindowAncestor( rootPane );
if( window == null )
return;
// 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();
if( c instanceof Container )
repaintMnemonics( (Container) c );
}
}
private static boolean hasMnemonic( Component c ) {
if( c instanceof JLabel && ((JLabel)c).getDisplayedMnemonicIndex() >= 0 )
return true;
if( c instanceof AbstractButton && ((AbstractButton)c).getDisplayedMnemonicIndex() >= 0 )
return true;
if( c instanceof JTabbedPane ) {
JTabbedPane tabPane = (JTabbedPane) c;
int tabCount = tabPane.getTabCount();
for( int i = 0; i < tabCount; i++ ) {
if( tabPane.getDisplayedMnemonicIndexAt( i ) >= 0 )
return true;
}
}
return false;
} }
//---- class ActiveFont --------------------------------------------------- //---- class ActiveFont ---------------------------------------------------

View File

@@ -0,0 +1,122 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formdev.flatlaf;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Properties;
/**
* A Flat LaF that is able to load UI defaults from properties passed to the constructor.
* <p>
* Specify the base theme in the properties with {@code @baseTheme=<baseTheme>}.
* Allowed values for {@code <baseTheme>} are {@code light} (the default), {@code dark},
* {@code intellij} or {@code darcula}.
* <p>
* The properties are applied after loading the base theme and may overwrite base properties.
* All features of FlatLaf properties files are available.
*
* @author Karl Tauber
*/
public class FlatPropertiesLaf
extends FlatLaf
{
private final String name;
private final String baseTheme;
private final boolean dark;
private final Properties properties;
public FlatPropertiesLaf( String name, File propertiesFile )
throws IOException
{
this( name, new FileInputStream( propertiesFile ) );
}
public FlatPropertiesLaf( String name, InputStream in )
throws IOException
{
this( name, loadProperties( in ) );
}
private static Properties loadProperties( InputStream in )
throws IOException
{
Properties properties = new Properties();
try( InputStream in2 = in ) {
properties.load( in2 );
}
return properties;
}
public FlatPropertiesLaf( String name, Properties properties ) {
this.name = name;
this.properties = properties;
baseTheme = properties.getProperty( "@baseTheme", "light" );
dark = "dark".equalsIgnoreCase( baseTheme ) || "darcula".equalsIgnoreCase( baseTheme );
}
@Override
public String getName() {
return name;
}
@Override
public String getDescription() {
return name;
}
@Override
public boolean isDark() {
return dark;
}
@Override
protected ArrayList<Class<?>> getLafClassesForDefaultsLoading() {
ArrayList<Class<?>> lafClasses = new ArrayList<>();
lafClasses.add( FlatLaf.class );
switch( baseTheme.toLowerCase() ) {
default:
case "light":
lafClasses.add( FlatLightLaf.class );
break;
case "dark":
lafClasses.add( FlatDarkLaf.class );
break;
case "intellij":
lafClasses.add( FlatLightLaf.class );
lafClasses.add( FlatIntelliJLaf.class );
break;
case "darcula":
lafClasses.add( FlatDarkLaf.class );
lafClasses.add( FlatDarculaLaf.class );
break;
}
return lafClasses;
}
@Override
protected Properties getAdditionalDefaults() {
return properties;
}
}

View File

@@ -240,7 +240,7 @@ public class IntelliJTheme
if( color != null ) { if( color != null ) {
String key = e.getKey(); String key = e.getKey();
namedColors.put( key, color ); namedColors.put( key, color );
defaults.put( "ColorPalette." + e.getKey(), color ); defaults.put( "ColorPalette." + key, color );
} }
} }
} }

View File

@@ -0,0 +1,259 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formdev.flatlaf;
import java.awt.Component;
import java.awt.Container;
import java.awt.EventQueue;
import java.awt.KeyEventPostProcessor;
import java.awt.KeyboardFocusManager;
import java.awt.Window;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.lang.ref.WeakReference;
import javax.swing.AbstractButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JRootPane;
import javax.swing.JTabbedPane;
import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.formdev.flatlaf.util.SystemInfo;
/**
* Show/hide mnemonics.
*
* @author Karl Tauber
*/
class MnemonicHandler
implements KeyEventPostProcessor, ChangeListener
{
private static boolean showMnemonics;
private static WeakReference<Window> lastShowMnemonicWindow;
private static WindowListener windowListener;
static boolean isShowMnemonics() {
return showMnemonics || !UIManager.getBoolean( "Component.hideMnemonics" );
}
void install() {
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventPostProcessor( this );
MenuSelectionManager.defaultManager().addChangeListener( this );
}
void uninstall() {
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventPostProcessor( this );
MenuSelectionManager.defaultManager().removeChangeListener( this );
}
@Override
public boolean postProcessKeyEvent( KeyEvent e ) {
int keyCode = e.getKeyCode();
if( SystemInfo.IS_MAC ) {
// Ctrl+Alt keys must be pressed on Mac
if( keyCode == KeyEvent.VK_CONTROL || keyCode == KeyEvent.VK_ALT )
showMnemonics( shouldShowMnemonics( e ) && e.isControlDown() && e.isAltDown(), e.getComponent() );
} else {
// Alt key must be pressed on Windows and Linux
if( SystemInfo.IS_WINDOWS )
return processKeyEventOnWindows( e );
if( keyCode == KeyEvent.VK_ALT )
showMnemonics( shouldShowMnemonics( e ), e.getComponent() );
}
return false;
}
private boolean shouldShowMnemonics( KeyEvent e ) {
return e.getID() == KeyEvent.KEY_PRESSED ||
MenuSelectionManager.defaultManager().getSelectedPath().length > 0;
}
private static int altPressedEventCount;
private static boolean selectMenuOnAltReleased;
/**
* Special Alt key behavior on Windows.
*
* Press-and-release Alt key selects first menu (if available) and moves focus
* temporary to menu bar. If menu bar has focus (some menu is selected),
* pressing Alt key unselects menu and moves focus back to permanent focus owner.
*/
private boolean processKeyEventOnWindows( KeyEvent e ) {
if( e.getKeyCode() != KeyEvent.VK_ALT ) {
selectMenuOnAltReleased = false;
return false;
}
if( e.getID() == KeyEvent.KEY_PRESSED ) {
altPressedEventCount++;
if( altPressedEventCount == 1 && !e.isConsumed() ) {
MenuSelectionManager menuSelectionManager = MenuSelectionManager.defaultManager();
selectMenuOnAltReleased = (menuSelectionManager.getSelectedPath().length == 0);
// if menu is selected when Alt key is pressed then clear menu selection
if( !selectMenuOnAltReleased )
menuSelectionManager.clearSelectedPath();
}
// show mnemonics
showMnemonics( shouldShowMnemonics( e ), e.getComponent() );
// avoid that the system menu of the window gets focus
e.consume();
return true;
} else if( e.getID() == KeyEvent.KEY_RELEASED ) {
altPressedEventCount = 0;
boolean mnemonicsShown = false;
if( selectMenuOnAltReleased && !e.isConsumed() ) {
MenuSelectionManager menuSelectionManager = MenuSelectionManager.defaultManager();
if( menuSelectionManager.getSelectedPath().length == 0 ) {
// get menu bar and first menu
Component c = e.getComponent();
JRootPane rootPane = SwingUtilities.getRootPane( c );
Window window = (rootPane != null) ? SwingUtilities.getWindowAncestor( rootPane ) : null;
JMenuBar menuBar = (rootPane != null) ? rootPane.getJMenuBar() : null;
if( menuBar == null && window instanceof JFrame )
menuBar = ((JFrame)window).getJMenuBar();
JMenu firstMenu = (menuBar != null) ? menuBar.getMenu( 0 ) : null;
// select first menu and show mnemonics
if( firstMenu != null ) {
menuSelectionManager.setSelectedPath( new MenuElement[] { menuBar, firstMenu } );
showMnemonics( true, c );
mnemonicsShown = true;
}
}
}
selectMenuOnAltReleased = false;
// hide mnemonics
if( !mnemonicsShown )
showMnemonics( shouldShowMnemonics( e ), e.getComponent() );
}
return false;
}
@Override
public void stateChanged( ChangeEvent e ) {
MenuElement[] selectedPath = MenuSelectionManager.defaultManager().getSelectedPath();
if( selectedPath.length == 0 && altPressedEventCount == 0 ) {
// hide mnemonics when menu selection was canceled
showMnemonics( false, null );
}
}
static void showMnemonics( boolean show, Component c ) {
if( show == showMnemonics )
return;
showMnemonics = show;
// check whether it is necessary to repaint
if( !UIManager.getBoolean( "Component.hideMnemonics" ) )
return;
if( show ) {
// get root pane
JRootPane rootPane = SwingUtilities.getRootPane( c );
if( rootPane == null )
return;
// get window
Window window = SwingUtilities.getWindowAncestor( rootPane );
if( window == null )
return;
// repaint components with mnemonics in focused window
repaintMnemonics( window );
// hide mnemonics if window is deactivated (e.g. Alt+Tab to another window)
windowListener = new WindowAdapter() {
@Override
public void windowDeactivated( WindowEvent e ) {
altPressedEventCount = 0;
selectMenuOnAltReleased = false;
// use invokeLater() to avoid that the listener is removed
// while the listener queue is iterated to fire this event
EventQueue.invokeLater( () -> {
showMnemonics( false, null );
} );
}
};
window.addWindowListener( windowListener );
lastShowMnemonicWindow = new WeakReference<>( window );
} else if( lastShowMnemonicWindow != null ) {
Window window = lastShowMnemonicWindow.get();
if( window != null ) {
repaintMnemonics( window );
if( windowListener != null ) {
window.removeWindowListener( windowListener );
windowListener = null;
}
}
lastShowMnemonicWindow = null;
}
}
private static void repaintMnemonics( Container container ) {
for( Component c : container.getComponents() ) {
if( !c.isVisible() )
continue;
if( hasMnemonic( c ) )
c.repaint();
if( c instanceof Container )
repaintMnemonics( (Container) c );
}
}
private static boolean hasMnemonic( Component c ) {
if( c instanceof JLabel && ((JLabel)c).getDisplayedMnemonicIndex() >= 0 )
return true;
if( c instanceof AbstractButton && ((AbstractButton)c).getDisplayedMnemonicIndex() >= 0 )
return true;
if( c instanceof JTabbedPane ) {
JTabbedPane tabPane = (JTabbedPane) c;
int tabCount = tabPane.getTabCount();
for( int i = 0; i < tabCount; i++ ) {
if( tabPane.getDisplayedMnemonicIndexAt( i ) >= 0 )
return true;
}
}
return false;
}
}

View File

@@ -63,8 +63,6 @@ class UIDefaultsLoader
private static final String TYPE_PREFIX = "{"; private static final String TYPE_PREFIX = "{";
private static final String TYPE_PREFIX_END = "}"; private static final String TYPE_PREFIX_END = "}";
private static final String VARIABLE_PREFIX = "@"; private static final String VARIABLE_PREFIX = "@";
@Deprecated
private static final String REF_PREFIX = VARIABLE_PREFIX + "@";
private static final String PROPERTY_PREFIX = "$"; private static final String PROPERTY_PREFIX = "$";
private static final String OPTIONAL_PREFIX = "?"; private static final String OPTIONAL_PREFIX = "?";
private static final String GLOBAL_PREFIX = "*."; private static final String GLOBAL_PREFIX = "*.";
@@ -213,12 +211,6 @@ class UIDefaultsLoader
else if( !value.startsWith( VARIABLE_PREFIX ) ) else if( !value.startsWith( VARIABLE_PREFIX ) )
return value; return value;
// for compatibility
if( value.startsWith( REF_PREFIX ) ) {
FlatLaf.LOG.log( Level.WARNING, "FlatLaf: Usage of '@@' in .properties files is deprecated. Use '$' instead." );
value = value.substring( REF_PREFIX.length() );
}
boolean optional = false; boolean optional = false;
if( value.startsWith( OPTIONAL_PREFIX ) ) { if( value.startsWith( OPTIONAL_PREFIX ) ) {
value = value.substring( OPTIONAL_PREFIX.length() ); value = value.substring( OPTIONAL_PREFIX.length() );
@@ -515,8 +507,8 @@ class UIDefaultsLoader
throw new IllegalArgumentException( "missing parameters in function '" + value + "'" ); throw new IllegalArgumentException( "missing parameters in function '" + value + "'" );
switch( function ) { switch( function ) {
case "rgb": return parseColorRgbOrRgba( false, params ); case "rgb": return parseColorRgbOrRgba( false, params, resolver, reportError );
case "rgba": return parseColorRgbOrRgba( true, params ); case "rgba": return parseColorRgbOrRgba( true, params, resolver, reportError );
case "hsl": return parseColorHslOrHsla( false, params ); case "hsl": return parseColorHslOrHsla( false, params );
case "hsla": return parseColorHslOrHsla( true, params ); case "hsla": return parseColorHslOrHsla( true, params );
case "lighten": return parseColorLightenOrDarken( true, params, resolver, reportError ); case "lighten": return parseColorLightenOrDarken( true, params, resolver, reportError );
@@ -527,17 +519,28 @@ class UIDefaultsLoader
} }
/** /**
* Syntax: rgb(red,green,blue) or rgba(red,green,blue,alpha) * Syntax: rgb(red,green,blue) or rgba(red,green,blue,alpha) or rgba(color,alpha)
* - red: an integer 0-255 * - red: an integer 0-255 or a percentage 0-100%
* - green: an integer 0-255 * - green: an integer 0-255 or a percentage 0-100%
* - blue: an integer 0-255 * - blue: an integer 0-255 or a percentage 0-100%
* - alpha: an integer 0-255 * - alpha: an integer 0-255 or a percentage 0-100%
*/ */
private static ColorUIResource parseColorRgbOrRgba( boolean hasAlpha, List<String> params ) { private static ColorUIResource parseColorRgbOrRgba( boolean hasAlpha, List<String> params,
int red = parseInteger( params.get( 0 ), 0, 255 ); Function<String, String> resolver, boolean reportError )
int green = parseInteger( params.get( 1 ), 0, 255 ); {
int blue = parseInteger( params.get( 2 ), 0, 255 ); if( hasAlpha && params.size() == 2 ) {
int alpha = hasAlpha ? parseInteger( params.get( 3 ), 0, 255 ) : 255; // syntax rgba(color,alpha), which allows adding alpha to any color
String colorStr = params.get( 0 );
int alpha = parseInteger( params.get( 1 ), 0, 255, true );
ColorUIResource color = (ColorUIResource) parseColorOrFunction( resolver.apply( colorStr ), resolver, reportError );
return new ColorUIResource( new Color( ((alpha & 0xff) << 24) | (color.getRGB() & 0xffffff), true ) );
}
int red = parseInteger( params.get( 0 ), 0, 255, true );
int green = parseInteger( params.get( 1 ), 0, 255, true );
int blue = parseInteger( params.get( 2 ), 0, 255, true );
int alpha = hasAlpha ? parseInteger( params.get( 3 ), 0, 255, true ) : 255;
return hasAlpha return hasAlpha
? new ColorUIResource( new Color( red, green, blue, alpha ) ) ? new ColorUIResource( new Color( red, green, blue, alpha ) )
@@ -552,7 +555,7 @@ class UIDefaultsLoader
* - alpha: a percentage 0-100% * - alpha: a percentage 0-100%
*/ */
private static ColorUIResource parseColorHslOrHsla( boolean hasAlpha, List<String> params ) { private static ColorUIResource parseColorHslOrHsla( boolean hasAlpha, List<String> params ) {
int hue = parseInteger( params.get( 0 ), 0, 360 ); int hue = parseInteger( params.get( 0 ), 0, 360, false );
int saturation = parsePercentage( params.get( 1 ) ); int saturation = parsePercentage( params.get( 1 ) );
int lightness = parsePercentage( params.get( 2 ) ); int lightness = parsePercentage( params.get( 2 ) );
int alpha = hasAlpha ? parsePercentage( params.get( 3 ) ) : 100; int alpha = hasAlpha ? parsePercentage( params.get( 3 ) ) : 100;
@@ -629,7 +632,12 @@ class UIDefaultsLoader
return value.charAt( 0 ); return value.charAt( 0 );
} }
private static Integer parseInteger( String value, int min, int max ) { private static Integer parseInteger( String value, int min, int max, boolean allowPercentage ) {
if( allowPercentage && value.endsWith( "%" ) ) {
int percent = parsePercentage( value );
return (max * percent) / 100;
}
Integer integer = parseInteger( value, true ); Integer integer = parseInteger( value, true );
if( integer.intValue() < min || integer.intValue() > max ) if( integer.intValue() < min || integer.intValue() > max )
throw new NumberFormatException( "integer '" + value + "' out of range (" + min + '-' + max + ')' ); throw new NumberFormatException( "integer '" + value + "' out of range (" + min + '-' + max + ')' );

View File

@@ -30,7 +30,8 @@ import javax.swing.UIManager;
* *
* @uiDefault MenuItemCheckBox.icon.checkmarkColor Color * @uiDefault MenuItemCheckBox.icon.checkmarkColor Color
* @uiDefault MenuItemCheckBox.icon.disabledCheckmarkColor Color * @uiDefault MenuItemCheckBox.icon.disabledCheckmarkColor Color
* @uiDefault Menu.selectionForeground Color * @uiDefault MenuItem.selectionForeground Color
* @uiDefault MenuItem.selectionType String
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
@@ -39,7 +40,7 @@ public class FlatCheckBoxMenuItemIcon
{ {
protected final Color checkmarkColor = UIManager.getColor( "MenuItemCheckBox.icon.checkmarkColor" ); protected final Color checkmarkColor = UIManager.getColor( "MenuItemCheckBox.icon.checkmarkColor" );
protected final Color disabledCheckmarkColor = UIManager.getColor( "MenuItemCheckBox.icon.disabledCheckmarkColor" ); protected final Color disabledCheckmarkColor = UIManager.getColor( "MenuItemCheckBox.icon.disabledCheckmarkColor" );
protected final Color selectionForeground = UIManager.getColor( "Menu.selectionForeground" ); protected final Color selectionForeground = UIManager.getColor( "MenuItem.selectionForeground" );
public FlatCheckBoxMenuItemIcon() { public FlatCheckBoxMenuItemIcon() {
super( 15, 15, null ); super( 15, 15, null );
@@ -67,9 +68,14 @@ public class FlatCheckBoxMenuItemIcon
} }
private Color getCheckmarkColor( Component c ) { private Color getCheckmarkColor( Component c ) {
if( c instanceof JMenuItem && ((JMenuItem)c).isArmed() ) if( c instanceof JMenuItem && ((JMenuItem)c).isArmed() && !isUnderlineSelection() )
return selectionForeground; return selectionForeground;
return c.isEnabled() ? checkmarkColor : disabledCheckmarkColor; return c.isEnabled() ? checkmarkColor : disabledCheckmarkColor;
} }
private boolean isUnderlineSelection() {
// not storing value of "MenuItem.selectionType" in class to allow changing at runtime
return "underline".equals( UIManager.getString( "MenuItem.selectionType" ) );
}
} }

View File

@@ -32,6 +32,7 @@ import com.formdev.flatlaf.ui.FlatUIUtils;
* @uiDefault Menu.icon.arrowColor Color * @uiDefault Menu.icon.arrowColor Color
* @uiDefault Menu.icon.disabledArrowColor Color * @uiDefault Menu.icon.disabledArrowColor Color
* @uiDefault Menu.selectionForeground Color * @uiDefault Menu.selectionForeground Color
* @uiDefault MenuItem.selectionType String
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
@@ -65,9 +66,14 @@ public class FlatMenuArrowIcon
} }
private Color getArrowColor( Component c ) { private Color getArrowColor( Component c ) {
if( c instanceof JMenu && ((JMenu)c).isSelected() ) if( c instanceof JMenu && ((JMenu)c).isSelected() && !isUnderlineSelection() )
return selectionForeground; return selectionForeground;
return c.isEnabled() ? arrowColor : disabledArrowColor; return c.isEnabled() ? arrowColor : disabledArrowColor;
} }
private boolean isUnderlineSelection() {
// not storing value of "MenuItem.selectionType" in class to allow changing at runtime
return "underline".equals( UIManager.getString( "MenuItem.selectionType" ) );
}
} }

View File

@@ -16,12 +16,11 @@
package com.formdev.flatlaf.ui; package com.formdev.flatlaf.ui;
import static com.formdev.flatlaf.util.UIScale.scale; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Rectangle; import javax.swing.Icon;
import java.beans.PropertyChangeListener;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JMenuItem; import javax.swing.LookAndFeel;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI; import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI;
@@ -30,29 +29,34 @@ import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI;
* *
* <!-- BasicCheckBoxMenuItemUI --> * <!-- BasicCheckBoxMenuItemUI -->
* *
* @uiDefault CheckBoxMenuItem.font Font * @uiDefault CheckBoxMenuItem.font Font
* @uiDefault CheckBoxMenuItem.background Color * @uiDefault CheckBoxMenuItem.background Color
* @uiDefault CheckBoxMenuItem.foreground Color * @uiDefault CheckBoxMenuItem.foreground Color
* @uiDefault CheckBoxMenuItem.disabledForeground Color * @uiDefault CheckBoxMenuItem.disabledForeground Color
* @uiDefault CheckBoxMenuItem.selectionBackground Color * @uiDefault CheckBoxMenuItem.selectionBackground Color
* @uiDefault CheckBoxMenuItem.selectionForeground Color * @uiDefault CheckBoxMenuItem.selectionForeground Color
* @uiDefault CheckBoxMenuItem.acceleratorForeground Color * @uiDefault CheckBoxMenuItem.acceleratorForeground Color
* @uiDefault CheckBoxMenuItem.acceleratorSelectionForeground Color * @uiDefault CheckBoxMenuItem.acceleratorSelectionForeground Color
* @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font * @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font
* @uiDefault MenuItem.acceleratorDelimiter String * @uiDefault MenuItem.acceleratorDelimiter String
* @uiDefault CheckBoxMenuItem.border Border * @uiDefault CheckBoxMenuItem.border Border
* @uiDefault CheckBoxMenuItem.borderPainted boolean * @uiDefault CheckBoxMenuItem.borderPainted boolean
* @uiDefault CheckBoxMenuItem.margin Insets * @uiDefault CheckBoxMenuItem.margin Insets
* @uiDefault CheckBoxMenuItem.arrowIcon Icon * @uiDefault CheckBoxMenuItem.arrowIcon Icon
* @uiDefault CheckBoxMenuItem.checkIcon Icon * @uiDefault CheckBoxMenuItem.checkIcon Icon
* @uiDefault CheckBoxMenuItem.opaque boolean * @uiDefault CheckBoxMenuItem.opaque boolean
* @uiDefault CheckBoxMenuItem.evenHeight boolean *
* <!-- FlatCheckBoxMenuItemUI -->
*
* @uiDefault MenuItem.iconTextGap int
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatCheckBoxMenuItemUI public class FlatCheckBoxMenuItemUI
extends BasicCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI
{ {
private FlatMenuItemRenderer renderer;
public static ComponentUI createUI( JComponent c ) { public static ComponentUI createUI( JComponent c ) {
return new FlatCheckBoxMenuItemUI(); return new FlatCheckBoxMenuItemUI();
} }
@@ -61,25 +65,30 @@ public class FlatCheckBoxMenuItemUI
protected void installDefaults() { protected void installDefaults() {
super.installDefaults(); super.installDefaults();
// scale LookAndFeel.installProperty( menuItem, "iconTextGap", FlatUIUtils.getUIInt( "MenuItem.iconTextGap", 4 ) );
defaultTextIconGap = scale( defaultTextIconGap );
}
/** renderer = createRenderer();
* Scale defaultTextIconGap again if iconTextGap property has changed.
*/
@Override
protected PropertyChangeListener createPropertyChangeListener( JComponent c ) {
PropertyChangeListener superListener = super.createPropertyChangeListener( c );
return e -> {
superListener.propertyChange( e );
if( e.getPropertyName() == "iconTextGap" )
defaultTextIconGap = scale( defaultTextIconGap );
};
} }
@Override @Override
protected void paintText( Graphics g, JMenuItem menuItem, Rectangle textRect, String text ) { protected void uninstallDefaults() {
FlatMenuItemUI.paintText( g, menuItem, textRect, text, disabledForeground, selectionForeground ); super.uninstallDefaults();
renderer = null;
}
protected FlatMenuItemRenderer createRenderer() {
return new FlatMenuItemRenderer( menuItem, checkIcon, arrowIcon, acceleratorFont, acceleratorDelimiter );
}
@Override
protected Dimension getPreferredMenuItemSize( JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap ) {
return renderer.getPreferredMenuItemSize();
}
@Override
public void paint( Graphics g, JComponent c ) {
renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground,
acceleratorForeground, acceleratorSelectionForeground );
} }
} }

View File

@@ -48,6 +48,14 @@ public class FlatLineBorder
this.lineThickness = lineThickness; this.lineThickness = lineThickness;
} }
public Color getLineColor() {
return lineColor;
}
public float getLineThickness() {
return lineThickness;
}
@Override @Override
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) { public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
Graphics2D g2 = (Graphics2D) g.create(); Graphics2D g2 = (Graphics2D) g.create();

View File

@@ -16,9 +16,20 @@
package com.formdev.flatlaf.ui; package com.formdev.flatlaf.ui;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;
import javax.swing.SwingUtilities;
import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicMenuBarUI; import javax.swing.plaf.basic.BasicMenuBarUI;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.util.SystemInfo;
/** /**
* Provides the Flat LaF UI delegate for {@link javax.swing.JMenuBar}. * Provides the Flat LaF UI delegate for {@link javax.swing.JMenuBar}.
@@ -38,4 +49,45 @@ public class FlatMenuBarUI
public static ComponentUI createUI( JComponent c ) { public static ComponentUI createUI( JComponent c ) {
return new FlatMenuBarUI(); return new FlatMenuBarUI();
} }
/*
* WARNING: This class is not used on macOS if screen menu bar is enabled.
* Do not add any functionality here.
*/
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
ActionMap map = SwingUtilities.getUIActionMap( menuBar );
if( map == null ) {
map = new ActionMapUIResource();
SwingUtilities.replaceUIActionMap( menuBar, map );
}
map.put( "takeFocus", new TakeFocus() );
}
//---- class TakeFocus ----------------------------------------------------
/**
* Activates the menu bar and shows mnemonics.
* On Windows, the popup of the first menu is not shown.
* On other platforms, the popup of the first menu is shown.
*/
private static class TakeFocus
extends AbstractAction
{
@Override
public void actionPerformed( ActionEvent e ) {
JMenuBar menuBar = (JMenuBar) e.getSource();
JMenu menu = menuBar.getMenu( 0 );
if( menu != null ) {
MenuSelectionManager.defaultManager().setSelectedPath( SystemInfo.IS_WINDOWS
? new MenuElement[] { menuBar, menu }
: new MenuElement[] { menuBar, menu, menu.getPopupMenu() } );
FlatLaf.showMnemonics( menuBar );
}
}
}
} }

View File

@@ -0,0 +1,516 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formdev.flatlaf.ui;
import static com.formdev.flatlaf.util.UIScale.scale;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.text.AttributedCharacterIterator;
import javax.swing.Icon;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.View;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.util.Graphics2DProxy;
/**
* Renderer for menu items.
*
* @uiDefault MenuItem.minimumWidth int
* @uiDefault MenuItem.minimumIconSize Dimension
* @uiDefault MenuItem.textAcceleratorGap int
* @uiDefault MenuItem.textNoAcceleratorGap int
* @uiDefault MenuItem.acceleratorArrowGap int
* @uiDefault MenuItem.checkBackground Color
* @uiDefault MenuItem.underlineSelectionBackground Color
* @uiDefault MenuItem.underlineSelectionCheckBackground Color
* @uiDefault MenuItem.underlineSelectionColor Color
* @uiDefault MenuItem.underlineSelectionHeight Color
*
* @author Karl Tauber
*/
public class FlatMenuItemRenderer
{
protected final JMenuItem menuItem;
protected final Icon checkIcon;
protected final Icon arrowIcon;
protected final Font acceleratorFont;
protected final String acceleratorDelimiter;
protected final int minimumWidth = UIManager.getInt( "MenuItem.minimumWidth" );
protected final Dimension minimumIconSize;
protected final int textAcceleratorGap = FlatUIUtils.getUIInt( "MenuItem.textAcceleratorGap", 28 );
protected final int textNoAcceleratorGap = FlatUIUtils.getUIInt( "MenuItem.textNoAcceleratorGap", 6 );
protected final int acceleratorArrowGap = FlatUIUtils.getUIInt( "MenuItem.acceleratorArrowGap", 2 );
protected final Color checkBackground = UIManager.getColor( "MenuItem.checkBackground" );
protected final Insets checkMargins = UIManager.getInsets( "MenuItem.checkMargins" );
protected final Color underlineSelectionBackground = UIManager.getColor( "MenuItem.underlineSelectionBackground" );
protected final Color underlineSelectionCheckBackground = UIManager.getColor( "MenuItem.underlineSelectionCheckBackground" );
protected final Color underlineSelectionColor = UIManager.getColor( "MenuItem.underlineSelectionColor" );
protected final int underlineSelectionHeight = UIManager.getInt( "MenuItem.underlineSelectionHeight" );
protected FlatMenuItemRenderer( JMenuItem menuItem, Icon checkIcon, Icon arrowIcon,
Font acceleratorFont, String acceleratorDelimiter )
{
this.menuItem = menuItem;
this.checkIcon = checkIcon;
this.arrowIcon = arrowIcon;
this.acceleratorFont = acceleratorFont;
this.acceleratorDelimiter = acceleratorDelimiter;
Dimension minimumIconSize = UIManager.getDimension( "MenuItem.minimumIconSize" );
this.minimumIconSize = (minimumIconSize != null) ? minimumIconSize : new Dimension( 16, 16 );
}
protected Dimension getPreferredMenuItemSize() {
int width = 0;
int height = 0;
boolean isTopLevelMenu = isTopLevelMenu( menuItem );
Rectangle viewRect = new Rectangle( 0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE );
Rectangle iconRect = new Rectangle();
Rectangle textRect = new Rectangle();
// layout icon and text
SwingUtilities.layoutCompoundLabel( menuItem,
menuItem.getFontMetrics( menuItem.getFont() ), menuItem.getText(), getIconForLayout(),
menuItem.getVerticalAlignment(), menuItem.getHorizontalAlignment(),
menuItem.getVerticalTextPosition(), menuItem.getHorizontalTextPosition(),
viewRect, iconRect, textRect, scale( menuItem.getIconTextGap() ) );
// union icon and text rectangles
Rectangle labelRect = iconRect.union( textRect );
width += labelRect.width;
height = Math.max( labelRect.height, height );
// accelerator size
String accelText = getAcceleratorText();
if( accelText != null ) {
// gap between text and accelerator
width += scale( !isTopLevelMenu ? textAcceleratorGap : menuItem.getIconTextGap() );
FontMetrics accelFm = menuItem.getFontMetrics( acceleratorFont );
width += SwingUtilities.computeStringWidth( accelFm, accelText );
height = Math.max( accelFm.getHeight(), height );
}
// arrow size
if( !isTopLevelMenu && arrowIcon != null ) {
// gap between text and arrow
if( accelText == null )
width += scale( textNoAcceleratorGap );
// gap between accelerator and arrow
width += scale( acceleratorArrowGap );
width += arrowIcon.getIconWidth();
height = Math.max( arrowIcon.getIconHeight(), height );
}
// add insets
Insets insets = menuItem.getInsets();
width += insets.left + insets.right;
height += insets.top + insets.bottom;
// minimum width
if( !isTopLevelMenu ) {
int minimumWidth = FlatUIUtils.minimumWidth( menuItem, this.minimumWidth );
width = Math.max( width, scale( minimumWidth ) );
}
return new Dimension( width, height );
}
private void layout( Rectangle viewRect, Rectangle iconRect, Rectangle textRect,
Rectangle accelRect, Rectangle arrowRect, Rectangle labelRect )
{
boolean isTopLevelMenu = isTopLevelMenu( menuItem );
// layout arrow
if( !isTopLevelMenu && arrowIcon != null ) {
arrowRect.width = arrowIcon.getIconWidth();
arrowRect.height = arrowIcon.getIconHeight();
} else
arrowRect.setSize( 0, 0 );
arrowRect.y = viewRect.y + centerOffset( viewRect.height, arrowRect.height );
// layout accelerator
String accelText = getAcceleratorText();
if( accelText != null ) {
FontMetrics accelFm = menuItem.getFontMetrics( acceleratorFont );
accelRect.width = SwingUtilities.computeStringWidth( accelFm, accelText );
accelRect.height = accelFm.getHeight();
accelRect.y = viewRect.y + centerOffset( viewRect.height, accelRect.height );
} else
accelRect.setBounds( 0, 0, 0, 0 );
// compute horizontal positions of accelerator and arrow
int accelArrowGap = !isTopLevelMenu ? scale( acceleratorArrowGap ) : 0;
if( menuItem.getComponentOrientation().isLeftToRight() ) {
// left-to-right
arrowRect.x = viewRect.x + viewRect.width - arrowRect.width;
accelRect.x = arrowRect.x - accelArrowGap - accelRect.width;
} else {
// right-to-left
arrowRect.x = viewRect.x;
accelRect.x = arrowRect.x + accelArrowGap + arrowRect.width;
}
// width of accelerator, arrow and gap
int accelArrowWidth = accelRect.width + arrowRect.width;
if( accelText != null )
accelArrowWidth += scale( !isTopLevelMenu ? textAcceleratorGap : menuItem.getIconTextGap() );
if( !isTopLevelMenu && arrowIcon != null ) {
if( accelText == null )
accelArrowWidth += scale( textNoAcceleratorGap );
accelArrowWidth += scale( acceleratorArrowGap );
}
// label rectangle is view rectangle subtracted by accelerator, arrow and gap
labelRect.setBounds( viewRect );
labelRect.width -= accelArrowWidth;
if( !menuItem.getComponentOrientation().isLeftToRight() )
labelRect.x += accelArrowWidth;
// layout icon and text
SwingUtilities.layoutCompoundLabel( menuItem,
menuItem.getFontMetrics( menuItem.getFont() ), menuItem.getText(), getIconForLayout(),
menuItem.getVerticalAlignment(), menuItem.getHorizontalAlignment(),
menuItem.getVerticalTextPosition(), menuItem.getHorizontalTextPosition(),
labelRect, iconRect, textRect, scale( menuItem.getIconTextGap() ) );
}
private static int centerOffset( int wh1, int wh2 ) {
return (wh1 / 2) - (wh2 / 2);
}
protected void paintMenuItem( Graphics g, Color selectionBackground, Color selectionForeground,
Color disabledForeground, Color acceleratorForeground, Color acceleratorSelectionForeground )
{
Rectangle viewRect = new Rectangle( menuItem.getWidth(), menuItem.getHeight() );
// subtract insets
Insets insets = menuItem.getInsets();
viewRect.x += insets.left;
viewRect.y += insets.top;
viewRect.width -= (insets.left + insets.right);
viewRect.height -= (insets.top + insets.bottom);
Rectangle iconRect = new Rectangle();
Rectangle textRect = new Rectangle();
Rectangle accelRect = new Rectangle();
Rectangle arrowRect = new Rectangle();
Rectangle labelRect = new Rectangle();
layout( viewRect, iconRect, textRect, accelRect, arrowRect, labelRect );
/*debug
g.setColor( Color.green ); g.drawRect( viewRect.x, viewRect.y, viewRect.width - 1, viewRect.height - 1 );
g.setColor( Color.red ); g.drawRect( labelRect.x, labelRect.y, labelRect.width - 1, labelRect.height - 1 );
g.setColor( Color.blue ); g.drawRect( iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1 );
g.setColor( Color.cyan ); g.drawRect( textRect.x, textRect.y, textRect.width - 1, textRect.height - 1 );
g.setColor( Color.magenta ); g.drawRect( accelRect.x, accelRect.y, accelRect.width - 1, accelRect.height - 1 );
g.setColor( Color.orange ); g.drawRect( arrowRect.x, arrowRect.y, arrowRect.width - 1, arrowRect.height - 1 );
debug*/
paintBackground( g, selectionBackground );
paintIcon( g, iconRect, getIconForPainting() );
paintText( g, textRect, menuItem.getText(), selectionForeground, disabledForeground );
paintAccelerator( g, accelRect, getAcceleratorText(), acceleratorForeground, acceleratorSelectionForeground, disabledForeground );
if( !isTopLevelMenu( menuItem ) )
paintArrowIcon( g, arrowRect, arrowIcon );
}
protected void paintBackground( Graphics g, Color selectionBackground ) {
boolean armedOrSelected = isArmedOrSelected( menuItem );
if( menuItem.isOpaque() || armedOrSelected ) {
int width = menuItem.getWidth();
int height = menuItem.getHeight();
// paint background
g.setColor( armedOrSelected
? (isUnderlineSelection() ? underlineSelectionBackground : selectionBackground)
: menuItem.getBackground() );
g.fillRect( 0, 0, width, height );
// paint underline
if( armedOrSelected && isUnderlineSelection() ) {
int underlineHeight = scale( underlineSelectionHeight );
g.setColor( underlineSelectionColor );
if( isTopLevelMenu( menuItem ) ) {
// paint underline at bottom
g.fillRect( 0, height - underlineHeight, width, underlineHeight );
} else if( menuItem.getComponentOrientation().isLeftToRight() ) {
// paint underline at left side
g.fillRect( 0, 0, underlineHeight, height );
} else {
// paint underline at right side
g.fillRect( width - underlineHeight, 0, underlineHeight, height );
}
}
}
}
protected void paintIcon( Graphics g, Rectangle iconRect, Icon icon ) {
// if checkbox/radiobutton menu item is selected and also has a custom icon,
// then use filled icon background to indicate selection (instead of using checkIcon)
if( menuItem.isSelected() && checkIcon != null && icon != checkIcon ) {
Rectangle r = FlatUIUtils.addInsets( iconRect, scale( checkMargins ) );
g.setColor( isUnderlineSelection() ? underlineSelectionCheckBackground : checkBackground );
g.fillRect( r.x, r.y, r.width, r.height );
}
paintIcon( g, menuItem, icon, iconRect );
}
protected void paintText( Graphics g, Rectangle textRect, String text, Color selectionForeground, Color disabledForeground ) {
View htmlView = (View) menuItem.getClientProperty( BasicHTML.propertyKey );
if( htmlView != null ) {
paintHTMLText( g, menuItem, textRect, htmlView, isUnderlineSelection() ? null : selectionForeground );
return;
}
int mnemonicIndex = FlatLaf.isShowMnemonics() ? menuItem.getDisplayedMnemonicIndex() : -1;
Color foreground = menuItem.getForeground();
paintText( g, menuItem, textRect, text, mnemonicIndex, menuItem.getFont(),
foreground, isUnderlineSelection() ? foreground : selectionForeground, disabledForeground );
}
protected void paintAccelerator( Graphics g, Rectangle accelRect, String accelText,
Color foreground, Color selectionForeground, Color disabledForeground )
{
paintText( g, menuItem, accelRect, accelText, -1, acceleratorFont,
foreground, isUnderlineSelection() ? foreground : selectionForeground, disabledForeground );
}
protected void paintArrowIcon( Graphics g, Rectangle arrowRect, Icon arrowIcon ) {
paintIcon( g, menuItem, arrowIcon, arrowRect );
}
protected static void paintIcon( Graphics g, JMenuItem menuItem, Icon icon, Rectangle iconRect ) {
if( icon == null )
return;
// center because the real icon may be smaller than dimension in iconRect
int x = iconRect.x + centerOffset( iconRect.width, icon.getIconWidth() );
int y = iconRect.y + centerOffset( iconRect.height, icon.getIconHeight() );
// paint
icon.paintIcon( menuItem, g, x, y );
}
protected static void paintText( Graphics g, JMenuItem menuItem,
Rectangle textRect, String text, int mnemonicIndex, Font font,
Color foreground, Color selectionForeground, Color disabledForeground )
{
if( text == null || text.isEmpty() )
return;
FontMetrics fm = menuItem.getFontMetrics( font );
Font oldFont = g.getFont();
g.setFont( font );
g.setColor( !menuItem.isEnabled()
? disabledForeground
: (isArmedOrSelected( menuItem )
? selectionForeground
: foreground) );
FlatUIUtils.drawStringUnderlineCharAt( menuItem, g, text, mnemonicIndex,
textRect.x, textRect.y + fm.getAscent() );
g.setFont( oldFont );
}
protected static void paintHTMLText( Graphics g, JMenuItem menuItem,
Rectangle textRect, View htmlView, Color selectionForeground )
{
if( isArmedOrSelected( menuItem ) && selectionForeground != null )
g = new GraphicsProxyWithTextColor( (Graphics2D) g, selectionForeground );
htmlView.paint( g, textRect );
}
protected static boolean isArmedOrSelected( JMenuItem menuItem ) {
return menuItem.isArmed() || (menuItem instanceof JMenu && menuItem.isSelected());
}
protected static boolean isTopLevelMenu( JMenuItem menuItem ) {
return menuItem instanceof JMenu && ((JMenu)menuItem).isTopLevelMenu();
}
private boolean isUnderlineSelection() {
return "underline".equals( UIManager.getString( "MenuItem.selectionType" ) );
}
private Icon getIconForPainting() {
Icon icon = menuItem.getIcon();
if( icon == null && checkIcon != null && !isTopLevelMenu( menuItem ) )
return checkIcon;
if( icon == null )
return null;
if( !menuItem.isEnabled() )
return menuItem.getDisabledIcon();
if( menuItem.getModel().isPressed() && menuItem.isArmed() ) {
Icon pressedIcon = menuItem.getPressedIcon();
if( pressedIcon != null )
return pressedIcon;
}
return icon;
}
private Icon getIconForLayout() {
Icon icon = menuItem.getIcon();
if( isTopLevelMenu( menuItem ) )
return (icon != null) ? new MinSizeIcon( icon ) : null;
return new MinSizeIcon( (icon != null) ? icon : checkIcon );
}
private KeyStroke cachedAccelerator;
private String cachedAcceleratorText;
private String getAcceleratorText() {
KeyStroke accelerator = menuItem.getAccelerator();
if( accelerator == null )
return null;
if( accelerator == cachedAccelerator )
return cachedAcceleratorText;
StringBuilder buf = new StringBuilder();
int modifiers = accelerator.getModifiers();
if( modifiers != 0 )
buf.append( InputEvent.getModifiersExText( modifiers ) ).append( acceleratorDelimiter );
int keyCode = accelerator.getKeyCode();
if( keyCode != 0 )
buf.append( KeyEvent.getKeyText( keyCode ) );
else
buf.append( accelerator.getKeyChar() );
cachedAccelerator = accelerator;
cachedAcceleratorText = buf.toString();
return cachedAcceleratorText;
}
//---- class MinSizeIcon --------------------------------------------------
private class MinSizeIcon
implements Icon
{
private final Icon delegate;
MinSizeIcon( Icon delegate ) {
this.delegate = delegate;
}
@Override
public int getIconWidth() {
int iconWidth = (delegate != null) ? delegate.getIconWidth() : 0;
return Math.max( iconWidth, scale( minimumIconSize.width ) );
}
@Override
public int getIconHeight() {
int iconHeight = (delegate != null) ? delegate.getIconHeight() : 0;
return Math.max( iconHeight, scale( minimumIconSize.height ) );
}
@Override
public void paintIcon( Component c, Graphics g, int x, int y ) {
}
}
//---- class GraphicsProxyWithTextColor -----------------------------------
private static class GraphicsProxyWithTextColor
extends Graphics2DProxy
{
private final Color textColor;
GraphicsProxyWithTextColor( Graphics2D delegate, Color textColor ) {
super( delegate );
this.textColor = textColor;
}
@Override
public void drawString( String str, int x, int y ) {
Paint oldPaint = getPaint();
setPaint( textColor );
super.drawString( str, x, y );
setPaint( oldPaint );
}
@Override
public void drawString( String str, float x, float y ) {
Paint oldPaint = getPaint();
setPaint( textColor );
super.drawString( str, x, y );
setPaint( oldPaint );
}
@Override
public void drawString( AttributedCharacterIterator iterator, int x, int y ) {
Paint oldPaint = getPaint();
setPaint( textColor );
super.drawString( iterator, x, y );
setPaint( oldPaint );
}
@Override
public void drawString( AttributedCharacterIterator iterator, float x, float y ) {
Paint oldPaint = getPaint();
setPaint( textColor );
super.drawString( iterator, x, y );
setPaint( oldPaint );
}
@Override
public void drawChars( char[] data, int offset, int length, int x, int y ) {
Paint oldPaint = getPaint();
setPaint( textColor );
super.drawChars( data, offset, length, x, y );
setPaint( oldPaint );
}
}
}

View File

@@ -16,48 +16,47 @@
package com.formdev.flatlaf.ui; package com.formdev.flatlaf.ui;
import static com.formdev.flatlaf.util.UIScale.scale; import java.awt.Dimension;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Rectangle; import javax.swing.Icon;
import java.beans.PropertyChangeListener;
import javax.swing.ButtonModel;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JMenu; import javax.swing.LookAndFeel;
import javax.swing.JMenuItem;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicMenuItemUI; import javax.swing.plaf.basic.BasicMenuItemUI;
import com.formdev.flatlaf.FlatLaf;
/** /**
* Provides the Flat LaF UI delegate for {@link javax.swing.JMenuItem}. * Provides the Flat LaF UI delegate for {@link javax.swing.JMenuItem}.
* *
* <!-- BasicMenuItemUI --> * <!-- BasicMenuItemUI -->
* *
* @uiDefault MenuItem.font Font * @uiDefault MenuItem.font Font
* @uiDefault MenuItem.background Color * @uiDefault MenuItem.background Color
* @uiDefault MenuItem.foreground Color * @uiDefault MenuItem.foreground Color
* @uiDefault MenuItem.disabledForeground Color * @uiDefault MenuItem.disabledForeground Color
* @uiDefault MenuItem.selectionBackground Color * @uiDefault MenuItem.selectionBackground Color
* @uiDefault MenuItem.selectionForeground Color * @uiDefault MenuItem.selectionForeground Color
* @uiDefault MenuItem.acceleratorForeground Color * @uiDefault MenuItem.acceleratorForeground Color
* @uiDefault MenuItem.acceleratorSelectionForeground Color * @uiDefault MenuItem.acceleratorSelectionForeground Color
* @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font * @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font
* @uiDefault MenuItem.acceleratorDelimiter String * @uiDefault MenuItem.acceleratorDelimiter String
* @uiDefault MenuItem.border Border * @uiDefault MenuItem.border Border
* @uiDefault MenuItem.borderPainted boolean * @uiDefault MenuItem.borderPainted boolean
* @uiDefault MenuItem.margin Insets * @uiDefault MenuItem.margin Insets
* @uiDefault MenuItem.arrowIcon Icon * @uiDefault MenuItem.arrowIcon Icon
* @uiDefault MenuItem.checkIcon Icon * @uiDefault MenuItem.checkIcon Icon
* @uiDefault MenuItem.opaque boolean * @uiDefault MenuItem.opaque boolean
* @uiDefault MenuItem.evenHeight boolean *
* <!-- FlatMenuItemUI -->
*
* @uiDefault MenuItem.iconTextGap int
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatMenuItemUI public class FlatMenuItemUI
extends BasicMenuItemUI extends BasicMenuItemUI
{ {
private FlatMenuItemRenderer renderer;
public static ComponentUI createUI( JComponent c ) { public static ComponentUI createUI( JComponent c ) {
return new FlatMenuItemUI(); return new FlatMenuItemUI();
} }
@@ -66,42 +65,30 @@ public class FlatMenuItemUI
protected void installDefaults() { protected void installDefaults() {
super.installDefaults(); super.installDefaults();
// scale LookAndFeel.installProperty( menuItem, "iconTextGap", FlatUIUtils.getUIInt( "MenuItem.iconTextGap", 4 ) );
defaultTextIconGap = scale( defaultTextIconGap );
}
/** renderer = createRenderer();
* Scale defaultTextIconGap again if iconTextGap property has changed.
*/
@Override
protected PropertyChangeListener createPropertyChangeListener( JComponent c ) {
PropertyChangeListener superListener = super.createPropertyChangeListener( c );
return e -> {
superListener.propertyChange( e );
if( e.getPropertyName() == "iconTextGap" )
defaultTextIconGap = scale( defaultTextIconGap );
};
} }
@Override @Override
protected void paintText( Graphics g, JMenuItem menuItem, Rectangle textRect, String text ) { protected void uninstallDefaults() {
paintText( g, menuItem, textRect, text, disabledForeground, selectionForeground ); super.uninstallDefaults();
renderer = null;
} }
public static void paintText( Graphics g, JMenuItem menuItem, Rectangle textRect, protected FlatMenuItemRenderer createRenderer() {
String text, Color disabledForeground, Color selectionForeground ) return new FlatMenuItemRenderer( menuItem, checkIcon, arrowIcon, acceleratorFont, acceleratorDelimiter );
{ }
FontMetrics fm = menuItem.getFontMetrics( menuItem.getFont() );
int mnemonicIndex = FlatLaf.isShowMnemonics() ? menuItem.getDisplayedMnemonicIndex() : -1;
ButtonModel model = menuItem.getModel(); @Override
g.setColor( !model.isEnabled() protected Dimension getPreferredMenuItemSize( JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap ) {
? disabledForeground return renderer.getPreferredMenuItemSize();
: (model.isArmed() || (menuItem instanceof JMenu && model.isSelected()) }
? selectionForeground
: menuItem.getForeground()) );
FlatUIUtils.drawStringUnderlineCharAt( menuItem, g, text, mnemonicIndex, @Override
textRect.x, textRect.y + fm.getAscent() ); public void paint( Graphics g, JComponent c ) {
renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground,
acceleratorForeground, acceleratorSelectionForeground );
} }
} }

View File

@@ -16,16 +16,17 @@
package com.formdev.flatlaf.ui; package com.formdev.flatlaf.ui;
import static com.formdev.flatlaf.util.UIScale.scale;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.beans.PropertyChangeListener;
import javax.swing.ButtonModel; import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JMenu; import javax.swing.JMenu;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
import javax.swing.LookAndFeel;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.event.MouseInputListener; import javax.swing.event.MouseInputListener;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
@@ -36,30 +37,30 @@ import javax.swing.plaf.basic.BasicMenuUI;
* *
* <!-- BasicMenuUI --> * <!-- BasicMenuUI -->
* *
* @uiDefault Menu.font Font * @uiDefault Menu.font Font
* @uiDefault Menu.background Color * @uiDefault Menu.background Color
* @uiDefault Menu.foreground Color * @uiDefault Menu.foreground Color
* @uiDefault Menu.disabledForeground Color * @uiDefault Menu.disabledForeground Color
* @uiDefault Menu.selectionBackground Color * @uiDefault Menu.selectionBackground Color
* @uiDefault Menu.selectionForeground Color * @uiDefault Menu.selectionForeground Color
* @uiDefault Menu.acceleratorForeground Color * @uiDefault Menu.acceleratorForeground Color
* @uiDefault Menu.acceleratorSelectionForeground Color * @uiDefault Menu.acceleratorSelectionForeground Color
* @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font * @uiDefault MenuItem.acceleratorFont Font defaults to MenuItem.font
* @uiDefault MenuItem.acceleratorDelimiter String * @uiDefault MenuItem.acceleratorDelimiter String
* @uiDefault Menu.border Border * @uiDefault Menu.border Border
* @uiDefault Menu.borderPainted boolean * @uiDefault Menu.borderPainted boolean
* @uiDefault Menu.margin Insets * @uiDefault Menu.margin Insets
* @uiDefault Menu.arrowIcon Icon * @uiDefault Menu.arrowIcon Icon
* @uiDefault Menu.checkIcon Icon * @uiDefault Menu.checkIcon Icon
* @uiDefault Menu.opaque boolean * @uiDefault Menu.opaque boolean
* @uiDefault Menu.evenHeight boolean * @uiDefault Menu.crossMenuMnemonic boolean default is false
* @uiDefault Menu.crossMenuMnemonic boolean default is false * @uiDefault Menu.useMenuBarBackgroundForTopLevel boolean default is false
* @uiDefault Menu.useMenuBarBackgroundForTopLevel boolean default is false * @uiDefault MenuBar.background Color used if Menu.useMenuBarBackgroundForTopLevel is true
* @uiDefault MenuBar.background Color used if Menu.useMenuBarBackgroundForTopLevel is true
* *
* <!-- FlatMenuUI --> * <!-- FlatMenuUI -->
* *
* @uiDefault MenuBar.hoverBackground Color * @uiDefault MenuItem.iconTextGap int
* @uiDefault MenuBar.hoverBackground Color
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
@@ -67,6 +68,7 @@ public class FlatMenuUI
extends BasicMenuUI extends BasicMenuUI
{ {
private Color hoverBackground; private Color hoverBackground;
private FlatMenuItemRenderer renderer;
public static ComponentUI createUI( JComponent c ) { public static ComponentUI createUI( JComponent c ) {
return new FlatMenuUI(); return new FlatMenuUI();
@@ -76,12 +78,12 @@ public class FlatMenuUI
protected void installDefaults() { protected void installDefaults() {
super.installDefaults(); super.installDefaults();
LookAndFeel.installProperty( menuItem, "iconTextGap", FlatUIUtils.getUIInt( "MenuItem.iconTextGap", 4 ) );
menuItem.setRolloverEnabled( true ); menuItem.setRolloverEnabled( true );
hoverBackground = UIManager.getColor( "MenuBar.hoverBackground" ); hoverBackground = UIManager.getColor( "MenuBar.hoverBackground" );
renderer = createRenderer();
// scale
defaultTextIconGap = scale( defaultTextIconGap );
} }
@Override @Override
@@ -89,19 +91,11 @@ public class FlatMenuUI
super.uninstallDefaults(); super.uninstallDefaults();
hoverBackground = null; hoverBackground = null;
renderer = null;
} }
/** protected FlatMenuItemRenderer createRenderer() {
* Scale defaultTextIconGap again if iconTextGap property has changed. return new FlatMenuRenderer( menuItem, checkIcon, arrowIcon, acceleratorFont, acceleratorDelimiter );
*/
@Override
protected PropertyChangeListener createPropertyChangeListener( JComponent c ) {
PropertyChangeListener superListener = super.createPropertyChangeListener( c );
return e -> {
superListener.propertyChange( e );
if( e.getPropertyName() == "iconTextGap" )
defaultTextIconGap = scale( defaultTextIconGap );
};
} }
@Override @Override
@@ -130,19 +124,37 @@ public class FlatMenuUI
} }
@Override @Override
protected void paintBackground( Graphics g, JMenuItem menuItem, Color bgColor ) { protected Dimension getPreferredMenuItemSize( JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap ) {
ButtonModel model = menuItem.getModel(); return renderer.getPreferredMenuItemSize();
if( model.isArmed() || model.isSelected() ) {
super.paintBackground( g, menuItem, bgColor );
} else if( model.isRollover() && model.isEnabled() && ((JMenu)menuItem).isTopLevelMenu() ) {
FlatUIUtils.setColor( g, hoverBackground, menuItem.getBackground() );
g.fillRect( 0, 0, menuItem.getWidth(), menuItem.getHeight() );
} else
super.paintBackground( g, menuItem, bgColor );
} }
@Override @Override
protected void paintText( Graphics g, JMenuItem menuItem, Rectangle textRect, String text ) { public void paint( Graphics g, JComponent c ) {
FlatMenuItemUI.paintText( g, menuItem, textRect, text, disabledForeground, selectionForeground ); renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground,
acceleratorForeground, acceleratorSelectionForeground );
}
//---- class FlatMenuRenderer ---------------------------------------------
protected class FlatMenuRenderer
extends FlatMenuItemRenderer
{
protected FlatMenuRenderer( JMenuItem menuItem, Icon checkIcon, Icon arrowIcon,
Font acceleratorFont, String acceleratorDelimiter )
{
super( menuItem, checkIcon, arrowIcon, acceleratorFont, acceleratorDelimiter );
}
@Override
protected void paintBackground( Graphics g, Color selectionBackground ) {
ButtonModel model = menuItem.getModel();
if( model.isRollover() && !model.isArmed() && !model.isSelected() &&
model.isEnabled() && ((JMenu)menuItem).isTopLevelMenu() )
{
FlatUIUtils.setColor( g, hoverBackground, menuItem.getBackground() );
g.fillRect( 0, 0, menuItem.getWidth(), menuItem.getHeight() );
} else
super.paintBackground( g, selectionBackground );
}
} }
} }

View File

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

View File

@@ -16,12 +16,11 @@
package com.formdev.flatlaf.ui; package com.formdev.flatlaf.ui;
import static com.formdev.flatlaf.util.UIScale.scale; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Rectangle; import javax.swing.Icon;
import java.beans.PropertyChangeListener;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JMenuItem; import javax.swing.LookAndFeel;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicRadioButtonMenuItemUI; import javax.swing.plaf.basic.BasicRadioButtonMenuItemUI;
@@ -46,13 +45,18 @@ import javax.swing.plaf.basic.BasicRadioButtonMenuItemUI;
* @uiDefault RadioButtonMenuItem.arrowIcon Icon * @uiDefault RadioButtonMenuItem.arrowIcon Icon
* @uiDefault RadioButtonMenuItem.checkIcon Icon * @uiDefault RadioButtonMenuItem.checkIcon Icon
* @uiDefault RadioButtonMenuItem.opaque boolean * @uiDefault RadioButtonMenuItem.opaque boolean
* @uiDefault RadioButtonMenuItem.evenHeight boolean *
* <!-- FlatRadioButtonMenuItemUI -->
*
* @uiDefault MenuItem.iconTextGap int
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatRadioButtonMenuItemUI public class FlatRadioButtonMenuItemUI
extends BasicRadioButtonMenuItemUI extends BasicRadioButtonMenuItemUI
{ {
private FlatMenuItemRenderer renderer;
public static ComponentUI createUI( JComponent c ) { public static ComponentUI createUI( JComponent c ) {
return new FlatRadioButtonMenuItemUI(); return new FlatRadioButtonMenuItemUI();
} }
@@ -61,25 +65,30 @@ public class FlatRadioButtonMenuItemUI
protected void installDefaults() { protected void installDefaults() {
super.installDefaults(); super.installDefaults();
// scale LookAndFeel.installProperty( menuItem, "iconTextGap", FlatUIUtils.getUIInt( "MenuItem.iconTextGap", 4 ) );
defaultTextIconGap = scale( defaultTextIconGap );
}
/** renderer = createRenderer();
* Scale defaultTextIconGap again if iconTextGap property has changed.
*/
@Override
protected PropertyChangeListener createPropertyChangeListener( JComponent c ) {
PropertyChangeListener superListener = super.createPropertyChangeListener( c );
return e -> {
superListener.propertyChange( e );
if( e.getPropertyName() == "iconTextGap" )
defaultTextIconGap = scale( defaultTextIconGap );
};
} }
@Override @Override
protected void paintText( Graphics g, JMenuItem menuItem, Rectangle textRect, String text ) { protected void uninstallDefaults() {
FlatMenuItemUI.paintText( g, menuItem, textRect, text, disabledForeground, selectionForeground ); super.uninstallDefaults();
renderer = null;
}
protected FlatMenuItemRenderer createRenderer() {
return new FlatMenuItemRenderer( menuItem, checkIcon, arrowIcon, acceleratorFont, acceleratorDelimiter );
}
@Override
protected Dimension getPreferredMenuItemSize( JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap ) {
return renderer.getPreferredMenuItemSize();
}
@Override
public void paint( Graphics g, JComponent c ) {
renderer.paintMenuItem( g, selectionBackground, selectionForeground, disabledForeground,
acceleratorForeground, acceleratorSelectionForeground );
} }
} }

View File

@@ -27,6 +27,7 @@ import javax.swing.JComponent;
import javax.swing.JToolTip; import javax.swing.JToolTip;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.plaf.basic.BasicToolTipUI; import javax.swing.plaf.basic.BasicToolTipUI;
import com.formdev.flatlaf.util.StringUtils; import com.formdev.flatlaf.util.StringUtils;
@@ -134,6 +135,6 @@ public class FlatToolTipUI
private boolean isMultiLine( JComponent c ) { private boolean isMultiLine( JComponent c ) {
String text = ((JToolTip)c).getTipText(); String text = ((JToolTip)c).getTipText();
return c.getClientProperty( "html" ) == null && text != null && text.indexOf( '\n' ) >= 0; return c.getClientProperty( BasicHTML.propertyKey ) == null && text != null && text.indexOf( '\n' ) >= 0;
} }
} }

View File

@@ -42,6 +42,7 @@ import javax.swing.UIManager;
import javax.swing.plaf.UIResource; import javax.swing.plaf.UIResource;
import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.util.DerivedColor; import com.formdev.flatlaf.util.DerivedColor;
import com.formdev.flatlaf.util.Graphics2DProxy;
import com.formdev.flatlaf.util.HiDPIUtils; import com.formdev.flatlaf.util.HiDPIUtils;
import com.formdev.flatlaf.util.JavaCompatibility; import com.formdev.flatlaf.util.JavaCompatibility;
import com.formdev.flatlaf.util.UIScale; import com.formdev.flatlaf.util.UIScale;
@@ -427,6 +428,23 @@ public class FlatUIUtils
public static void drawStringUnderlineCharAt( JComponent c, Graphics g, public static void drawStringUnderlineCharAt( JComponent c, Graphics g,
String text, int underlinedIndex, int x, int y ) String text, int underlinedIndex, int x, int y )
{ {
// scale underline height if necessary
if( underlinedIndex >= 0 && UIScale.getUserScaleFactor() > 1 ) {
g = new Graphics2DProxy( (Graphics2D) g ) {
@Override
public void fillRect( int x, int y, int width, int height ) {
if( height == 1 ) {
// scale height and correct y position
// (using 0.9f so that underline height is 1 at scale factor 1.5x)
height = Math.round( UIScale.scale( 0.9f ) );
y += height - 1;
}
super.fillRect( x, y, width, height );
}
};
}
JavaCompatibility.drawStringUnderlineCharAt( c, g, text, underlinedIndex, x, y ); JavaCompatibility.drawStringUnderlineCharAt( c, g, text, underlinedIndex, x, y );
} }

View File

@@ -0,0 +1,479 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formdev.flatlaf.util;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.Image;
import java.awt.Paint;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.RenderingHints.Key;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
import java.awt.image.ImageObserver;
import java.awt.image.RenderedImage;
import java.awt.image.renderable.RenderableImage;
import java.text.AttributedCharacterIterator;
import java.util.Map;
/**
* A proxy for {@link Graphics2D}.
*
* @author Karl Tauber
*/
public class Graphics2DProxy
extends Graphics2D
{
private final Graphics2D delegate;
public Graphics2DProxy( Graphics2D delegate ) {
this.delegate = delegate;
}
@Override
public Graphics create() {
return delegate.create();
}
@Override
public Graphics create( int x, int y, int width, int height ) {
return delegate.create( x, y, width, height );
}
@Override
public Color getColor() {
return delegate.getColor();
}
@Override
public void setColor( Color c ) {
delegate.setColor( c );
}
@Override
public void setPaintMode() {
delegate.setPaintMode();
}
@Override
public void setXORMode( Color c1 ) {
delegate.setXORMode( c1 );
}
@Override
public Font getFont() {
return delegate.getFont();
}
@Override
public void setFont( Font font ) {
delegate.setFont( font );
}
@Override
public FontMetrics getFontMetrics() {
return delegate.getFontMetrics();
}
@Override
public FontMetrics getFontMetrics( Font f ) {
return delegate.getFontMetrics( f );
}
@Override
public Rectangle getClipBounds() {
return delegate.getClipBounds();
}
@Override
public void clipRect( int x, int y, int width, int height ) {
delegate.clipRect( x, y, width, height );
}
@Override
public void setClip( int x, int y, int width, int height ) {
delegate.setClip( x, y, width, height );
}
@Override
public Shape getClip() {
return delegate.getClip();
}
@Override
public void setClip( Shape clip ) {
delegate.setClip( clip );
}
@Override
public void copyArea( int x, int y, int width, int height, int dx, int dy ) {
delegate.copyArea( x, y, width, height, dx, dy );
}
@Override
public void drawLine( int x1, int y1, int x2, int y2 ) {
delegate.drawLine( x1, y1, x2, y2 );
}
@Override
public void fillRect( int x, int y, int width, int height ) {
delegate.fillRect( x, y, width, height );
}
@Override
public void drawRect( int x, int y, int width, int height ) {
delegate.drawRect( x, y, width, height );
}
@Override
public void clearRect( int x, int y, int width, int height ) {
delegate.clearRect( x, y, width, height );
}
@Override
public void drawRoundRect( int x, int y, int width, int height, int arcWidth, int arcHeight ) {
delegate.drawRoundRect( x, y, width, height, arcWidth, arcHeight );
}
@Override
public void fillRoundRect( int x, int y, int width, int height, int arcWidth, int arcHeight ) {
delegate.fillRoundRect( x, y, width, height, arcWidth, arcHeight );
}
@Override
public void drawOval( int x, int y, int width, int height ) {
delegate.drawOval( x, y, width, height );
}
@Override
public void fillOval( int x, int y, int width, int height ) {
delegate.fillOval( x, y, width, height );
}
@Override
public void drawArc( int x, int y, int width, int height, int startAngle, int arcAngle ) {
delegate.drawArc( x, y, width, height, startAngle, arcAngle );
}
@Override
public void fillArc( int x, int y, int width, int height, int startAngle, int arcAngle ) {
delegate.fillArc( x, y, width, height, startAngle, arcAngle );
}
@Override
public void drawPolyline( int[] xPoints, int[] yPoints, int nPoints ) {
delegate.drawPolyline( xPoints, yPoints, nPoints );
}
@Override
public void drawPolygon( int[] xPoints, int[] yPoints, int nPoints ) {
delegate.drawPolygon( xPoints, yPoints, nPoints );
}
@Override
public void drawPolygon( Polygon p ) {
delegate.drawPolygon( p );
}
@Override
public void fillPolygon( int[] xPoints, int[] yPoints, int nPoints ) {
delegate.fillPolygon( xPoints, yPoints, nPoints );
}
@Override
public void fillPolygon( Polygon p ) {
delegate.fillPolygon( p );
}
@Override
public void drawChars( char[] data, int offset, int length, int x, int y ) {
delegate.drawChars( data, offset, length, x, y );
}
@Override
public void drawBytes( byte[] data, int offset, int length, int x, int y ) {
delegate.drawBytes( data, offset, length, x, y );
}
@Override
public boolean drawImage( Image img, int x, int y, ImageObserver observer ) {
return delegate.drawImage( img, x, y, observer );
}
@Override
public boolean drawImage( Image img, int x, int y, int width, int height, ImageObserver observer ) {
return delegate.drawImage( img, x, y, width, height, observer );
}
@Override
public boolean drawImage( Image img, int x, int y, Color bgcolor, ImageObserver observer ) {
return delegate.drawImage( img, x, y, bgcolor, observer );
}
@Override
public boolean drawImage( Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer ) {
return delegate.drawImage( img, x, y, width, height, bgcolor, observer );
}
@Override
public boolean drawImage( Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer ) {
return delegate.drawImage( img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer );
}
@Override
public boolean drawImage( Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer ) {
return delegate.drawImage( img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bgcolor, observer );
}
@Override
public void dispose() {
delegate.dispose();
}
@Override
public void finalize() {
delegate.finalize();
}
@Override
public String toString() {
return delegate.toString();
}
@SuppressWarnings( "deprecation" )
@Override
public Rectangle getClipRect() {
return delegate.getClipRect();
}
@Override
public boolean hitClip( int x, int y, int width, int height ) {
return delegate.hitClip( x, y, width, height );
}
@Override
public Rectangle getClipBounds( Rectangle r ) {
return delegate.getClipBounds( r );
}
@Override
public void draw3DRect( int x, int y, int width, int height, boolean raised ) {
delegate.draw3DRect( x, y, width, height, raised );
}
@Override
public void fill3DRect( int x, int y, int width, int height, boolean raised ) {
delegate.fill3DRect( x, y, width, height, raised );
}
@Override
public void draw( Shape s ) {
delegate.draw( s );
}
@Override
public boolean drawImage( Image img, AffineTransform xform, ImageObserver obs ) {
return delegate.drawImage( img, xform, obs );
}
@Override
public void drawImage( BufferedImage img, BufferedImageOp op, int x, int y ) {
delegate.drawImage( img, op, x, y );
}
@Override
public void drawRenderedImage( RenderedImage img, AffineTransform xform ) {
delegate.drawRenderedImage( img, xform );
}
@Override
public void drawRenderableImage( RenderableImage img, AffineTransform xform ) {
delegate.drawRenderableImage( img, xform );
}
@Override
public void drawString( String str, int x, int y ) {
delegate.drawString( str, x, y );
}
@Override
public void drawString( String str, float x, float y ) {
delegate.drawString( str, x, y );
}
@Override
public void drawString( AttributedCharacterIterator iterator, int x, int y ) {
delegate.drawString( iterator, x, y );
}
@Override
public void drawString( AttributedCharacterIterator iterator, float x, float y ) {
delegate.drawString( iterator, x, y );
}
@Override
public void drawGlyphVector( GlyphVector g, float x, float y ) {
delegate.drawGlyphVector( g, x, y );
}
@Override
public void fill( Shape s ) {
delegate.fill( s );
}
@Override
public boolean hit( Rectangle rect, Shape s, boolean onStroke ) {
return delegate.hit( rect, s, onStroke );
}
@Override
public GraphicsConfiguration getDeviceConfiguration() {
return delegate.getDeviceConfiguration();
}
@Override
public void setComposite( Composite comp ) {
delegate.setComposite( comp );
}
@Override
public void setPaint( Paint paint ) {
delegate.setPaint( paint );
}
@Override
public void setStroke( Stroke s ) {
delegate.setStroke( s );
}
@Override
public void setRenderingHint( Key hintKey, Object hintValue ) {
delegate.setRenderingHint( hintKey, hintValue );
}
@Override
public Object getRenderingHint( Key hintKey ) {
return delegate.getRenderingHint( hintKey );
}
@Override
public void setRenderingHints( Map<?, ?> hints ) {
delegate.setRenderingHints( hints );
}
@Override
public void addRenderingHints( Map<?, ?> hints ) {
delegate.addRenderingHints( hints );
}
@Override
public RenderingHints getRenderingHints() {
return delegate.getRenderingHints();
}
@Override
public void translate( int x, int y ) {
delegate.translate( x, y );
}
@Override
public void translate( double tx, double ty ) {
delegate.translate( tx, ty );
}
@Override
public void rotate( double theta ) {
delegate.rotate( theta );
}
@Override
public void rotate( double theta, double x, double y ) {
delegate.rotate( theta, x, y );
}
@Override
public void scale( double sx, double sy ) {
delegate.scale( sx, sy );
}
@Override
public void shear( double shx, double shy ) {
delegate.shear( shx, shy );
}
@Override
public void transform( AffineTransform Tx ) {
delegate.transform( Tx );
}
@Override
public void setTransform( AffineTransform Tx ) {
delegate.setTransform( Tx );
}
@Override
public AffineTransform getTransform() {
return delegate.getTransform();
}
@Override
public Paint getPaint() {
return delegate.getPaint();
}
@Override
public Composite getComposite() {
return delegate.getComposite();
}
@Override
public void setBackground( Color color ) {
delegate.setBackground( color );
}
@Override
public Color getBackground() {
return delegate.getBackground();
}
@Override
public Stroke getStroke() {
return delegate.getStroke();
}
@Override
public void clip( Shape s ) {
delegate.clip( s );
}
@Override
public FontRenderContext getFontRenderContext() {
return delegate.getFontRenderContext();
}
}

View File

@@ -19,6 +19,12 @@ public class GrayFilter
private final int origContrast; private final int origContrast;
private final int origBrightness; private final int origBrightness;
public static GrayFilter createDisabledIconFilter( boolean dark ) {
return dark
? new GrayFilter( -20, -70, 100 )
: new GrayFilter( 25, -25, 100 );
}
/** /**
* @param brightness in range [-100..100] where 0 has no effect * @param brightness in range [-100..100] where 0 has no effect
* @param contrast in range [-100..100] where 0 has no effect * @param contrast in range [-100..100] where 0 has no effect

View File

@@ -29,6 +29,9 @@
@disabledText=#777777 @disabledText=#777777
@textComponentBackground=#45494A @textComponentBackground=#45494A
@menuBackground=darken(@background,5%) @menuBackground=darken(@background,5%)
@menuHoverBackground=lighten(@menuBackground,10%)
@menuCheckBackground=lighten(@menuBackground,10%)
@menuCheckHoverBackground=lighten(@menuBackground,20%)
@cellFocusColor=#000000 @cellFocusColor=#000000
@icon=#adadad @icon=#adadad
@@ -53,7 +56,7 @@
*.disabledBackground=@background *.disabledBackground=@background
*.disabledForeground=@disabledText *.disabledForeground=@disabledText
*.disabledText=@disabledText *.disabledText=@disabledText
*.acceleratorForeground=#bbbbbb *.acceleratorForeground=darken(@foreground,15%)
*.acceleratorSelectionForeground=@selectionForeground *.acceleratorSelectionForeground=@selectionForeground
@@ -170,7 +173,7 @@ Menu.icon.disabledArrowColor=#606060
#---- MenuBar ---- #---- MenuBar ----
MenuBar.borderColor=#515151 MenuBar.borderColor=#515151
MenuBar.hoverBackground=lighten($MenuBar.background,10%) MenuBar.hoverBackground=@menuHoverBackground
#---- MenuItemCheckBox ---- #---- MenuItemCheckBox ----

View File

@@ -64,7 +64,7 @@ ViewportUI=com.formdev.flatlaf.ui.FlatViewportUI
#---- variables ---- #---- variables ----
@textComponentMargin=2,6,2,6 @textComponentMargin=2,6,2,6
@menuItemMargin=2,8,2,8 @menuItemMargin=3,6,3,6
#---- system colors ---- #---- system colors ----
@@ -299,7 +299,7 @@ Menu.background=@menuBackground
MenuBar.border=com.formdev.flatlaf.ui.FlatMenuBarBorder MenuBar.border=com.formdev.flatlaf.ui.FlatMenuBarBorder
MenuBar.background=@menuBackground MenuBar.background=@menuBackground
MenuBar.itemMargins=3,3,3,3 MenuBar.itemMargins=3,8,3,8
#---- MenuItem ---- #---- MenuItem ----
@@ -311,9 +311,23 @@ MenuItem.margin=@menuItemMargin
MenuItem.opaque=false MenuItem.opaque=false
MenuItem.borderPainted=true MenuItem.borderPainted=true
MenuItem.background=@menuBackground MenuItem.background=@menuBackground
MenuItem.checkBackground=@menuCheckBackground
MenuItem.checkMargins=2,2,2,2
MenuItem.minimumWidth=72
MenuItem.minimumIconSize=16,16
MenuItem.iconTextGap=6
MenuItem.textAcceleratorGap=24
MenuItem.textNoAcceleratorGap=6
MenuItem.acceleratorArrowGap=2
MenuItem.acceleratorDelimiter=- MenuItem.acceleratorDelimiter=-
[mac]MenuItem.acceleratorDelimiter= [mac]MenuItem.acceleratorDelimiter=
# for MenuItem.selectionType=underline
MenuItem.underlineSelectionBackground=@menuHoverBackground
MenuItem.underlineSelectionCheckBackground=@menuCheckHoverBackground
MenuItem.underlineSelectionColor=$TabbedPane.underlineColor
MenuItem.underlineSelectionHeight=3
#---- OptionPane ---- #---- OptionPane ----
@@ -577,14 +591,6 @@ ToolBar.spacingBorder=$Button.toolbar.spacingInsets
ToolTipManager.enableToolTipMode=activeApplication ToolTipManager.enableToolTipMode=activeApplication
#---- ToolTip ----
ToolTip.border=4,6,4,6,$Component.borderColor
ToolTip.borderInactive=null
ToolTip.backgroundInactive=$ToolTip.background
ToolTip.foregroundInactive=@disabledText
#---- Tree ---- #---- Tree ----
Tree.border=1,1,1,1 Tree.border=1,1,1,1

View File

@@ -29,6 +29,9 @@
@disabledText=#8C8C8C @disabledText=#8C8C8C
@textComponentBackground=#ffffff @textComponentBackground=#ffffff
@menuBackground=#fff @menuBackground=#fff
@menuHoverBackground=darken(@menuBackground,10%)
@menuCheckBackground=darken(@menuBackground,10%)
@menuCheckHoverBackground=darken(@menuBackground,20%)
@cellFocusColor=#000000 @cellFocusColor=#000000
@icon=#afafaf @icon=#afafaf
@@ -53,7 +56,7 @@
*.disabledBackground=@background *.disabledBackground=@background
*.disabledForeground=@disabledText *.disabledForeground=@disabledText
*.disabledText=@disabledText *.disabledText=@disabledText
*.acceleratorForeground=#505050 *.acceleratorForeground=lighten(@foreground,30%)
*.acceleratorSelectionForeground=@selectionForeground *.acceleratorSelectionForeground=@selectionForeground
@@ -177,7 +180,7 @@ Menu.icon.disabledArrowColor=#ABABAB
#---- MenuBar ---- #---- MenuBar ----
MenuBar.borderColor=#cdcdcd MenuBar.borderColor=#cdcdcd
MenuBar.hoverBackground=darken($MenuBar.background,10%) MenuBar.hoverBackground=@menuHoverBackground
#---- MenuItemCheckBox ---- #---- MenuItemCheckBox ----
@@ -266,6 +269,7 @@ ToggleButton.toolbar.selectedBackground=$ToggleButton.selectedBackground
#---- ToolTip ---- #---- ToolTip ----
ToolTip.border=4,6,4,6,$InternalFrame.activeBorderColor
ToolTip.background=#fafafa ToolTip.background=#fafafa

View File

@@ -602,14 +602,17 @@ class BasicComponentsPanel
//---- cutMenuItem ---- //---- cutMenuItem ----
cutMenuItem.setText("Cut"); cutMenuItem.setText("Cut");
cutMenuItem.setMnemonic('C');
popupMenu1.add(cutMenuItem); popupMenu1.add(cutMenuItem);
//---- copyMenuItem ---- //---- copyMenuItem ----
copyMenuItem.setText("Copy"); copyMenuItem.setText("Copy");
copyMenuItem.setMnemonic('O');
popupMenu1.add(copyMenuItem); popupMenu1.add(copyMenuItem);
//---- pasteMenuItem ---- //---- pasteMenuItem ----
pasteMenuItem.setText("Paste"); pasteMenuItem.setText("Paste");
pasteMenuItem.setMnemonic('P');
popupMenu1.add(pasteMenuItem); popupMenu1.add(pasteMenuItem);
} }
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents

View File

@@ -601,14 +601,17 @@ new FormModel {
add( new FormComponent( "javax.swing.JMenuItem" ) { add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "cutMenuItem" name: "cutMenuItem"
"text": "Cut" "text": "Cut"
"mnemonic": 67
} ) } )
add( new FormComponent( "javax.swing.JMenuItem" ) { add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "copyMenuItem" name: "copyMenuItem"
"text": "Copy" "text": "Copy"
"mnemonic": 79
} ) } )
add( new FormComponent( "javax.swing.JMenuItem" ) { add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "pasteMenuItem" name: "pasteMenuItem"
"text": "Paste" "text": "Paste"
"mnemonic": 80
} ) } )
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 500 ) "location": new java.awt.Point( 0, 500 )

View File

@@ -63,7 +63,7 @@ class ControlBar
(SystemInfo.IS_LINUX && className.equals( "com.sun.java.swing.plaf.gtk.GTKLookAndFeel") ) ) (SystemInfo.IS_LINUX && className.equals( "com.sun.java.swing.plaf.gtk.GTKLookAndFeel") ) )
name += " (F9)"; name += " (F9)";
else if( className.equals( MetalLookAndFeel.class.getName() ) ) else if( className.equals( MetalLookAndFeel.class.getName() ) )
name += " (F10)"; name += " (F12)";
else if( className.equals( NimbusLookAndFeel.class.getName() ) ) else if( className.equals( NimbusLookAndFeel.class.getName() ) )
name += " (F11)"; name += " (F11)";
@@ -106,7 +106,7 @@ class ControlBar
registerSwitchToLookAndFeel( KeyEvent.VK_F9, "com.apple.laf.AquaLookAndFeel" ); registerSwitchToLookAndFeel( KeyEvent.VK_F9, "com.apple.laf.AquaLookAndFeel" );
else if( SystemInfo.IS_LINUX ) else if( SystemInfo.IS_LINUX )
registerSwitchToLookAndFeel( KeyEvent.VK_F9, "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" ); registerSwitchToLookAndFeel( KeyEvent.VK_F9, "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" );
registerSwitchToLookAndFeel( KeyEvent.VK_F10, MetalLookAndFeel.class.getName() ); registerSwitchToLookAndFeel( KeyEvent.VK_F12, MetalLookAndFeel.class.getName() );
registerSwitchToLookAndFeel( KeyEvent.VK_F11, NimbusLookAndFeel.class.getName() ); registerSwitchToLookAndFeel( KeyEvent.VK_F11, NimbusLookAndFeel.class.getName() );
// register ESC key to close frame // register ESC key to close frame

View File

@@ -21,6 +21,7 @@ import java.awt.event.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.text.DefaultEditorKit; import javax.swing.text.DefaultEditorKit;
import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.demo.extras.*;
import com.formdev.flatlaf.demo.intellijthemes.*; import com.formdev.flatlaf.demo.intellijthemes.*;
import com.formdev.flatlaf.extras.FlatSVGIcon; import com.formdev.flatlaf.extras.FlatSVGIcon;
import net.miginfocom.swing.*; import net.miginfocom.swing.*;
@@ -59,6 +60,10 @@ class DemoFrame
} ); } );
} }
private void underlineMenuSelection() {
UIManager.put( "MenuItem.selectionType", underlineMenuSelectionMenuItem.isSelected() ? "underline" : null );
}
private void fontFamilyChanged( ActionEvent e ) { private void fontFamilyChanged( ActionEvent e ) {
String fontFamily = e.getActionCommand(); String fontFamily = e.getActionCommand();
@@ -125,6 +130,7 @@ class DemoFrame
JMenuItem projectViewMenuItem = new JMenuItem(); JMenuItem projectViewMenuItem = new JMenuItem();
JMenuItem structureViewMenuItem = new JMenuItem(); JMenuItem structureViewMenuItem = new JMenuItem();
JMenuItem propertiesViewMenuItem = new JMenuItem(); JMenuItem propertiesViewMenuItem = new JMenuItem();
JMenuItem menuItem1 = new JMenuItem();
JRadioButtonMenuItem radioButtonMenuItem1 = new JRadioButtonMenuItem(); JRadioButtonMenuItem radioButtonMenuItem1 = new JRadioButtonMenuItem();
JRadioButtonMenuItem radioButtonMenuItem2 = new JRadioButtonMenuItem(); JRadioButtonMenuItem radioButtonMenuItem2 = new JRadioButtonMenuItem();
JRadioButtonMenuItem radioButtonMenuItem3 = new JRadioButtonMenuItem(); JRadioButtonMenuItem radioButtonMenuItem3 = new JRadioButtonMenuItem();
@@ -132,6 +138,8 @@ class DemoFrame
JMenuItem restoreFontMenuItem = new JMenuItem(); JMenuItem restoreFontMenuItem = new JMenuItem();
JMenuItem incrFontMenuItem = new JMenuItem(); JMenuItem incrFontMenuItem = new JMenuItem();
JMenuItem decrFontMenuItem = new JMenuItem(); JMenuItem decrFontMenuItem = new JMenuItem();
JMenu optionsMenu = new JMenu();
underlineMenuSelectionMenuItem = new JCheckBoxMenuItem();
JMenu helpMenu = new JMenu(); JMenu helpMenu = new JMenu();
JMenuItem aboutMenuItem = new JMenuItem(); JMenuItem aboutMenuItem = new JMenuItem();
JToolBar toolBar1 = new JToolBar(); JToolBar toolBar1 = new JToolBar();
@@ -149,6 +157,7 @@ class DemoFrame
DataComponentsPanel dataComponentsPanel = new DataComponentsPanel(); DataComponentsPanel dataComponentsPanel = new DataComponentsPanel();
TabsPanel tabsPanel = new TabsPanel(); TabsPanel tabsPanel = new TabsPanel();
OptionPanePanel optionPanePanel = new OptionPanePanel(); OptionPanePanel optionPanePanel = new OptionPanePanel();
ExtrasPanel extrasPanel1 = new ExtrasPanel();
controlBar = new ControlBar(); controlBar = new ControlBar();
IJThemesPanel themesPanel = new IJThemesPanel(); IJThemesPanel themesPanel = new IJThemesPanel();
@@ -308,6 +317,10 @@ class DemoFrame
menu1.add(propertiesViewMenuItem); menu1.add(propertiesViewMenuItem);
} }
viewMenu.add(menu1); viewMenu.add(menu1);
//---- menuItem1 ----
menuItem1.setText("<html>some <b color=\"red\">HTML</b> <i color=\"blue\">text</i></html>");
viewMenu.add(menuItem1);
viewMenu.addSeparator(); viewMenu.addSeparator();
//---- radioButtonMenuItem1 ---- //---- radioButtonMenuItem1 ----
@@ -355,6 +368,17 @@ class DemoFrame
} }
menuBar1.add(fontMenu); menuBar1.add(fontMenu);
//======== optionsMenu ========
{
optionsMenu.setText("Options");
//---- underlineMenuSelectionMenuItem ----
underlineMenuSelectionMenuItem.setText("Use underline menu selection");
underlineMenuSelectionMenuItem.addActionListener(e -> underlineMenuSelection());
optionsMenu.add(underlineMenuSelectionMenuItem);
}
menuBar1.add(optionsMenu);
//======== helpMenu ======== //======== helpMenu ========
{ {
helpMenu.setText("Help"); helpMenu.setText("Help");
@@ -425,6 +449,7 @@ class DemoFrame
tabbedPane.addTab("Data Components", dataComponentsPanel); tabbedPane.addTab("Data Components", dataComponentsPanel);
tabbedPane.addTab("SplitPane & Tabs", tabsPanel); tabbedPane.addTab("SplitPane & Tabs", tabsPanel);
tabbedPane.addTab("Option Pane", optionPanePanel); tabbedPane.addTab("Option Pane", optionPanePanel);
tabbedPane.addTab("Extras", extrasPanel1);
} }
contentPanel.add(tabbedPane, "cell 0 0"); contentPanel.add(tabbedPane, "cell 0 0");
} }
@@ -481,6 +506,7 @@ class DemoFrame
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JMenu fontMenu; private JMenu fontMenu;
private JCheckBoxMenuItem underlineMenuSelectionMenuItem;
private JTabbedPane tabbedPane; private JTabbedPane tabbedPane;
private ControlBar controlBar; private ControlBar controlBar;
// JFormDesigner - End of variables declaration //GEN-END:variables // JFormDesigner - End of variables declaration //GEN-END:variables

View File

@@ -93,6 +93,11 @@ new FormModel {
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"title": "Option Pane" "title": "Option Pane"
} ) } )
add( new FormComponent( "com.formdev.flatlaf.demo.extras.ExtrasPanel" ) {
name: "extrasPanel1"
}, new FormLayoutConstraints( null ) {
"title": "Extras"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0" "value": "cell 0 0"
} ) } )
@@ -259,6 +264,10 @@ new FormModel {
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) )
} ) } )
} ) } )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem1"
"text": "<html>some <b color=\"red\">HTML</b> <i color=\"blue\">text</i></html>"
} )
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
name: "separator8" name: "separator8"
} ) } )
@@ -310,6 +319,18 @@ new FormModel {
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "decrFont", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "decrFont", false ) )
} ) } )
} ) } )
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "optionsMenu"
"text": "Options"
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
name: "underlineMenuSelectionMenuItem"
"text": "Use underline menu selection"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "underlineMenuSelection", false ) )
} )
} )
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "helpMenu" name: "helpMenu"
"text": "Help" "text": "Help"

View File

@@ -22,9 +22,9 @@ import java.util.prefs.Preferences;
import javax.swing.UIManager; import javax.swing.UIManager;
import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.FlatLightLaf; import com.formdev.flatlaf.FlatLightLaf;
import com.formdev.flatlaf.FlatPropertiesLaf;
import com.formdev.flatlaf.IntelliJTheme; import com.formdev.flatlaf.IntelliJTheme;
import com.formdev.flatlaf.demo.intellijthemes.IJThemesPanel; import com.formdev.flatlaf.demo.intellijthemes.IJThemesPanel;
import com.formdev.flatlaf.demo.intellijthemes.IJThemesPanel.PropertiesLaf;
import com.formdev.flatlaf.util.StringUtils; import com.formdev.flatlaf.util.StringUtils;
/** /**
@@ -68,12 +68,12 @@ public class DemoPrefs
if( !theme.isEmpty() ) if( !theme.isEmpty() )
UIManager.getLookAndFeelDefaults().put( THEME_UI_KEY, theme ); UIManager.getLookAndFeelDefaults().put( THEME_UI_KEY, theme );
} else if( IJThemesPanel.PropertiesLaf.class.getName().equals( lafClassName ) ) { } else if( FlatPropertiesLaf.class.getName().equals( lafClassName ) ) {
String theme = state.get( KEY_LAF_THEME, "" ); String theme = state.get( KEY_LAF_THEME, "" );
if( theme.startsWith( FILE_PREFIX ) ) { if( theme.startsWith( FILE_PREFIX ) ) {
File themeFile = new File( theme.substring( FILE_PREFIX.length() ) ); File themeFile = new File( theme.substring( FILE_PREFIX.length() ) );
String themeName = StringUtils.removeTrailing( themeFile.getName(), ".properties" ); String themeName = StringUtils.removeTrailing( themeFile.getName(), ".properties" );
FlatLaf.install( new PropertiesLaf( themeName, themeFile ) ); FlatLaf.install( new FlatPropertiesLaf( themeName, themeFile ) );
} else } else
FlatLightLaf.install(); FlatLightLaf.install();

View File

@@ -17,6 +17,7 @@
package com.formdev.flatlaf.demo; package com.formdev.flatlaf.demo;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import com.formdev.flatlaf.util.SystemInfo;
/** /**
* @author Karl Tauber * @author Karl Tauber
@@ -27,6 +28,9 @@ public class FlatLafDemo
static final String KEY_TAB = "tab"; static final String KEY_TAB = "tab";
public static void main( String[] args ) { public static void main( String[] args ) {
if( SystemInfo.IS_MAC )
System.setProperty( "apple.laf.useScreenMenuBar", "true" );
SwingUtilities.invokeLater( () -> { SwingUtilities.invokeLater( () -> {
DemoPrefs.init( PREFS_ROOT_PATH ); DemoPrefs.init( PREFS_ROOT_PATH );

View File

@@ -27,7 +27,7 @@ import net.miginfocom.swing.*;
* @author Karl Tauber * @author Karl Tauber
*/ */
class OptionPanePanel class OptionPanePanel
extends JScrollPane extends JPanel
{ {
OptionPanePanel() { OptionPanePanel() {
initComponents(); initComponents();
@@ -48,6 +48,7 @@ class OptionPanePanel
private void initComponents() { private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JScrollPane scrollPane1 = new JScrollPane();
ScrollablePanel panel9 = new ScrollablePanel(); ScrollablePanel panel9 = new ScrollablePanel();
JLabel plainLabel = new JLabel(); JLabel plainLabel = new JLabel();
JPanel panel1 = new JPanel(); JPanel panel1 = new JPanel();
@@ -83,200 +84,206 @@ class OptionPanePanel
OptionPanePanel.ShowDialogLinkLabel customShowDialogLabel = new OptionPanePanel.ShowDialogLinkLabel(); OptionPanePanel.ShowDialogLinkLabel customShowDialogLabel = new OptionPanePanel.ShowDialogLinkLabel();
//======== this ======== //======== this ========
setBorder(BorderFactory.createEmptyBorder()); setLayout(new BorderLayout());
//======== panel9 ======== //======== scrollPane1 ========
{ {
panel9.setLayout(new MigLayout( scrollPane1.setBorder(BorderFactory.createEmptyBorder());
"flowy,hidemode 3",
// columns
"[]" +
"[]" +
"[fill]",
// rows
"[top]" +
"[top]" +
"[top]" +
"[top]" +
"[top]" +
"[top]" +
"[top]" +
"[top]"));
//---- plainLabel ---- //======== panel9 ========
plainLabel.setText("Plain");
panel9.add(plainLabel, "cell 0 0");
//======== panel1 ========
{ {
panel1.setBorder(LineBorder.createGrayLineBorder()); panel9.setLayout(new MigLayout(
panel1.setLayout(new BorderLayout()); "flowy,hidemode 3",
// columns
"[]" +
"[]" +
"[fill]",
// rows
"[top]" +
"[top]" +
"[top]" +
"[top]" +
"[top]" +
"[top]" +
"[top]" +
"[top]"));
//---- plainOptionPane ---- //---- plainLabel ----
plainOptionPane.setMessage("Hello world."); plainLabel.setText("Plain");
panel1.add(plainOptionPane, BorderLayout.CENTER); panel9.add(plainLabel, "cell 0 0");
//======== panel1 ========
{
panel1.setBorder(LineBorder.createGrayLineBorder());
panel1.setLayout(new BorderLayout());
//---- plainOptionPane ----
plainOptionPane.setMessage("Hello world.");
panel1.add(plainOptionPane, BorderLayout.CENTER);
}
panel9.add(panel1, "cell 1 0");
//---- plainShowDialogLabel ----
plainShowDialogLabel.setOptionPane(plainOptionPane);
plainShowDialogLabel.setTitleLabel(plainLabel);
panel9.add(plainShowDialogLabel, "cell 2 0");
//---- errorLabel ----
errorLabel.setText("Error");
panel9.add(errorLabel, "cell 0 1");
//======== panel2 ========
{
panel2.setBorder(LineBorder.createGrayLineBorder());
panel2.setLayout(new BorderLayout());
//---- errorOptionPane ----
errorOptionPane.setMessageType(JOptionPane.ERROR_MESSAGE);
errorOptionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
errorOptionPane.setMessage("Your PC ran into a problem. Buy a new one.");
panel2.add(errorOptionPane, BorderLayout.CENTER);
}
panel9.add(panel2, "cell 1 1");
//---- errorShowDialogLabel ----
errorShowDialogLabel.setTitleLabel(errorLabel);
errorShowDialogLabel.setOptionPane(errorOptionPane);
panel9.add(errorShowDialogLabel, "cell 2 1");
//---- informationLabel ----
informationLabel.setText("Information");
panel9.add(informationLabel, "cell 0 2");
//======== panel3 ========
{
panel3.setBorder(LineBorder.createGrayLineBorder());
panel3.setLayout(new BorderLayout());
//---- informationOptionPane ----
informationOptionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
informationOptionPane.setOptionType(JOptionPane.YES_NO_OPTION);
informationOptionPane.setMessage("Text with\nmultiple lines\n(use \\n to separate lines)");
panel3.add(informationOptionPane, BorderLayout.CENTER);
}
panel9.add(panel3, "cell 1 2");
//---- informationShowDialogLabel ----
informationShowDialogLabel.setOptionPane(informationOptionPane);
informationShowDialogLabel.setTitleLabel(informationLabel);
panel9.add(informationShowDialogLabel, "cell 2 2");
//---- questionLabel ----
questionLabel.setText("Question");
panel9.add(questionLabel, "cell 0 3");
//======== panel4 ========
{
panel4.setBorder(LineBorder.createGrayLineBorder());
panel4.setLayout(new BorderLayout());
//---- questionOptionPane ----
questionOptionPane.setMessageType(JOptionPane.QUESTION_MESSAGE);
questionOptionPane.setOptionType(JOptionPane.YES_NO_CANCEL_OPTION);
questionOptionPane.setMessage("Answer the question. What question? Don't know. Just writing useless text to make this longer than 80 characters.");
panel4.add(questionOptionPane, BorderLayout.CENTER);
}
panel9.add(panel4, "cell 1 3");
//---- questionShowDialogLabel ----
questionShowDialogLabel.setOptionPane(questionOptionPane);
questionShowDialogLabel.setTitleLabel(questionLabel);
panel9.add(questionShowDialogLabel, "cell 2 3");
//---- warningLabel ----
warningLabel.setText("Warning");
panel9.add(warningLabel, "cell 0 4");
//======== panel5 ========
{
panel5.setBorder(LineBorder.createGrayLineBorder());
panel5.setLayout(new BorderLayout());
//---- warningOptionPane ----
warningOptionPane.setMessageType(JOptionPane.WARNING_MESSAGE);
warningOptionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
warningOptionPane.setMessage("<html>I like <b>bold</b>,<br> and I like <i>italic</i>,<br> and I like to have<br> many lines.<br> Lots of lines.");
panel5.add(warningOptionPane, BorderLayout.CENTER);
}
panel9.add(panel5, "cell 1 4");
//---- warningShowDialogLabel ----
warningShowDialogLabel.setOptionPane(warningOptionPane);
warningShowDialogLabel.setTitleLabel(warningLabel);
panel9.add(warningShowDialogLabel, "cell 2 4");
//---- inputLabel ----
inputLabel.setText("Input");
panel9.add(inputLabel, "cell 0 5");
//======== panel7 ========
{
panel7.setBorder(LineBorder.createGrayLineBorder());
panel7.setLayout(new BorderLayout());
//---- inputOptionPane ----
inputOptionPane.setWantsInput(true);
inputOptionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
inputOptionPane.setMessage("Enter whatever you want:");
panel7.add(inputOptionPane, BorderLayout.CENTER);
}
panel9.add(panel7, "cell 1 5");
//---- inputShowDialogLabel ----
inputShowDialogLabel.setOptionPane(inputOptionPane);
inputShowDialogLabel.setTitleLabel(inputLabel);
panel9.add(inputShowDialogLabel, "cell 2 5");
//---- inputIconLabel ----
inputIconLabel.setText("Input + icon");
panel9.add(inputIconLabel, "cell 0 6");
//======== panel8 ========
{
panel8.setBorder(LineBorder.createGrayLineBorder());
panel8.setLayout(new BorderLayout());
//---- inputIconOptionPane ----
inputIconOptionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
inputIconOptionPane.setWantsInput(true);
inputIconOptionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
inputIconOptionPane.setMessage("Enter something:");
panel8.add(inputIconOptionPane, BorderLayout.CENTER);
}
panel9.add(panel8, "cell 1 6");
//---- inputIconShowDialogLabel ----
inputIconShowDialogLabel.setTitleLabel(inputIconLabel);
inputIconShowDialogLabel.setOptionPane(inputIconOptionPane);
panel9.add(inputIconShowDialogLabel, "cell 2 6");
//---- customLabel ----
customLabel.setText("Custom");
panel9.add(customLabel, "cell 0 7");
//======== panel6 ========
{
panel6.setBorder(LineBorder.createGrayLineBorder());
panel6.setLayout(new BorderLayout());
//---- customOptionPane ----
customOptionPane.setIcon(UIManager.getIcon("Tree.leafIcon"));
panel6.add(customOptionPane, BorderLayout.CENTER);
}
panel9.add(panel6, "cell 1 7");
//---- customShowDialogLabel ----
customShowDialogLabel.setOptionPane(customOptionPane);
customShowDialogLabel.setTitleLabel(customLabel);
panel9.add(customShowDialogLabel, "cell 2 7");
} }
panel9.add(panel1, "cell 1 0"); scrollPane1.setViewportView(panel9);
//---- plainShowDialogLabel ----
plainShowDialogLabel.setOptionPane(plainOptionPane);
plainShowDialogLabel.setTitleLabel(plainLabel);
panel9.add(plainShowDialogLabel, "cell 2 0");
//---- errorLabel ----
errorLabel.setText("Error");
panel9.add(errorLabel, "cell 0 1");
//======== panel2 ========
{
panel2.setBorder(LineBorder.createGrayLineBorder());
panel2.setLayout(new BorderLayout());
//---- errorOptionPane ----
errorOptionPane.setMessageType(JOptionPane.ERROR_MESSAGE);
errorOptionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
errorOptionPane.setMessage("Your PC ran into a problem. Buy a new one.");
panel2.add(errorOptionPane, BorderLayout.CENTER);
}
panel9.add(panel2, "cell 1 1");
//---- errorShowDialogLabel ----
errorShowDialogLabel.setTitleLabel(errorLabel);
errorShowDialogLabel.setOptionPane(errorOptionPane);
panel9.add(errorShowDialogLabel, "cell 2 1");
//---- informationLabel ----
informationLabel.setText("Information");
panel9.add(informationLabel, "cell 0 2");
//======== panel3 ========
{
panel3.setBorder(LineBorder.createGrayLineBorder());
panel3.setLayout(new BorderLayout());
//---- informationOptionPane ----
informationOptionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
informationOptionPane.setOptionType(JOptionPane.YES_NO_OPTION);
informationOptionPane.setMessage("Text with\nmultiple lines\n(use \\n to separate lines)");
panel3.add(informationOptionPane, BorderLayout.CENTER);
}
panel9.add(panel3, "cell 1 2");
//---- informationShowDialogLabel ----
informationShowDialogLabel.setOptionPane(informationOptionPane);
informationShowDialogLabel.setTitleLabel(informationLabel);
panel9.add(informationShowDialogLabel, "cell 2 2");
//---- questionLabel ----
questionLabel.setText("Question");
panel9.add(questionLabel, "cell 0 3");
//======== panel4 ========
{
panel4.setBorder(LineBorder.createGrayLineBorder());
panel4.setLayout(new BorderLayout());
//---- questionOptionPane ----
questionOptionPane.setMessageType(JOptionPane.QUESTION_MESSAGE);
questionOptionPane.setOptionType(JOptionPane.YES_NO_CANCEL_OPTION);
questionOptionPane.setMessage("Answer the question. What question? Don't know. Just writing useless text to make this longer than 80 characters.");
panel4.add(questionOptionPane, BorderLayout.CENTER);
}
panel9.add(panel4, "cell 1 3");
//---- questionShowDialogLabel ----
questionShowDialogLabel.setOptionPane(questionOptionPane);
questionShowDialogLabel.setTitleLabel(questionLabel);
panel9.add(questionShowDialogLabel, "cell 2 3");
//---- warningLabel ----
warningLabel.setText("Warning");
panel9.add(warningLabel, "cell 0 4");
//======== panel5 ========
{
panel5.setBorder(LineBorder.createGrayLineBorder());
panel5.setLayout(new BorderLayout());
//---- warningOptionPane ----
warningOptionPane.setMessageType(JOptionPane.WARNING_MESSAGE);
warningOptionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
warningOptionPane.setMessage("<html>I like <b>bold</b>,<br> and I like <i>italic</i>,<br> and I like to have<br> many lines.<br> Lots of lines.");
panel5.add(warningOptionPane, BorderLayout.CENTER);
}
panel9.add(panel5, "cell 1 4");
//---- warningShowDialogLabel ----
warningShowDialogLabel.setOptionPane(warningOptionPane);
warningShowDialogLabel.setTitleLabel(warningLabel);
panel9.add(warningShowDialogLabel, "cell 2 4");
//---- inputLabel ----
inputLabel.setText("Input");
panel9.add(inputLabel, "cell 0 5");
//======== panel7 ========
{
panel7.setBorder(LineBorder.createGrayLineBorder());
panel7.setLayout(new BorderLayout());
//---- inputOptionPane ----
inputOptionPane.setWantsInput(true);
inputOptionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
inputOptionPane.setMessage("Enter whatever you want:");
panel7.add(inputOptionPane, BorderLayout.CENTER);
}
panel9.add(panel7, "cell 1 5");
//---- inputShowDialogLabel ----
inputShowDialogLabel.setOptionPane(inputOptionPane);
inputShowDialogLabel.setTitleLabel(inputLabel);
panel9.add(inputShowDialogLabel, "cell 2 5");
//---- inputIconLabel ----
inputIconLabel.setText("Input + icon");
panel9.add(inputIconLabel, "cell 0 6");
//======== panel8 ========
{
panel8.setBorder(LineBorder.createGrayLineBorder());
panel8.setLayout(new BorderLayout());
//---- inputIconOptionPane ----
inputIconOptionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
inputIconOptionPane.setWantsInput(true);
inputIconOptionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
inputIconOptionPane.setMessage("Enter something:");
panel8.add(inputIconOptionPane, BorderLayout.CENTER);
}
panel9.add(panel8, "cell 1 6");
//---- inputIconShowDialogLabel ----
inputIconShowDialogLabel.setTitleLabel(inputIconLabel);
inputIconShowDialogLabel.setOptionPane(inputIconOptionPane);
panel9.add(inputIconShowDialogLabel, "cell 2 6");
//---- customLabel ----
customLabel.setText("Custom");
panel9.add(customLabel, "cell 0 7");
//======== panel6 ========
{
panel6.setBorder(LineBorder.createGrayLineBorder());
panel6.setLayout(new BorderLayout());
//---- customOptionPane ----
customOptionPane.setIcon(UIManager.getIcon("Tree.leafIcon"));
panel6.add(customOptionPane, BorderLayout.CENTER);
}
panel9.add(panel6, "cell 1 7");
//---- customShowDialogLabel ----
customShowDialogLabel.setOptionPane(customOptionPane);
customShowDialogLabel.setTitleLabel(customLabel);
panel9.add(customShowDialogLabel, "cell 2 7");
} }
setViewportView(panel9); add(scrollPane1, BorderLayout.CENTER);
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
} }

View File

@@ -6,240 +6,245 @@ new FormModel {
auxiliary() { auxiliary() {
"JavaCodeGenerator.defaultVariableLocal": true "JavaCodeGenerator.defaultVariableLocal": true
} }
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "this" name: "this"
"border": new javax.swing.border.EmptyBorder( 0, 0, 0, 0 ) add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
add( new FormContainer( "com.formdev.flatlaf.demo.ScrollablePanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { name: "scrollPane1"
"$layoutConstraints": "flowy,hidemode 3" "border": new javax.swing.border.EmptyBorder( 0, 0, 0, 0 )
"$columnConstraints": "[][][fill]" add( new FormContainer( "com.formdev.flatlaf.demo.ScrollablePanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$rowConstraints": "[top][top][top][top][top][top][top][top]" "$layoutConstraints": "flowy,hidemode 3"
} ) { "$columnConstraints": "[][][fill]"
name: "panel9" "$rowConstraints": "[top][top][top][top][top][top][top][top]"
add( new FormComponent( "javax.swing.JLabel" ) { } ) {
name: "plainLabel" name: "panel9"
"text": "Plain" add( new FormComponent( "javax.swing.JLabel" ) {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { name: "plainLabel"
"value": "cell 0 0" "text": "Plain"
} ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) { "value": "cell 0 0"
name: "panel1"
"border": &LineBorder0 new javax.swing.border.LineBorder( sfield java.awt.Color gray, 1, false )
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "plainOptionPane"
"message": "Hello world."
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
"value": "cell 1 0" name: "panel1"
} ) "border": &LineBorder0 new javax.swing.border.LineBorder( sfield java.awt.Color gray, 1, false )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) { add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "plainShowDialogLabel" name: "plainOptionPane"
"optionPane": new FormReference( "plainOptionPane" ) "message": "Hello world."
"titleLabel": new FormReference( "plainLabel" ) }, new FormLayoutConstraints( class java.lang.String ) {
auxiliary() { "value": "Center"
"JavaCodeGenerator.variableLocal": false } )
} }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 0"
"value": "cell 2 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "errorLabel"
"text": "Error"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel2"
"border": #LineBorder0
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "errorOptionPane"
"messageType": 0
"optionType": 2
"message": "Your PC ran into a problem. Buy a new one."
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) {
"value": "cell 1 1" name: "plainShowDialogLabel"
} ) "optionPane": new FormReference( "plainOptionPane" )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) { "titleLabel": new FormReference( "plainLabel" )
name: "errorShowDialogLabel"
"titleLabel": new FormReference( "errorLabel" )
"optionPane": new FormReference( "errorOptionPane" )
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "informationLabel"
"text": "Information"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel3"
"border": #LineBorder0
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "informationOptionPane"
"messageType": 1
"optionType": 0
"message": "Text with\nmultiple lines\n(use \\n to separate lines)"
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) {
name: "informationShowDialogLabel"
"optionPane": new FormReference( "informationOptionPane" )
"titleLabel": new FormReference( "informationLabel" )
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 2"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "questionLabel"
"text": "Question"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel4"
"border": #LineBorder0
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "questionOptionPane"
"messageType": 3
"optionType": 1
"message": "Answer the question. What question? Don't know. Just writing useless text to make this longer than 80 characters."
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3"
} )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) {
name: "questionShowDialogLabel"
"optionPane": new FormReference( "questionOptionPane" )
"titleLabel": new FormReference( "questionLabel" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 3"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "warningLabel"
"text": "Warning"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel5"
"border": #LineBorder0
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "warningOptionPane"
"messageType": 2
"optionType": 2
"message": "<html>I like <b>bold</b>,<br> and I like <i>italic</i>,<br> and I like to have<br> many lines.<br> Lots of lines."
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4"
} )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) {
name: "warningShowDialogLabel"
"optionPane": new FormReference( "warningOptionPane" )
"titleLabel": new FormReference( "warningLabel" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 4"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "inputLabel"
"text": "Input"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 5"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel7"
"border": #LineBorder0
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "inputOptionPane"
"wantsInput": true
"optionType": 2
"message": "Enter whatever you want:"
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 5"
} )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) {
name: "inputShowDialogLabel"
"optionPane": new FormReference( "inputOptionPane" )
"titleLabel": new FormReference( "inputLabel" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 5"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "inputIconLabel"
"text": "Input + icon"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 6"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel8"
"border": #LineBorder0
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "inputIconOptionPane"
"messageType": 1
"wantsInput": true
"optionType": 2
"message": "Enter something:"
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 6"
} )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) {
name: "inputIconShowDialogLabel"
"titleLabel": new FormReference( "inputIconLabel" )
"optionPane": new FormReference( "inputIconOptionPane" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 6"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "customLabel"
"text": "Custom"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 7"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel6"
"border": #LineBorder0
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "customOptionPane"
"icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.leafIcon" )
auxiliary() { auxiliary() {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
}, new FormLayoutConstraints( class java.lang.String ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "Center" "value": "cell 2 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "errorLabel"
"text": "Error"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel2"
"border": #LineBorder0
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "errorOptionPane"
"messageType": 0
"optionType": 2
"message": "Your PC ran into a problem. Buy a new one."
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1"
} )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) {
name: "errorShowDialogLabel"
"titleLabel": new FormReference( "errorLabel" )
"optionPane": new FormReference( "errorOptionPane" )
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "informationLabel"
"text": "Information"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel3"
"border": #LineBorder0
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "informationOptionPane"
"messageType": 1
"optionType": 0
"message": "Text with\nmultiple lines\n(use \\n to separate lines)"
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) {
name: "informationShowDialogLabel"
"optionPane": new FormReference( "informationOptionPane" )
"titleLabel": new FormReference( "informationLabel" )
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 2"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "questionLabel"
"text": "Question"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel4"
"border": #LineBorder0
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "questionOptionPane"
"messageType": 3
"optionType": 1
"message": "Answer the question. What question? Don't know. Just writing useless text to make this longer than 80 characters."
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3"
} )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) {
name: "questionShowDialogLabel"
"optionPane": new FormReference( "questionOptionPane" )
"titleLabel": new FormReference( "questionLabel" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 3"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "warningLabel"
"text": "Warning"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel5"
"border": #LineBorder0
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "warningOptionPane"
"messageType": 2
"optionType": 2
"message": "<html>I like <b>bold</b>,<br> and I like <i>italic</i>,<br> and I like to have<br> many lines.<br> Lots of lines."
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4"
} )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) {
name: "warningShowDialogLabel"
"optionPane": new FormReference( "warningOptionPane" )
"titleLabel": new FormReference( "warningLabel" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 4"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "inputLabel"
"text": "Input"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 5"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel7"
"border": #LineBorder0
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "inputOptionPane"
"wantsInput": true
"optionType": 2
"message": "Enter whatever you want:"
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 5"
} )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) {
name: "inputShowDialogLabel"
"optionPane": new FormReference( "inputOptionPane" )
"titleLabel": new FormReference( "inputLabel" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 5"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "inputIconLabel"
"text": "Input + icon"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 6"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel8"
"border": #LineBorder0
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "inputIconOptionPane"
"messageType": 1
"wantsInput": true
"optionType": 2
"message": "Enter something:"
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 6"
} )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) {
name: "inputIconShowDialogLabel"
"titleLabel": new FormReference( "inputIconLabel" )
"optionPane": new FormReference( "inputIconOptionPane" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 6"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "customLabel"
"text": "Custom"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 7"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel6"
"border": #LineBorder0
add( new FormComponent( "javax.swing.JOptionPane" ) {
name: "customOptionPane"
"icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.leafIcon" )
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 7"
} )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) {
name: "customShowDialogLabel"
"optionPane": new FormReference( "customOptionPane" )
"titleLabel": new FormReference( "customLabel" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 7"
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 7"
} )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel$ShowDialogLinkLabel" ) {
name: "customShowDialogLabel"
"optionPane": new FormReference( "customOptionPane" )
"titleLabel": new FormReference( "customLabel" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 7"
} ) } )
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} ) } )
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 ) "location": new java.awt.Point( 0, 0 )

View File

@@ -0,0 +1,132 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formdev.flatlaf.demo.extras;
import javax.swing.*;
import com.formdev.flatlaf.extras.*;
import net.miginfocom.swing.*;
/**
* @author Karl Tauber
*/
public class ExtrasPanel
extends JPanel
{
public ExtrasPanel() {
initComponents();
triStateLabel1.setText( triStateCheckBox1.getState().toString() );
addSVGIcon( "actions/copy.svg" );
addSVGIcon( "actions/colors.svg" );
addSVGIcon( "actions/execute.svg" );
addSVGIcon( "actions/suspend.svg" );
addSVGIcon( "actions/intentionBulb.svg" );
addSVGIcon( "actions/quickfixOffBulb.svg" );
addSVGIcon( "objects/abstractClass.svg" );
addSVGIcon( "objects/abstractMethod.svg" );
addSVGIcon( "objects/annotationtype.svg" );
addSVGIcon( "objects/annotationtype.svg" );
addSVGIcon( "objects/css.svg" );
addSVGIcon( "objects/javaScript.svg" );
addSVGIcon( "objects/xhtml.svg" );
addSVGIcon( "errorDialog.svg" );
addSVGIcon( "informationDialog.svg" );
addSVGIcon( "warningDialog.svg" );
}
private void addSVGIcon( String name ) {
svgIconsPanel.add( new JLabel( new FlatSVGIcon( "com/formdev/flatlaf/demo/extras/svg/" + name ) ) );
}
private void triStateCheckBox1Changed() {
triStateLabel1.setText( triStateCheckBox1.getState().toString() );
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
label4 = new JLabel();
label1 = new JLabel();
triStateCheckBox1 = new TriStateCheckBox();
triStateLabel1 = new JLabel();
label2 = new JLabel();
svgIconsPanel = new JPanel();
label3 = new JLabel();
//======== this ========
setLayout(new MigLayout(
"hidemode 3",
// columns
"[]" +
"[]" +
"[left]",
// rows
"[]para" +
"[]" +
"[]" +
"[]"));
//---- label4 ----
label4.setText("Note: Components on this page require the flatlaf-extras library.");
add(label4, "cell 0 0 3 1");
//---- label1 ----
label1.setText("TriStateCheckBox:");
add(label1, "cell 0 1");
//---- triStateCheckBox1 ----
triStateCheckBox1.setText("three states");
triStateCheckBox1.addActionListener(e -> triStateCheckBox1Changed());
add(triStateCheckBox1, "cell 1 1");
//---- triStateLabel1 ----
triStateLabel1.setText("text");
add(triStateLabel1, "cell 2 1");
//---- label2 ----
label2.setText("SVG Icons:");
add(label2, "cell 0 2");
//======== svgIconsPanel ========
{
svgIconsPanel.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns
"[fill]",
// rows
"[grow,center]"));
}
add(svgIconsPanel, "cell 1 2 2 1");
//---- label3 ----
label3.setText("The icons may change colors when switching to another theme.");
add(label3, "cell 1 3 2 1");
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JLabel label4;
private JLabel label1;
private TriStateCheckBox triStateCheckBox1;
private JLabel triStateLabel1;
private JLabel label2;
private JPanel svgIconsPanel;
private JLabel label3;
// JFormDesigner - End of variables declaration //GEN-END:variables
}

View File

@@ -0,0 +1,63 @@
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
root: new FormRoot {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "hidemode 3"
"$columnConstraints": "[][][left]"
"$rowConstraints": "[]para[][][]"
} ) {
name: "this"
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label4"
"text": "Note: Components on this page require the flatlaf-extras library."
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0 3 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label1"
"text": "TriStateCheckBox:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )
add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) {
name: "triStateCheckBox1"
"text": "three states"
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "triStateCheckBox1Changed", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "triStateLabel1"
"text": "text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label2"
"text": "SVG Icons:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3"
"$columnConstraints": "[fill]"
"$rowConstraints": "[grow,center]"
} ) {
name: "svgIconsPanel"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2 2 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label3"
"text": "The icons may change colors when switching to another theme."
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3 2 1"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 500, 300 )
} )
}
}

View File

@@ -28,7 +28,6 @@ import java.beans.PropertyChangeListener;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.nio.file.Files; import java.nio.file.Files;
@@ -38,7 +37,6 @@ import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Properties;
import java.util.function.Predicate; import java.util.function.Predicate;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.CompoundBorder; import javax.swing.border.CompoundBorder;
@@ -48,6 +46,7 @@ import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.FlatIntelliJLaf; import com.formdev.flatlaf.FlatIntelliJLaf;
import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.FlatLightLaf; import com.formdev.flatlaf.FlatLightLaf;
import com.formdev.flatlaf.FlatPropertiesLaf;
import com.formdev.flatlaf.IntelliJTheme; import com.formdev.flatlaf.IntelliJTheme;
import com.formdev.flatlaf.demo.DemoPrefs; import com.formdev.flatlaf.demo.DemoPrefs;
import com.formdev.flatlaf.extras.FlatSVGIcon; import com.formdev.flatlaf.extras.FlatSVGIcon;
@@ -198,14 +197,14 @@ public class IJThemesPanel
} }
private void themesListValueChanged( ListSelectionEvent e ) { private void themesListValueChanged( ListSelectionEvent e ) {
if( e.getValueIsAdjusting() || isAdjustingThemesList )
return;
IJThemeInfo themeInfo = themesList.getSelectedValue(); IJThemeInfo themeInfo = themesList.getSelectedValue();
boolean bundledTheme = (themeInfo != null && themeInfo.resourceName != null); boolean bundledTheme = (themeInfo != null && themeInfo.resourceName != null);
saveButton.setEnabled( bundledTheme ); saveButton.setEnabled( bundledTheme );
sourceCodeButton.setEnabled( bundledTheme ); sourceCodeButton.setEnabled( bundledTheme );
if( e.getValueIsAdjusting() || isAdjustingThemesList )
return;
EventQueue.invokeLater( () -> { EventQueue.invokeLater( () -> {
setTheme( themeInfo ); setTheme( themeInfo );
} ); } );
@@ -229,7 +228,7 @@ public class IJThemesPanel
} else if( themeInfo.themeFile != null ) { } else if( themeInfo.themeFile != null ) {
try { try {
if( themeInfo.themeFile.getName().endsWith( ".properties" ) ) { if( themeInfo.themeFile.getName().endsWith( ".properties" ) ) {
FlatLaf.install( new PropertiesLaf( themeInfo.name, themeInfo.themeFile ) ); FlatLaf.install( new FlatPropertiesLaf( themeInfo.name, themeInfo.themeFile ) );
} else } else
FlatLaf.install( IntelliJTheme.createLaf( new FileInputStream( themeInfo.themeFile ) ) ); FlatLaf.install( IntelliJTheme.createLaf( new FileInputStream( themeInfo.themeFile ) ) );
@@ -342,7 +341,7 @@ public class IJThemesPanel
LookAndFeel lookAndFeel = UIManager.getLookAndFeel(); LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
String theme = UIManager.getLookAndFeelDefaults().getString( DemoPrefs.THEME_UI_KEY ); String theme = UIManager.getLookAndFeelDefaults().getString( DemoPrefs.THEME_UI_KEY );
if( theme == null && (lookAndFeel instanceof IntelliJTheme.ThemeLaf || lookAndFeel instanceof PropertiesLaf) ) if( theme == null && (lookAndFeel instanceof IntelliJTheme.ThemeLaf || lookAndFeel instanceof FlatPropertiesLaf) )
return; return;
Predicate<IJThemeInfo> test; Predicate<IJThemeInfo> test;
@@ -431,78 +430,4 @@ public class IJThemesPanel
private JScrollPane themesScrollPane; private JScrollPane themesScrollPane;
private JList<IJThemeInfo> themesList; private JList<IJThemeInfo> themesList;
// JFormDesigner - End of variables declaration //GEN-END:variables // JFormDesigner - End of variables declaration //GEN-END:variables
//---- class PropertiesLaf ------------------------------------------------
public static class PropertiesLaf
extends FlatLaf
{
private final String name;
private final String baseTheme;
private final boolean dark;
private final Properties properties;
public PropertiesLaf( String name, File propertiesFile )
throws IOException
{
this.name = name;
properties = new Properties();
try( InputStream in = new FileInputStream( propertiesFile ) ) {
if( in != null )
properties.load( in );
}
baseTheme = properties.getProperty( "@baseTheme", "light" );
dark = "dark".equalsIgnoreCase( baseTheme ) || "darcula".equalsIgnoreCase( baseTheme );
}
@Override
public String getName() {
return name;
}
@Override
public String getDescription() {
return name;
}
@Override
public boolean isDark() {
return dark;
}
@Override
protected ArrayList<Class<?>> getLafClassesForDefaultsLoading() {
ArrayList<Class<?>> lafClasses = new ArrayList<>();
lafClasses.add( FlatLaf.class );
switch( baseTheme.toLowerCase() ) {
default:
case "light":
lafClasses.add( FlatLightLaf.class );
break;
case "dark":
lafClasses.add( FlatDarkLaf.class );
break;
case "intellij":
lafClasses.add( FlatLightLaf.class );
lafClasses.add( FlatIntelliJLaf.class );
break;
case "darcula":
lafClasses.add( FlatDarkLaf.class );
lafClasses.add( FlatDarculaLaf.class );
break;
}
lafClasses.add( PropertiesLaf.class );
return lafClasses;
}
@Override
protected Properties getAdditionalDefaults() {
return properties;
}
}
} }

View File

@@ -0,0 +1,3 @@
The icons in this folder are from IntelliJ IDEA Community Edition,
which is licensed under the Apache 2.0 license. Copyright 2000-2019 JetBrains s.r.o.
See: https://github.com/JetBrains/intellij-community/

View File

@@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd" transform="translate(2 2)">
<rect width="5.5" height="5.5" fill="#59A869"/>
<rect width="5.5" height="5.5" x="6.5" fill="#EDA200"/>
<rect width="5.5" height="5.5" y="6.5" fill="#389FD6"/>
<rect width="5.5" height="5.5" x="6.5" y="6.5" fill="#DB5860"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 403 B

View File

@@ -1,6 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd"> <g fill="none" fill-rule="evenodd">
<path fill="#AFB1B3" d="M11,3 L4,3 L4,11 L2,11 L2,1 L11,1 L11,3 Z"/> <path fill="#6E6E6E" d="M11,3 L4,3 L4,11 L2,11 L2,1 L11,1 L11,3 Z"/>
<path fill="#AFB1B3" d="M5,4 L14,4 L14,14 L5,14 L5,4 Z M7,6 L7,7 L12,7 L12,6 L7,6 Z M7,10 L7,11 L12,11 L12,10 L7,10 Z M7,8 L7,9 L12,9 L12,8 L7,8 Z"/> <path fill="#6E6E6E" d="M5,4 L14,4 L14,14 L5,14 L5,4 Z M7,6 L7,7 L12,7 L12,6 L7,6 Z M7,10 L7,11 L12,11 L12,10 L7,10 Z M7,8 L7,9 L12,9 L12,8 L7,8 Z"/>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 363 B

After

Width:  |  Height:  |  Size: 363 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<polygon fill="#59A869" fill-rule="evenodd" points="4 2 14 8 4 14"/>
</svg>

After

Width:  |  Height:  |  Size: 162 B

View File

@@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<rect width="6" height="1" x="5" y="12" fill="#6E6E6E"/>
<path fill="#6E6E6E" d="M5.5,14 L10.5,14 L10.5,14 C10.5,14.5522847 10.0522847,15 9.5,15 L6.5,15 C5.94771525,15 5.5,14.5522847 5.5,14 Z"/>
<path fill="#EDA200" d="M13,5.2 C13,9.2 11,8.96875 11,11 L5,11 C5,9.03125 3,9.2 3,5.2 C3,2.991 5.23878906,1 8,1 C10.76125,1 13,2.99103125 13,5.2 Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 493 B

View File

@@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<rect width="6" height="1" x="5" y="12" fill="#6E6E6E"/>
<path fill="#6E6E6E" d="M5.5,14 L10.5,14 L10.5,14 C10.5,14.5522847 10.0522847,15 9.5,15 L6.5,15 C5.94771525,15 5.5,14.5522847 5.5,14 Z"/>
<path fill="#389FD6" d="M13,5.2 C13,9.2 11,8.96875 11,11 L5,11 C5,9.03125 3,9.2 3,5.2 C3,2.991 5.23878906,1 8,1 C10.76125,1 13,2.99103125 13,5.2 Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 493 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<rect width="10" height="10" x="3" y="3" fill="#DB5860" fill-rule="evenodd"/>
</svg>

After

Width:  |  Height:  |  Size: 171 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<path fill="#DB5860" fill-rule="evenodd" d="M16,30 C8.2680135,30 2,23.7319865 2,16 C2,8.2680135 8.2680135,2 16,2 C23.7319865,2 30,8.2680135 30,16 C30,23.7319865 23.7319865,30 16,30 Z M14,7 L14,18 L18,18 L18,7 L14,7 Z M14,21 L14,25 L18,25 L18,21 L14,21 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 350 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<path fill="#389FD6" fill-rule="evenodd" d="M16,30 C8.2680135,30 2,23.7319865 2,16 C2,8.2680135 8.2680135,2 16,2 C23.7319865,2 30,8.2680135 30,16 C30,23.7319865 23.7319865,30 16,30 Z M14,7 L14,18 L18,18 L18,7 L14,7 Z M14,21 L14,25 L18,25 L18,21 L14,21 Z" transform="rotate(180 16 16)"/>
</svg>

After

Width:  |  Height:  |  Size: 380 B

View File

@@ -0,0 +1,19 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
<defs>
<rect id="abstractclass-a" width="8" height="14"/>
</defs>
<g fill="none" fill-rule="evenodd">
<path fill="#9AA7B0" fill-opacity=".8" d="M3 3.1055C1.764 4.3685 1 6.0935 1 8.0005 1 9.9065 1.764 11.6315 3 12.8945L3 3.1055zM13 3.1055L13 12.8945C14.236 11.6315 15 9.9065 15 8.0005 15 6.0935 14.236 4.3675 13 3.1055"/>
<g transform="translate(4 1)">
<mask id="abstractclass-b" fill="#fff">
<use xlink:href="#abstractclass-a"/>
</mask>
<g mask="url(#abstractclass-b)">
<g transform="translate(-4 -1)">
<path fill="#40B6E0" fill-opacity=".6" d="M15,8 C15,11.866 11.866,15 8,15 C4.134,15 1,11.866 1,8 C1,4.134 4.134,1 8,1 C11.866,1 15,4.134 15,8"/>
<path fill="#231F20" fill-opacity=".7" d="M5,4.28253174 C4.53,4.74153174 4.028,4.978 3.1,5 C2.061,5.022 1,4.2794 1,3.0004 C1,1.7124 1.971,1 3.1,1 C3.94833171,1 4.54833171,1.18475342 4.9,1.55426025 L5.5162,0.836730957 C4.8293999,0.270175195 4.28826904,0.0004 3.0982,0.0004 C1.3402,0.0004 0.0002,1.3584 0.0002,3.0004 C0.0002,4.6824 1.3642,6.0004 3.0022,6.0004 C4.29284668,6.0004 5.0232,5.5934 5.6162,4.9814 C5.2054,4.51548783 5,4.28253174 5,4.28253174 Z" transform="translate(5 5)"/>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,19 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
<defs>
<rect id="abstractmethod-a" width="8" height="14"/>
</defs>
<g fill="none" fill-rule="evenodd">
<path fill="#9AA7B0" fill-opacity=".8" d="M3 3.1055C1.764 4.3685 1 6.0935 1 8.0005 1 9.9065 1.764 11.6315 3 12.8945L3 3.1055zM13 3.1055L13 12.8945C14.236 11.6315 15 9.9065 15 8.0005 15 6.0935 14.236 4.3675 13 3.1055"/>
<g transform="translate(4 1)">
<mask id="abstractmethod-b" fill="#fff">
<use xlink:href="#abstractmethod-a"/>
</mask>
<g mask="url(#abstractmethod-b)">
<g transform="translate(-4 -1)">
<path fill="#F98B9E" fill-opacity=".6" d="M15,8 C15,11.866 11.866,15 8,15 C4.134,15 1,11.866 1,8 C1,4.134 4.134,1 8,1 C11.866,1 15,4.134 15,8"/>
<path fill="#231F20" fill-opacity=".7" d="M6.9922,2 C6.9912,1.251 6.63513184,0.0003 4.98162842,0.0003 C4.11224365,0.0003 3.6576,0.502 3.5986,0.6 C3.28363037,0.194116211 2.94411621,0.0003 2.1,0.0003 C1.63194173,0.0003 1.26527507,0.0999436667 1,0.299231 L1,0.0003 L0,0.0003 L0,5.0003 L1,5.0003 C0.966666667,3.1563 0.966666667,2.1562 1,2 C1.05,1.7657 1.05,1 2,1 C2.95,1 2.999,1.537 3,2 L3,5.0003 L4,5.0003 L4,2 C4,1.686 3.95911952,1 4.98162842,1 C6.00413731,1 6.00413731,1.73961181 6.00469971,2 C6.00469971,2.79041884 6.00469971,3.38323296 6.00469971,3.77844238 C6.00469971,4.0499663 6.00469971,4.45725217 6.00469971,5.0003 L6.9972,5.0003 L6.9922,2 Z" transform="translate(5 6)"/>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<path fill="#62B543" fill-opacity=".6" d="M15,8 C15,11.866 11.866,15 8,15 C4.134,15 1,11.866 1,8 C1,4.134 4.134,1 8,1 C11.866,1 15,4.134 15,8"/>
<path fill="#231F20" fill-opacity=".7" d="M3.6281,2.7611 C3.4731,2.8511 3.3451,2.9741 3.2461,3.1241 C3.1511,3.2721 3.0811,3.4411 3.0391,3.6261 C2.9971,3.8091 2.9761,3.9961 2.9761,4.1841 C2.9761,4.5861 3.0491,4.8721 3.1971,5.0581 C3.3491,5.2481 3.5541,5.3451 3.8051,5.3451 C3.9701,5.3451 4.1151,5.3071 4.2371,5.2311 C4.3571,5.1581 4.4571,5.0531 4.5331,4.9201 C4.6061,4.7931 4.6631,4.6401 4.7011,4.4641 C4.7391,4.2941 4.7641,4.1011 4.7731,3.8931 L4.8421,2.6991 L4.8001,2.6891 C4.6851,2.6621 4.5981,2.6481 4.5001,2.6371 C4.4021,2.6271 4.3041,2.6221 4.2021,2.6221 C3.9781,2.6221 3.7861,2.6681 3.6281,2.7611 Z M0.0021,4.0006 C0.0021,0.0011 3.66741943,0.0011 4.3161,0.0011 C4.65105644,0.0011 8.0001,0.0864290039 8.0001,3.5571 C8.0001,6.0091 6.4751,6 6.1701,6 C5.67331784,5.97 5.31431784,5.7737 5.0931,5.4111 C4.68260397,5.8037 4.28127064,6 3.8891,6 C3.0796519,6 2.0001,5.9211 2.0001,4.0001 C2.0001,2.32043457 3.45593262,2.0001 4.0001,2.0001 C4.1531,2.0001 5.7451,2.0551 5.8241,2.0791 L5.7441,4.1881 C5.6361,4.89276667 5.7991,5.2451 6.2331,5.2451 C6.95605469,5.2451 7.0601,3.7831 7.0601,3.5471 C7.0601,0.907409668 4.7081,0.7451 4.3161,0.7451 C3.7711,0.7451 0.94354248,0.850891113 0.94354248,4.0006 C0.94354248,4.58402311 0.94354248,7.2461 3.8891,7.2461 C4.0901,7.2461 5.7441,7.04302979 6.1621,6.8281 L6.1621,7.5781 C5.8551,7.7031 5.0931,8.0001 3.8981,8.0001 C3.15576172,8.0001 0.0021,8.0001 0.0021,4.0006 Z" transform="translate(4 4)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<polygon fill="#9AA7B0" fill-opacity=".8" points="7 1 3 5 7 5"/>
<polygon fill="#9AA7B0" fill-opacity=".8" points="8 1 8 6 3 6 3 8 13 8 13 1"/>
<polygon fill="#40B6E0" fill-opacity=".7" points="1 16 16 16 16 9 1 9"/>
<path fill="#231F20" fill-opacity=".7" d="M0,2.501 C0,1 0.931,2.02832126e-16 2.256,0 C3.20239258,0 3.55,0.311 3.969,0.753 L3.42669678,1.42712402 C3.07669678,1.06812402 2.75,1 2.25,1 C1.418,1 1,1.73791504 1,2.487 C1,3.23608496 1.412,4 2.25,4 C2.787,4 3.05169678,3.89340869 3.42669678,3.50640869 L4,4.144 C3.544,4.669 3.19732666,5 2.225,5 C0.949,5 7.35277938e-17,4.002 0,2.501 Z" transform="translate(2 10)"/>
<path fill="#231F20" fill-opacity=".7" d="M0.972767969,1.50152588 C0.972767969,1.13305664 1.284,1 1.845,1 C1.85033333,1 2.23533333,1 3,1 L3,0 C2.26266667,0 1.88266667,0 1.86,0 C0.778,0 0,0.45916748 0,1.45 C0,2.31452637 0.419555664,2.69049072 1.47125244,2.91607666 C2.24158869,3.08131157 2.496155,3.22862939 2.496155,3.548 C2.496155,3.86737061 2.13842773,4 1.47125244,4 C1.46058577,4 1.07016829,4 0.3,4 L0.3,5 C1.07550163,5 1.46591911,5 1.47125244,5 C3.5,5 3.5,4 3.5,3.548 C3.5,2.91607666 3.02026367,2.42071533 2.15869141,2.14685059 C1.29711914,1.87298584 0.972767969,1.86999512 0.972767969,1.50152588 Z" transform="translate(7 10)"/>
<path fill="#231F20" fill-opacity=".7" d="M0.972767969,1.50152588 C0.972767969,1.13305664 1.284,1 1.845,1 C1.85033333,1 2.23533333,1 3,1 L3,0 C2.26266667,0 1.88266667,0 1.86,0 C0.778,0 0,0.45916748 0,1.45 C0,2.31452637 0.419555664,2.69049072 1.47125244,2.91607666 C2.24158869,3.08131157 2.496155,3.22862939 2.496155,3.548 C2.496155,3.86737061 2.13842773,4 1.47125244,4 C1.46058577,4 1.07016829,4 0.3,4 L0.3,5 C1.07550163,5 1.46591911,5 1.47125244,5 C3.5,5 3.5,4 3.5,3.548 C3.5,2.91607666 3.02026367,2.42071533 2.15869141,2.14685059 C1.29711914,1.87298584 0.972767969,1.86999512 0.972767969,1.50152588 Z" transform="translate(11 10)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<polygon fill="#F4AF3D" fill-opacity=".7" points="1 16 16 16 16 9 1 9"/>
<polygon fill="#9AA7B0" fill-opacity=".8" points="7 1 3 5 7 5"/>
<polygon fill="#9AA7B0" fill-opacity=".8" points="8 1 8 6 3 6 3 8 13 8 13 1"/>
<path fill="#231F20" fill-opacity=".7" d="M1.39509277,3.58770752 C1.62440186,3.83789062 1.83782861,4 2.28682861,4 C2.81318359,4 3,3.58770752 3,3.29760742 L3,0 L4,0 L4,3.58770752 C4,4.31964111 3.32670898,5 2.45,5 C1.629,5 1.15,4.76264111 0.8,4.31964111 L1.39509277,3.58770752 Z" transform="translate(1 10)"/>
<path fill="#231F20" fill-opacity=".7" d="M0.972767969,1.50152588 C0.972767969,1.13305664 1.284,1 1.845,1 C1.85033333,1 2.23533333,1 3,1 L3,0 C2.26266667,0 1.88266667,0 1.86,0 C0.778,0 0,0.45916748 0,1.45 C0,2.31452637 0.419555664,2.69049072 1.47125244,2.91607666 C2.24158869,3.08131157 2.496155,3.22862939 2.496155,3.548 C2.496155,3.86737061 2.13842773,4 1.47125244,4 C1.46058577,4 1.07016829,4 0.3,4 L0.3,5 C1.07550163,5 1.46591911,5 1.47125244,5 C3.5,5 3.5,4 3.5,3.548 C3.5,2.91607666 3.02026367,2.42071533 2.15869141,2.14685059 C1.29711914,1.87298584 0.972767969,1.86999512 0.972767969,1.50152588 Z" transform="translate(6 10)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<polygon fill="#F26522" fill-opacity=".7" points="1 16 16 16 16 9 1 9"/>
<polygon fill="#9AA7B0" fill-opacity=".8" points="7 1 3 5 7 5"/>
<polygon fill="#9AA7B0" fill-opacity=".8" points="8 1 8 6 3 6 3 8 13 8 13 1"/>
<polygon fill="#231F20" fill-opacity=".7" points="0 0 1 0 1 2 3 2 3 0 4 0 4 5 3 5 3 3 1 3 1 5 0 5" transform="translate(3 10)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 498 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<path fill="#EDA200" fill-rule="evenodd" d="M16,2 L31,28 L1,28 L16,2 Z M18,25 L18,21 L14,21 L14,25 L18,25 Z M18,18 L18,10 L14,10 L14,18 L18,18 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 241 B

View File

@@ -1,9 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="#AFB1B3" fill-rule="evenodd" transform="translate(1 3)">
<rect width="11" height="2" x="2" y="4"/>
<g transform="translate(0 .02)">
<rect width="7" height="1.8" x="-.389" y="2.24" transform="rotate(-45 3.111 3.14)"/>
<rect width="1.8" height="7" x="2.211" y="3.317" transform="rotate(-45 3.111 6.817)"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 442 B

View File

@@ -1,6 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<polygon fill="#AFB1B3" points="9 7 12 7 8 11 4 7 7 7 7 2 9 2" transform="matrix(-1 0 0 1 16 0)"/>
<rect width="12" height="2" x="2" y="12" fill="#AFB1B3"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 301 B

View File

@@ -1,9 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="#AFB1B3" fill-rule="evenodd" transform="matrix(-1 0 0 1 15 3)">
<rect width="12" height="2" x="1" y="4"/>
<g transform="translate(0 .02)">
<rect width="7" height="1.8" x="-.389" y="2.24" transform="rotate(-45 3.111 3.14)"/>
<rect width="1.8" height="7" x="2.211" y="3.317" transform="rotate(-45 3.111 6.817)"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 449 B

View File

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="#AFB1B3" d="M6.53206047,5.10906 C6.68535547,4.77581 6.77200047,4.40923501 6.77200047,4.01600001 C6.77200047,2.54303502 5.57896548,1.35000002 4.10600049,1.35000002 C2.63303549,1.35000002 1.4400005,2.54303502 1.4400005,4.01600001 C1.4400005,5.488965 2.63303549,6.68199999 4.10600049,6.68199999 C4.49923548,6.68199999 4.86581048,6.59535499 5.19906048,6.44205999 L6.77200047,8.01499999 L5.19906048,9.58793998 C4.86581048,9.43464498 4.49923548,9.34799998 4.10600049,9.34799998 C2.63303549,9.34799998 1.4400005,10.541035 1.4400005,12.014 C1.4400005,13.486965 2.63303549,14.6799999 4.10600049,14.6799999 C5.57896548,14.6799999 6.77200047,13.486965 6.77200047,12.014 C6.77200047,11.620765 6.68535547,11.25419 6.53206047,10.92094 L8.10500046,9.34799998 L12.7705004,14 L14.7700004,14 L14.7700004,13.347 L6.53206047,5.10906 Z M4.1053342,5.33702364 C3.37236745,5.33702364 2.77266738,4.74383861 2.77266738,4.00402356 C2.77266738,3.26420851 3.37236745,2.67102348 4.1053342,2.67102348 C4.83830096,2.67102348 5.43800103,3.26420851 5.43800103,4.00402356 C5.43800103,4.74383861 4.83830096,5.33702364 4.1053342,5.33702364 Z M4.1053342,13.3350241 C3.37236745,13.3350241 2.77266738,12.7418391 2.77266738,12.0020241 C2.77266738,11.262209 3.37236745,10.669024 4.1053342,10.669024 C4.83830096,10.669024 5.43800103,11.262209 5.43800103,12.0020241 C5.43800103,12.7418391 4.83830096,13.3350241 4.1053342,13.3350241 Z M8.10333468,8.33627383 C7.91676132,8.33627383 7.77016797,8.18964382 7.77016797,8.00302381 C7.77016797,7.8164038 7.91676132,7.66977379 8.10333468,7.66977379 C8.28990803,7.66977379 8.43650138,7.8164038 8.43650138,8.00302381 C8.43650138,8.18964382 8.28990803,8.33627383 8.10333468,8.33627383 Z M12.7710002,2.00452344 L8.77299971,6.00352368 L10.1056665,7.33652377 L14.7700004,2.67102348 L14.7700004,2.00452344 L12.7710002,2.00452344 Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -1,3 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="#737373" fill-rule="evenodd" d="M3,1 L3,0 L7,0 L7,1 L10,1 L10,13 L0,13 L0,1 L3,1 Z M4,1 L4,2 L6,2 L6,1 L4,1 Z M2,4 L2,11 L8,11 L8,4 L2,4 Z" transform="translate(3 1)"/> <path fill="#6E6E6E" fill-rule="evenodd" d="M3,1 L3,0 L7,0 L7,1 L10,1 L10,13 L0,13 L0,1 L3,1 Z M4,1 L4,2 L6,2 L6,1 L4,1 Z M2,4 L2,11 L8,11 L8,4 L2,4 Z" transform="translate(3 1)"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 274 B

View File

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="#AFB1B3" fill-rule="evenodd" d="M3,1 L3,0 L7,0 L7,1 L10,1 L10,13 L0,13 L0,1 L3,1 Z M4,1 L4,2 L6,2 L6,1 L4,1 Z M2,4 L2,11 L8,11 L8,4 L2,4 Z" transform="translate(3 1)"/>
</svg>

Before

Width:  |  Height:  |  Size: 274 B

View File

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="#AFB1B3" d="M8.35170965,4.66666667 C6.5846115,4.66666667 4.98422073,5.32666667 3.75058618,6.4 L1.35000002,4 L1.35000002,10 L7.35146542,10 L4.93754267,7.58666667 C5.86443566,6.81333333 7.04472385,6.33333333 8.35170965,6.33333333 C10.712286,6.33333333 12.7194428,7.87333333 13.4196138,10 L14.9999996,9.48 C14.0731067,6.68666667 11.4524668,4.66666667 8.35170965,4.66666667 Z" transform="matrix(-1 0 0 1 16.35 0)"/>
</svg>

Before

Width:  |  Height:  |  Size: 517 B

View File

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="#AFB1B3" fill-rule="evenodd" d="M12.5747152,11.8852806 C11.4741474,13.1817355 9.83247882,14.0044386 7.99865879,14.0044386 C5.03907292,14.0044386 2.57997332,11.8615894 2.08820756,9.0427473 L3.94774327,9.10768372 C4.43372186,10.8898575 6.06393114,12.2000519 8.00015362,12.2000519 C9.30149237,12.2000519 10.4645985,11.6082097 11.2349873,10.6790094 L9.05000019,8.71167959 L14.0431479,8.44999981 L14.3048222,13.4430431 L12.5747152,11.8852806 Z M3.42785637,4.11741586 C4.52839138,2.82452748 6.16775464,2.00443857 7.99865879,2.00443857 C10.918604,2.00443857 13.3513802,4.09026967 13.8882946,6.8532307 L12.0226389,6.78808057 C11.5024872,5.05935553 9.89838095,3.8000774 8.00015362,3.8000774 C6.69867367,3.8000774 5.53545628,4.39204806 4.76506921,5.32142241 L6.95482203,7.29304326 L1.96167436,7.55472304 L1.70000005,2.56167973 L3.42785637,4.11741586 Z" transform="rotate(3 8.002 8.004)"/>
</svg>

Before

Width:  |  Height:  |  Size: 984 B

View File

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="#AFB1B3" d="M8,3 C4.81818182,3 2.10090909,5.07333333 1,8 C2.10090909,10.9266667 4.81818182,13 8,13 C11.1818182,13 13.8990909,10.9266667 15,8 C13.8990909,5.07333333 11.1818182,3 8,3 Z M8,11.5 C6.068,11.5 4.5,9.932 4.5,8 C4.5,6.068 6.068,4.5 8,4.5 C9.932,4.5 11.5,6.068 11.5,8 C11.5,9.932 9.932,11.5 8,11.5 Z M8,6 C6.89333333,6 6,6.89333333 6,8 C6,9.10666667 6.89333333,10 8,10 C9.10666667,10 10,9.10666667 10,8 C10,6.89333333 9.10666667,6 8,6 Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 552 B

View File

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="#AFB1B3" d="M8.00170962,4.66666667 C6.23461148,4.66666667 4.63422071,5.32666667 3.40058616,6.4 L1,4 L1,10 L7.00146539,10 L4.58754265,7.58666667 C5.51443563,6.81333333 6.69472383,6.33333333 8.00170962,6.33333333 C10.362286,6.33333333 12.3694428,7.87333333 13.0696137,10 L14.6499996,9.48 C13.7231066,6.68666667 11.1024667,4.66666667 8.00170962,4.66666667 Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 463 B

View File

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

View File

@@ -20,17 +20,22 @@ import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Image; import java.awt.Paint;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.image.BufferedImage; import java.awt.image.RGBImageFilter;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import javax.swing.ImageIcon; import java.util.HashMap;
import java.util.Map;
import javax.swing.Icon;
import javax.swing.LookAndFeel; import javax.swing.LookAndFeel;
import javax.swing.UIManager; import javax.swing.UIManager;
import com.formdev.flatlaf.FlatIconColors;
import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.Graphics2DProxy;
import com.formdev.flatlaf.util.GrayFilter;
import com.formdev.flatlaf.util.UIScale; import com.formdev.flatlaf.util.UIScale;
import com.kitfox.svg.SVGDiagram; import com.kitfox.svg.SVGDiagram;
import com.kitfox.svg.SVGException; import com.kitfox.svg.SVGException;
@@ -40,7 +45,7 @@ import com.kitfox.svg.SVGUniverse;
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatSVGIcon public class FlatSVGIcon
extends ImageIcon implements Icon
{ {
// use own SVG universe so that it can not be cleared from anywhere // use own SVG universe so that it can not be cleared from anywhere
private static final SVGUniverse svgUniverse = new SVGUniverse(); private static final SVGUniverse svgUniverse = new SVGUniverse();
@@ -98,7 +103,17 @@ public class FlatSVGIcon
if( clipBounds != null && !clipBounds.intersects( new Rectangle( x, y, getIconWidth(), getIconHeight() ) ) ) if( clipBounds != null && !clipBounds.intersects( new Rectangle( x, y, getIconWidth(), getIconHeight() ) ) )
return; return;
Graphics2D g2 = (Graphics2D) g.create(); // get gray filter
RGBImageFilter grayFilter = null;
if( c != null && !c.isEnabled() ) {
Object grayFilterObj = UIManager.get( "Component.grayFilter" );
grayFilter = (grayFilterObj instanceof RGBImageFilter)
? (RGBImageFilter) grayFilterObj
: GrayFilter.createDisabledIconFilter( dark );
}
Graphics2D g2 = new GraphicsFilter( (Graphics2D) g.create(), ColorFilter.getInstance(), grayFilter );
try { try {
FlatUIUtils.setRenderingHints( g2 ); FlatUIUtils.setRenderingHints( g2 );
g2.setRenderingHint( RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR ); g2.setRenderingHint( RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR );
@@ -134,20 +149,6 @@ public class FlatSVGIcon
g.fillRect( x, y, getIconWidth(), getIconHeight() ); g.fillRect( x, y, getIconWidth(), getIconHeight() );
} }
@Override
public Image getImage() {
update();
BufferedImage image = new BufferedImage( getIconWidth(), getIconHeight(), BufferedImage.TYPE_INT_ARGB );
Graphics2D g = image.createGraphics();
try {
paintIcon( null, g, 0, 0 );
} finally {
g.dispose();
}
return image;
}
private static Boolean darkLaf; private static Boolean darkLaf;
private static boolean isDarkLaf() { private static boolean isDarkLaf() {
@@ -166,4 +167,76 @@ public class FlatSVGIcon
LookAndFeel lookAndFeel = UIManager.getLookAndFeel(); LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
darkLaf = (lookAndFeel instanceof FlatLaf && ((FlatLaf)lookAndFeel).isDark()); darkLaf = (lookAndFeel instanceof FlatLaf && ((FlatLaf)lookAndFeel).isDark());
} }
//---- class ColorFilter --------------------------------------------------
public static class ColorFilter
{
private static ColorFilter instance;
private final Map<Integer, String> rgb2keyMap = new HashMap<>();
public static ColorFilter getInstance() {
if( instance == null )
instance = new ColorFilter();
return instance;
}
public ColorFilter() {
for( FlatIconColors c : FlatIconColors.values() )
rgb2keyMap.put( c.rgb, c.key );
}
public Color filter( Color color ) {
String colorKey = rgb2keyMap.get( color.getRGB() & 0xffffff );
if( colorKey == null )
return color;
Color newColor = UIManager.getColor( colorKey );
if( newColor == null )
return color;
return (newColor.getAlpha() != color.getAlpha())
? new Color( (newColor.getRGB() & 0x00ffffff) | (color.getRGB() & 0xff000000) )
: newColor;
};
}
//---- class GraphicsFilter -----------------------------------------------
private static class GraphicsFilter
extends Graphics2DProxy
{
private final ColorFilter colorFilter;
private final RGBImageFilter grayFilter;
public GraphicsFilter( Graphics2D delegate, ColorFilter colorFilter, RGBImageFilter grayFilter ) {
super( delegate );
this.colorFilter = colorFilter;
this.grayFilter = grayFilter;
}
@Override
public void setColor( Color c ) {
super.setColor( filterColor( c ) );
}
@Override
public void setPaint( Paint paint ) {
if( paint instanceof Color )
paint = filterColor( (Color) paint );
super.setPaint( paint );
}
private Color filterColor( Color color ) {
if( colorFilter != null )
color = colorFilter.filter( color );
if( grayFilter != null ) {
int oldRGB = color.getRGB();
int newRGB = grayFilter.filterRGB( 0, 0, oldRGB );
color = (newRGB != oldRGB) ? new Color( newRGB, true ) : color;
}
return color;
}
}
} }

View File

@@ -83,6 +83,14 @@ public class FlatComponents2Test
scrollPane5.setCorner( JScrollPane.UPPER_TRAILING_CORNER, button ); scrollPane5.setCorner( JScrollPane.UPPER_TRAILING_CORNER, button );
} }
private void rowSelectionChanged() {
table1.setRowSelectionAllowed( rowSelectionCheckBox.isSelected() );
}
private void columnSelectionChanged() {
table1.setColumnSelectionAllowed( columnSelectionCheckBox.isSelected() );
}
@SuppressWarnings( { "unchecked", "rawtypes" } ) @SuppressWarnings( { "unchecked", "rawtypes" } )
private void initComponents() { private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
@@ -104,6 +112,8 @@ public class FlatComponents2Test
table1 = new JTable(); table1 = new JTable();
dndCheckBox = new JCheckBox(); dndCheckBox = new JCheckBox();
tableHeaderButtonCheckBox = new JCheckBox(); tableHeaderButtonCheckBox = new JCheckBox();
rowSelectionCheckBox = new JCheckBox();
columnSelectionCheckBox = new JCheckBox();
//======== this ======== //======== this ========
setLayout(new MigLayout( setLayout(new MigLayout(
@@ -312,6 +322,17 @@ public class FlatComponents2Test
tableHeaderButtonCheckBox.setText("show button in table header"); tableHeaderButtonCheckBox.setText("show button in table header");
tableHeaderButtonCheckBox.addActionListener(e -> tableHeaderButtonChanged()); tableHeaderButtonCheckBox.addActionListener(e -> tableHeaderButtonChanged());
add(tableHeaderButtonCheckBox, "cell 0 4 3 1"); add(tableHeaderButtonCheckBox, "cell 0 4 3 1");
//---- rowSelectionCheckBox ----
rowSelectionCheckBox.setText("row selection");
rowSelectionCheckBox.setSelected(true);
rowSelectionCheckBox.addActionListener(e -> rowSelectionChanged());
add(rowSelectionCheckBox, "cell 0 4 3 1");
//---- columnSelectionCheckBox ----
columnSelectionCheckBox.setText("column selection");
columnSelectionCheckBox.addActionListener(e -> columnSelectionChanged());
add(columnSelectionCheckBox, "cell 0 4 3 1");
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
((JComboBox)((DefaultCellEditor)table1.getColumnModel().getColumn( 3 ).getCellEditor()).getComponent()).setEditable( true ); ((JComboBox)((DefaultCellEditor)table1.getColumnModel().getColumn( 3 ).getCellEditor()).getComponent()).setEditable( true );
@@ -326,6 +347,8 @@ public class FlatComponents2Test
private JTable table1; private JTable table1;
private JCheckBox dndCheckBox; private JCheckBox dndCheckBox;
private JCheckBox tableHeaderButtonCheckBox; private JCheckBox tableHeaderButtonCheckBox;
private JCheckBox rowSelectionCheckBox;
private JCheckBox columnSelectionCheckBox;
// JFormDesigner - End of variables declaration //GEN-END:variables // JFormDesigner - End of variables declaration //GEN-END:variables
//---- class DummyTransferHandler ----------------------------------------- //---- class DummyTransferHandler -----------------------------------------

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8" JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
new FormModel { new FormModel {
contentType: "form/swing" contentType: "form/swing"
@@ -295,6 +295,27 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4 3 1" "value": "cell 0 4 3 1"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "rowSelectionCheckBox"
"text": "row selection"
"selected": true
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "rowSelectionChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4 3 1"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "columnSelectionCheckBox"
"text": "column selection"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "columnSelectionChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4 3 1"
} )
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 ) "location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 790, 715 ) "size": new java.awt.Dimension( 790, 715 )

View File

@@ -53,6 +53,14 @@ public class FlatInternalFrameTest
if( iconCheckBox.isSelected() ) if( iconCheckBox.isSelected() )
internalFrame.setFrameIcon( new FlatFileViewFloppyDriveIcon() ); internalFrame.setFrameIcon( new FlatFileViewFloppyDriveIcon() );
if( menuBarCheckBox.isSelected() ) {
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu( "I'm a Menu Bar" );
menu.add( new JMenuItem( "Menu Item" ) );
menuBar.add( menu );
internalFrame.setJMenuBar( menuBar );
}
JPanel panel = new JPanel() { JPanel panel = new JPanel() {
private final Color color = new Color( (int) (Math.random() * 0xffffff) | 0x20000000, true ); private final Color color = new Color( (int) (Math.random() * 0xffffff) | 0x20000000, true );
@@ -93,6 +101,7 @@ public class FlatInternalFrameTest
iconifiableCheckBox = new JCheckBox(); iconifiableCheckBox = new JCheckBox();
maximizableCheckBox = new JCheckBox(); maximizableCheckBox = new JCheckBox();
iconCheckBox = new JCheckBox(); iconCheckBox = new JCheckBox();
menuBarCheckBox = new JCheckBox();
titleLabel = new JLabel(); titleLabel = new JLabel();
titleField = new JTextField(); titleField = new JTextField();
createFrameButton = new JButton(); createFrameButton = new JButton();
@@ -152,6 +161,10 @@ public class FlatInternalFrameTest
iconCheckBox.setText("Frame icon"); iconCheckBox.setText("Frame icon");
paletteContentPane.add(iconCheckBox, "cell 0 2"); paletteContentPane.add(iconCheckBox, "cell 0 2");
//---- menuBarCheckBox ----
menuBarCheckBox.setText("Menu Bar");
paletteContentPane.add(menuBarCheckBox, "cell 1 2");
//---- titleLabel ---- //---- titleLabel ----
titleLabel.setText("Frame title:"); titleLabel.setText("Frame title:");
paletteContentPane.add(titleLabel, "cell 0 3"); paletteContentPane.add(titleLabel, "cell 0 3");
@@ -163,7 +176,7 @@ public class FlatInternalFrameTest
paletteContentPane.add(createFrameButton, "cell 1 4,alignx right,growx 0"); paletteContentPane.add(createFrameButton, "cell 1 4,alignx right,growx 0");
} }
desktopPane.add(palette, JLayeredPane.PALETTE_LAYER); desktopPane.add(palette, JLayeredPane.PALETTE_LAYER);
palette.setBounds(15, 25, 220, 185); palette.setBounds(15, 25, 275, 185);
} }
add(desktopPane, "cell 0 0,width 600,height 600"); add(desktopPane, "cell 0 0,width 600,height 600");
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
@@ -180,6 +193,7 @@ public class FlatInternalFrameTest
private JCheckBox iconifiableCheckBox; private JCheckBox iconifiableCheckBox;
private JCheckBox maximizableCheckBox; private JCheckBox maximizableCheckBox;
private JCheckBox iconCheckBox; private JCheckBox iconCheckBox;
private JCheckBox menuBarCheckBox;
private JLabel titleLabel; private JLabel titleLabel;
private JTextField titleField; private JTextField titleField;
private JButton createFrameButton; private JButton createFrameButton;

View File

@@ -56,6 +56,12 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2" "value": "cell 0 2"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "menuBarCheckBox"
"text": "Menu Bar"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "titleLabel" name: "titleLabel"
"text": "Frame title:" "text": "Frame title:"
@@ -77,7 +83,7 @@ new FormModel {
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"x": 15 "x": 15
"y": 25 "y": 25
"width": 220 "width": 275
"height": 185 "height": 185
"layer": 100 "layer": 100
} ) } )

View File

@@ -18,8 +18,13 @@ package com.formdev.flatlaf.testing;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.*; import java.awt.event.*;
import java.util.function.Supplier;
import javax.swing.*; import javax.swing.*;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.util.UIScale;
import net.miginfocom.swing.*; import net.miginfocom.swing.*;
/** /**
@@ -31,12 +36,15 @@ public class FlatMenusTest
public static void main( String[] args ) { public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> { SwingUtilities.invokeLater( () -> {
FlatTestFrame frame = FlatTestFrame.create( args, "FlatMenusTest" ); FlatTestFrame frame = FlatTestFrame.create( args, "FlatMenusTest" );
frame.useApplyComponentOrientation = true;
frame.showFrame( FlatMenusTest::new ); frame.showFrame( FlatMenusTest::new );
} ); } );
} }
FlatMenusTest() { FlatMenusTest() {
initComponents(); initComponents();
largerCheckBox.setSelected( LargerMenuItem.useLargerSize );
} }
private void armedChanged() { private void armedChanged() {
@@ -54,6 +62,13 @@ public class FlatMenusTest
} }
} }
private void underlineChanged() {
UIManager.put( "MenuItem.selectionType", underlineCheckBox.isSelected() ? "underline" : null );
if( armedCheckBox.isSelected() )
FlatLaf.updateUI();
}
private void showPopupMenuButtonActionPerformed(ActionEvent e) { private void showPopupMenuButtonActionPerformed(ActionEvent e) {
Component invoker = (Component) e.getSource(); Component invoker = (Component) e.getSource();
PopupMenu popupMenu = new PopupMenu(); PopupMenu popupMenu = new PopupMenu();
@@ -61,16 +76,107 @@ public class FlatMenusTest
popupMenu.show( invoker, 0, invoker.getHeight() ); popupMenu.show( invoker, 0, invoker.getHeight() );
} }
private void largerChanged() {
LargerMenuItem.useLargerSize = largerCheckBox.isSelected();
menuBar2.revalidate();
}
private void accelChanged() {
updateAccel( menuBar2, () -> {
return accelCheckBox.isSelected() ? getRandomKeyStroke() : null;
} );
}
private void updateAccel( Component c, Supplier<KeyStroke> keyStrokeSupplier ) {
if( c instanceof JMenuItem && !(c instanceof JMenu) )
((JMenuItem)c).setAccelerator( keyStrokeSupplier.get() );
if( c instanceof Container ) {
for( Component c2 : ((Container)c).getComponents() )
updateAccel( c2, keyStrokeSupplier );
}
if( c instanceof JMenu ) {
randomKeyStrokeIndex = 0;
JMenu menu = (JMenu) c;
int itemCount = menu.getItemCount();
for( int i = 0; i < itemCount; i++ )
updateAccel( menu.getItem( i ), keyStrokeSupplier );
}
}
private KeyStroke getRandomKeyStroke() {
if( randomKeyStrokeIndex >= randomKeyStrokes.length )
randomKeyStrokeIndex = 0;
return randomKeyStrokes[randomKeyStrokeIndex++];
}
private int randomKeyStrokeIndex = 0;
private final KeyStroke[] randomKeyStrokes = {
KeyStroke.getKeyStroke( KeyEvent.VK_F2, 0 ),
KeyStroke.getKeyStroke( KeyEvent.VK_A, KeyEvent.CTRL_MASK ),
KeyStroke.getKeyStroke( KeyEvent.VK_B, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK ),
KeyStroke.getKeyStroke( KeyEvent.VK_BACK_SPACE, 0 ),
KeyStroke.getKeyStroke( KeyEvent.VK_PAGE_UP, 0 ),
KeyStroke.getKeyStroke( KeyEvent.VK_C, KeyEvent.ALT_MASK ),
KeyStroke.getKeyStroke( KeyEvent.VK_ENTER, 0 ),
KeyStroke.getKeyStroke( KeyEvent.VK_F10, 0 ),
KeyStroke.getKeyStroke( KeyEvent.VK_0, 0 ),
};
private void initComponents() { private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JLabel menuBarLabel = new JLabel(); JLabel menuBarLabel = new JLabel();
JMenuBar menuBar1 = new JMenuBar(); JMenuBar menuBar1 = new JMenuBar();
JMenu menu5 = new JMenu(); JMenu menu5 = new JMenu();
JMenuItem menuItem35 = new JMenuItem();
JMenuItem menuItem7 = new JMenuItem(); JMenuItem menuItem7 = new JMenuItem();
JMenuItem menuItem34 = new JMenuItem();
JMenuItem menuItem8 = new JMenuItem(); JMenuItem menuItem8 = new JMenuItem();
JMenuItem menuItem38 = new JMenuItem();
JMenu menu11 = new JMenu();
JMenuItem menuItem36 = new JMenuItem();
JMenuItem menuItem37 = new JMenuItem();
JCheckBoxMenuItem checkBoxMenuItem6 = new JCheckBoxMenuItem();
JCheckBoxMenuItem checkBoxMenuItem7 = new JCheckBoxMenuItem();
JRadioButtonMenuItem radioButtonMenuItem5 = new JRadioButtonMenuItem();
JRadioButtonMenuItem radioButtonMenuItem6 = new JRadioButtonMenuItem();
JRadioButtonMenuItem radioButtonMenuItem8 = new JRadioButtonMenuItem();
JRadioButtonMenuItem radioButtonMenuItem9 = new JRadioButtonMenuItem();
JMenu menu6 = new JMenu(); JMenu menu6 = new JMenu();
JMenuItem menuItem5 = new JMenuItem(); JMenuItem menuItem5 = new JMenuItem();
JMenuItem menuItem6 = new JMenuItem(); JMenuItem menuItem6 = new JMenuItem();
FlatMenusTest.MenuWithAccelerator menuWithAccelerator1 = new FlatMenusTest.MenuWithAccelerator();
FlatMenusTest.MenuWithAccelerator menuWithAccelerator2 = new FlatMenusTest.MenuWithAccelerator();
JMenuItem menuItem40 = new JMenuItem();
JMenuItem menuItem39 = new JMenuItem();
menuBar2 = new JMenuBar();
JMenu menu8 = new JMenu();
FlatMenusTest.LargerMenuItem menuItem13 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem14 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem27 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem15 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem16 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem28 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem18 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem17 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem19 = new FlatMenusTest.LargerMenuItem();
JMenuItem menuItem31 = new JMenuItem();
JMenu menu9 = new JMenu();
FlatMenusTest.LargerMenuItem menuItem20 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem21 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem29 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem22 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem23 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem30 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem25 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem24 = new FlatMenusTest.LargerMenuItem();
FlatMenusTest.LargerMenuItem menuItem26 = new FlatMenusTest.LargerMenuItem();
JMenuItem menuItem32 = new JMenuItem();
JMenu menu10 = new JMenu();
FlatMenusTest.LargerMenuItem menuItem33 = new FlatMenusTest.LargerMenuItem();
JPanel panel5 = new JPanel();
largerCheckBox = new JCheckBox();
accelCheckBox = new JCheckBox();
JPanel panel1 = new JPanel(); JPanel panel1 = new JPanel();
JLabel menuLabel = new JLabel(); JLabel menuLabel = new JLabel();
JMenu menu1 = new JMenu(); JMenu menu1 = new JMenu();
@@ -100,6 +206,7 @@ public class FlatMenusTest
JLabel popupMenuLabel = new JLabel(); JLabel popupMenuLabel = new JLabel();
JButton showPopupMenuButton = new JButton(); JButton showPopupMenuButton = new JButton();
armedCheckBox = new JCheckBox(); armedCheckBox = new JCheckBox();
underlineCheckBox = new JCheckBox();
//======== this ======== //======== this ========
setLayout(new MigLayout( setLayout(new MigLayout(
@@ -114,6 +221,7 @@ public class FlatMenusTest
"[]" + "[]" +
"[top]" + "[top]" +
"[]" + "[]" +
"[]" +
"[]")); "[]"));
//---- menuBarLabel ---- //---- menuBarLabel ----
@@ -127,16 +235,81 @@ public class FlatMenusTest
{ {
menu5.setText("text"); menu5.setText("text");
menu5.setMnemonic('T'); menu5.setMnemonic('T');
menu5.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
//---- menuItem35 ----
menuItem35.setText("text");
menu5.add(menuItem35);
//---- menuItem7 ---- //---- menuItem7 ----
menuItem7.setText("text"); menuItem7.setText("text");
menuItem7.setMnemonic('X'); menuItem7.setMnemonic('X');
menuItem7.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png")));
menuItem7.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, KeyEvent.CTRL_MASK|KeyEvent.SHIFT_MASK));
menu5.add(menuItem7); menu5.add(menuItem7);
//---- menuItem34 ----
menuItem34.setText("longer text longer text");
menuItem34.setMnemonic('E');
menuItem34.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0));
menu5.add(menuItem34);
//---- menuItem8 ---- //---- menuItem8 ----
menuItem8.setText("text"); menuItem8.setText("longer text longer text longer");
menuItem8.setMnemonic('E'); menuItem8.setMnemonic('E');
menu5.add(menuItem8); menu5.add(menuItem8);
//---- menuItem38 ----
menuItem38.setText("<html>some <b color=\"red\">HTML</b> <i color=\"blue\">text</i></html>");
menu5.add(menuItem38);
//======== menu11 ========
{
menu11.setText("sub menu");
//---- menuItem36 ----
menuItem36.setText("text");
menu11.add(menuItem36);
//---- menuItem37 ----
menuItem37.setText("text");
menu11.add(menuItem37);
}
menu5.add(menu11);
menu5.addSeparator();
//---- checkBoxMenuItem6 ----
checkBoxMenuItem6.setText("check");
checkBoxMenuItem6.setSelected(true);
menu5.add(checkBoxMenuItem6);
//---- checkBoxMenuItem7 ----
checkBoxMenuItem7.setText("check with icon");
checkBoxMenuItem7.setSelected(true);
checkBoxMenuItem7.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
menu5.add(checkBoxMenuItem7);
menu5.addSeparator();
//---- radioButtonMenuItem5 ----
radioButtonMenuItem5.setText("radio 1");
radioButtonMenuItem5.setSelected(true);
menu5.add(radioButtonMenuItem5);
//---- radioButtonMenuItem6 ----
radioButtonMenuItem6.setText("radio 2");
menu5.add(radioButtonMenuItem6);
menu5.addSeparator();
//---- radioButtonMenuItem8 ----
radioButtonMenuItem8.setText("radio with icon 1");
radioButtonMenuItem8.setSelected(true);
radioButtonMenuItem8.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
menu5.add(radioButtonMenuItem8);
//---- radioButtonMenuItem9 ----
radioButtonMenuItem9.setText("radio with icon 2");
radioButtonMenuItem9.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png")));
menu5.add(radioButtonMenuItem9);
} }
menuBar1.add(menu5); menuBar1.add(menu5);
@@ -153,8 +326,206 @@ public class FlatMenusTest
menu6.add(menuItem6); menu6.add(menuItem6);
} }
menuBar1.add(menu6); menuBar1.add(menu6);
//======== menuWithAccelerator1 ========
{
menuWithAccelerator1.setText("text");
menuWithAccelerator1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0));
//======== menuWithAccelerator2 ========
{
menuWithAccelerator2.setText("text");
menuWithAccelerator2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, KeyEvent.CTRL_MASK));
//---- menuItem40 ----
menuItem40.setText("text");
menuWithAccelerator2.add(menuItem40);
}
menuWithAccelerator1.add(menuWithAccelerator2);
//---- menuItem39 ----
menuItem39.setText("text");
menuItem39.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, KeyEvent.CTRL_MASK));
menuWithAccelerator1.add(menuItem39);
}
menuBar1.add(menuWithAccelerator1);
} }
add(menuBar1, "cell 1 0 4 1,growx"); add(menuBar1, "cell 1 0 2 1,growx");
//======== menuBar2 ========
{
//======== menu8 ========
{
menu8.setText("text position");
menu8.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png")));
menu8.setHorizontalTextPosition(SwingConstants.CENTER);
menu8.setVerticalTextPosition(SwingConstants.BOTTOM);
//---- menuItem13 ----
menuItem13.setText("vert top");
menuItem13.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem13.setVerticalTextPosition(SwingConstants.TOP);
menu8.add(menuItem13);
//---- menuItem14 ----
menuItem14.setText("vert bottom");
menuItem14.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem14.setVerticalTextPosition(SwingConstants.BOTTOM);
menu8.add(menuItem14);
//---- menuItem27 ----
menuItem27.setText("horz leading");
menuItem27.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem27.setHorizontalTextPosition(SwingConstants.LEADING);
menu8.add(menuItem27);
//---- menuItem15 ----
menuItem15.setText("horz left");
menuItem15.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem15.setHorizontalTextPosition(SwingConstants.LEFT);
menu8.add(menuItem15);
//---- menuItem16 ----
menuItem16.setText("horz right");
menuItem16.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem16.setHorizontalTextPosition(SwingConstants.RIGHT);
menu8.add(menuItem16);
//---- menuItem28 ----
menuItem28.setText("horz trailing");
menuItem28.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menu8.add(menuItem28);
//---- menuItem18 ----
menuItem18.setText("horz center / vert top");
menuItem18.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem18.setHorizontalTextPosition(SwingConstants.CENTER);
menuItem18.setVerticalTextPosition(SwingConstants.TOP);
menu8.add(menuItem18);
//---- menuItem17 ----
menuItem17.setText("horz center / vert bottom");
menuItem17.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem17.setHorizontalTextPosition(SwingConstants.CENTER);
menuItem17.setVerticalTextPosition(SwingConstants.BOTTOM);
menu8.add(menuItem17);
//---- menuItem19 ----
menuItem19.setText("horz center / vert center");
menuItem19.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem19.setHorizontalTextPosition(SwingConstants.CENTER);
menu8.add(menuItem19);
//---- menuItem31 ----
menuItem31.setText("1234567890123456789012345678901234567890");
menu8.add(menuItem31);
}
menuBar2.add(menu8);
//======== menu9 ========
{
menu9.setText("alignment");
menu9.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png")));
menu9.setHorizontalTextPosition(SwingConstants.CENTER);
menu9.setVerticalTextPosition(SwingConstants.TOP);
//---- menuItem20 ----
menuItem20.setText("vert top");
menuItem20.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem20.setVerticalAlignment(SwingConstants.TOP);
menu9.add(menuItem20);
//---- menuItem21 ----
menuItem21.setText("vert bottom");
menuItem21.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem21.setVerticalAlignment(SwingConstants.BOTTOM);
menu9.add(menuItem21);
//---- menuItem29 ----
menuItem29.setText("horz leading");
menuItem29.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menu9.add(menuItem29);
//---- menuItem22 ----
menuItem22.setText("horz left");
menuItem22.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem22.setHorizontalAlignment(SwingConstants.LEFT);
menu9.add(menuItem22);
//---- menuItem23 ----
menuItem23.setText("horz right");
menuItem23.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem23.setHorizontalAlignment(SwingConstants.RIGHT);
menu9.add(menuItem23);
//---- menuItem30 ----
menuItem30.setText("horz trailing");
menuItem30.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem30.setHorizontalAlignment(SwingConstants.TRAILING);
menu9.add(menuItem30);
//---- menuItem25 ----
menuItem25.setText("horz center / vert top");
menuItem25.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem25.setHorizontalAlignment(SwingConstants.CENTER);
menuItem25.setVerticalAlignment(SwingConstants.TOP);
menu9.add(menuItem25);
//---- menuItem24 ----
menuItem24.setText("horz center / vert bottom");
menuItem24.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem24.setHorizontalAlignment(SwingConstants.CENTER);
menuItem24.setVerticalAlignment(SwingConstants.BOTTOM);
menu9.add(menuItem24);
//---- menuItem26 ----
menuItem26.setText("horz center / vert center");
menuItem26.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menuItem26.setHorizontalAlignment(SwingConstants.CENTER);
menu9.add(menuItem26);
//---- menuItem32 ----
menuItem32.setText("1234567890123456789012345678901234567890");
menu9.add(menuItem32);
}
menuBar2.add(menu9);
//======== menu10 ========
{
menu10.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menu10.setHorizontalTextPosition(SwingConstants.CENTER);
menu10.setVerticalTextPosition(SwingConstants.TOP);
//---- menuItem33 ----
menuItem33.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png")));
menu10.add(menuItem33);
}
menuBar2.add(menu10);
}
add(menuBar2, "cell 3 0 2 1,growx");
//======== panel5 ========
{
panel5.setLayout(new MigLayout(
"ltr,insets 0,hidemode 3",
// columns
"[]",
// rows
"[]0" +
"[]"));
//---- largerCheckBox ----
largerCheckBox.setText("larger");
largerCheckBox.addActionListener(e -> largerChanged());
panel5.add(largerCheckBox, "cell 0 0");
//---- accelCheckBox ----
accelCheckBox.setText("accel");
accelCheckBox.addActionListener(e -> accelChanged());
panel5.add(accelCheckBox, "cell 0 1");
}
add(panel5, "cell 3 0 2 1");
//======== panel1 ======== //======== panel1 ========
{ {
@@ -197,7 +568,7 @@ public class FlatMenusTest
panel1.add(checkBoxMenuItemLabel, "cell 0 2"); panel1.add(checkBoxMenuItemLabel, "cell 0 2");
//---- checkBoxMenuItem1 ---- //---- checkBoxMenuItem1 ----
checkBoxMenuItem1.setText("enabled"); checkBoxMenuItem1.setText("<html>en<b>abl</b>ed</html>");
checkBoxMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)); checkBoxMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
checkBoxMenuItem1.setMnemonic('A'); checkBoxMenuItem1.setMnemonic('A');
panel1.add(checkBoxMenuItem1, "cell 1 2"); panel1.add(checkBoxMenuItem1, "cell 1 2");
@@ -207,7 +578,7 @@ public class FlatMenusTest
panel1.add(radioButtonMenuItemLabel, "cell 0 3"); panel1.add(radioButtonMenuItemLabel, "cell 0 3");
//---- radioButtonMenuItem1 ---- //---- radioButtonMenuItem1 ----
radioButtonMenuItem1.setText("enabled"); radioButtonMenuItem1.setText("<html>en<b color=\"red\">abl</b><i color=\"blue\">ed</i></html>");
radioButtonMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)); radioButtonMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
radioButtonMenuItem1.setMnemonic('B'); radioButtonMenuItem1.setMnemonic('B');
panel1.add(radioButtonMenuItem1, "cell 1 3"); panel1.add(radioButtonMenuItem1, "cell 1 3");
@@ -361,13 +732,34 @@ public class FlatMenusTest
armedCheckBox.setMnemonic('A'); armedCheckBox.setMnemonic('A');
armedCheckBox.addActionListener(e -> armedChanged()); armedCheckBox.addActionListener(e -> armedChanged());
add(armedCheckBox, "cell 0 3"); add(armedCheckBox, "cell 0 3");
//---- underlineCheckBox ----
underlineCheckBox.setText("underline menu selection");
underlineCheckBox.addActionListener(e -> underlineChanged());
add(underlineCheckBox, "cell 0 4 2 1");
//---- buttonGroup1 ----
ButtonGroup buttonGroup1 = new ButtonGroup();
buttonGroup1.add(radioButtonMenuItem5);
buttonGroup1.add(radioButtonMenuItem6);
//---- buttonGroup2 ----
ButtonGroup buttonGroup2 = new ButtonGroup();
buttonGroup2.add(radioButtonMenuItem8);
buttonGroup2.add(radioButtonMenuItem9);
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
} }
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JMenuBar menuBar2;
private JCheckBox largerCheckBox;
private JCheckBox accelCheckBox;
private JCheckBox armedCheckBox; private JCheckBox armedCheckBox;
private JCheckBox underlineCheckBox;
// JFormDesigner - End of variables declaration //GEN-END:variables // JFormDesigner - End of variables declaration //GEN-END:variables
//---- class PopupMenu ----------------------------------------------------
private class PopupMenu extends JPopupMenu { private class PopupMenu extends JPopupMenu {
private PopupMenu() { private PopupMenu() {
initComponents(); initComponents();
@@ -417,4 +809,54 @@ public class FlatMenusTest
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
// JFormDesigner - End of variables declaration //GEN-END:variables // JFormDesigner - End of variables declaration //GEN-END:variables
} }
//---- class LargerMenuItem -----------------------------------------------
public static class LargerMenuItem
extends JMenuItem
{
static boolean useLargerSize = true;
@Override
public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize();
return useLargerSize
? new Dimension( size.width + UIScale.scale( 40 ),
size.height + UIScale.scale( 30 ) )
: size;
}
@Override
protected void paintComponent( Graphics g ) {
super.paintComponent( g );
g.setColor( UIManager.getColor( "Separator.foreground" ) );
g.drawLine( 0, 0, getWidth(), 0 );
g.drawLine( 0, getHeight(), getWidth(), getHeight() );
}
}
//---- class MenuWithAccelerator ------------------------------------------
public static class MenuWithAccelerator
extends JMenu
{
private KeyStroke accelerator;
@Override
public KeyStroke getAccelerator() {
return accelerator;
}
@Override
public void setAccelerator( KeyStroke keyStroke ) {
KeyStroke oldAccelerator = accelerator;
this.accelerator = keyStroke;
revalidate();
repaint();
firePropertyChange( "accelerator", oldAccelerator, accelerator );
}
}
} }

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8" JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
new FormModel { new FormModel {
contentType: "form/swing" contentType: "form/swing"
@@ -9,7 +9,7 @@ new FormModel {
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "ltr,insets dialog,hidemode 3" "$layoutConstraints": "ltr,insets dialog,hidemode 3"
"$columnConstraints": "[125][][][][]" "$columnConstraints": "[125][][][][]"
"$rowConstraints": "[][top][][]" "$rowConstraints": "[][top][][][]"
} ) { } ) {
name: "this" name: "this"
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
@@ -24,16 +24,89 @@ new FormModel {
name: "menu5" name: "menu5"
"text": "text" "text": "text"
"mnemonic": 84 "mnemonic": 84
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png" )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem35"
"text": "text"
} )
add( new FormComponent( "javax.swing.JMenuItem" ) { add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem7" name: "menuItem7"
"text": "text" "text": "text"
"mnemonic": 88 "mnemonic": 88
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png" )
"accelerator": static javax.swing.KeyStroke getKeyStroke( 74, 195, false )
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem34"
"text": "longer text longer text"
"mnemonic": 69
"accelerator": static javax.swing.KeyStroke getKeyStroke( 115, 0, false )
} ) } )
add( new FormComponent( "javax.swing.JMenuItem" ) { add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem8" name: "menuItem8"
"text": "text" "text": "longer text longer text longer"
"mnemonic": 69 "mnemonic": 69
} ) } )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem38"
"text": "<html>some <b color=\"red\">HTML</b> <i color=\"blue\">text</i></html>"
} )
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menu11"
"text": "sub menu"
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem36"
"text": "text"
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem37"
"text": "text"
} )
} )
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
name: "separator3"
} )
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
name: "checkBoxMenuItem6"
"text": "check"
"selected": true
} )
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
name: "checkBoxMenuItem7"
"text": "check with icon"
"selected": true
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png" )
} )
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
name: "separator5"
} )
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
name: "radioButtonMenuItem5"
"text": "radio 1"
"$buttonGroup": new FormReference( "buttonGroup1" )
"selected": true
} )
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
name: "radioButtonMenuItem6"
"text": "radio 2"
"$buttonGroup": new FormReference( "buttonGroup1" )
} )
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
name: "separator4"
} )
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
name: "radioButtonMenuItem8"
"text": "radio with icon 1"
"selected": true
"$buttonGroup": new FormReference( "buttonGroup2" )
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png" )
} )
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
name: "radioButtonMenuItem9"
"text": "radio with icon 2"
"$buttonGroup": new FormReference( "buttonGroup2" )
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png" )
} )
} ) } )
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menu6" name: "menu6"
@@ -47,8 +120,206 @@ new FormModel {
"text": "text" "text": "text"
} ) } )
} ) } )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatMenusTest$MenuWithAccelerator", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menuWithAccelerator1"
"text": "text"
"accelerator": static javax.swing.KeyStroke getKeyStroke( 122, 0, false )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatMenusTest$MenuWithAccelerator", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menuWithAccelerator2"
"text": "text"
"accelerator": &KeyStroke0 static javax.swing.KeyStroke getKeyStroke( 72, 130, false )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem40"
"text": "text"
} )
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem39"
"text": "text"
"accelerator": #KeyStroke0
} )
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0 4 1,growx" "value": "cell 1 0 2 1,growx"
} )
add( new FormContainer( "javax.swing.JMenuBar", new FormLayoutManager( class javax.swing.JMenuBar ) ) {
name: "menuBar2"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menu8"
"text": "text position"
"icon": &SwingIcon0 new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png" )
"horizontalTextPosition": 0
"verticalTextPosition": 3
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem13"
"text": "vert top"
"icon": &SwingIcon1 new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png" )
"verticalTextPosition": 1
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem14"
"text": "vert bottom"
"icon": #SwingIcon1
"verticalTextPosition": 3
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem27"
"text": "horz leading"
"icon": &SwingIcon2 new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png" )
"horizontalTextPosition": 10
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem15"
"text": "horz left"
"icon": #SwingIcon2
"horizontalTextPosition": 2
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem16"
"text": "horz right"
"icon": #SwingIcon2
"horizontalTextPosition": 4
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem28"
"text": "horz trailing"
"icon": #SwingIcon2
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem18"
"text": "horz center / vert top"
"icon": #SwingIcon2
"horizontalTextPosition": 0
"verticalTextPosition": 1
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem17"
"text": "horz center / vert bottom"
"icon": #SwingIcon2
"horizontalTextPosition": 0
"verticalTextPosition": 3
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem19"
"text": "horz center / vert center"
"icon": #SwingIcon2
"horizontalTextPosition": 0
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem31"
"text": "1234567890123456789012345678901234567890"
} )
} )
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menu9"
"text": "alignment"
"icon": #SwingIcon0
"horizontalTextPosition": 0
"verticalTextPosition": 1
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem20"
"text": "vert top"
"icon": #SwingIcon1
"verticalAlignment": 1
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem21"
"text": "vert bottom"
"icon": #SwingIcon1
"verticalAlignment": 3
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem29"
"text": "horz leading"
"icon": #SwingIcon2
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem22"
"text": "horz left"
"icon": #SwingIcon2
"horizontalAlignment": 2
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem23"
"text": "horz right"
"icon": #SwingIcon2
"horizontalAlignment": 4
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem30"
"text": "horz trailing"
"icon": #SwingIcon2
"horizontalAlignment": 11
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem25"
"text": "horz center / vert top"
"icon": #SwingIcon2
"horizontalAlignment": 0
"verticalAlignment": 1
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem24"
"text": "horz center / vert bottom"
"icon": #SwingIcon2
"horizontalAlignment": 0
"verticalAlignment": 3
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem26"
"text": "horz center / vert center"
"icon": #SwingIcon2
"horizontalAlignment": 0
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem32"
"text": "1234567890123456789012345678901234567890"
} )
} )
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menu10"
"icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png" )
"horizontalTextPosition": 0
"verticalTextPosition": 1
add( new FormComponent( "com.formdev.flatlaf.testing.FlatMenusTest$LargerMenuItem" ) {
name: "menuItem33"
"icon": #SwingIcon1
} )
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 0 2 1,growx"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$columnConstraints": "[]"
"$rowConstraints": "[]0[]"
"$layoutConstraints": "ltr,insets 0,hidemode 3"
} ) {
name: "panel5"
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "largerCheckBox"
"text": "larger"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "largerChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "accelCheckBox"
"text": "accel"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "accelChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 0 2 1"
} ) } )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$columnConstraints": "[125,left][fill]" "$columnConstraints": "[125,left][fill]"
@@ -92,8 +363,8 @@ new FormModel {
} ) } )
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) { add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
name: "checkBoxMenuItem1" name: "checkBoxMenuItem1"
"text": "enabled" "text": "<html>en<b>abl</b>ed</html>"
"accelerator": &KeyStroke0 static javax.swing.KeyStroke getKeyStroke( 112, 0, false ) "accelerator": &KeyStroke1 static javax.swing.KeyStroke getKeyStroke( 112, 0, false )
"mnemonic": 65 "mnemonic": 65
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2" "value": "cell 1 2"
@@ -106,8 +377,8 @@ new FormModel {
} ) } )
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) { add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
name: "radioButtonMenuItem1" name: "radioButtonMenuItem1"
"text": "enabled" "text": "<html>en<b color=\"red\">abl</b><i color=\"blue\">ed</i></html>"
"accelerator": #KeyStroke0 "accelerator": #KeyStroke1
"mnemonic": 66 "mnemonic": 66
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3" "value": "cell 1 3"
@@ -154,7 +425,7 @@ new FormModel {
name: "checkBoxMenuItem2" name: "checkBoxMenuItem2"
"text": "disabled" "text": "disabled"
"enabled": false "enabled": false
"accelerator": #KeyStroke0 "accelerator": #KeyStroke1
"mnemonic": 83 "mnemonic": 83
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2" "value": "cell 0 2"
@@ -163,7 +434,7 @@ new FormModel {
name: "radioButtonMenuItem2" name: "radioButtonMenuItem2"
"text": "disabled" "text": "disabled"
"enabled": false "enabled": false
"accelerator": #KeyStroke0 "accelerator": #KeyStroke1
"mnemonic": 76 "mnemonic": 76
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3" "value": "cell 0 3"
@@ -189,7 +460,7 @@ new FormModel {
name: "menuItem3" name: "menuItem3"
"text": "selected" "text": "selected"
"selected": true "selected": true
"accelerator": #KeyStroke0 "accelerator": #KeyStroke1
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1" "value": "cell 0 1"
} ) } )
@@ -197,7 +468,7 @@ new FormModel {
name: "checkBoxMenuItem3" name: "checkBoxMenuItem3"
"text": "selected" "text": "selected"
"selected": true "selected": true
"accelerator": #KeyStroke0 "accelerator": #KeyStroke1
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2" "value": "cell 0 2"
} ) } )
@@ -205,7 +476,7 @@ new FormModel {
name: "radioButtonMenuItem3" name: "radioButtonMenuItem3"
"text": "selected" "text": "selected"
"selected": true "selected": true
"accelerator": #KeyStroke0 "accelerator": #KeyStroke1
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3" "value": "cell 0 3"
} ) } )
@@ -231,7 +502,7 @@ new FormModel {
"text": "selected disabled" "text": "selected disabled"
"selected": true "selected": true
"enabled": false "enabled": false
"accelerator": #KeyStroke0 "accelerator": #KeyStroke1
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1" "value": "cell 0 1"
} ) } )
@@ -240,7 +511,7 @@ new FormModel {
"text": "selected disabled" "text": "selected disabled"
"enabled": false "enabled": false
"selected": true "selected": true
"accelerator": #KeyStroke0 "accelerator": #KeyStroke1
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2" "value": "cell 0 2"
} ) } )
@@ -249,7 +520,7 @@ new FormModel {
"text": "selected disabled" "text": "selected disabled"
"enabled": false "enabled": false
"selected": true "selected": true
"accelerator": #KeyStroke0 "accelerator": #KeyStroke1
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3" "value": "cell 0 3"
} ) } )
@@ -280,6 +551,16 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3" "value": "cell 0 3"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "underlineCheckBox"
"text": "underline menu selection"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "underlineChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4 2 1"
} )
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 ) "location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 790, 380 ) "size": new java.awt.Dimension( 790, 380 )
@@ -321,5 +602,15 @@ new FormModel {
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 430 ) "location": new java.awt.Point( 0, 430 )
} ) } )
add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
name: "buttonGroup1"
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 564 )
} )
add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
name: "buttonGroup2"
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 616 )
} )
} }
} }

View File

@@ -0,0 +1,449 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formdev.flatlaf.testing;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import net.miginfocom.swing.*;
/**
* @author Karl Tauber
*/
public class FlatMnemonicsTest
extends FlatTestPanel
{
public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> {
FlatTestFrame frame = FlatTestFrame.create( args, "FlatMnemonicsTest" );
frame.showFrame( FlatMnemonicsTest::new, panel -> ((FlatMnemonicsTest)panel).menuBar );
} );
}
FlatMnemonicsTest() {
initComponents();
}
private void menuItemActionPerformed(ActionEvent e) {
SwingUtilities.invokeLater( () -> {
JOptionPane.showMessageDialog( this, e.getActionCommand(), "Menu Item", JOptionPane.PLAIN_MESSAGE );
} );
}
private void textArea1KeyReleased(KeyEvent e) {
if( e.getKeyCode() == KeyEvent.VK_ALT ) {
System.out.println( "++++ consume Alt key on release +++++++++++++++++++++++++++++++++++++++++++++++++++++" );
e.consume();
}
}
private void alwaysShowMnemonicsChanged() {
UIManager.put( "Component.hideMnemonics", !alwaysShowMnemonicsCheckBox.isSelected() );
SwingUtilities.windowForComponent( this ).repaint();
}
private void openDialog() {
JOptionPane.showMessageDialog( this, new FlatMnemonicsTest() );
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JLabel label1 = new JLabel();
JTextField textField1 = new JTextField();
JLabel label2 = new JLabel();
JTextField textField2 = new JTextField();
JLabel label3 = new JLabel();
JComboBox<String> comboBox1 = new JComboBox<>();
JCheckBox checkBox1 = new JCheckBox();
JButton button1 = new JButton();
JLabel label4 = new JLabel();
JScrollPane scrollPane1 = new JScrollPane();
JTextArea textArea1 = new JTextArea();
JTabbedPane tabbedPane1 = new JTabbedPane();
JPanel panel1 = new JPanel();
JLabel label7 = new JLabel();
JPanel panel2 = new JPanel();
JLabel label6 = new JLabel();
JPanel panel3 = new JPanel();
JLabel label5 = new JLabel();
alwaysShowMnemonicsCheckBox = new JCheckBox();
JButton button2 = new JButton();
menuBar = new JMenuBar();
JMenu fileMenu = new JMenu();
JMenuItem newMenuItem = new JMenuItem();
JMenuItem openMenuItem = new JMenuItem();
JMenuItem closeMenuItem = new JMenuItem();
JMenuItem closeMenuItem2 = new JMenuItem();
JMenuItem exitMenuItem = new JMenuItem();
JMenu editMenu = new JMenu();
JMenuItem undoMenuItem = new JMenuItem();
JMenuItem redoMenuItem = new JMenuItem();
JMenuItem cutMenuItem = new JMenuItem();
JMenuItem copyMenuItem = new JMenuItem();
JMenuItem pasteMenuItem = new JMenuItem();
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();
JMenu helpMenu = new JMenu();
JMenuItem aboutMenuItem = new JMenuItem();
JPopupMenu popupMenu1 = new JPopupMenu();
JMenuItem cutMenuItem2 = new JMenuItem();
JMenuItem copyMenuItem2 = new JMenuItem();
JMenuItem pasteMenuItem2 = new JMenuItem();
//======== this ========
setLayout(new MigLayout(
"ltr,insets dialog,hidemode 3",
// columns
"[fill]" +
"[150,fill]para" +
"[300,grow,fill]",
// rows
"[]" +
"[]" +
"[]" +
"[]" +
"[]para" +
"[]" +
"[]para" +
"[]"));
//---- label1 ----
label1.setText("Name");
label1.setLabelFor(textField1);
label1.setDisplayedMnemonic('N');
add(label1, "cell 0 0,alignx left,growx 0");
//---- textField1 ----
textField1.setComponentPopupMenu(popupMenu1);
add(textField1, "cell 1 0");
//---- label2 ----
label2.setText("Phone");
label2.setLabelFor(textField2);
label2.setDisplayedMnemonic('P');
add(label2, "cell 0 1");
//---- textField2 ----
textField2.setComponentPopupMenu(popupMenu1);
add(textField2, "cell 1 1");
//---- label3 ----
label3.setText("Planet");
label3.setDisplayedMnemonic('A');
label3.setLabelFor(comboBox1);
add(label3, "cell 0 2");
//---- comboBox1 ----
comboBox1.setModel(new DefaultComboBoxModel<>(new String[] {
"Earth",
"Moon",
"Mars"
}));
comboBox1.setComponentPopupMenu(popupMenu1);
add(comboBox1, "cell 1 2");
//---- checkBox1 ----
checkBox1.setText("Astronaut");
checkBox1.setMnemonic('S');
checkBox1.setComponentPopupMenu(popupMenu1);
add(checkBox1, "cell 1 3");
//---- button1 ----
button1.setText("Lift off");
button1.setMnemonic('L');
button1.setComponentPopupMenu(popupMenu1);
add(button1, "cell 1 4,alignx left,growx 0");
//---- label4 ----
label4.setText("Text area that consumes Alt key:");
label4.setLabelFor(textArea1);
label4.setDisplayedMnemonic('T');
add(label4, "cell 1 5");
//======== scrollPane1 ========
{
//---- textArea1 ----
textArea1.setRows(4);
textArea1.setComponentPopupMenu(popupMenu1);
textArea1.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
textArea1KeyReleased(e);
}
});
scrollPane1.setViewportView(textArea1);
}
add(scrollPane1, "cell 1 6,grow");
//======== tabbedPane1 ========
{
//======== panel1 ========
{
panel1.setLayout(new FlowLayout());
//---- label7 ----
label7.setText("Guitar");
panel1.add(label7);
}
tabbedPane1.addTab("Guitar", panel1);
tabbedPane1.setMnemonicAt(0, 'G');
//======== panel2 ========
{
panel2.setLayout(new FlowLayout());
//---- label6 ----
label6.setText("Drums");
panel2.add(label6);
}
tabbedPane1.addTab("Drums", panel2);
tabbedPane1.setMnemonicAt(1, 'D');
//======== panel3 ========
{
panel3.setLayout(new FlowLayout());
//---- label5 ----
label5.setText("Keyboard");
panel3.add(label5);
}
tabbedPane1.addTab("Keyboard", panel3);
tabbedPane1.setMnemonicAt(2, 'K');
}
add(tabbedPane1, "cell 2 6,aligny top,growy 0");
//---- alwaysShowMnemonicsCheckBox ----
alwaysShowMnemonicsCheckBox.setText("Always show mnemonics");
alwaysShowMnemonicsCheckBox.setMnemonic('M');
alwaysShowMnemonicsCheckBox.addActionListener(e -> alwaysShowMnemonicsChanged());
add(alwaysShowMnemonicsCheckBox, "cell 0 7 2 1,alignx left,growx 0");
//---- button2 ----
button2.setText("Open Dialog");
button2.addActionListener(e -> openDialog());
add(button2, "cell 2 7,alignx left,growx 0");
//======== menuBar ========
{
//======== fileMenu ========
{
fileMenu.setText("File");
fileMenu.setMnemonic('F');
//---- newMenuItem ----
newMenuItem.setText("New");
newMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, KeyEvent.CTRL_MASK));
newMenuItem.setMnemonic('N');
newMenuItem.addActionListener(e -> menuItemActionPerformed(e));
fileMenu.add(newMenuItem);
//---- openMenuItem ----
openMenuItem.setText("Open");
openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, KeyEvent.ALT_MASK));
openMenuItem.setMnemonic('O');
openMenuItem.addActionListener(e -> menuItemActionPerformed(e));
fileMenu.add(openMenuItem);
fileMenu.addSeparator();
//---- closeMenuItem ----
closeMenuItem.setText("Close");
closeMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, KeyEvent.CTRL_MASK|KeyEvent.ALT_MASK));
closeMenuItem.setMnemonic('C');
closeMenuItem.addActionListener(e -> menuItemActionPerformed(e));
fileMenu.add(closeMenuItem);
//---- closeMenuItem2 ----
closeMenuItem2.setText("Close All");
closeMenuItem2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, KeyEvent.ALT_MASK|KeyEvent.SHIFT_MASK));
closeMenuItem2.addActionListener(e -> menuItemActionPerformed(e));
fileMenu.add(closeMenuItem2);
fileMenu.addSeparator();
//---- exitMenuItem ----
exitMenuItem.setText("Exit");
exitMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()|KeyEvent.ALT_MASK|KeyEvent.SHIFT_MASK));
exitMenuItem.setMnemonic('X');
exitMenuItem.addActionListener(e -> menuItemActionPerformed(e));
fileMenu.add(exitMenuItem);
}
menuBar.add(fileMenu);
//======== 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');
editMenu.add(cutMenuItem);
//---- copyMenuItem ----
copyMenuItem.setText("Copy");
copyMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
copyMenuItem.setMnemonic('O');
editMenu.add(copyMenuItem);
//---- pasteMenuItem ----
pasteMenuItem.setText("Paste");
pasteMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
pasteMenuItem.setMnemonic('P');
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);
}
menuBar.add(editMenu);
//======== 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);
}
menuBar.add(viewMenu);
//======== helpMenu ========
{
helpMenu.setText("Help");
helpMenu.setMnemonic('H');
//---- aboutMenuItem ----
aboutMenuItem.setText("About");
aboutMenuItem.setMnemonic('A');
aboutMenuItem.addActionListener(e -> menuItemActionPerformed(e));
helpMenu.add(aboutMenuItem);
}
menuBar.add(helpMenu);
}
//======== popupMenu1 ========
{
//---- cutMenuItem2 ----
cutMenuItem2.setText("Cut");
cutMenuItem2.setMnemonic('C');
popupMenu1.add(cutMenuItem2);
//---- copyMenuItem2 ----
copyMenuItem2.setText("Copy");
copyMenuItem2.setMnemonic('O');
popupMenu1.add(copyMenuItem2);
//---- pasteMenuItem2 ----
pasteMenuItem2.setText("Paste");
pasteMenuItem2.setMnemonic('P');
popupMenu1.add(pasteMenuItem2);
}
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JCheckBox alwaysShowMnemonicsCheckBox;
private JMenuBar menuBar;
// JFormDesigner - End of variables declaration //GEN-END:variables
}

View File

@@ -0,0 +1,349 @@
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
root: new FormRoot {
auxiliary() {
"JavaCodeGenerator.defaultVariableLocal": true
}
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
"$columnConstraints": "[fill][150,fill]para[300,grow,fill]"
"$rowConstraints": "[][][][][]para[][]para[]"
} ) {
name: "this"
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label1"
"text": "Name"
"labelFor": new FormReference( "textField1" )
"displayedMnemonic": 78
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0,alignx left,growx 0"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "textField1"
"componentPopupMenu": &FormReference0 new FormReference( "popupMenu1" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label2"
"text": "Phone"
"labelFor": new FormReference( "textField2" )
"displayedMnemonic": 80
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "textField2"
"componentPopupMenu": #FormReference0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label3"
"text": "Planet"
"displayedMnemonic": 65
"labelFor": new FormReference( "comboBox1" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2"
} )
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "comboBox1"
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "Earth"
addElement( "Earth" )
addElement( "Moon" )
addElement( "Mars" )
}
"componentPopupMenu": #FormReference0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "checkBox1"
"text": "Astronaut"
"mnemonic": 83
"componentPopupMenu": #FormReference0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button1"
"text": "Lift off"
"mnemonic": 76
"componentPopupMenu": #FormReference0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4,alignx left,growx 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label4"
"text": "Text area that consumes Alt key:"
"labelFor": new FormReference( "textArea1" )
"displayedMnemonic": 84
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 5"
} )
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "scrollPane1"
add( new FormComponent( "javax.swing.JTextArea" ) {
name: "textArea1"
"rows": 4
"componentPopupMenu": #FormReference0
addEvent( new FormEvent( "java.awt.event.KeyListener", "keyReleased", "textArea1KeyReleased", true ) )
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 6,grow"
} )
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
name: "tabbedPane1"
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) {
name: "panel1"
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label7"
"text": "Guitar"
} )
}, new FormLayoutConstraints( null ) {
"title": "Guitar"
"mnemonic": 71
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) {
name: "panel2"
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label6"
"text": "Drums"
} )
}, new FormLayoutConstraints( null ) {
"title": "Drums"
"mnemonic": 68
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) {
name: "panel3"
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label5"
"text": "Keyboard"
} )
}, new FormLayoutConstraints( null ) {
"title": "Keyboard"
"mnemonic": 75
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 6,aligny top,growy 0"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "alwaysShowMnemonicsCheckBox"
"text": "Always show mnemonics"
"mnemonic": 77
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "alwaysShowMnemonicsChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 7 2 1,alignx left,growx 0"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button2"
"text": "Open Dialog"
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "openDialog", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 7,alignx left,growx 0"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 790, 380 )
} )
add( new FormContainer( "javax.swing.JMenuBar", new FormLayoutManager( class javax.swing.JMenuBar ) ) {
name: "menuBar"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
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( 74, 130, 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( 74, 520, false )
"mnemonic": 79
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) )
} )
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
name: "separator2"
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "closeMenuItem"
"text": "Close"
"accelerator": static javax.swing.KeyStroke getKeyStroke( 74, 650, false )
"mnemonic": 67
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) )
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "closeMenuItem2"
"text": "Close All"
"accelerator": static javax.swing.KeyStroke getKeyStroke( 74, 585, false )
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) )
} )
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
name: "separator1"
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "exitMenuItem"
"text": "Exit"
"accelerator": static javax.swing.KeyStroke getKeyStroke( 74, 4811, false )
"mnemonic": 88
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "menuItemActionPerformed", true ) )
} )
} )
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"
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "cutMenuItem"
"text": "Cut"
"accelerator": static javax.swing.KeyStroke getKeyStroke( 88, 4226, false )
"mnemonic": 67
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "copyMenuItem"
"text": "Copy"
"accelerator": static javax.swing.KeyStroke getKeyStroke( 67, 4226, false )
"mnemonic": 79
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "pasteMenuItem"
"text": "Paste"
"accelerator": static javax.swing.KeyStroke getKeyStroke( 86, 4226, false )
"mnemonic": 80
} )
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
name: "separator3"
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
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 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", "menuItemActionPerformed", true ) )
} )
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 410 )
"size": new java.awt.Dimension( 255, 30 )
} )
add( new FormContainer( "javax.swing.JPopupMenu", new FormLayoutManager( class javax.swing.JPopupMenu ) ) {
name: "popupMenu1"
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "cutMenuItem2"
"text": "Cut"
"mnemonic": 67
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "copyMenuItem2"
"text": "Copy"
"mnemonic": 79
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "pasteMenuItem2"
"text": "Paste"
"mnemonic": 80
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 300, 415 )
"size": new java.awt.Dimension( 91, 87 )
} )
}
}

View File

@@ -23,6 +23,7 @@ import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
import javax.swing.*; import javax.swing.*;
import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.UIManager.LookAndFeelInfo;
@@ -104,7 +105,7 @@ public class FlatTestFrame
(SystemInfo.IS_LINUX && className.equals( "com.sun.java.swing.plaf.gtk.GTKLookAndFeel") ) ) (SystemInfo.IS_LINUX && className.equals( "com.sun.java.swing.plaf.gtk.GTKLookAndFeel") ) )
name += " (F9)"; name += " (F9)";
else if( className.equals( MetalLookAndFeel.class.getName() ) ) else if( className.equals( MetalLookAndFeel.class.getName() ) )
name += " (F10)"; name += " (F12)";
else if( className.equals( NimbusLookAndFeel.class.getName() ) ) else if( className.equals( NimbusLookAndFeel.class.getName() ) )
name += " (F11)"; name += " (F11)";
@@ -114,25 +115,25 @@ public class FlatTestFrame
String substanceClassName = "org.pushingpixels.substance.api.skin.SubstanceGraphiteAquaLookAndFeel"; String substanceClassName = "org.pushingpixels.substance.api.skin.SubstanceGraphiteAquaLookAndFeel";
if( SystemInfo.IS_JAVA_9_OR_LATER && isClassAvailable( substanceClassName ) ) { if( SystemInfo.IS_JAVA_9_OR_LATER && isClassAvailable( substanceClassName ) ) {
lafModel.addElement( new LookAndFeelInfo( "Substance (F5)", substanceClassName ) ); lafModel.addElement( new LookAndFeelInfo( "Substance (F5)", substanceClassName ) );
registerSwitchToLookAndFeel( KeyEvent.VK_F5, substanceClassName ); registerSwitchToLookAndFeel( "F5", substanceClassName );
} }
String webLafClassName = "com.alee.laf.WebLookAndFeel"; String webLafClassName = "com.alee.laf.WebLookAndFeel";
if( isClassAvailable( webLafClassName ) ) { if( isClassAvailable( webLafClassName ) ) {
lafModel.addElement( new LookAndFeelInfo( "WebLaf (F12)", webLafClassName ) ); lafModel.addElement( new LookAndFeelInfo( "WebLaf (Ctrl+F12)", webLafClassName ) );
registerSwitchToLookAndFeel( KeyEvent.VK_F12, webLafClassName ); registerSwitchToLookAndFeel( "ctrl F12", webLafClassName );
} }
String looksPlasticClassName = "com.jgoodies.looks.plastic.PlasticLookAndFeel"; String looksPlasticClassName = "com.jgoodies.looks.plastic.PlasticLookAndFeel";
if( isClassAvailable( looksPlasticClassName ) ) { if( isClassAvailable( looksPlasticClassName ) ) {
lafModel.addElement( new LookAndFeelInfo( "JGoodies Looks Plastic (F6)", looksPlasticClassName ) ); lafModel.addElement( new LookAndFeelInfo( "JGoodies Looks Plastic (F6)", looksPlasticClassName ) );
registerSwitchToLookAndFeel( KeyEvent.VK_F6, looksPlasticClassName ); registerSwitchToLookAndFeel( "F6", looksPlasticClassName );
} }
String looksWindowsClassName = "com.jgoodies.looks.windows.WindowsLookAndFeel"; String looksWindowsClassName = "com.jgoodies.looks.windows.WindowsLookAndFeel";
if( SystemInfo.IS_WINDOWS && isClassAvailable( looksWindowsClassName ) ) { if( SystemInfo.IS_WINDOWS && isClassAvailable( looksWindowsClassName ) ) {
lafModel.addElement( new LookAndFeelInfo( "JGoodies Looks Windows (F7)", looksWindowsClassName ) ); lafModel.addElement( new LookAndFeelInfo( "JGoodies Looks Windows (F7)", looksWindowsClassName ) );
registerSwitchToLookAndFeel( KeyEvent.VK_F7, looksWindowsClassName ); registerSwitchToLookAndFeel( "F7", looksWindowsClassName );
} }
lookAndFeelComboBox.setModel( lafModel ); lookAndFeelComboBox.setModel( lafModel );
@@ -145,21 +146,21 @@ public class FlatTestFrame
updateSizeVariantComboBox(); updateSizeVariantComboBox();
// register F1, F2, ... keys to switch to Light, Dark or other LaFs // register F1, F2, ... keys to switch to Light, Dark or other LaFs
registerSwitchToLookAndFeel( KeyEvent.VK_F1, FlatLightLaf.class.getName() ); registerSwitchToLookAndFeel( "F1", FlatLightLaf.class.getName() );
registerSwitchToLookAndFeel( KeyEvent.VK_F2, FlatDarkLaf.class.getName() ); registerSwitchToLookAndFeel( "F2", FlatDarkLaf.class.getName() );
registerSwitchToLookAndFeel( KeyEvent.VK_F3, FlatIntelliJLaf.class.getName() ); registerSwitchToLookAndFeel( "F3", FlatIntelliJLaf.class.getName() );
registerSwitchToLookAndFeel( KeyEvent.VK_F4, FlatDarculaLaf.class.getName() ); registerSwitchToLookAndFeel( "F4", FlatDarculaLaf.class.getName() );
registerSwitchToLookAndFeel( KeyEvent.VK_F8, FlatTestLaf.class.getName() ); registerSwitchToLookAndFeel( "F8", FlatTestLaf.class.getName() );
if( SystemInfo.IS_WINDOWS ) if( SystemInfo.IS_WINDOWS )
registerSwitchToLookAndFeel( KeyEvent.VK_F9, "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" ); registerSwitchToLookAndFeel( "F9", "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" );
else if( SystemInfo.IS_MAC ) else if( SystemInfo.IS_MAC )
registerSwitchToLookAndFeel( KeyEvent.VK_F9, "com.apple.laf.AquaLookAndFeel" ); registerSwitchToLookAndFeel( "F9", "com.apple.laf.AquaLookAndFeel" );
else if( SystemInfo.IS_LINUX ) else if( SystemInfo.IS_LINUX )
registerSwitchToLookAndFeel( KeyEvent.VK_F9, "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" ); registerSwitchToLookAndFeel( "F9", "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" );
registerSwitchToLookAndFeel( KeyEvent.VK_F10, MetalLookAndFeel.class.getName() ); registerSwitchToLookAndFeel( "F12", MetalLookAndFeel.class.getName() );
registerSwitchToLookAndFeel( KeyEvent.VK_F11, NimbusLookAndFeel.class.getName() ); registerSwitchToLookAndFeel( "F11", NimbusLookAndFeel.class.getName() );
// register ESC key to close frame // register ESC key to close frame
((JComponent)getContentPane()).registerKeyboardAction( ((JComponent)getContentPane()).registerKeyboardAction(
@@ -228,12 +229,16 @@ public class FlatTestFrame
setTitle( newTitle ); setTitle( newTitle );
} }
private void registerSwitchToLookAndFeel( int keyCode, String lafClassName ) { private void registerSwitchToLookAndFeel( String keyStrokeStr, String lafClassName ) {
KeyStroke keyStroke = KeyStroke.getKeyStroke( keyStrokeStr );
if( keyStroke == null )
throw new IllegalArgumentException( "Invalid key stroke '" + keyStrokeStr + "'" );
((JComponent)getContentPane()).registerKeyboardAction( ((JComponent)getContentPane()).registerKeyboardAction(
e -> { e -> {
selectLookAndFeel( lafClassName ); selectLookAndFeel( lafClassName );
}, },
KeyStroke.getKeyStroke( keyCode, 0, false ), keyStroke,
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ); JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
} }
@@ -247,9 +252,16 @@ public class FlatTestFrame
} }
public void showFrame( Supplier<JComponent> contentFactory ) { public void showFrame( Supplier<JComponent> contentFactory ) {
showFrame( contentFactory, null );
}
public void showFrame( Supplier<JComponent> contentFactory, Function<JComponent, JMenuBar> menuBarFactory ) {
this.contentFactory = contentFactory; this.contentFactory = contentFactory;
this.content = contentFactory.get(); this.content = contentFactory.get();
if( menuBarFactory != null )
setJMenuBar( menuBarFactory.apply( content ) );
contentPanel.getContentPane().add( content ); contentPanel.getContentPane().add( content );
pack(); pack();
setLocationRelativeTo( null ); setLocationRelativeTo( null );

View File

@@ -17,6 +17,7 @@
package com.formdev.flatlaf.testing.extras; package com.formdev.flatlaf.testing.extras;
import javax.swing.*; import javax.swing.*;
import com.formdev.flatlaf.FlatIconColors;
import com.formdev.flatlaf.extras.*; import com.formdev.flatlaf.extras.*;
import com.formdev.flatlaf.testing.*; import com.formdev.flatlaf.testing.*;
import net.miginfocom.swing.*; import net.miginfocom.swing.*;
@@ -30,6 +31,7 @@ public class FlatExtrasTest
public static void main( String[] args ) { public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> { SwingUtilities.invokeLater( () -> {
FlatTestFrame frame = FlatTestFrame.create( args, "FlatExtrasTest" ); FlatTestFrame frame = FlatTestFrame.create( args, "FlatExtrasTest" );
System.out.println( UIManager.getColor( FlatIconColors.ACTIONS_GREY.key ) );
frame.showFrame( FlatExtrasTest::new ); frame.showFrame( FlatExtrasTest::new );
} ); } );
} }
@@ -39,6 +41,29 @@ public class FlatExtrasTest
triStateLabel1.setText( triStateCheckBox1.getState().toString() ); triStateLabel1.setText( triStateCheckBox1.getState().toString() );
triStateLabel2.setText( triStateCheckBox2.getState().toString() ); triStateLabel2.setText( triStateCheckBox2.getState().toString() );
addSVGIcon( "actions/copy.svg" );
addSVGIcon( "actions/colors.svg" );
addSVGIcon( "actions/execute.svg" );
addSVGIcon( "actions/suspend.svg" );
addSVGIcon( "actions/intentionBulb.svg" );
addSVGIcon( "actions/quickfixOffBulb.svg" );
addSVGIcon( "objects/abstractClass.svg" );
addSVGIcon( "objects/abstractMethod.svg" );
addSVGIcon( "objects/annotationtype.svg" );
addSVGIcon( "objects/annotationtype.svg" );
addSVGIcon( "objects/css.svg" );
addSVGIcon( "objects/javaScript.svg" );
addSVGIcon( "objects/xhtml.svg" );
addSVGIcon( "errorDialog.svg" );
addSVGIcon( "informationDialog.svg" );
addSVGIcon( "warningDialog.svg" );
}
private void addSVGIcon( String name ) {
svgIconsPanel.add( new JLabel( new FlatSVGIcon( "com/formdev/flatlaf/demo/extras/svg/" + name ) ) );
} }
private void triStateCheckBox1Changed() { private void triStateCheckBox1Changed() {
@@ -56,6 +81,9 @@ public class FlatExtrasTest
triStateLabel1 = new JLabel(); triStateLabel1 = new JLabel();
triStateCheckBox2 = new TriStateCheckBox(); triStateCheckBox2 = new TriStateCheckBox();
triStateLabel2 = new JLabel(); triStateLabel2 = new JLabel();
label2 = new JLabel();
svgIconsPanel = new JPanel();
label3 = new JLabel();
//======== this ======== //======== this ========
setLayout(new MigLayout( setLayout(new MigLayout(
@@ -66,6 +94,8 @@ public class FlatExtrasTest
"[left]", "[left]",
// rows // rows
"[]" + "[]" +
"[]" +
"[]" +
"[]")); "[]"));
//---- label1 ---- //---- label1 ----
@@ -90,6 +120,25 @@ public class FlatExtrasTest
//---- triStateLabel2 ---- //---- triStateLabel2 ----
triStateLabel2.setText("text"); triStateLabel2.setText("text");
add(triStateLabel2, "cell 2 1"); add(triStateLabel2, "cell 2 1");
//---- label2 ----
label2.setText("SVG Icons:");
add(label2, "cell 0 2");
//======== svgIconsPanel ========
{
svgIconsPanel.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns
"[fill]",
// rows
"[grow,center]"));
}
add(svgIconsPanel, "cell 1 2 2 1");
//---- label3 ----
label3.setText("The icons may change colors when switching to another theme.");
add(label3, "cell 1 3 2 1");
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
} }
@@ -99,5 +148,8 @@ public class FlatExtrasTest
private JLabel triStateLabel1; private JLabel triStateLabel1;
private TriStateCheckBox triStateCheckBox2; private TriStateCheckBox triStateCheckBox2;
private JLabel triStateLabel2; private JLabel triStateLabel2;
private JLabel label2;
private JPanel svgIconsPanel;
private JLabel label3;
// JFormDesigner - End of variables declaration //GEN-END:variables // JFormDesigner - End of variables declaration //GEN-END:variables
} }

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8" JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
new FormModel { new FormModel {
contentType: "form/swing" contentType: "form/swing"
@@ -6,7 +6,7 @@ new FormModel {
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "ltr,insets dialog,hidemode 3" "$layoutConstraints": "ltr,insets dialog,hidemode 3"
"$columnConstraints": "[][][left]" "$columnConstraints": "[][][left]"
"$rowConstraints": "[][]" "$rowConstraints": "[][][][]"
} ) { } ) {
name: "this" name: "this"
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
@@ -42,9 +42,30 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 1" "value": "cell 2 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label2"
"text": "SVG Icons:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3"
"$columnConstraints": "[fill]"
"$rowConstraints": "[grow,center]"
} ) {
name: "svgIconsPanel"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2 2 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label3"
"text": "The icons may change colors when switching to another theme."
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3 2 1"
} )
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 ) "location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 400, 300 ) "size": new java.awt.Dimension( 500, 300 )
} ) } )
} }
} }

View File

@@ -29,6 +29,7 @@ import java.lang.reflect.Array;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.function.Predicate; import java.util.function.Predicate;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
@@ -52,6 +53,7 @@ import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicLookAndFeel; import javax.swing.plaf.basic.BasicLookAndFeel;
import com.formdev.flatlaf.*; import com.formdev.flatlaf.*;
import com.formdev.flatlaf.intellijthemes.FlatAllIJThemes; import com.formdev.flatlaf.intellijthemes.FlatAllIJThemes;
import com.formdev.flatlaf.ui.FlatLineBorder;
import com.formdev.flatlaf.util.StringUtils; import com.formdev.flatlaf.util.StringUtils;
import com.formdev.flatlaf.util.SystemInfo; import com.formdev.flatlaf.util.SystemInfo;
@@ -69,6 +71,7 @@ public class UIDefaultsDump
private JComponent dummyComponent; private JComponent dummyComponent;
public static void main( String[] args ) { public static void main( String[] args ) {
Locale.setDefault( Locale.ENGLISH );
System.setProperty( "sun.java2d.uiScale", "1x" ); System.setProperty( "sun.java2d.uiScale", "1x" );
System.setProperty( "flatlaf.uiScale", "1x" ); System.setProperty( "flatlaf.uiScale", "1x" );
@@ -352,6 +355,13 @@ public class UIDefaultsDump
insets.top, insets.left, insets.bottom, insets.right, insets.top, insets.left, insets.bottom, insets.right,
border.isBorderOpaque(), border.isBorderOpaque(),
dumpClass( border ) ); dumpClass( border ) );
if( border instanceof FlatLineBorder ) {
FlatLineBorder lineBorder = (FlatLineBorder) border;
out.print( " lineColor=" );
dumpColor( out, lineBorder.getLineColor() );
out.printf( " lineThickness=%f", lineBorder.getLineThickness() );
}
} }
} }

View File

@@ -25,6 +25,8 @@
@disabledText=#000088 @disabledText=#000088
@textComponentBackground=#ffffff @textComponentBackground=#ffffff
@menuBackground=#fff @menuBackground=#fff
@menuHoverBackground=darken(@menuBackground,10%)
@menuCheckBackground=darken(@menuBackground,15%)
@cellFocusColor=#ff0000 @cellFocusColor=#ff0000
@icon=#afafaf @icon=#afafaf

View File

@@ -138,7 +138,7 @@ CheckBox.textShiftOffset 0
#---- CheckBoxMenuItem ---- #---- CheckBoxMenuItem ----
CheckBoxMenuItem.acceleratorFont [active] $defaultFont [UI] CheckBoxMenuItem.acceleratorFont [active] $defaultFont [UI]
CheckBoxMenuItem.acceleratorForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.acceleratorForeground #959595 javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI] CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI]
CheckBoxMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
@@ -148,7 +148,7 @@ CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatChe
CheckBoxMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.font [active] $defaultFont [UI] CheckBoxMenuItem.font [active] $defaultFont [UI]
CheckBoxMenuItem.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] CheckBoxMenuItem.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
CheckBoxMenuItem.opaque false CheckBoxMenuItem.opaque false
CheckBoxMenuItem.selectionBackground #4b6eaf javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.selectionBackground #4b6eaf javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
@@ -206,6 +206,7 @@ Component.disabledBorderColor #646464 javax.swing.plaf.ColorUIResource [UI]
Component.focusColor #3d6185 javax.swing.plaf.ColorUIResource [UI] Component.focusColor #3d6185 javax.swing.plaf.ColorUIResource [UI]
Component.focusWidth 0 Component.focusWidth 0
Component.focusedBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI] Component.focusedBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
Component.grayFilter [lazy] [unknown type] com.formdev.flatlaf.util.GrayFilter
Component.hideMnemonics true Component.hideMnemonics true
Component.innerFocusWidth 0.5 Component.innerFocusWidth 0.5
Component.linkColor #589df6 javax.swing.plaf.ColorUIResource [UI] Component.linkColor #589df6 javax.swing.plaf.ColorUIResource [UI]
@@ -440,13 +441,13 @@ List.background #45494a javax.swing.plaf.ColorUIResource [UI]
List.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatEmptyBorder [UI] List.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatEmptyBorder [UI]
List.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI] List.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI]
List.cellMargins 1,6,1,6 javax.swing.plaf.InsetsUIResource [UI] List.cellMargins 1,6,1,6 javax.swing.plaf.InsetsUIResource [UI]
List.cellNoFocusBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Default [UI] List.cellNoFocusBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Default [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
List.cellRenderer [active] javax.swing.DefaultListCellRenderer$UIResource [UI] List.cellRenderer [active] javax.swing.DefaultListCellRenderer$UIResource [UI]
List.dropCellBackground [lazy] #3c588b javax.swing.plaf.ColorUIResource [UI] List.dropCellBackground [lazy] #3c588b javax.swing.plaf.ColorUIResource [UI]
List.dropCellForeground [lazy] #bbbbbb javax.swing.plaf.ColorUIResource [UI] List.dropCellForeground [lazy] #bbbbbb javax.swing.plaf.ColorUIResource [UI]
List.dropLineColor [lazy] #6d8ac0 javax.swing.plaf.ColorUIResource [UI] List.dropLineColor [lazy] #6d8ac0 javax.swing.plaf.ColorUIResource [UI]
List.focusCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Focused [UI] List.focusCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Focused [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
List.focusSelectedCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Selected [UI] List.focusSelectedCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Selected [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
List.font [active] $defaultFont [UI] List.font [active] $defaultFont [UI]
List.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] List.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
List.noFocusBorder 1,1,1,1 false javax.swing.plaf.BorderUIResource$EmptyBorderUIResource [UI] List.noFocusBorder 1,1,1,1 false javax.swing.plaf.BorderUIResource$EmptyBorderUIResource [UI]
@@ -461,7 +462,7 @@ ListUI com.formdev.flatlaf.ui.FlatListUI
#---- Menu ---- #---- Menu ----
Menu.acceleratorFont [active] $defaultFont [UI] Menu.acceleratorFont [active] $defaultFont [UI]
Menu.acceleratorForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] Menu.acceleratorForeground #959595 javax.swing.plaf.ColorUIResource [UI]
Menu.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] Menu.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
Menu.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuArrowIcon [UI] Menu.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuArrowIcon [UI]
Menu.background #303234 javax.swing.plaf.ColorUIResource [UI] Menu.background #303234 javax.swing.plaf.ColorUIResource [UI]
@@ -474,7 +475,7 @@ Menu.font [active] $defaultFont [UI]
Menu.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] Menu.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
Menu.icon.arrowColor #a7a7a7 javax.swing.plaf.ColorUIResource [UI] Menu.icon.arrowColor #a7a7a7 javax.swing.plaf.ColorUIResource [UI]
Menu.icon.disabledArrowColor #606060 javax.swing.plaf.ColorUIResource [UI] Menu.icon.disabledArrowColor #606060 javax.swing.plaf.ColorUIResource [UI]
Menu.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] Menu.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
Menu.menuPopupOffsetX 0 Menu.menuPopupOffsetX 0
Menu.menuPopupOffsetY 0 Menu.menuPopupOffsetY 0
Menu.opaque false Menu.opaque false
@@ -496,7 +497,7 @@ MenuBar.font [active] $defaultFont [UI]
MenuBar.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] MenuBar.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
MenuBar.highlight #242424 javax.swing.plaf.ColorUIResource [UI] MenuBar.highlight #242424 javax.swing.plaf.ColorUIResource [UI]
MenuBar.hoverBackground #484c4f javax.swing.plaf.ColorUIResource [UI] MenuBar.hoverBackground #484c4f javax.swing.plaf.ColorUIResource [UI]
MenuBar.itemMargins 3,3,3,3 javax.swing.plaf.InsetsUIResource [UI] MenuBar.itemMargins 3,8,3,8 javax.swing.plaf.InsetsUIResource [UI]
MenuBar.shadow #646464 javax.swing.plaf.ColorUIResource [UI] MenuBar.shadow #646464 javax.swing.plaf.ColorUIResource [UI]
MenuBar.windowBindings length=2 [Ljava.lang.Object; MenuBar.windowBindings length=2 [Ljava.lang.Object;
[0] F10 [0] F10
@@ -506,21 +507,33 @@ MenuBarUI com.formdev.flatlaf.ui.FlatMenuBarUI
#---- MenuItem ---- #---- MenuItem ----
MenuItem.acceleratorArrowGap 2
MenuItem.acceleratorDelimiter MenuItem.acceleratorDelimiter
MenuItem.acceleratorFont [active] $defaultFont [UI] MenuItem.acceleratorFont [active] $defaultFont [UI]
MenuItem.acceleratorForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] MenuItem.acceleratorForeground #959595 javax.swing.plaf.ColorUIResource [UI]
MenuItem.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] MenuItem.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
MenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI] MenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI]
MenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI] MenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI] MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
MenuItem.borderPainted true MenuItem.borderPainted true
MenuItem.checkBackground #484c4f javax.swing.plaf.ColorUIResource [UI]
MenuItem.checkMargins 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI]
MenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI] MenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI]
MenuItem.font [active] $defaultFont [UI] MenuItem.font [active] $defaultFont [UI]
MenuItem.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] MenuItem.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
MenuItem.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] MenuItem.iconTextGap 6
MenuItem.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
MenuItem.minimumIconSize 16,16 javax.swing.plaf.DimensionUIResource [UI]
MenuItem.minimumWidth 72
MenuItem.opaque false MenuItem.opaque false
MenuItem.selectionBackground #4b6eaf javax.swing.plaf.ColorUIResource [UI] MenuItem.selectionBackground #4b6eaf javax.swing.plaf.ColorUIResource [UI]
MenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] MenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
MenuItem.textAcceleratorGap 24
MenuItem.textNoAcceleratorGap 6
MenuItem.underlineSelectionBackground #484c4f javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionCheckBackground #616569 javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionColor #4a88c7 javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionHeight 3
#---- MenuItemCheckBox ---- #---- MenuItemCheckBox ----
@@ -620,7 +633,7 @@ PasswordFieldUI com.formdev.flatlaf.ui.FlatPasswordFieldUI
#---- PopupMenu ---- #---- PopupMenu ----
PopupMenu.background #303234 javax.swing.plaf.ColorUIResource [UI] PopupMenu.background #303234 javax.swing.plaf.ColorUIResource [UI]
PopupMenu.border [lazy] 4,1,4,1 false com.formdev.flatlaf.ui.FlatPopupMenuBorder [UI] PopupMenu.border [lazy] 4,1,4,1 false com.formdev.flatlaf.ui.FlatPopupMenuBorder [UI] lineColor=#5e5e5e javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
PopupMenu.borderColor #5e5e5e javax.swing.plaf.ColorUIResource [UI] PopupMenu.borderColor #5e5e5e javax.swing.plaf.ColorUIResource [UI]
PopupMenu.borderInsets 4,1,4,1 javax.swing.plaf.InsetsUIResource [UI] PopupMenu.borderInsets 4,1,4,1 javax.swing.plaf.InsetsUIResource [UI]
PopupMenu.consumeEventOnClose false PopupMenu.consumeEventOnClose false
@@ -682,7 +695,7 @@ RadioButton.textShiftOffset 0
#---- RadioButtonMenuItem ---- #---- RadioButtonMenuItem ----
RadioButtonMenuItem.acceleratorFont [active] $defaultFont [UI] RadioButtonMenuItem.acceleratorFont [active] $defaultFont [UI]
RadioButtonMenuItem.acceleratorForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.acceleratorForeground #959595 javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI] RadioButtonMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI]
RadioButtonMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
@@ -692,7 +705,7 @@ RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRad
RadioButtonMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.font [active] $defaultFont [UI] RadioButtonMenuItem.font [active] $defaultFont [UI]
RadioButtonMenuItem.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] RadioButtonMenuItem.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
RadioButtonMenuItem.opaque false RadioButtonMenuItem.opaque false
RadioButtonMenuItem.selectionBackground #4b6eaf javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.selectionBackground #4b6eaf javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
@@ -706,7 +719,7 @@ RadioButtonUI com.formdev.flatlaf.ui.FlatRadioButtonUI
#---- Resizable ---- #---- Resizable ----
Resizable.resizeBorder [lazy] 4,4,4,4 false com.formdev.flatlaf.ui.FlatLineBorder [UI] Resizable.resizeBorder [lazy] 4,4,4,4 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#5e5e5e javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
#---- RootPane ---- #---- RootPane ----
@@ -877,7 +890,7 @@ Table.ascendingSortIcon [lazy] 10,5 com.formdev.flatlaf.icons.FlatAsce
Table.background #45494a javax.swing.plaf.ColorUIResource [UI] Table.background #45494a javax.swing.plaf.ColorUIResource [UI]
Table.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI] Table.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI]
Table.cellMargins 2,3,2,3 javax.swing.plaf.InsetsUIResource [UI] Table.cellMargins 2,3,2,3 javax.swing.plaf.InsetsUIResource [UI]
Table.cellNoFocusBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Default [UI] Table.cellNoFocusBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Default [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
Table.descendingSortIcon [lazy] 10,5 com.formdev.flatlaf.icons.FlatDescendingSortIcon [UI] Table.descendingSortIcon [lazy] 10,5 com.formdev.flatlaf.icons.FlatDescendingSortIcon [UI]
Table.dropCellBackground [lazy] #3c588b javax.swing.plaf.ColorUIResource [UI] Table.dropCellBackground [lazy] #3c588b javax.swing.plaf.ColorUIResource [UI]
Table.dropCellForeground [lazy] #bbbbbb javax.swing.plaf.ColorUIResource [UI] Table.dropCellForeground [lazy] #bbbbbb javax.swing.plaf.ColorUIResource [UI]
@@ -885,8 +898,8 @@ Table.dropLineColor [lazy] #6d8ac0 javax.swing.plaf.ColorUIResourc
Table.dropLineShortColor [lazy] #b4c3df javax.swing.plaf.ColorUIResource [UI] Table.dropLineShortColor [lazy] #b4c3df javax.swing.plaf.ColorUIResource [UI]
Table.focusCellBackground #45494a javax.swing.plaf.ColorUIResource [UI] Table.focusCellBackground #45494a javax.swing.plaf.ColorUIResource [UI]
Table.focusCellForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] Table.focusCellForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
Table.focusCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Focused [UI] Table.focusCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Focused [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
Table.focusSelectedCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Selected [UI] Table.focusSelectedCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Selected [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
Table.font [active] $defaultFont [UI] Table.font [active] $defaultFont [UI]
Table.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] Table.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
Table.gridColor #4c5152 javax.swing.plaf.ColorUIResource [UI] Table.gridColor #4c5152 javax.swing.plaf.ColorUIResource [UI]
@@ -1003,7 +1016,7 @@ TextPaneUI com.formdev.flatlaf.ui.FlatTextPaneUI
#---- TitledBorder ---- #---- TitledBorder ----
TitledBorder.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatLineBorder [UI] TitledBorder.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#515151 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
TitledBorder.font [active] $defaultFont [UI] TitledBorder.font [active] $defaultFont [UI]
TitledBorder.titleColor #bbbbbb javax.swing.plaf.ColorUIResource [UI] TitledBorder.titleColor #bbbbbb javax.swing.plaf.ColorUIResource [UI]
@@ -1079,11 +1092,9 @@ ToolBarUI com.formdev.flatlaf.ui.FlatToolBarUI
#---- ToolTip ---- #---- ToolTip ----
ToolTip.background #1e2123 javax.swing.plaf.ColorUIResource [UI] ToolTip.background #1e2123 javax.swing.plaf.ColorUIResource [UI]
ToolTip.backgroundInactive #1e2123 javax.swing.plaf.ColorUIResource [UI]
ToolTip.border [lazy] 4,6,4,6 false com.formdev.flatlaf.ui.FlatEmptyBorder [UI] ToolTip.border [lazy] 4,6,4,6 false com.formdev.flatlaf.ui.FlatEmptyBorder [UI]
ToolTip.font [active] $defaultFont [UI] ToolTip.font [active] $defaultFont [UI]
ToolTip.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] ToolTip.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
ToolTip.foregroundInactive #777777 javax.swing.plaf.ColorUIResource [UI]
#---- ToolTipManager ---- #---- ToolTipManager ----

View File

@@ -138,7 +138,7 @@ CheckBox.textShiftOffset 0
#---- CheckBoxMenuItem ---- #---- CheckBoxMenuItem ----
CheckBoxMenuItem.acceleratorFont [active] $defaultFont [UI] CheckBoxMenuItem.acceleratorFont [active] $defaultFont [UI]
CheckBoxMenuItem.acceleratorForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.acceleratorForeground #959595 javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI] CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI]
CheckBoxMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
@@ -148,7 +148,7 @@ CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatChe
CheckBoxMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.font [active] $defaultFont [UI] CheckBoxMenuItem.font [active] $defaultFont [UI]
CheckBoxMenuItem.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] CheckBoxMenuItem.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
CheckBoxMenuItem.opaque false CheckBoxMenuItem.opaque false
CheckBoxMenuItem.selectionBackground #4b6eaf javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.selectionBackground #4b6eaf javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
@@ -205,6 +205,7 @@ Component.disabledBorderColor #646464 javax.swing.plaf.ColorUIResource [UI]
Component.focusColor #3d6185 javax.swing.plaf.ColorUIResource [UI] Component.focusColor #3d6185 javax.swing.plaf.ColorUIResource [UI]
Component.focusWidth 0 Component.focusWidth 0
Component.focusedBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI] Component.focusedBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
Component.grayFilter [lazy] [unknown type] com.formdev.flatlaf.util.GrayFilter
Component.hideMnemonics true Component.hideMnemonics true
Component.innerFocusWidth 0.5 Component.innerFocusWidth 0.5
Component.linkColor #589df6 javax.swing.plaf.ColorUIResource [UI] Component.linkColor #589df6 javax.swing.plaf.ColorUIResource [UI]
@@ -439,13 +440,13 @@ List.background #45494a javax.swing.plaf.ColorUIResource [UI]
List.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatEmptyBorder [UI] List.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatEmptyBorder [UI]
List.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI] List.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI]
List.cellMargins 1,6,1,6 javax.swing.plaf.InsetsUIResource [UI] List.cellMargins 1,6,1,6 javax.swing.plaf.InsetsUIResource [UI]
List.cellNoFocusBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Default [UI] List.cellNoFocusBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Default [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
List.cellRenderer [active] javax.swing.DefaultListCellRenderer$UIResource [UI] List.cellRenderer [active] javax.swing.DefaultListCellRenderer$UIResource [UI]
List.dropCellBackground [lazy] #3c588b javax.swing.plaf.ColorUIResource [UI] List.dropCellBackground [lazy] #3c588b javax.swing.plaf.ColorUIResource [UI]
List.dropCellForeground [lazy] #bbbbbb javax.swing.plaf.ColorUIResource [UI] List.dropCellForeground [lazy] #bbbbbb javax.swing.plaf.ColorUIResource [UI]
List.dropLineColor [lazy] #6d8ac0 javax.swing.plaf.ColorUIResource [UI] List.dropLineColor [lazy] #6d8ac0 javax.swing.plaf.ColorUIResource [UI]
List.focusCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Focused [UI] List.focusCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Focused [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
List.focusSelectedCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Selected [UI] List.focusSelectedCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Selected [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
List.font [active] $defaultFont [UI] List.font [active] $defaultFont [UI]
List.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] List.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
List.noFocusBorder 1,1,1,1 false javax.swing.plaf.BorderUIResource$EmptyBorderUIResource [UI] List.noFocusBorder 1,1,1,1 false javax.swing.plaf.BorderUIResource$EmptyBorderUIResource [UI]
@@ -460,7 +461,7 @@ ListUI com.formdev.flatlaf.ui.FlatListUI
#---- Menu ---- #---- Menu ----
Menu.acceleratorFont [active] $defaultFont [UI] Menu.acceleratorFont [active] $defaultFont [UI]
Menu.acceleratorForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] Menu.acceleratorForeground #959595 javax.swing.plaf.ColorUIResource [UI]
Menu.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] Menu.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
Menu.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuArrowIcon [UI] Menu.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuArrowIcon [UI]
Menu.background #303234 javax.swing.plaf.ColorUIResource [UI] Menu.background #303234 javax.swing.plaf.ColorUIResource [UI]
@@ -473,7 +474,7 @@ Menu.font [active] $defaultFont [UI]
Menu.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] Menu.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
Menu.icon.arrowColor #a7a7a7 javax.swing.plaf.ColorUIResource [UI] Menu.icon.arrowColor #a7a7a7 javax.swing.plaf.ColorUIResource [UI]
Menu.icon.disabledArrowColor #606060 javax.swing.plaf.ColorUIResource [UI] Menu.icon.disabledArrowColor #606060 javax.swing.plaf.ColorUIResource [UI]
Menu.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] Menu.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
Menu.menuPopupOffsetX 0 Menu.menuPopupOffsetX 0
Menu.menuPopupOffsetY 0 Menu.menuPopupOffsetY 0
Menu.opaque false Menu.opaque false
@@ -495,7 +496,7 @@ MenuBar.font [active] $defaultFont [UI]
MenuBar.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] MenuBar.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
MenuBar.highlight #242424 javax.swing.plaf.ColorUIResource [UI] MenuBar.highlight #242424 javax.swing.plaf.ColorUIResource [UI]
MenuBar.hoverBackground #484c4f javax.swing.plaf.ColorUIResource [UI] MenuBar.hoverBackground #484c4f javax.swing.plaf.ColorUIResource [UI]
MenuBar.itemMargins 3,3,3,3 javax.swing.plaf.InsetsUIResource [UI] MenuBar.itemMargins 3,8,3,8 javax.swing.plaf.InsetsUIResource [UI]
MenuBar.shadow #646464 javax.swing.plaf.ColorUIResource [UI] MenuBar.shadow #646464 javax.swing.plaf.ColorUIResource [UI]
MenuBar.windowBindings length=2 [Ljava.lang.Object; MenuBar.windowBindings length=2 [Ljava.lang.Object;
[0] F10 [0] F10
@@ -505,21 +506,33 @@ MenuBarUI com.formdev.flatlaf.ui.FlatMenuBarUI
#---- MenuItem ---- #---- MenuItem ----
MenuItem.acceleratorArrowGap 2
MenuItem.acceleratorDelimiter - MenuItem.acceleratorDelimiter -
MenuItem.acceleratorFont [active] $defaultFont [UI] MenuItem.acceleratorFont [active] $defaultFont [UI]
MenuItem.acceleratorForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] MenuItem.acceleratorForeground #959595 javax.swing.plaf.ColorUIResource [UI]
MenuItem.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] MenuItem.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
MenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI] MenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI]
MenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI] MenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI] MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
MenuItem.borderPainted true MenuItem.borderPainted true
MenuItem.checkBackground #484c4f javax.swing.plaf.ColorUIResource [UI]
MenuItem.checkMargins 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI]
MenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI] MenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI]
MenuItem.font [active] $defaultFont [UI] MenuItem.font [active] $defaultFont [UI]
MenuItem.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] MenuItem.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
MenuItem.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] MenuItem.iconTextGap 6
MenuItem.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
MenuItem.minimumIconSize 16,16 javax.swing.plaf.DimensionUIResource [UI]
MenuItem.minimumWidth 72
MenuItem.opaque false MenuItem.opaque false
MenuItem.selectionBackground #4b6eaf javax.swing.plaf.ColorUIResource [UI] MenuItem.selectionBackground #4b6eaf javax.swing.plaf.ColorUIResource [UI]
MenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] MenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
MenuItem.textAcceleratorGap 24
MenuItem.textNoAcceleratorGap 6
MenuItem.underlineSelectionBackground #484c4f javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionCheckBackground #616569 javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionColor #4a88c7 javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionHeight 3
#---- MenuItemCheckBox ---- #---- MenuItemCheckBox ----
@@ -618,7 +631,7 @@ PasswordFieldUI com.formdev.flatlaf.ui.FlatPasswordFieldUI
#---- PopupMenu ---- #---- PopupMenu ----
PopupMenu.background #303234 javax.swing.plaf.ColorUIResource [UI] PopupMenu.background #303234 javax.swing.plaf.ColorUIResource [UI]
PopupMenu.border [lazy] 4,1,4,1 false com.formdev.flatlaf.ui.FlatPopupMenuBorder [UI] PopupMenu.border [lazy] 4,1,4,1 false com.formdev.flatlaf.ui.FlatPopupMenuBorder [UI] lineColor=#5e5e5e javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
PopupMenu.borderColor #5e5e5e javax.swing.plaf.ColorUIResource [UI] PopupMenu.borderColor #5e5e5e javax.swing.plaf.ColorUIResource [UI]
PopupMenu.borderInsets 4,1,4,1 javax.swing.plaf.InsetsUIResource [UI] PopupMenu.borderInsets 4,1,4,1 javax.swing.plaf.InsetsUIResource [UI]
PopupMenu.consumeEventOnClose false PopupMenu.consumeEventOnClose false
@@ -680,7 +693,7 @@ RadioButton.textShiftOffset 0
#---- RadioButtonMenuItem ---- #---- RadioButtonMenuItem ----
RadioButtonMenuItem.acceleratorFont [active] $defaultFont [UI] RadioButtonMenuItem.acceleratorFont [active] $defaultFont [UI]
RadioButtonMenuItem.acceleratorForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.acceleratorForeground #959595 javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.acceleratorSelectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI] RadioButtonMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI]
RadioButtonMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
@@ -690,7 +703,7 @@ RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRad
RadioButtonMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.disabledForeground #777777 javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.font [active] $defaultFont [UI] RadioButtonMenuItem.font [active] $defaultFont [UI]
RadioButtonMenuItem.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] RadioButtonMenuItem.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
RadioButtonMenuItem.opaque false RadioButtonMenuItem.opaque false
RadioButtonMenuItem.selectionBackground #4b6eaf javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.selectionBackground #4b6eaf javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
@@ -704,7 +717,7 @@ RadioButtonUI com.formdev.flatlaf.ui.FlatRadioButtonUI
#---- Resizable ---- #---- Resizable ----
Resizable.resizeBorder [lazy] 4,4,4,4 false com.formdev.flatlaf.ui.FlatLineBorder [UI] Resizable.resizeBorder [lazy] 4,4,4,4 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#5e5e5e javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
#---- RootPane ---- #---- RootPane ----
@@ -875,7 +888,7 @@ Table.ascendingSortIcon [lazy] 10,5 com.formdev.flatlaf.icons.FlatAsce
Table.background #45494a javax.swing.plaf.ColorUIResource [UI] Table.background #45494a javax.swing.plaf.ColorUIResource [UI]
Table.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI] Table.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI]
Table.cellMargins 2,3,2,3 javax.swing.plaf.InsetsUIResource [UI] Table.cellMargins 2,3,2,3 javax.swing.plaf.InsetsUIResource [UI]
Table.cellNoFocusBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Default [UI] Table.cellNoFocusBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Default [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
Table.descendingSortIcon [lazy] 10,5 com.formdev.flatlaf.icons.FlatDescendingSortIcon [UI] Table.descendingSortIcon [lazy] 10,5 com.formdev.flatlaf.icons.FlatDescendingSortIcon [UI]
Table.dropCellBackground [lazy] #3c588b javax.swing.plaf.ColorUIResource [UI] Table.dropCellBackground [lazy] #3c588b javax.swing.plaf.ColorUIResource [UI]
Table.dropCellForeground [lazy] #bbbbbb javax.swing.plaf.ColorUIResource [UI] Table.dropCellForeground [lazy] #bbbbbb javax.swing.plaf.ColorUIResource [UI]
@@ -883,8 +896,8 @@ Table.dropLineColor [lazy] #6d8ac0 javax.swing.plaf.ColorUIResourc
Table.dropLineShortColor [lazy] #b4c3df javax.swing.plaf.ColorUIResource [UI] Table.dropLineShortColor [lazy] #b4c3df javax.swing.plaf.ColorUIResource [UI]
Table.focusCellBackground #45494a javax.swing.plaf.ColorUIResource [UI] Table.focusCellBackground #45494a javax.swing.plaf.ColorUIResource [UI]
Table.focusCellForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI] Table.focusCellForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
Table.focusCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Focused [UI] Table.focusCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Focused [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
Table.focusSelectedCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Selected [UI] Table.focusSelectedCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Selected [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
Table.font [active] $defaultFont [UI] Table.font [active] $defaultFont [UI]
Table.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] Table.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
Table.gridColor #4c5152 javax.swing.plaf.ColorUIResource [UI] Table.gridColor #4c5152 javax.swing.plaf.ColorUIResource [UI]
@@ -1001,7 +1014,7 @@ TextPaneUI com.formdev.flatlaf.ui.FlatTextPaneUI
#---- TitledBorder ---- #---- TitledBorder ----
TitledBorder.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatLineBorder [UI] TitledBorder.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#515151 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
TitledBorder.font [active] $defaultFont [UI] TitledBorder.font [active] $defaultFont [UI]
TitledBorder.titleColor #bbbbbb javax.swing.plaf.ColorUIResource [UI] TitledBorder.titleColor #bbbbbb javax.swing.plaf.ColorUIResource [UI]
@@ -1077,11 +1090,9 @@ ToolBarUI com.formdev.flatlaf.ui.FlatToolBarUI
#---- ToolTip ---- #---- ToolTip ----
ToolTip.background #1e2123 javax.swing.plaf.ColorUIResource [UI] ToolTip.background #1e2123 javax.swing.plaf.ColorUIResource [UI]
ToolTip.backgroundInactive #1e2123 javax.swing.plaf.ColorUIResource [UI]
ToolTip.border [lazy] 4,6,4,6 false com.formdev.flatlaf.ui.FlatEmptyBorder [UI] ToolTip.border [lazy] 4,6,4,6 false com.formdev.flatlaf.ui.FlatEmptyBorder [UI]
ToolTip.font [active] $defaultFont [UI] ToolTip.font [active] $defaultFont [UI]
ToolTip.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] ToolTip.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
ToolTip.foregroundInactive #777777 javax.swing.plaf.ColorUIResource [UI]
#---- ToolTipManager ---- #---- ToolTipManager ----

View File

@@ -139,7 +139,7 @@ CheckBox.textShiftOffset 0
#---- CheckBoxMenuItem ---- #---- CheckBoxMenuItem ----
CheckBoxMenuItem.acceleratorFont [active] $defaultFont [UI] CheckBoxMenuItem.acceleratorFont [active] $defaultFont [UI]
CheckBoxMenuItem.acceleratorForeground #505050 javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.acceleratorForeground #4d4d4d javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI] CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI]
CheckBoxMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
@@ -149,7 +149,7 @@ CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatChe
CheckBoxMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.font [active] $defaultFont [UI] CheckBoxMenuItem.font [active] $defaultFont [UI]
CheckBoxMenuItem.foreground #000000 javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] CheckBoxMenuItem.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
CheckBoxMenuItem.opaque false CheckBoxMenuItem.opaque false
CheckBoxMenuItem.selectionBackground #2675bf javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.selectionBackground #2675bf javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
@@ -207,6 +207,7 @@ Component.disabledBorderColor #cfcfcf javax.swing.plaf.ColorUIResource [UI]
Component.focusColor #97c3f3 javax.swing.plaf.ColorUIResource [UI] Component.focusColor #97c3f3 javax.swing.plaf.ColorUIResource [UI]
Component.focusWidth 0 Component.focusWidth 0
Component.focusedBorderColor #87afda javax.swing.plaf.ColorUIResource [UI] Component.focusedBorderColor #87afda javax.swing.plaf.ColorUIResource [UI]
Component.grayFilter [lazy] [unknown type] com.formdev.flatlaf.util.GrayFilter
Component.hideMnemonics true Component.hideMnemonics true
Component.innerFocusWidth 0.5 Component.innerFocusWidth 0.5
Component.linkColor #2470b3 javax.swing.plaf.ColorUIResource [UI] Component.linkColor #2470b3 javax.swing.plaf.ColorUIResource [UI]
@@ -442,13 +443,13 @@ List.background #ffffff javax.swing.plaf.ColorUIResource [UI]
List.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatEmptyBorder [UI] List.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatEmptyBorder [UI]
List.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI] List.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI]
List.cellMargins 1,6,1,6 javax.swing.plaf.InsetsUIResource [UI] List.cellMargins 1,6,1,6 javax.swing.plaf.InsetsUIResource [UI]
List.cellNoFocusBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Default [UI] List.cellNoFocusBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Default [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
List.cellRenderer [active] javax.swing.DefaultListCellRenderer$UIResource [UI] List.cellRenderer [active] javax.swing.DefaultListCellRenderer$UIResource [UI]
List.dropCellBackground [lazy] #3f8fd9 javax.swing.plaf.ColorUIResource [UI] List.dropCellBackground [lazy] #3f8fd9 javax.swing.plaf.ColorUIResource [UI]
List.dropCellForeground [lazy] #ffffff javax.swing.plaf.ColorUIResource [UI] List.dropCellForeground [lazy] #ffffff javax.swing.plaf.ColorUIResource [UI]
List.dropLineColor [lazy] #6aa7e1 javax.swing.plaf.ColorUIResource [UI] List.dropLineColor [lazy] #6aa7e1 javax.swing.plaf.ColorUIResource [UI]
List.focusCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Focused [UI] List.focusCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Focused [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
List.focusSelectedCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Selected [UI] List.focusSelectedCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Selected [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
List.font [active] $defaultFont [UI] List.font [active] $defaultFont [UI]
List.foreground #000000 javax.swing.plaf.ColorUIResource [UI] List.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
List.noFocusBorder 1,1,1,1 false javax.swing.plaf.BorderUIResource$EmptyBorderUIResource [UI] List.noFocusBorder 1,1,1,1 false javax.swing.plaf.BorderUIResource$EmptyBorderUIResource [UI]
@@ -463,7 +464,7 @@ ListUI com.formdev.flatlaf.ui.FlatListUI
#---- Menu ---- #---- Menu ----
Menu.acceleratorFont [active] $defaultFont [UI] Menu.acceleratorFont [active] $defaultFont [UI]
Menu.acceleratorForeground #505050 javax.swing.plaf.ColorUIResource [UI] Menu.acceleratorForeground #4d4d4d javax.swing.plaf.ColorUIResource [UI]
Menu.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI] Menu.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
Menu.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuArrowIcon [UI] Menu.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuArrowIcon [UI]
Menu.background #ffffff javax.swing.plaf.ColorUIResource [UI] Menu.background #ffffff javax.swing.plaf.ColorUIResource [UI]
@@ -476,7 +477,7 @@ Menu.font [active] $defaultFont [UI]
Menu.foreground #000000 javax.swing.plaf.ColorUIResource [UI] Menu.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
Menu.icon.arrowColor #666666 javax.swing.plaf.ColorUIResource [UI] Menu.icon.arrowColor #666666 javax.swing.plaf.ColorUIResource [UI]
Menu.icon.disabledArrowColor #ababab javax.swing.plaf.ColorUIResource [UI] Menu.icon.disabledArrowColor #ababab javax.swing.plaf.ColorUIResource [UI]
Menu.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] Menu.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
Menu.menuPopupOffsetX 0 Menu.menuPopupOffsetX 0
Menu.menuPopupOffsetY 0 Menu.menuPopupOffsetY 0
Menu.opaque false Menu.opaque false
@@ -498,7 +499,7 @@ MenuBar.font [active] $defaultFont [UI]
MenuBar.foreground #000000 javax.swing.plaf.ColorUIResource [UI] MenuBar.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
MenuBar.highlight #ffffff javax.swing.plaf.ColorUIResource [UI] MenuBar.highlight #ffffff javax.swing.plaf.ColorUIResource [UI]
MenuBar.hoverBackground #e6e6e6 javax.swing.plaf.ColorUIResource [UI] MenuBar.hoverBackground #e6e6e6 javax.swing.plaf.ColorUIResource [UI]
MenuBar.itemMargins 3,3,3,3 javax.swing.plaf.InsetsUIResource [UI] MenuBar.itemMargins 3,8,3,8 javax.swing.plaf.InsetsUIResource [UI]
MenuBar.shadow #c4c4c4 javax.swing.plaf.ColorUIResource [UI] MenuBar.shadow #c4c4c4 javax.swing.plaf.ColorUIResource [UI]
MenuBar.windowBindings length=2 [Ljava.lang.Object; MenuBar.windowBindings length=2 [Ljava.lang.Object;
[0] F10 [0] F10
@@ -508,21 +509,33 @@ MenuBarUI com.formdev.flatlaf.ui.FlatMenuBarUI
#---- MenuItem ---- #---- MenuItem ----
MenuItem.acceleratorArrowGap 2
MenuItem.acceleratorDelimiter MenuItem.acceleratorDelimiter
MenuItem.acceleratorFont [active] $defaultFont [UI] MenuItem.acceleratorFont [active] $defaultFont [UI]
MenuItem.acceleratorForeground #505050 javax.swing.plaf.ColorUIResource [UI] MenuItem.acceleratorForeground #4d4d4d javax.swing.plaf.ColorUIResource [UI]
MenuItem.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI] MenuItem.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
MenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI] MenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI]
MenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI] MenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI] MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
MenuItem.borderPainted true MenuItem.borderPainted true
MenuItem.checkBackground #e6e6e6 javax.swing.plaf.ColorUIResource [UI]
MenuItem.checkMargins 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI]
MenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI] MenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
MenuItem.font [active] $defaultFont [UI] MenuItem.font [active] $defaultFont [UI]
MenuItem.foreground #000000 javax.swing.plaf.ColorUIResource [UI] MenuItem.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
MenuItem.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] MenuItem.iconTextGap 6
MenuItem.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
MenuItem.minimumIconSize 16,16 javax.swing.plaf.DimensionUIResource [UI]
MenuItem.minimumWidth 72
MenuItem.opaque false MenuItem.opaque false
MenuItem.selectionBackground #2675bf javax.swing.plaf.ColorUIResource [UI] MenuItem.selectionBackground #2675bf javax.swing.plaf.ColorUIResource [UI]
MenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI] MenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
MenuItem.textAcceleratorGap 24
MenuItem.textNoAcceleratorGap 6
MenuItem.underlineSelectionBackground #e6e6e6 javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionCheckBackground #cccccc javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionColor #4083c9 javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionHeight 3
#---- MenuItemCheckBox ---- #---- MenuItemCheckBox ----
@@ -622,7 +635,7 @@ PasswordFieldUI com.formdev.flatlaf.ui.FlatPasswordFieldUI
#---- PopupMenu ---- #---- PopupMenu ----
PopupMenu.background #ffffff javax.swing.plaf.ColorUIResource [UI] PopupMenu.background #ffffff javax.swing.plaf.ColorUIResource [UI]
PopupMenu.border [lazy] 4,1,4,1 false com.formdev.flatlaf.ui.FlatPopupMenuBorder [UI] PopupMenu.border [lazy] 4,1,4,1 false com.formdev.flatlaf.ui.FlatPopupMenuBorder [UI] lineColor=#adadad javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
PopupMenu.borderColor #adadad javax.swing.plaf.ColorUIResource [UI] PopupMenu.borderColor #adadad javax.swing.plaf.ColorUIResource [UI]
PopupMenu.borderInsets 4,1,4,1 javax.swing.plaf.InsetsUIResource [UI] PopupMenu.borderInsets 4,1,4,1 javax.swing.plaf.InsetsUIResource [UI]
PopupMenu.consumeEventOnClose false PopupMenu.consumeEventOnClose false
@@ -684,7 +697,7 @@ RadioButton.textShiftOffset 0
#---- RadioButtonMenuItem ---- #---- RadioButtonMenuItem ----
RadioButtonMenuItem.acceleratorFont [active] $defaultFont [UI] RadioButtonMenuItem.acceleratorFont [active] $defaultFont [UI]
RadioButtonMenuItem.acceleratorForeground #505050 javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.acceleratorForeground #4d4d4d javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI] RadioButtonMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI]
RadioButtonMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
@@ -694,7 +707,7 @@ RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRad
RadioButtonMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.font [active] $defaultFont [UI] RadioButtonMenuItem.font [active] $defaultFont [UI]
RadioButtonMenuItem.foreground #000000 javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] RadioButtonMenuItem.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
RadioButtonMenuItem.opaque false RadioButtonMenuItem.opaque false
RadioButtonMenuItem.selectionBackground #2675bf javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.selectionBackground #2675bf javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
@@ -708,7 +721,7 @@ RadioButtonUI com.formdev.flatlaf.ui.FlatRadioButtonUI
#---- Resizable ---- #---- Resizable ----
Resizable.resizeBorder [lazy] 4,4,4,4 false com.formdev.flatlaf.ui.FlatLineBorder [UI] Resizable.resizeBorder [lazy] 4,4,4,4 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#adadad javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
#---- RootPane ---- #---- RootPane ----
@@ -879,7 +892,7 @@ Table.ascendingSortIcon [lazy] 10,5 com.formdev.flatlaf.icons.FlatAsce
Table.background #ffffff javax.swing.plaf.ColorUIResource [UI] Table.background #ffffff javax.swing.plaf.ColorUIResource [UI]
Table.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI] Table.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI]
Table.cellMargins 2,3,2,3 javax.swing.plaf.InsetsUIResource [UI] Table.cellMargins 2,3,2,3 javax.swing.plaf.InsetsUIResource [UI]
Table.cellNoFocusBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Default [UI] Table.cellNoFocusBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Default [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
Table.descendingSortIcon [lazy] 10,5 com.formdev.flatlaf.icons.FlatDescendingSortIcon [UI] Table.descendingSortIcon [lazy] 10,5 com.formdev.flatlaf.icons.FlatDescendingSortIcon [UI]
Table.dropCellBackground [lazy] #3f8fd9 javax.swing.plaf.ColorUIResource [UI] Table.dropCellBackground [lazy] #3f8fd9 javax.swing.plaf.ColorUIResource [UI]
Table.dropCellForeground [lazy] #ffffff javax.swing.plaf.ColorUIResource [UI] Table.dropCellForeground [lazy] #ffffff javax.swing.plaf.ColorUIResource [UI]
@@ -887,8 +900,8 @@ Table.dropLineColor [lazy] #6aa7e1 javax.swing.plaf.ColorUIResourc
Table.dropLineShortColor [lazy] #15416a javax.swing.plaf.ColorUIResource [UI] Table.dropLineShortColor [lazy] #15416a javax.swing.plaf.ColorUIResource [UI]
Table.focusCellBackground #ffffff javax.swing.plaf.ColorUIResource [UI] Table.focusCellBackground #ffffff javax.swing.plaf.ColorUIResource [UI]
Table.focusCellForeground #000000 javax.swing.plaf.ColorUIResource [UI] Table.focusCellForeground #000000 javax.swing.plaf.ColorUIResource [UI]
Table.focusCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Focused [UI] Table.focusCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Focused [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
Table.focusSelectedCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Selected [UI] Table.focusSelectedCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Selected [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
Table.font [active] $defaultFont [UI] Table.font [active] $defaultFont [UI]
Table.foreground #000000 javax.swing.plaf.ColorUIResource [UI] Table.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
Table.gridColor #f7f7f7 javax.swing.plaf.ColorUIResource [UI] Table.gridColor #f7f7f7 javax.swing.plaf.ColorUIResource [UI]
@@ -1005,7 +1018,7 @@ TextPaneUI com.formdev.flatlaf.ui.FlatTextPaneUI
#---- TitledBorder ---- #---- TitledBorder ----
TitledBorder.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatLineBorder [UI] TitledBorder.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#d1d1d1 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
TitledBorder.font [active] $defaultFont [UI] TitledBorder.font [active] $defaultFont [UI]
TitledBorder.titleColor #000000 javax.swing.plaf.ColorUIResource [UI] TitledBorder.titleColor #000000 javax.swing.plaf.ColorUIResource [UI]
@@ -1081,11 +1094,9 @@ ToolBarUI com.formdev.flatlaf.ui.FlatToolBarUI
#---- ToolTip ---- #---- ToolTip ----
ToolTip.background #fafafa javax.swing.plaf.ColorUIResource [UI] ToolTip.background #fafafa javax.swing.plaf.ColorUIResource [UI]
ToolTip.backgroundInactive #fafafa javax.swing.plaf.ColorUIResource [UI] ToolTip.border [lazy] 4,6,4,6 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#919191 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
ToolTip.border [lazy] 4,6,4,6 false com.formdev.flatlaf.ui.FlatLineBorder [UI]
ToolTip.font [active] $defaultFont [UI] ToolTip.font [active] $defaultFont [UI]
ToolTip.foreground #000000 javax.swing.plaf.ColorUIResource [UI] ToolTip.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
ToolTip.foregroundInactive #8c8c8c javax.swing.plaf.ColorUIResource [UI]
#---- ToolTipManager ---- #---- ToolTipManager ----

View File

@@ -139,7 +139,7 @@ CheckBox.textShiftOffset 0
#---- CheckBoxMenuItem ---- #---- CheckBoxMenuItem ----
CheckBoxMenuItem.acceleratorFont [active] $defaultFont [UI] CheckBoxMenuItem.acceleratorFont [active] $defaultFont [UI]
CheckBoxMenuItem.acceleratorForeground #505050 javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.acceleratorForeground #4d4d4d javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI] CheckBoxMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI]
CheckBoxMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
@@ -149,7 +149,7 @@ CheckBoxMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatChe
CheckBoxMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.font [active] $defaultFont [UI] CheckBoxMenuItem.font [active] $defaultFont [UI]
CheckBoxMenuItem.foreground #000000 javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] CheckBoxMenuItem.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
CheckBoxMenuItem.opaque false CheckBoxMenuItem.opaque false
CheckBoxMenuItem.selectionBackground #2675bf javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.selectionBackground #2675bf javax.swing.plaf.ColorUIResource [UI]
CheckBoxMenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI] CheckBoxMenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
@@ -206,6 +206,7 @@ Component.disabledBorderColor #cfcfcf javax.swing.plaf.ColorUIResource [UI]
Component.focusColor #97c3f3 javax.swing.plaf.ColorUIResource [UI] Component.focusColor #97c3f3 javax.swing.plaf.ColorUIResource [UI]
Component.focusWidth 0 Component.focusWidth 0
Component.focusedBorderColor #87afda javax.swing.plaf.ColorUIResource [UI] Component.focusedBorderColor #87afda javax.swing.plaf.ColorUIResource [UI]
Component.grayFilter [lazy] [unknown type] com.formdev.flatlaf.util.GrayFilter
Component.hideMnemonics true Component.hideMnemonics true
Component.innerFocusWidth 0.5 Component.innerFocusWidth 0.5
Component.linkColor #2470b3 javax.swing.plaf.ColorUIResource [UI] Component.linkColor #2470b3 javax.swing.plaf.ColorUIResource [UI]
@@ -441,13 +442,13 @@ List.background #ffffff javax.swing.plaf.ColorUIResource [UI]
List.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatEmptyBorder [UI] List.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatEmptyBorder [UI]
List.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI] List.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI]
List.cellMargins 1,6,1,6 javax.swing.plaf.InsetsUIResource [UI] List.cellMargins 1,6,1,6 javax.swing.plaf.InsetsUIResource [UI]
List.cellNoFocusBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Default [UI] List.cellNoFocusBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Default [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
List.cellRenderer [active] javax.swing.DefaultListCellRenderer$UIResource [UI] List.cellRenderer [active] javax.swing.DefaultListCellRenderer$UIResource [UI]
List.dropCellBackground [lazy] #3f8fd9 javax.swing.plaf.ColorUIResource [UI] List.dropCellBackground [lazy] #3f8fd9 javax.swing.plaf.ColorUIResource [UI]
List.dropCellForeground [lazy] #ffffff javax.swing.plaf.ColorUIResource [UI] List.dropCellForeground [lazy] #ffffff javax.swing.plaf.ColorUIResource [UI]
List.dropLineColor [lazy] #6aa7e1 javax.swing.plaf.ColorUIResource [UI] List.dropLineColor [lazy] #6aa7e1 javax.swing.plaf.ColorUIResource [UI]
List.focusCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Focused [UI] List.focusCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Focused [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
List.focusSelectedCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Selected [UI] List.focusSelectedCellHighlightBorder [lazy] 1,6,1,6 false com.formdev.flatlaf.ui.FlatListCellBorder$Selected [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
List.font [active] $defaultFont [UI] List.font [active] $defaultFont [UI]
List.foreground #000000 javax.swing.plaf.ColorUIResource [UI] List.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
List.noFocusBorder 1,1,1,1 false javax.swing.plaf.BorderUIResource$EmptyBorderUIResource [UI] List.noFocusBorder 1,1,1,1 false javax.swing.plaf.BorderUIResource$EmptyBorderUIResource [UI]
@@ -462,7 +463,7 @@ ListUI com.formdev.flatlaf.ui.FlatListUI
#---- Menu ---- #---- Menu ----
Menu.acceleratorFont [active] $defaultFont [UI] Menu.acceleratorFont [active] $defaultFont [UI]
Menu.acceleratorForeground #505050 javax.swing.plaf.ColorUIResource [UI] Menu.acceleratorForeground #4d4d4d javax.swing.plaf.ColorUIResource [UI]
Menu.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI] Menu.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
Menu.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuArrowIcon [UI] Menu.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuArrowIcon [UI]
Menu.background #ffffff javax.swing.plaf.ColorUIResource [UI] Menu.background #ffffff javax.swing.plaf.ColorUIResource [UI]
@@ -475,7 +476,7 @@ Menu.font [active] $defaultFont [UI]
Menu.foreground #000000 javax.swing.plaf.ColorUIResource [UI] Menu.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
Menu.icon.arrowColor #666666 javax.swing.plaf.ColorUIResource [UI] Menu.icon.arrowColor #666666 javax.swing.plaf.ColorUIResource [UI]
Menu.icon.disabledArrowColor #ababab javax.swing.plaf.ColorUIResource [UI] Menu.icon.disabledArrowColor #ababab javax.swing.plaf.ColorUIResource [UI]
Menu.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] Menu.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
Menu.menuPopupOffsetX 0 Menu.menuPopupOffsetX 0
Menu.menuPopupOffsetY 0 Menu.menuPopupOffsetY 0
Menu.opaque false Menu.opaque false
@@ -497,7 +498,7 @@ MenuBar.font [active] $defaultFont [UI]
MenuBar.foreground #000000 javax.swing.plaf.ColorUIResource [UI] MenuBar.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
MenuBar.highlight #ffffff javax.swing.plaf.ColorUIResource [UI] MenuBar.highlight #ffffff javax.swing.plaf.ColorUIResource [UI]
MenuBar.hoverBackground #e6e6e6 javax.swing.plaf.ColorUIResource [UI] MenuBar.hoverBackground #e6e6e6 javax.swing.plaf.ColorUIResource [UI]
MenuBar.itemMargins 3,3,3,3 javax.swing.plaf.InsetsUIResource [UI] MenuBar.itemMargins 3,8,3,8 javax.swing.plaf.InsetsUIResource [UI]
MenuBar.shadow #c4c4c4 javax.swing.plaf.ColorUIResource [UI] MenuBar.shadow #c4c4c4 javax.swing.plaf.ColorUIResource [UI]
MenuBar.windowBindings length=2 [Ljava.lang.Object; MenuBar.windowBindings length=2 [Ljava.lang.Object;
[0] F10 [0] F10
@@ -507,21 +508,33 @@ MenuBarUI com.formdev.flatlaf.ui.FlatMenuBarUI
#---- MenuItem ---- #---- MenuItem ----
MenuItem.acceleratorArrowGap 2
MenuItem.acceleratorDelimiter - MenuItem.acceleratorDelimiter -
MenuItem.acceleratorFont [active] $defaultFont [UI] MenuItem.acceleratorFont [active] $defaultFont [UI]
MenuItem.acceleratorForeground #505050 javax.swing.plaf.ColorUIResource [UI] MenuItem.acceleratorForeground #4d4d4d javax.swing.plaf.ColorUIResource [UI]
MenuItem.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI] MenuItem.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
MenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI] MenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI]
MenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI] MenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI] MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
MenuItem.borderPainted true MenuItem.borderPainted true
MenuItem.checkBackground #e6e6e6 javax.swing.plaf.ColorUIResource [UI]
MenuItem.checkMargins 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI]
MenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI] MenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
MenuItem.font [active] $defaultFont [UI] MenuItem.font [active] $defaultFont [UI]
MenuItem.foreground #000000 javax.swing.plaf.ColorUIResource [UI] MenuItem.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
MenuItem.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] MenuItem.iconTextGap 6
MenuItem.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
MenuItem.minimumIconSize 16,16 javax.swing.plaf.DimensionUIResource [UI]
MenuItem.minimumWidth 72
MenuItem.opaque false MenuItem.opaque false
MenuItem.selectionBackground #2675bf javax.swing.plaf.ColorUIResource [UI] MenuItem.selectionBackground #2675bf javax.swing.plaf.ColorUIResource [UI]
MenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI] MenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
MenuItem.textAcceleratorGap 24
MenuItem.textNoAcceleratorGap 6
MenuItem.underlineSelectionBackground #e6e6e6 javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionCheckBackground #cccccc javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionColor #4083c9 javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionHeight 3
#---- MenuItemCheckBox ---- #---- MenuItemCheckBox ----
@@ -620,7 +633,7 @@ PasswordFieldUI com.formdev.flatlaf.ui.FlatPasswordFieldUI
#---- PopupMenu ---- #---- PopupMenu ----
PopupMenu.background #ffffff javax.swing.plaf.ColorUIResource [UI] PopupMenu.background #ffffff javax.swing.plaf.ColorUIResource [UI]
PopupMenu.border [lazy] 4,1,4,1 false com.formdev.flatlaf.ui.FlatPopupMenuBorder [UI] PopupMenu.border [lazy] 4,1,4,1 false com.formdev.flatlaf.ui.FlatPopupMenuBorder [UI] lineColor=#adadad javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
PopupMenu.borderColor #adadad javax.swing.plaf.ColorUIResource [UI] PopupMenu.borderColor #adadad javax.swing.plaf.ColorUIResource [UI]
PopupMenu.borderInsets 4,1,4,1 javax.swing.plaf.InsetsUIResource [UI] PopupMenu.borderInsets 4,1,4,1 javax.swing.plaf.InsetsUIResource [UI]
PopupMenu.consumeEventOnClose false PopupMenu.consumeEventOnClose false
@@ -682,7 +695,7 @@ RadioButton.textShiftOffset 0
#---- RadioButtonMenuItem ---- #---- RadioButtonMenuItem ----
RadioButtonMenuItem.acceleratorFont [active] $defaultFont [UI] RadioButtonMenuItem.acceleratorFont [active] $defaultFont [UI]
RadioButtonMenuItem.acceleratorForeground #505050 javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.acceleratorForeground #4d4d4d javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.acceleratorSelectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI] RadioButtonMenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenuItemArrowIcon [UI]
RadioButtonMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
@@ -692,7 +705,7 @@ RadioButtonMenuItem.checkIcon [lazy] 15,15 com.formdev.flatlaf.icons.FlatRad
RadioButtonMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.font [active] $defaultFont [UI] RadioButtonMenuItem.font [active] $defaultFont [UI]
RadioButtonMenuItem.foreground #000000 javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.margin 2,8,2,8 javax.swing.plaf.InsetsUIResource [UI] RadioButtonMenuItem.margin 3,6,3,6 javax.swing.plaf.InsetsUIResource [UI]
RadioButtonMenuItem.opaque false RadioButtonMenuItem.opaque false
RadioButtonMenuItem.selectionBackground #2675bf javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.selectionBackground #2675bf javax.swing.plaf.ColorUIResource [UI]
RadioButtonMenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI] RadioButtonMenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
@@ -706,7 +719,7 @@ RadioButtonUI com.formdev.flatlaf.ui.FlatRadioButtonUI
#---- Resizable ---- #---- Resizable ----
Resizable.resizeBorder [lazy] 4,4,4,4 false com.formdev.flatlaf.ui.FlatLineBorder [UI] Resizable.resizeBorder [lazy] 4,4,4,4 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#adadad javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
#---- RootPane ---- #---- RootPane ----
@@ -877,7 +890,7 @@ Table.ascendingSortIcon [lazy] 10,5 com.formdev.flatlaf.icons.FlatAsce
Table.background #ffffff javax.swing.plaf.ColorUIResource [UI] Table.background #ffffff javax.swing.plaf.ColorUIResource [UI]
Table.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI] Table.cellFocusColor #000000 javax.swing.plaf.ColorUIResource [UI]
Table.cellMargins 2,3,2,3 javax.swing.plaf.InsetsUIResource [UI] Table.cellMargins 2,3,2,3 javax.swing.plaf.InsetsUIResource [UI]
Table.cellNoFocusBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Default [UI] Table.cellNoFocusBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Default [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
Table.descendingSortIcon [lazy] 10,5 com.formdev.flatlaf.icons.FlatDescendingSortIcon [UI] Table.descendingSortIcon [lazy] 10,5 com.formdev.flatlaf.icons.FlatDescendingSortIcon [UI]
Table.dropCellBackground [lazy] #3f8fd9 javax.swing.plaf.ColorUIResource [UI] Table.dropCellBackground [lazy] #3f8fd9 javax.swing.plaf.ColorUIResource [UI]
Table.dropCellForeground [lazy] #ffffff javax.swing.plaf.ColorUIResource [UI] Table.dropCellForeground [lazy] #ffffff javax.swing.plaf.ColorUIResource [UI]
@@ -885,8 +898,8 @@ Table.dropLineColor [lazy] #6aa7e1 javax.swing.plaf.ColorUIResourc
Table.dropLineShortColor [lazy] #15416a javax.swing.plaf.ColorUIResource [UI] Table.dropLineShortColor [lazy] #15416a javax.swing.plaf.ColorUIResource [UI]
Table.focusCellBackground #ffffff javax.swing.plaf.ColorUIResource [UI] Table.focusCellBackground #ffffff javax.swing.plaf.ColorUIResource [UI]
Table.focusCellForeground #000000 javax.swing.plaf.ColorUIResource [UI] Table.focusCellForeground #000000 javax.swing.plaf.ColorUIResource [UI]
Table.focusCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Focused [UI] Table.focusCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Focused [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
Table.focusSelectedCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Selected [UI] Table.focusSelectedCellHighlightBorder [lazy] 2,3,2,3 false com.formdev.flatlaf.ui.FlatTableCellBorder$Selected [UI] lineColor=#000000 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
Table.font [active] $defaultFont [UI] Table.font [active] $defaultFont [UI]
Table.foreground #000000 javax.swing.plaf.ColorUIResource [UI] Table.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
Table.gridColor #f7f7f7 javax.swing.plaf.ColorUIResource [UI] Table.gridColor #f7f7f7 javax.swing.plaf.ColorUIResource [UI]
@@ -1003,7 +1016,7 @@ TextPaneUI com.formdev.flatlaf.ui.FlatTextPaneUI
#---- TitledBorder ---- #---- TitledBorder ----
TitledBorder.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatLineBorder [UI] TitledBorder.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#d1d1d1 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
TitledBorder.font [active] $defaultFont [UI] TitledBorder.font [active] $defaultFont [UI]
TitledBorder.titleColor #000000 javax.swing.plaf.ColorUIResource [UI] TitledBorder.titleColor #000000 javax.swing.plaf.ColorUIResource [UI]
@@ -1079,11 +1092,9 @@ ToolBarUI com.formdev.flatlaf.ui.FlatToolBarUI
#---- ToolTip ---- #---- ToolTip ----
ToolTip.background #fafafa javax.swing.plaf.ColorUIResource [UI] ToolTip.background #fafafa javax.swing.plaf.ColorUIResource [UI]
ToolTip.backgroundInactive #fafafa javax.swing.plaf.ColorUIResource [UI] ToolTip.border [lazy] 4,6,4,6 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#919191 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000
ToolTip.border [lazy] 4,6,4,6 false com.formdev.flatlaf.ui.FlatLineBorder [UI]
ToolTip.font [active] $defaultFont [UI] ToolTip.font [active] $defaultFont [UI]
ToolTip.foreground #000000 javax.swing.plaf.ColorUIResource [UI] ToolTip.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
ToolTip.foregroundInactive #8c8c8c javax.swing.plaf.ColorUIResource [UI]
#---- ToolTipManager ---- #---- ToolTipManager ----

View File

@@ -573,9 +573,9 @@ Table.ancestorInputMap [lazy] 34 javax.swing.plaf.InputMapUIResource
UP selectPreviousRow UP selectPreviousRow
shift alt TAB focusHeader shift alt TAB focusHeader
shift DOWN selectNextRowExtendSelection shift DOWN selectNextRowExtendSelection
shift END selectLastColumnExtendSelection shift END selectLastRowExtendSelection
shift ENTER selectPreviousRowCell shift ENTER selectPreviousRowCell
shift HOME selectFirstColumnExtendSelection shift HOME selectFirstRowExtendSelection
shift KP_DOWN selectNextRowExtendSelection shift KP_DOWN selectNextRowExtendSelection
shift KP_LEFT selectPreviousColumnExtendSelection shift KP_LEFT selectPreviousColumnExtendSelection
shift KP_RIGHT selectNextColumnExtendSelection shift KP_RIGHT selectNextColumnExtendSelection
@@ -894,7 +894,7 @@ Tree.focusInputMap.RightToLeft [lazy] 12 javax.swing.plaf.InputMapUIResource
shift KP_RIGHT selectParent shift KP_RIGHT selectParent
shift LEFT selectChild shift LEFT selectChild
shift RIGHT selectParent shift RIGHT selectParent
Tree.focusInputMap [lazy] 27 javax.swing.plaf.InputMapUIResource [UI] Tree.focusInputMap [lazy] 29 javax.swing.plaf.InputMapUIResource [UI]
alt KP_LEFT selectParent alt KP_LEFT selectParent
alt KP_RIGHT selectChild alt KP_RIGHT selectChild
alt LEFT selectParent alt LEFT selectParent
@@ -915,6 +915,8 @@ Tree.focusInputMap [lazy] 27 javax.swing.plaf.InputMapUIResource
RIGHT selectChild RIGHT selectChild
UP selectPrevious UP selectPrevious
shift DOWN selectNextExtendSelection shift DOWN selectNextExtendSelection
shift END selectLastExtendSelection
shift HOME selectFirstExtendSelection
shift KP_DOWN selectNextExtendSelection shift KP_DOWN selectNextExtendSelection
shift KP_LEFT selectParent shift KP_LEFT selectParent
shift KP_RIGHT selectChild shift KP_RIGHT selectChild

View File

@@ -583,8 +583,8 @@ Table.ancestorInputMap [lazy] 71 javax.swing.plaf.InputMapUIResource
TAB selectNextColumnCell TAB selectNextColumnCell
UP selectPreviousRow UP selectPreviousRow
shift ctrl DOWN selectNextRowExtendSelection shift ctrl DOWN selectNextRowExtendSelection
shift ctrl END selectLastRowExtendSelection shift ctrl END selectLastColumnExtendSelection
shift ctrl HOME selectFirstRowExtendSelection shift ctrl HOME selectFirstColumnExtendSelection
shift ctrl KP_DOWN selectNextRowExtendSelection shift ctrl KP_DOWN selectNextRowExtendSelection
shift ctrl KP_LEFT selectPreviousColumnExtendSelection shift ctrl KP_LEFT selectPreviousColumnExtendSelection
shift ctrl KP_RIGHT selectNextColumnExtendSelection shift ctrl KP_RIGHT selectNextColumnExtendSelection
@@ -597,9 +597,9 @@ Table.ancestorInputMap [lazy] 71 javax.swing.plaf.InputMapUIResource
shift ctrl UP selectPreviousRowExtendSelection shift ctrl UP selectPreviousRowExtendSelection
shift DELETE cut shift DELETE cut
shift DOWN selectNextRowExtendSelection shift DOWN selectNextRowExtendSelection
shift END selectLastColumnExtendSelection shift END selectLastRowExtendSelection
shift ENTER selectPreviousRowCell shift ENTER selectPreviousRowCell
shift HOME selectFirstColumnExtendSelection shift HOME selectFirstRowExtendSelection
shift INSERT paste shift INSERT paste
shift KP_DOWN selectNextRowExtendSelection shift KP_DOWN selectNextRowExtendSelection
shift KP_LEFT selectPreviousColumnExtendSelection shift KP_LEFT selectPreviousColumnExtendSelection