Compare commits

...

20 Commits
0.40 ... 0.41

Author SHA1 Message Date
Karl Tauber
ec8213b891 release 0.41 2020-09-02 11:23:43 +02:00
Karl Tauber
ae61383742 README.md: screenshots updated; removed unused screenshots 2020-09-01 18:50:26 +02:00
Karl Tauber
cc90a2ad75 Demo: reworked "More Components" tab and added screenshot mode 2020-09-01 17:24:26 +02:00
Karl Tauber
28634cda56 README.md: screenshots updated 2020-09-01 12:20:40 +02:00
Karl Tauber
3b71fcd690 Demo: fixed too large gap between themes list and control bar 2020-08-31 18:25:01 +02:00
Karl Tauber
5923ac65df smoother transition from old to new theme, independent of UI complexity, when using animated theme change 2020-08-31 18:10:54 +02:00
Karl Tauber
faffc9393d fixed sub-pixel text rendering in animated theme change; use weak hash map for static map to avoid memory leak for the case that something went wrong 2020-08-31 18:07:37 +02:00
Karl Tauber
6da220f36c IntelliJ Themes: updated themes to newest versions (used IJThemesUpdater) 2020-08-27 00:05:29 +02:00
Karl Tauber
21d78671d6 Demo: show hint popups to guide users to some features of the FlatLaf Demo application; added "Options > Show hints" menu item 2020-08-26 23:17:55 +02:00
Karl Tauber
af5a0ec0b7 Window decorations: fixed title pane background color in IntelliJ themes if window is inactive 2020-08-26 16:13:44 +02:00
Karl Tauber
ff214455a3 Window decorations: fixed iconify, maximize and close icon colors if window is inactive 2020-08-26 15:03:26 +02:00
Karl Tauber
3e941e3e42 Demo: fixed restoring last used theme on startup (regression in 0.39 since commit a8f4c8e843) 2020-08-26 12:35:26 +02:00
Karl Tauber
2f876d553f List and Table: fixed possible NPE in unusual cases 2020-08-26 12:16:11 +02:00
Karl Tauber
b208017117 added API to register packages or folders where FlatLaf searches for application specific properties files with custom UI defaults 2020-08-26 12:07:00 +02:00
Karl Tauber
a1dab94a61 TextArea: update background color property if enabled or editable state changes in the same way as Swing does it for all other text components (issue #147) 2020-08-25 19:15:53 +02:00
Karl Tauber
e55b2afd60 Button: show "selected" state (issue #161) 2020-08-25 16:41:40 +02:00
Karl Tauber
535c3ddf6c FlatSVGIcon now allows specifying ClassLoader that is used to load SVG file (issue #163) 2020-08-24 23:31:18 +02:00
Karl Tauber
3008d99fcd updated svgSalamander to version 1.1.2.3 2020-08-24 22:45:35 +02:00
Karl Tauber
fd37339e2f TableHeader: fixed NPE for the (unusual) case that JTableHeader is used without JTable 2020-08-13 17:07:44 +02:00
Karl Tauber
e29eca203c Theme Editor: build fat jar (includes all dependencies) (issue #160) 2020-08-12 14:02:04 +02:00
56 changed files with 942 additions and 221 deletions

View File

@@ -1,6 +1,41 @@
FlatLaf Change Log
==================
## 0.41
#### New features and improvements
- Added API to register packages or folders where FlatLaf searches for
application specific properties files with custom UI defaults (see
`FlatLaf.registerCustomDefaultsSource(...)` methods).
- Demo: Show hint popups to guide users to some features of the FlatLaf Demo
application.
- Extras: `FlatSVGIcon` now allows specifying `ClassLoader` that is used to load
SVG file. (issue #163)
- Smoother transition from old to new theme, independent of UI complexity, when
using animated theme change (see [FlatLaf Extras](flatlaf-extras)).
#### Fixed bugs
- Button: "selected" state was not shown. (issue #161)
- TextArea: Update background color property if enabled or editable state
changes in the same way as Swing does it for all other text components. (issue
#147)
- Demo: Fixed restoring last used theme on startup. (regression in 0.39)
- Custom window decorations: Fixed iconify, maximize and close icon colors if
window is inactive.
- Custom window decorations: Fixed title pane background color in IntelliJ
themes if window is inactive.
- Fixed sub-pixel text rendering in animated theme change (see
[FlatLaf Extras](flatlaf-extras)).
#### Other Changes
- Extras: Updated dependency
[svgSalamander](https://github.com/JFormDesigner/svgSalamander) to version
1.1.2.3.
## 0.40
#### New features

View File

@@ -11,9 +11,9 @@ scales on **HiDPI** displays and runs on Java 8 or newer.
The look is heavily inspired by **Darcula** and **IntelliJ** themes from
IntelliJ IDEA 2019.2+ and uses almost the same colors and icons.
![Flat Light Demo](images/FlatLightDemo.png)
![Flat Light](images/flat_light.png)
![Flat Dark Demo](images/FlatDarkDemo.png)
![Flat Dark](images/flat_dark.png)
IntelliJ Platform Themes
@@ -22,9 +22,7 @@ IntelliJ Platform Themes
FlatLaf can use 3rd party themes created for IntelliJ Platform (see
[IntelliJ Themes Pack](flatlaf-intellij-themes)):
![Cyan Light Demo](images/CyanLightDemo.png)
![Dark Purple Demo](images/DarkPurpleDemo.png)
![IntelliJ Platform Themes](images/intellij_platform_themes.png)
Demo

View File

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

View File

@@ -29,6 +29,7 @@ import java.awt.image.ImageFilter;
import java.awt.image.ImageProducer;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
@@ -76,6 +77,8 @@ public abstract class FlatLaf
static final Logger LOG = Logger.getLogger( FlatLaf.class.getName() );
private static final String DESKTOPFONTHINTS = "awt.font.desktophints";
private static List<Object> customDefaultsSources;
private String desktopPropertyName;
private String desktopPropertyName2;
private PropertyChangeListener desktopPropertyListener;
@@ -552,6 +555,87 @@ public abstract class FlatLaf
defaults.put( key, value );
}
static List<Object> getCustomDefaultsSources() {
return customDefaultsSources;
}
/**
* Registers a package where FlatLaf searches for properties files with custom UI defaults.
* <p>
* This can be used to specify application specific UI defaults that override UI values
* of existing themes or to define own UI values used in custom controls.
* <p>
* There may be multiple properties files in that package for multiple themes.
* The properties file name must match the used theme class names.
* E.g. {@code FlatLightLaf.properties} for class {@link FlatLightLaf}
* or {@code FlatDarkLaf.properties} for class {@link FlatDarkLaf}.
* {@code FlatLaf.properties} is loaded first for all themes.
* <p>
* These properties files are loaded after theme and addon properties files
* and can therefore override all UI defaults.
* <p>
* Invoke this method before setting the look and feel.
*
* @param packageName a package name (e.g. "com.myapp.resources")
*/
public static void registerCustomDefaultsSource( String packageName ) {
registerCustomDefaultsSource( packageName, null );
}
public static void unregisterCustomDefaultsSource( String packageName ) {
unregisterCustomDefaultsSource( packageName, null );
}
/**
* Registers a package where FlatLaf searches for properties files with custom UI defaults.
* <p>
* See {@link #registerCustomDefaultsSource(String)} for details.
*
* @param packageName a package name (e.g. "com.myapp.resources")
* @param classLoader a class loader used to find resources, or {@code null}
*/
public static void registerCustomDefaultsSource( String packageName, ClassLoader classLoader ) {
if( customDefaultsSources == null )
customDefaultsSources = new ArrayList<>();
customDefaultsSources.add( packageName );
customDefaultsSources.add( classLoader );
}
public static void unregisterCustomDefaultsSource( String packageName, ClassLoader classLoader ) {
if( customDefaultsSources == null )
return;
int size = customDefaultsSources.size();
for( int i = 0; i < size - 1; i++ ) {
Object source = customDefaultsSources.get( i );
if( packageName.equals( source ) && customDefaultsSources.get( i + 1 ) == classLoader ) {
customDefaultsSources.remove( i + 1 );
customDefaultsSources.remove( i );
break;
}
}
}
/**
* Registers a folder where FlatLaf searches for properties files with custom UI defaults.
* <p>
* See {@link #registerCustomDefaultsSource(String)} for details.
*
* @param folder a folder
*/
public static void registerCustomDefaultsSource( File folder ) {
if( customDefaultsSources == null )
customDefaultsSources = new ArrayList<>();
customDefaultsSources.add( folder );
}
public static void unregisterCustomDefaultsSource( File folder ) {
if( customDefaultsSources == null )
return;
customDefaultsSources.remove( folder );
}
private static void reSetLookAndFeel() {
EventQueue.invokeLater( () -> {
LookAndFeel lookAndFeel = UIManager.getLookAndFeel();

View File

@@ -531,6 +531,7 @@ public class IntelliJTheme
uiKeyMapping.put( "Slider.trackWidth", "" ); // ignore (used in Material Theme UI Lite)
// TitlePane
uiKeyCopying.put( "TitlePane.inactiveBackground", "TitlePane.background" );
uiKeyMapping.put( "TitlePane.infoForeground", "TitlePane.foreground" );
uiKeyMapping.put( "TitlePane.inactiveInfoForeground", "TitlePane.inactiveForeground" );

View File

@@ -19,6 +19,8 @@ package com.formdev.flatlaf;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Insets;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@@ -107,6 +109,42 @@ class UIDefaultsLoader
}
}
// load custom properties files (usually provides by applications)
List<Object> customDefaultsSources = FlatLaf.getCustomDefaultsSources();
int size = (customDefaultsSources != null) ? customDefaultsSources.size() : 0;
for( int i = 0; i < size; i++ ) {
Object source = customDefaultsSources.get( i );
if( source instanceof String && i + 1 < size ) {
// load from package in classloader
String packageName = (String) source;
ClassLoader classLoader = (ClassLoader) customDefaultsSources.get( ++i );
packageName = packageName.replace( '.', '/' );
if( classLoader == null )
classLoader = FlatLaf.class.getClassLoader();
for( Class<?> lafClass : lafClasses ) {
String propertiesName = packageName + '/' + lafClass.getSimpleName() + ".properties";
try( InputStream in = classLoader.getResourceAsStream( propertiesName ) ) {
if( in != null )
properties.load( in );
}
}
} else if( source instanceof File ) {
// load from folder
File folder = (File) source;
for( Class<?> lafClass : lafClasses ) {
File propertiesFile = new File( folder, lafClass.getSimpleName() + ".properties" );
if( !propertiesFile.isFile() )
continue;
try( InputStream in = new FileInputStream( propertiesFile ) ) {
properties.load( in );
}
}
}
}
// collect addon class loaders
List<ClassLoader> addonClassLoaders = new ArrayList<>();
for( FlatDefaultsAddon addon : addons ) {

View File

@@ -67,8 +67,11 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault Button.focusedBackground Color optional
* @uiDefault Button.hoverBackground Color optional
* @uiDefault Button.pressedBackground Color optional
* @uiDefault Button.selectedBackground Color
* @uiDefault Button.selectedForeground Color
* @uiDefault Button.disabledBackground Color optional
* @uiDefault Button.disabledText Color
* @uiDefault Button.disabledSelectedBackground Color
* @uiDefault Button.default.background Color
* @uiDefault Button.default.startBackground Color optional; if set, a gradient paint is used and Button.default.background is ignored
* @uiDefault Button.default.endBackground Color optional; if set, a gradient paint is used
@@ -84,6 +87,7 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault Button.toolbar.spacingInsets Insets
* @uiDefault Button.toolbar.hoverBackground Color
* @uiDefault Button.toolbar.pressedBackground Color
* @uiDefault Button.toolbar.selectedBackground Color
*
* @author Karl Tauber
*/
@@ -101,8 +105,11 @@ public class FlatButtonUI
protected Color focusedBackground;
protected Color hoverBackground;
protected Color pressedBackground;
protected Color selectedBackground;
protected Color selectedForeground;
protected Color disabledBackground;
protected Color disabledText;
protected Color disabledSelectedBackground;
protected Color defaultBackground;
protected Color defaultEndBackground;
@@ -119,6 +126,7 @@ public class FlatButtonUI
protected Insets toolbarSpacingInsets;
protected Color toolbarHoverBackground;
protected Color toolbarPressedBackground;
protected Color toolbarSelectedBackground;
private Icon helpButtonIcon;
@@ -150,8 +158,11 @@ public class FlatButtonUI
focusedBackground = UIManager.getColor( prefix + "focusedBackground" );
hoverBackground = UIManager.getColor( prefix + "hoverBackground" );
pressedBackground = UIManager.getColor( prefix + "pressedBackground" );
selectedBackground = UIManager.getColor( prefix + "selectedBackground" );
selectedForeground = UIManager.getColor( prefix + "selectedForeground" );
disabledBackground = UIManager.getColor( prefix + "disabledBackground" );
disabledText = UIManager.getColor( prefix + "disabledText" );
disabledSelectedBackground = UIManager.getColor( prefix + "disabledSelectedBackground" );
if( UIManager.getBoolean( "Button.paintShadow" ) ) {
shadowWidth = FlatUIUtils.getUIInt( "Button.shadowWidth", 2 );
@@ -174,6 +185,7 @@ public class FlatButtonUI
toolbarSpacingInsets = UIManager.getInsets( "Button.toolbar.spacingInsets" );
toolbarHoverBackground = UIManager.getColor( prefix + "toolbar.hoverBackground" );
toolbarPressedBackground = UIManager.getColor( prefix + "toolbar.pressedBackground" );
toolbarSelectedBackground = UIManager.getColor( prefix + "toolbar.selectedBackground" );
helpButtonIcon = UIManager.getIcon( "HelpButton.icon" );
@@ -369,6 +381,17 @@ public class FlatButtonUI
}
protected Color getBackground( JComponent c ) {
if( ((AbstractButton)c).isSelected() ) {
// in toolbar use same colors for disabled and enabled because
// we assume that toolbar icon is shown disabled
boolean toolBarButton = isToolBarButton( c );
return buttonStateColor( c,
toolBarButton ? toolbarSelectedBackground : selectedBackground,
toolBarButton ? toolbarSelectedBackground : disabledSelectedBackground,
null, null,
toolBarButton ? toolbarPressedBackground : pressedBackground );
}
if( !c.isEnabled() )
return disabledBackground;
@@ -430,6 +453,9 @@ public class FlatButtonUI
if( !c.isEnabled() )
return disabledText;
if( ((AbstractButton)c).isSelected() && !isToolBarButton( c ) )
return selectedForeground;
// use component foreground if explicitly set
Color fg = c.getForeground();
if( isCustomForeground( fg ) )

View File

@@ -126,6 +126,9 @@ public class FlatListUI
* or the application has to be changed to extend a FlatLaf renderer.
*/
private void toggleSelectionColors() {
if( list == null )
return;
if( FlatUIUtils.isPermanentFocusOwner( list ) ) {
if( list.getSelectionBackground() == selectionInactiveBackground )
list.setSelectionBackground( selectionBackground );

View File

@@ -158,7 +158,7 @@ public class FlatTableHeaderUI
g2.setColor( separatorColor );
int sepCount = columnCount;
if( header.getTable().getAutoResizeMode() != JTable.AUTO_RESIZE_OFF && !isVerticalScrollBarVisible() )
if( header.getTable() != null && header.getTable().getAutoResizeMode() != JTable.AUTO_RESIZE_OFF && !isVerticalScrollBarVisible() )
sepCount--;
if( header.getComponentOrientation().isLeftToRight() ) {

View File

@@ -188,6 +188,9 @@ public class FlatTableUI
* or the application has to be changed to extend a FlatLaf renderer.
*/
private void toggleSelectionColors() {
if( table == null )
return;
if( FlatUIUtils.isPermanentFocusOwner( table ) ) {
if( table.getSelectionBackground() == selectionInactiveBackground )
table.setSelectionBackground( selectionBackground );

View File

@@ -60,6 +60,7 @@ public class FlatTextAreaUI
{
protected int minimumWidth;
protected boolean isIntelliJTheme;
protected Color background;
protected Color disabledBackground;
protected Color inactiveBackground;
@@ -67,12 +68,20 @@ public class FlatTextAreaUI
return new FlatTextAreaUI();
}
@Override
public void installUI( JComponent c ) {
super.installUI( c );
updateBackground();
}
@Override
protected void installDefaults() {
super.installDefaults();
minimumWidth = UIManager.getInt( "Component.minimumWidth" );
isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
background = UIManager.getColor( "TextArea.background" );
disabledBackground = UIManager.getColor( "TextArea.disabledBackground" );
inactiveBackground = UIManager.getColor( "TextArea.inactiveBackground" );
}
@@ -81,6 +90,7 @@ public class FlatTextAreaUI
protected void uninstallDefaults() {
super.uninstallDefaults();
background = null;
disabledBackground = null;
inactiveBackground = null;
}
@@ -89,26 +99,36 @@ public class FlatTextAreaUI
protected void propertyChange( PropertyChangeEvent e ) {
super.propertyChange( e );
FlatEditorPaneUI.propertyChange( getComponent(), e );
switch( e.getPropertyName() ) {
case "editable":
case "enabled":
updateBackground();
break;
}
}
@Override
protected void paintSafely( Graphics g ) {
super.paintSafely( HiDPIUtils.createGraphicsTextYCorrection( (Graphics2D) g ) );
}
@Override
protected void paintBackground( Graphics g ) {
private void updateBackground() {
JTextComponent c = getComponent();
Color background = c.getBackground();
g.setColor( !(background instanceof UIResource)
? background
: (isIntelliJTheme && (!c.isEnabled() || !c.isEditable())
? FlatUIUtils.getParentBackground( c )
: (!c.isEnabled()
? disabledBackground
: (!c.isEditable() ? inactiveBackground : background))) );
g.fillRect( 0, 0, c.getWidth(), c.getHeight() );
if( !(background instanceof UIResource) )
return;
// do not update background if it currently has a unknown color (assigned from outside)
if( background != this.background &&
background != disabledBackground &&
background != inactiveBackground )
return;
Color newBackground = !c.isEnabled()
? disabledBackground
: (!c.isEditable()
? inactiveBackground
: this.background);
if( newBackground != background )
c.setBackground( newBackground );
}
@Override
@@ -128,4 +148,22 @@ public class FlatTextAreaUI
return FlatEditorPaneUI.applyMinimumWidth( c, size, minimumWidth );
}
@Override
protected void paintSafely( Graphics g ) {
super.paintSafely( HiDPIUtils.createGraphicsTextYCorrection( (Graphics2D) g ) );
}
@Override
protected void paintBackground( Graphics g ) {
JTextComponent c = getComponent();
// for compatibility with IntelliJ themes
if( isIntelliJTheme && (!c.isEnabled() || !c.isEditable()) && (c.getBackground() instanceof UIResource) ) {
FlatUIUtils.paintParentBackground( g, c );
return;
}
super.paintBackground( g );
}
}

View File

@@ -240,12 +240,15 @@ public class FlatTitlePane
protected void activeChanged( boolean active ) {
boolean hasEmbeddedMenuBar = rootPane.getJMenuBar() != null && isMenuBarEmbedded();
Color background = FlatUIUtils.nonUIResource( active ? activeBackground : inactiveBackground );
Color foreground = FlatUIUtils.nonUIResource( active
? (hasEmbeddedMenuBar ? embeddedForeground : activeForeground)
: inactiveForeground );
Color foreground = FlatUIUtils.nonUIResource( active ? activeForeground : inactiveForeground );
Color titleForeground = (hasEmbeddedMenuBar && active) ? FlatUIUtils.nonUIResource( embeddedForeground ) : foreground;
setBackground( background );
titleLabel.setForeground( foreground );
titleLabel.setForeground( titleForeground );
iconifyButton.setForeground( foreground );
maximizeButton.setForeground( foreground );
restoreButton.setForeground( foreground );
closeButton.setForeground( foreground );
titleLabel.setHorizontalAlignment( hasEmbeddedMenuBar ? SwingConstants.CENTER : SwingConstants.LEADING );

View File

@@ -22,7 +22,6 @@ import java.awt.Component;
import java.awt.Graphics;
import java.beans.PropertyChangeEvent;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.JComponent;
import javax.swing.JToggleButton;
import javax.swing.UIManager;
@@ -50,18 +49,17 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault ToggleButton.startBackground Color optional; if set, a gradient paint is used and ToggleButton.background is ignored
* @uiDefault ToggleButton.endBackground Color optional; if set, a gradient paint is used
* @uiDefault ToggleButton.pressedBackground Color
* @uiDefault ToggleButton.disabledBackground Color optional
* @uiDefault ToggleButton.disabledText Color
* @uiDefault ToggleButton.toolbar.hoverBackground Color
* @uiDefault ToggleButton.toolbar.pressedBackground Color
*
* <!-- FlatToggleButtonUI -->
*
* @uiDefault ToggleButton.selectedBackground Color
* @uiDefault ToggleButton.selectedForeground Color
* @uiDefault ToggleButton.disabledBackground Color optional
* @uiDefault ToggleButton.disabledText Color
* @uiDefault ToggleButton.disabledSelectedBackground Color
* @uiDefault ToggleButton.toolbar.hoverBackground Color
* @uiDefault ToggleButton.toolbar.pressedBackground Color
* @uiDefault ToggleButton.toolbar.selectedBackground Color
*
* <!-- FlatToggleButtonUI -->
*
* @uiDefault ToggleButton.tab.underlineHeight int
* @uiDefault ToggleButton.tab.underlineColor Color
* @uiDefault ToggleButton.tab.disabledUnderlineColor Color
@@ -75,12 +73,6 @@ import com.formdev.flatlaf.util.UIScale;
public class FlatToggleButtonUI
extends FlatButtonUI
{
protected Color selectedBackground;
protected Color selectedForeground;
protected Color disabledSelectedBackground;
protected Color toolbarSelectedBackground;
protected int tabUnderlineHeight;
protected Color tabUnderlineColor;
protected Color tabDisabledUnderlineColor;
@@ -108,12 +100,6 @@ public class FlatToggleButtonUI
super.installDefaults( b );
if( !defaults_initialized ) {
selectedBackground = UIManager.getColor( "ToggleButton.selectedBackground" );
selectedForeground = UIManager.getColor( "ToggleButton.selectedForeground" );
disabledSelectedBackground = UIManager.getColor( "ToggleButton.disabledSelectedBackground" );
toolbarSelectedBackground = UIManager.getColor( "ToggleButton.toolbar.selectedBackground" );
tabUnderlineHeight = UIManager.getInt( "ToggleButton.tab.underlineHeight" );
tabUnderlineColor = UIManager.getColor( "ToggleButton.tab.underlineColor" );
tabDisabledUnderlineColor = UIManager.getColor( "ToggleButton.tab.disabledUnderlineColor" );
@@ -185,30 +171,4 @@ public class FlatToggleButtonUI
} else
super.paintBackground( g, c );
}
@Override
protected Color getBackground( JComponent c ) {
ButtonModel model = ((AbstractButton)c).getModel();
if( model.isSelected() ) {
// in toolbar use same colors for disabled and enabled because
// we assume that toolbar icon is shown disabled
boolean toolBarButton = isToolBarButton( c );
return buttonStateColor( c,
toolBarButton ? toolbarSelectedBackground : selectedBackground,
toolBarButton ? toolbarSelectedBackground : disabledSelectedBackground,
null, null,
toolBarButton ? toolbarPressedBackground : pressedBackground );
}
return super.getBackground( c );
}
@Override
protected Color getForeground( JComponent c ) {
if( c.isEnabled() && ((AbstractButton)c).isSelected() && !isToolBarButton( c ) )
return selectedForeground;
return super.getForeground( c );
}
}

View File

@@ -74,6 +74,9 @@ controlDkShadow=lighten($controlShadow,10%)
Button.background=#4c5052
Button.hoverBackground=lighten($Button.background,3%,derived)
Button.pressedBackground=lighten($Button.background,6%,derived)
Button.selectedBackground=lighten($Button.background,10%,derived)
Button.selectedForeground=@foreground
Button.disabledSelectedBackground=lighten($Button.background,3%,derived)
Button.borderColor=#5e6060
Button.disabledBorderColor=#5e6060
@@ -92,6 +95,7 @@ Button.default.boldText=true
Button.toolbar.hoverBackground=lighten($Button.background,1%,derived)
Button.toolbar.pressedBackground=lighten($Button.background,4%,derived)
Button.toolbar.selectedBackground=lighten($Button.background,7%,derived)
#---- CheckBox ----

View File

@@ -75,6 +75,9 @@ Button.background=#ffffff
Button.focusedBackground=#e3f1fa
Button.hoverBackground=darken($Button.background,3%,derived)
Button.pressedBackground=darken($Button.background,10%,derived)
Button.selectedBackground=darken($Button.background,20%,derived)
Button.selectedForeground=@foreground
Button.disabledSelectedBackground=darken($Button.background,13%,derived)
Button.borderColor=$Component.borderColor
Button.disabledBorderColor=$Component.disabledBorderColor
@@ -94,6 +97,7 @@ Button.default.borderWidth=2
Button.toolbar.hoverBackground=darken($Button.background,12%,derived)
Button.toolbar.pressedBackground=darken($Button.background,15%,derived)
Button.toolbar.selectedBackground=$Button.selectedBackground
#---- CheckBox ----

View File

@@ -16,6 +16,7 @@
package com.formdev.flatlaf.demo;
import java.awt.Component;
import javax.swing.*;
import javax.swing.text.DefaultEditorKit;
import net.miginfocom.swing.*;
@@ -114,14 +115,14 @@ class BasicComponentsPanel
JScrollPane scrollPane12 = new JScrollPane();
JTextPane textPane4 = new JTextPane();
JTextPane textPane5 = new JTextPane();
JLabel label3 = new JLabel();
JTextField textField5 = new JTextField();
JComboBox<String> comboBox7 = new JComboBox<>();
JSpinner spinner3 = new JSpinner();
JLabel label4 = new JLabel();
JTextField textField7 = new JTextField();
JComboBox<String> comboBox8 = new JComboBox<>();
JSpinner spinner4 = new JSpinner();
JLabel errorHintsLabel = new JLabel();
JTextField errorHintsTextField = new JTextField();
JComboBox<String> errorHintsComboBox = new JComboBox<>();
JSpinner errorHintsSpinner = new JSpinner();
JLabel warningHintsLabel = new JLabel();
JTextField warningHintsTextField = new JTextField();
JComboBox<String> warningHintsComboBox = new JComboBox<>();
JSpinner warningHintsSpinner = new JSpinner();
JPopupMenu popupMenu1 = new JPopupMenu();
JMenuItem cutMenuItem = new JMenuItem();
JMenuItem copyMenuItem = new JMenuItem();
@@ -129,12 +130,12 @@ class BasicComponentsPanel
//======== this ========
setLayout(new MigLayout(
"hidemode 3",
"insets dialog,hidemode 3",
// columns
"[]" +
"[]" +
"[]" +
"[]" +
"[sizegroup 1]" +
"[sizegroup 1]" +
"[sizegroup 1]" +
"[sizegroup 1]" +
"[]" +
"[]",
// rows
@@ -606,44 +607,44 @@ class BasicComponentsPanel
textPane5.setText("No scroll pane");
add(textPane5, "cell 5 11,growx");
//---- label3 ----
label3.setText("Error hints:");
add(label3, "cell 0 12");
//---- errorHintsLabel ----
errorHintsLabel.setText("Error hints:");
add(errorHintsLabel, "cell 0 12");
//---- textField5 ----
textField5.putClientProperty("JComponent.outline", "error");
add(textField5, "cell 1 12,growx");
//---- errorHintsTextField ----
errorHintsTextField.putClientProperty("JComponent.outline", "error");
add(errorHintsTextField, "cell 1 12,growx");
//---- comboBox7 ----
comboBox7.putClientProperty("JComponent.outline", "error");
comboBox7.setModel(new DefaultComboBoxModel<>(new String[] {
//---- errorHintsComboBox ----
errorHintsComboBox.putClientProperty("JComponent.outline", "error");
errorHintsComboBox.setModel(new DefaultComboBoxModel<>(new String[] {
"Editable"
}));
comboBox7.setEditable(true);
add(comboBox7, "cell 2 12,growx");
errorHintsComboBox.setEditable(true);
add(errorHintsComboBox, "cell 2 12,growx");
//---- spinner3 ----
spinner3.putClientProperty("JComponent.outline", "error");
add(spinner3, "cell 3 12,growx");
//---- errorHintsSpinner ----
errorHintsSpinner.putClientProperty("JComponent.outline", "error");
add(errorHintsSpinner, "cell 3 12,growx");
//---- label4 ----
label4.setText("Warning hints:");
add(label4, "cell 0 13");
//---- warningHintsLabel ----
warningHintsLabel.setText("Warning hints:");
add(warningHintsLabel, "cell 0 13");
//---- textField7 ----
textField7.putClientProperty("JComponent.outline", "warning");
add(textField7, "cell 1 13,growx");
//---- warningHintsTextField ----
warningHintsTextField.putClientProperty("JComponent.outline", "warning");
add(warningHintsTextField, "cell 1 13,growx");
//---- comboBox8 ----
comboBox8.putClientProperty("JComponent.outline", "warning");
comboBox8.setModel(new DefaultComboBoxModel<>(new String[] {
//---- warningHintsComboBox ----
warningHintsComboBox.putClientProperty("JComponent.outline", "warning");
warningHintsComboBox.setModel(new DefaultComboBoxModel<>(new String[] {
"Not editable"
}));
add(comboBox8, "cell 2 13,growx");
add(warningHintsComboBox, "cell 2 13,growx");
//---- spinner4 ----
spinner4.putClientProperty("JComponent.outline", "warning");
add(spinner4, "cell 3 13,growx");
//---- warningHintsSpinner ----
warningHintsSpinner.putClientProperty("JComponent.outline", "warning");
add(warningHintsSpinner, "cell 3 13,growx");
//======== popupMenu1 ========
{
@@ -668,6 +669,33 @@ class BasicComponentsPanel
cutMenuItem.addActionListener( new DefaultEditorKit.CutAction() );
copyMenuItem.addActionListener( new DefaultEditorKit.CopyAction() );
pasteMenuItem.addActionListener( new DefaultEditorKit.PasteAction() );
if( FlatLafDemo.screenshotsMode ) {
Component[] components = {
button13, button14, button15, button16, comboBox5, comboBox6,
textField6, passwordField5,
formattedTextFieldLabel, formattedTextField1, formattedTextField2, formattedTextField3, formattedTextField4, formattedTextField5,
textAreaLabel, scrollPane1, scrollPane2, scrollPane3, scrollPane4, textArea5,
editorPaneLabel, scrollPane5, scrollPane6, scrollPane7, scrollPane8, editorPane5,
textPaneLabel, scrollPane9, scrollPane10, scrollPane11, scrollPane12, textPane5,
errorHintsLabel, errorHintsTextField, errorHintsComboBox, errorHintsSpinner,
warningHintsLabel, warningHintsTextField, warningHintsComboBox, warningHintsSpinner,
};
for( Component c : components )
c.setVisible( false );
// move password fields one row up
Component[] formattedTextFields = { formattedTextFieldLabel, formattedTextField1, formattedTextField2, formattedTextField3, formattedTextField4 };
Component[] passwordFields = { passwordFieldLabel, passwordField1, passwordField2, passwordField3, passwordField4 };
MigLayout layout = (MigLayout) getLayout();
for( int i = 0; i < passwordFields.length; i++ ) {
Object cons = layout.getComponentConstraints( formattedTextFields[i] );
layout.setComponentConstraints( passwordFields[i], cons );
}
}
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables

View File

@@ -7,8 +7,8 @@ new FormModel {
"JavaCodeGenerator.defaultVariableLocal": true
}
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "hidemode 3"
"$columnConstraints": "[][][][][][]"
"$layoutConstraints": "insets dialog,hidemode 3"
"$columnConstraints": "[sizegroup 1][sizegroup 1][sizegroup 1][sizegroup 1][][]"
"$rowConstraints": "[][][][][][][][][][][][]para[][]"
} ) {
name: "this"
@@ -592,19 +592,19 @@ new FormModel {
"value": "cell 5 11,growx"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label3"
name: "errorHintsLabel"
"text": "Error hints:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 12"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "textField5"
name: "errorHintsTextField"
"$client.JComponent.outline": "error"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 12,growx"
} )
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "comboBox7"
name: "errorHintsComboBox"
"$client.JComponent.outline": "error"
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "Editable"
@@ -615,25 +615,25 @@ new FormModel {
"value": "cell 2 12,growx"
} )
add( new FormComponent( "javax.swing.JSpinner" ) {
name: "spinner3"
name: "errorHintsSpinner"
"$client.JComponent.outline": "error"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 12,growx"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label4"
name: "warningHintsLabel"
"text": "Warning hints:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 13"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "textField7"
name: "warningHintsTextField"
"$client.JComponent.outline": "warning"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 13,growx"
} )
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "comboBox8"
name: "warningHintsComboBox"
"$client.JComponent.outline": "warning"
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "Not editable"
@@ -643,7 +643,7 @@ new FormModel {
"value": "cell 2 13,growx"
} )
add( new FormComponent( "javax.swing.JSpinner" ) {
name: "spinner4"
name: "warningHintsSpinner"
"$client.JComponent.outline": "warning"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 13,growx"

View File

@@ -30,6 +30,9 @@ import com.formdev.flatlaf.*;
import com.formdev.flatlaf.extras.FlatAnimatedLafChange;
import com.formdev.flatlaf.util.SystemInfo;
import com.formdev.flatlaf.util.UIScale;
import net.miginfocom.layout.ConstraintParser;
import net.miginfocom.layout.LC;
import net.miginfocom.layout.UnitValue;
import net.miginfocom.swing.*;
/**
@@ -44,6 +47,18 @@ class ControlBar
ControlBar() {
initComponents();
// remove top insets
MigLayout layout = (MigLayout) getLayout();
LC lc = ConstraintParser.parseLayoutConstraint( (String) layout.getLayoutConstraints() );
UnitValue[] insets = lc.getInsets();
lc.setInsets( new UnitValue[] {
new UnitValue( 0, UnitValue.PIXEL, null ),
insets[1],
insets[2],
insets[3]
} );
layout.setLayoutConstraints( lc );
// initialize look and feels combo box
DefaultComboBoxModel<LookAndFeelInfo> lafModel = new DefaultComboBoxModel<>();
lafModel.addElement( new LookAndFeelInfo( "Flat Light (F1)", FlatLightLaf.class.getName() ) );

View File

@@ -20,11 +20,13 @@ import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.prefs.Preferences;
import javax.swing.*;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.StyleContext;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.demo.HintManager.Hint;
import com.formdev.flatlaf.demo.extras.*;
import com.formdev.flatlaf.demo.intellijthemes.*;
import com.formdev.flatlaf.extras.FlatAnimatedLafChange;
@@ -57,6 +59,35 @@ class DemoFrame
if( tabIndex >= 0 && tabIndex < tabbedPane.getTabCount() && tabIndex != tabbedPane.getSelectedIndex() )
tabbedPane.setSelectedIndex( tabIndex );
SwingUtilities.invokeLater( () -> {
showHints();
} );
}
private void showHints() {
Hint fontMenuHint = new Hint(
"Use 'Font' menu to increase/decrease font size or try different fonts.",
fontMenu, SwingConstants.BOTTOM, "hint.fontMenu", null );
Hint optionsMenuHint = new Hint(
"Use 'Options' menu to try out various FlatLaf options.",
optionsMenu, SwingConstants.BOTTOM, "hint.optionsMenu", fontMenuHint );
Hint themesHint = new Hint(
"Use 'Themes' list to try out various themes.",
themesPanel, SwingConstants.LEFT, "hint.themesPanel", optionsMenuHint );
HintManager.showHint( themesHint );
}
private void clearHints() {
HintManager.hideAllHints();
Preferences state = DemoPrefs.getState();
state.remove( "hint.fontMenu" );
state.remove( "hint.optionsMenu" );
state.remove( "hint.themesPanel" );
}
private void exitActionPerformed() {
@@ -110,6 +141,11 @@ class DemoFrame
System.setProperty( "flatlaf.animatedLafChange", String.valueOf( animatedLafChangeMenuItem.isSelected() ) );
}
private void showHintsChanged() {
clearHints();
showHints();
}
private void fontFamilyChanged( ActionEvent e ) {
String fontFamily = e.getActionCommand();
@@ -251,12 +287,13 @@ class DemoFrame
JMenuItem restoreFontMenuItem = new JMenuItem();
JMenuItem incrFontMenuItem = new JMenuItem();
JMenuItem decrFontMenuItem = new JMenuItem();
JMenu optionsMenu = new JMenu();
optionsMenu = new JMenu();
windowDecorationsCheckBoxMenuItem = new JCheckBoxMenuItem();
menuBarEmbeddedCheckBoxMenuItem = new JCheckBoxMenuItem();
underlineMenuSelectionMenuItem = new JCheckBoxMenuItem();
alwaysShowMnemonicsMenuItem = new JCheckBoxMenuItem();
animatedLafChangeMenuItem = new JCheckBoxMenuItem();
JMenuItem showHintsMenuItem = new JMenuItem();
JMenu helpMenu = new JMenu();
JMenuItem aboutMenuItem = new JMenuItem();
JToolBar toolBar1 = new JToolBar();
@@ -276,7 +313,7 @@ class DemoFrame
OptionPanePanel optionPanePanel = new OptionPanePanel();
ExtrasPanel extrasPanel1 = new ExtrasPanel();
controlBar = new ControlBar();
IJThemesPanel themesPanel = new IJThemesPanel();
themesPanel = new IJThemesPanel();
//======== this ========
setTitle("FlatLaf Demo");
@@ -516,6 +553,11 @@ class DemoFrame
animatedLafChangeMenuItem.setSelected(true);
animatedLafChangeMenuItem.addActionListener(e -> animatedLafChangeChanged());
optionsMenu.add(animatedLafChangeMenuItem);
//---- showHintsMenuItem ----
showHintsMenuItem.setText("Show hints");
showHintsMenuItem.addActionListener(e -> showHintsChanged());
optionsMenu.add(showHintsMenuItem);
}
menuBar1.add(optionsMenu);
@@ -631,6 +673,7 @@ class DemoFrame
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JMenu fontMenu;
private JMenu optionsMenu;
private JCheckBoxMenuItem windowDecorationsCheckBoxMenuItem;
private JCheckBoxMenuItem menuBarEmbeddedCheckBoxMenuItem;
private JCheckBoxMenuItem underlineMenuSelectionMenuItem;
@@ -638,5 +681,6 @@ class DemoFrame
private JCheckBoxMenuItem animatedLafChangeMenuItem;
private JTabbedPane tabbedPane;
private ControlBar controlBar;
private IJThemesPanel themesPanel;
// JFormDesigner - End of variables declaration //GEN-END:variables
}

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.2.0.298" Java: "14.0.2" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.2.0.298" Java: "14" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
@@ -114,6 +114,9 @@ new FormModel {
} )
add( new FormComponent( "com.formdev.flatlaf.demo.intellijthemes.IJThemesPanel" ) {
name: "themesPanel"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "East"
} )
@@ -322,6 +325,9 @@ new FormModel {
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "optionsMenu"
"text": "Options"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
name: "windowDecorationsCheckBoxMenuItem"
"text": "Window decorations"
@@ -365,6 +371,11 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "animatedLafChangeChanged", false ) )
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "showHintsMenuItem"
"text": "Show hints"
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showHintsChanged", false ) )
} )
} )
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "helpMenu"

View File

@@ -16,9 +16,11 @@
package com.formdev.flatlaf.demo;
import java.awt.Dimension;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.extras.FlatInspector;
import com.formdev.flatlaf.util.SystemInfo;
@@ -30,6 +32,8 @@ public class FlatLafDemo
static final String PREFS_ROOT_PATH = "/flatlaf-demo";
static final String KEY_TAB = "tab";
static boolean screenshotsMode = Boolean.parseBoolean( System.getProperty( "flatlaf.demo.screenshotsMode" ) );
public static void main( String[] args ) {
// on macOS enable screen menu bar
if( SystemInfo.isMacOS && System.getProperty( "apple.laf.useScreenMenuBar" ) == null )
@@ -42,6 +46,9 @@ public class FlatLafDemo
JFrame.setDefaultLookAndFeelDecorated( true );
JDialog.setDefaultLookAndFeelDecorated( true );
// application specific UI defaults
FlatLaf.registerCustomDefaultsSource( "com.formdev.flatlaf.demo" );
// set look and feel
DemoPrefs.initLaf( args );
@@ -51,6 +58,9 @@ public class FlatLafDemo
// create frame
DemoFrame frame = new DemoFrame();
if( FlatLafDemo.screenshotsMode )
frame.setPreferredSize( new Dimension( 1280, 620 ) );
// show frame
frame.pack();
frame.setLocationRelativeTo( null );

View File

@@ -0,0 +1,219 @@
/*
* 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;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.util.ArrayList;
import java.util.List;
import javax.swing.*;
import com.formdev.flatlaf.ui.FlatDropShadowBorder;
import com.formdev.flatlaf.ui.FlatPopupMenuBorder;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.UIScale;
import net.miginfocom.swing.*;
/**
* @author Karl Tauber
*/
class HintManager
{
private static final List<HintPanel> hintPanels = new ArrayList<>();
static void showHint( Hint hint ) {
// check whether user already closed the hint
if( DemoPrefs.getState().getBoolean( hint.prefsKey, false ) ) {
if( hint.nextHint != null )
showHint( hint.nextHint );
return;
}
HintPanel hintPanel = new HintPanel( hint );
hintPanel.showHint();
hintPanels.add( hintPanel );
}
static void hideAllHints() {
HintPanel[] hintPanels2 = hintPanels.toArray( new HintPanel[hintPanels.size()] );
for( HintPanel hintPanel : hintPanels2 )
hintPanel.hideHint();
}
//---- class HintPanel ----------------------------------------------------
static class Hint
{
private final String message;
private final Component owner;
private final int position;
private final String prefsKey;
private final Hint nextHint;
Hint( String message, Component owner, int position, String prefsKey, Hint nextHint ) {
this.message = message;
this.owner = owner;
this.position = position;
this.prefsKey = prefsKey;
this.nextHint = nextHint;
}
}
//---- class HintPanel ----------------------------------------------------
private static class HintPanel
extends JPanel
{
private final Hint hint;
private JPanel popup;
private HintPanel( Hint hint ) {
this.hint = hint;
initComponents();
hintLabel.setText( "<html>" + hint.message + "</html>" );
// grab all mouse events to avoid that components overlapped
// by the hint panel receive them
addMouseListener( new MouseAdapter() {} );
}
@Override
public void updateUI() {
super.updateUI();
setBackground( UIManager.getColor( "HintPanel.backgroundColor" ) );
setBorder( new FlatPopupMenuBorder() );
}
void showHint() {
JRootPane rootPane = SwingUtilities.getRootPane( hint.owner );
if( rootPane == null )
return;
JLayeredPane layeredPane = rootPane.getLayeredPane();
// create a popup panel that has a drop shadow
popup = new JPanel( new BorderLayout() ) {
@Override
public void updateUI() {
super.updateUI();
setBorder( new FlatDropShadowBorder(
UIManager.getColor( "Popup.dropShadowColor" ),
UIManager.getInsets( "Popup.dropShadowInsets" ),
FlatUIUtils.getUIFloat( "Popup.dropShadowOpacity", 0.5f ) ) );
// use invokeLater because at this time the UI delegates
// of child components are not yet updated
EventQueue.invokeLater( () -> {
validate();
setSize( getPreferredSize() );
} );
}
};
popup.setOpaque( false );
popup.add( this );
// calculate x/y location for hint popup
Point pt = SwingUtilities.convertPoint( hint.owner, 0, 0, layeredPane );
int x = pt.x;
int y = pt.y;
Dimension size = popup.getPreferredSize();
int gap = UIScale.scale( 6 );
switch( hint.position ) {
case SwingConstants.LEFT:
x -= size.width + gap;
break;
case SwingConstants.TOP:
y -= size.height + gap;
break;
case SwingConstants.RIGHT:
x += hint.owner.getWidth() + gap;
break;
case SwingConstants.BOTTOM:
y += hint.owner.getHeight() + gap;
break;
}
// set hint popup size and show it
popup.setBounds( x, y, size.width, size.height );
layeredPane.add( popup, JLayeredPane.POPUP_LAYER );
}
void hideHint() {
if( popup != null ) {
Container parent = popup.getParent();
if( parent != null ) {
parent.remove( popup );
parent.repaint( popup.getX(), popup.getY(), popup.getWidth(), popup.getHeight() );
}
}
hintPanels.remove( this );
}
private void gotIt() {
// hide hint
hideHint();
// remember that user closed the hint
DemoPrefs.getState().putBoolean( hint.prefsKey, true );
// show next hint (if any)
if( hint.nextHint != null )
HintManager.showHint( hint.nextHint );
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
hintLabel = new JLabel();
gotItButton = new JButton();
//======== this ========
setLayout(new MigLayout(
"insets dialog,hidemode 3",
// columns
"[::200,fill]",
// rows
"[]para" +
"[]"));
//---- hintLabel ----
hintLabel.setText("hint");
add(hintLabel, "cell 0 0");
//---- gotItButton ----
gotItButton.setText("Got it!");
gotItButton.setFocusable(false);
gotItButton.addActionListener(e -> gotIt());
add(gotItButton, "cell 0 1,alignx right,growx 0");
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JLabel hintLabel;
private JButton gotItButton;
// JFormDesigner - End of variables declaration //GEN-END:variables
}
}

View File

@@ -0,0 +1,34 @@
JFDML JFormDesigner: "7.0.2.0.298" Java: "14" 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": "insets dialog,hidemode 3"
"$columnConstraints": "[::200,fill]"
"$rowConstraints": "[]para[]"
} ) {
name: "panel"
auxiliary() {
"JavaCodeGenerator.className": "HintPanel"
}
add( new FormComponent( "javax.swing.JLabel" ) {
name: "hintLabel"
"text": "hint"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "gotItButton"
"text": "Got it!"
"focusable": false
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "gotIt", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1,alignx right,growx 0"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 400, 300 )
} )
}
}

View File

@@ -59,7 +59,6 @@ class MoreComponentsPanel
JSeparator separator2 = new JSeparator();
JSlider slider2 = new JSlider();
JSlider slider4 = new JSlider();
JScrollPane scrollPane14 = new JScrollPane();
progressBar3 = new JProgressBar();
progressBar4 = new JProgressBar();
JToolBar toolBar2 = new JToolBar();
@@ -67,11 +66,12 @@ class MoreComponentsPanel
JButton button10 = new JButton();
JButton button11 = new JButton();
JToggleButton toggleButton7 = new JToggleButton();
JPanel panel2 = new JPanel();
JLabel scrollBarLabel = new JLabel();
JScrollBar scrollBar1 = new JScrollBar();
JLabel label4 = new JLabel();
JScrollBar scrollBar4 = new JScrollBar();
JPanel panel3 = new JPanel();
JLabel label4 = new JLabel();
JLabel label3 = new JLabel();
JScrollPane scrollPane15 = new JScrollPane();
JEditorPane editorPane6 = new JEditorPane();
@@ -81,7 +81,6 @@ class MoreComponentsPanel
JScrollBar scrollBar6 = new JScrollBar();
JLabel separatorLabel = new JLabel();
JSeparator separator1 = new JSeparator();
JPanel panel2 = new JPanel();
JLabel sliderLabel = new JLabel();
JSlider slider1 = new JSlider();
JSlider slider6 = new JSlider();
@@ -105,13 +104,12 @@ class MoreComponentsPanel
//======== this ========
setLayout(new MigLayout(
"hidemode 3",
"insets dialog,hidemode 3",
// columns
"[]" +
"[]" +
"[]" +
"[]" +
"[]" +
"[]",
// rows
"[]" +
@@ -142,7 +140,7 @@ class MoreComponentsPanel
}
scrollPane13.setViewportView(panel1);
}
add(scrollPane13, "cell 1 0,grow,width 70,height 70");
add(scrollPane13, "cell 1 0,grow,width 70,height 40");
add(scrollBar2, "cell 2 0 1 6,growy");
//---- scrollBar3 ----
@@ -165,7 +163,7 @@ class MoreComponentsPanel
//---- slider2 ----
slider2.setOrientation(SwingConstants.VERTICAL);
slider2.setValue(30);
add(slider2, "cell 2 0 1 6,growy");
add(slider2, "cell 2 0 1 6,growy,height 100");
//---- slider4 ----
slider4.setMinorTickSpacing(10);
@@ -174,19 +172,18 @@ class MoreComponentsPanel
slider4.setPaintLabels(true);
slider4.setOrientation(SwingConstants.VERTICAL);
slider4.setValue(30);
add(slider4, "cell 2 0 1 6,growy");
add(scrollPane14, "cell 3 0,grow");
add(slider4, "cell 2 0 1 6,growy,height 100");
//---- progressBar3 ----
progressBar3.setOrientation(SwingConstants.VERTICAL);
progressBar3.setValue(60);
add(progressBar3, "cell 4 0 1 6,growy");
add(progressBar3, "cell 2 0 1 6,growy");
//---- progressBar4 ----
progressBar4.setOrientation(SwingConstants.VERTICAL);
progressBar4.setValue(60);
progressBar4.setStringPainted(true);
add(progressBar4, "cell 4 0 1 6,growy");
add(progressBar4, "cell 2 0 1 6,growy");
//======== toolBar2 ========
{
@@ -209,7 +206,14 @@ class MoreComponentsPanel
toggleButton7.setIcon(UIManager.getIcon("Tree.closedIcon"));
toolBar2.add(toggleButton7);
}
add(toolBar2, "cell 4 0 1 6,growy");
add(toolBar2, "cell 2 0 1 6,growy");
//======== panel2 ========
{
panel2.setBorder(new TitledBorder("TitledBorder"));
panel2.setLayout(new FlowLayout());
}
add(panel2, "cell 3 0 1 6,grow");
//---- scrollBarLabel ----
scrollBarLabel.setText("JScrollBar:");
@@ -219,10 +223,6 @@ class MoreComponentsPanel
scrollBar1.setOrientation(Adjustable.HORIZONTAL);
add(scrollBar1, "cell 1 1,growx");
//---- label4 ----
label4.setText("HTML:");
add(label4, "cell 5 1");
//---- scrollBar4 ----
scrollBar4.setOrientation(Adjustable.HORIZONTAL);
scrollBar4.setEnabled(false);
@@ -238,11 +238,16 @@ class MoreComponentsPanel
// rows
"[]" +
"[]" +
"[]" +
"[]"));
//---- label4 ----
label4.setText("HTML:");
panel3.add(label4, "cell 0 0");
//---- label3 ----
label3.setText("<html>JLabel HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a></html>");
panel3.add(label3, "cell 0 0");
panel3.add(label3, "cell 0 1");
//======== scrollPane15 ========
{
@@ -252,7 +257,7 @@ class MoreComponentsPanel
editorPane6.setText("JEditorPane HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a>");
scrollPane15.setViewportView(editorPane6);
}
panel3.add(scrollPane15, "cell 0 1,grow");
panel3.add(scrollPane15, "cell 0 2,grow");
//======== scrollPane16 ========
{
@@ -262,9 +267,9 @@ class MoreComponentsPanel
textPane6.setText("JTextPane HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a>");
scrollPane16.setViewportView(textPane6);
}
panel3.add(scrollPane16, "cell 0 2,grow");
panel3.add(scrollPane16, "cell 0 3,grow");
}
add(panel3, "cell 5 2 1 9,aligny top,growy 0");
add(panel3, "cell 4 0 1 8,aligny top,growy 0");
//---- scrollBar5 ----
scrollBar5.setOrientation(Adjustable.HORIZONTAL);
@@ -282,13 +287,6 @@ class MoreComponentsPanel
add(separatorLabel, "cell 0 5");
add(separator1, "cell 1 5,growx");
//======== panel2 ========
{
panel2.setBorder(new TitledBorder("TitledBorder"));
panel2.setLayout(new FlowLayout());
}
add(panel2, "cell 3 5,grow");
//---- sliderLabel ----
sliderLabel.setText("JSlider:");
add(sliderLabel, "cell 0 6");
@@ -389,6 +387,17 @@ class MoreComponentsPanel
}
add(toolBar1, "cell 1 10 3 1,growx");
// JFormDesigner - End of component initialization //GEN-END:initComponents
if( FlatLafDemo.screenshotsMode ) {
Component[] components = new Component[] {
indeterminateCheckBox,
toolTipLabel, toolTip1, toolTip2,
toolBarLabel, toolBar1, toolBar2,
};
for( Component c : components )
c.setVisible( false );
}
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.2.0.298" Java: "14" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
@@ -7,8 +7,8 @@ new FormModel {
"JavaCodeGenerator.defaultVariableLocal": true
}
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "hidemode 3"
"$columnConstraints": "[][][][][][]"
"$layoutConstraints": "insets dialog,hidemode 3"
"$columnConstraints": "[][][][][]"
"$rowConstraints": "[][][][][][][][][][][]"
} ) {
name: "this"
@@ -27,7 +27,7 @@ new FormModel {
"preferredSize": new java.awt.Dimension( 200, 200 )
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0,grow,width 70,height 70"
"value": "cell 1 0,grow,width 70,height 40"
} )
add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar2"
@@ -64,7 +64,7 @@ new FormModel {
"orientation": 1
"value": 30
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0 1 6,growy"
"value": "cell 2 0 1 6,growy,height 100"
} )
add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider4"
@@ -75,12 +75,7 @@ new FormModel {
"orientation": 1
"value": 30
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0 1 6,growy"
} )
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "scrollPane14"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 0,grow"
"value": "cell 2 0 1 6,growy,height 100"
} )
add( new FormComponent( "javax.swing.JProgressBar" ) {
name: "progressBar3"
@@ -90,7 +85,7 @@ new FormModel {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 0 1 6,growy"
"value": "cell 2 0 1 6,growy"
} )
add( new FormComponent( "javax.swing.JProgressBar" ) {
name: "progressBar4"
@@ -101,7 +96,7 @@ new FormModel {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 0 1 6,growy"
"value": "cell 2 0 1 6,growy"
} )
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
name: "toolBar2"
@@ -126,7 +121,13 @@ new FormModel {
"icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" )
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 0 1 6,growy"
"value": "cell 2 0 1 6,growy"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) {
name: "panel2"
"border": new javax.swing.border.TitledBorder( "TitledBorder" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 0 1 6,grow"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "scrollBarLabel"
@@ -140,12 +141,6 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1,growx"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label4"
"text": "HTML:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 1"
} )
add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar4"
"orientation": 0
@@ -155,16 +150,22 @@ new FormModel {
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$columnConstraints": "[]"
"$rowConstraints": "[][][]"
"$rowConstraints": "[][][][]"
"$layoutConstraints": "ltr,insets 0,hidemode 3"
} ) {
name: "panel3"
"opaque": false
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label4"
"text": "HTML:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label3"
"text": "<html>JLabel HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a></html>"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
"value": "cell 0 1"
} )
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "scrollPane15"
@@ -174,7 +175,7 @@ new FormModel {
"text": "JEditorPane HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a>"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1,grow"
"value": "cell 0 2,grow"
} )
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "scrollPane16"
@@ -184,10 +185,10 @@ new FormModel {
"text": "JTextPane HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a>"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2,grow"
"value": "cell 0 3,grow"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 2 1 9,aligny top,growy 0"
"value": "cell 4 0 1 8,aligny top,growy 0"
} )
add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar5"
@@ -215,12 +216,6 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 5,growx"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) {
name: "panel2"
"border": new javax.swing.border.TitledBorder( "TitledBorder" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 5,grow"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "sliderLabel"
"text": "JSlider:"
@@ -365,7 +360,7 @@ new FormModel {
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 790, 715 )
"size": new java.awt.Dimension( 700, 420 )
} )
}
}

View File

@@ -205,11 +205,11 @@ public class IJThemesPanel
break;
}
}
}
// select first theme if none selected
if( themesList.getSelectedIndex() < 0 )
themesList.setSelectedIndex( 0 );
// select first theme if none selected
if( themesList.getSelectedIndex() < 0 )
themesList.setSelectedIndex( 0 );
}
// scroll selection into visible area
int sel = themesList.getSelectedIndex();

View File

@@ -0,0 +1,17 @@
#
# 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.
#
HintPanel.backgroundColor=darken(#ffffe1,80%)

View File

@@ -0,0 +1,17 @@
#
# 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.
#
HintPanel.backgroundColor=#ffffe1

View File

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

View File

@@ -19,10 +19,10 @@ package com.formdev.flatlaf.extras;
import java.awt.AlphaComposite;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Window;
import java.util.HashMap;
import java.awt.image.VolatileImage;
import java.util.Map;
import java.util.WeakHashMap;
import javax.swing.JComponent;
import javax.swing.JLayeredPane;
import javax.swing.RootPaneContainer;
@@ -56,8 +56,10 @@ public class FlatAnimatedLafChange
public static int resolution = 40;
private static Animator animator;
private static final Map<JLayeredPane, JComponent> map = new HashMap<>();
private static final Map<JLayeredPane, JComponent> oldUIsnapshots = new WeakHashMap<>();
private static final Map<JLayeredPane, JComponent> newUIsnapshots = new WeakHashMap<>();
private static float alpha;
private static boolean inShowSnapshot;
/**
* Create a snapshot of the old UI and shows it on top of the UI.
@@ -73,16 +75,27 @@ public class FlatAnimatedLafChange
alpha = 1;
// show snapshot of old UI
showSnapshot( true, oldUIsnapshots );
}
private static void showSnapshot( boolean useAlpha, Map<JLayeredPane, JComponent> map ) {
inShowSnapshot = true;
// create snapshots for all shown windows
Window[] windows = Window.getWindows();
for( Window window : windows ) {
if( !(window instanceof RootPaneContainer) || !window.isShowing() )
continue;
JLayeredPane layeredPane = ((RootPaneContainer)window).getLayeredPane();
// create snapshot image
// (using volatile image to have correct sub-pixel text rendering on Java 9+)
VolatileImage snapshot = window.createVolatileImage( window.getWidth(), window.getHeight() );
if( snapshot == null )
continue;
// create snapshot image of layered pane
Image snapshot = window.createImage( window.getWidth(), window.getHeight() );
// paint window to snapshot image
JLayeredPane layeredPane = ((RootPaneContainer)window).getLayeredPane();
layeredPane.paint( snapshot.getGraphics() );
// create snapshot layer, which is added to layered pane and paints
@@ -90,16 +103,32 @@ public class FlatAnimatedLafChange
JComponent snapshotLayer = new JComponent() {
@Override
public void paint( Graphics g ) {
((Graphics2D)g).setComposite( AlphaComposite.getInstance( AlphaComposite.SRC_OVER, alpha ) );
if( inShowSnapshot || snapshot.contentsLost() )
return;
if( useAlpha )
((Graphics2D)g).setComposite( AlphaComposite.getInstance( AlphaComposite.SRC_OVER, alpha ) );
g.drawImage( snapshot, 0, 0, null );
}
@Override
public void removeNotify() {
super.removeNotify();
// release system resources used by volatile image
snapshot.flush();
}
};
if( !useAlpha )
snapshotLayer.setOpaque( true );
snapshotLayer.setSize( layeredPane.getSize() );
// add image layer to layered pane
layeredPane.add( snapshotLayer, JLayeredPane.DRAG_LAYER );
layeredPane.add( snapshotLayer, Integer.valueOf( JLayeredPane.DRAG_LAYER + (useAlpha ? 2 : 1) ) );
map.put( layeredPane, snapshotLayer );
}
inShowSnapshot = false;
}
/**
@@ -111,9 +140,12 @@ public class FlatAnimatedLafChange
if( !FlatSystemProperties.getBoolean( "flatlaf.animatedLafChange", true ) )
return;
if( map.isEmpty() )
if( oldUIsnapshots.isEmpty() )
return;
// show snapshot of new UI
showSnapshot( false, newUIsnapshots );
// create animator
animator = new Animator( duration, fraction -> {
if( fraction < 0.1 || fraction > 0.9 )
@@ -122,7 +154,7 @@ public class FlatAnimatedLafChange
alpha = 1f - fraction;
// repaint snapshots
for( Map.Entry<JLayeredPane, JComponent> e : map.entrySet() ) {
for( Map.Entry<JLayeredPane, JComponent> e : oldUIsnapshots.entrySet() ) {
if( e.getKey().isShowing() )
e.getValue().repaint();
}
@@ -136,6 +168,11 @@ public class FlatAnimatedLafChange
}
private static void hideSnapshot() {
hideSnapshot( oldUIsnapshots );
hideSnapshot( newUIsnapshots );
}
private static void hideSnapshot( Map<JLayeredPane, JComponent> map ) {
// remove snapshots
for( Map.Entry<JLayeredPane, JComponent> e : map.entrySet() ) {
e.getKey().remove( e.getValue() );

View File

@@ -50,11 +50,18 @@ public class FlatSVGIcon
private static final SVGUniverse svgUniverse = new SVGUniverse();
private final String name;
private final ClassLoader classLoader;
private SVGDiagram diagram;
private boolean dark;
public FlatSVGIcon( String name ) {
this( name, null );
}
public FlatSVGIcon( String name, ClassLoader classLoader ) {
this.name = name;
this.classLoader = classLoader;
}
private void update() {
@@ -79,7 +86,14 @@ public class FlatSVGIcon
int dotIndex = name.lastIndexOf( '.' );
name = name.substring( 0, dotIndex ) + "_dark" + name.substring( dotIndex );
}
return FlatSVGIcon.class.getClassLoader().getResource( name );
ClassLoader cl = (classLoader != null) ? classLoader : FlatSVGIcon.class.getClassLoader();
return cl.getResource( name );
}
public boolean hasFound() {
update();
return diagram != null;
}
@Override

View File

@@ -23,6 +23,8 @@
},
"ui": {
"*": {
"acceleratorForeground": "colorAcceleratorForeground",
"acceleratorSelectionForeground": "colorAcceleratorSelectionForeground",
"background": "colorBackground",
"caretForeground": "colorForeground",
"disabledForeground": "colorDisabledForeground",
@@ -68,10 +70,7 @@
"startBorderColor": "#476069"
},
"CheckBox": {},
"CheckBoxMenuItem": {
"acceleratorForeground": "colorAcceleratorForeground",
"acceleratorSelectionForeground": "colorAcceleratorSelectionForeground"
},
"CheckBoxMenuItem": {},
"ColorChooser": {
"swatchesDefaultRecentColor": "colorBackground"
},
@@ -257,8 +256,6 @@
"usedBackground": "#566C73"
},
"Menu": {
"acceleratorForeground": "colorAcceleratorForeground",
"acceleratorSelectionForeground": "colorAcceleratorSelectionForeground",
"borderColor": "colorSeparator",
"separatorColor": "colorSeparator"
},
@@ -372,10 +369,7 @@
"trackColor": "#36525B"
},
"RadioButton": {},
"RadioButtonMenuItem": {
"acceleratorForeground": "colorAcceleratorForeground",
"acceleratorSelectionForeground": "colorAcceleratorSelectionForeground"
},
"RadioButtonMenuItem": {},
"ScrollBar": {
"background": "#14414F",
"hoverThumbBorderColor": "#0A384459",
@@ -441,6 +435,11 @@
"Separator": {
"separatorColor": "colorSeparator"
},
"Settings": {
"Spotlight": {
"borderColor": "#9A670064"
}
},
"SidePanel": {
"background": "#0E4155"
},

View File

@@ -23,6 +23,8 @@
},
"ui": {
"*": {
"acceleratorForeground": "colorAcceleratorForeground",
"acceleratorSelectionForeground": "colorAcceleratorSelectionForeground",
"background": "colorBackground",
"caretForeground": "colorForeground",
"disabledForeground": "colorDisabledForeground",
@@ -68,10 +70,7 @@
"startBorderColor": "#B4BAB5"
},
"CheckBox": {},
"CheckBoxMenuItem": {
"acceleratorForeground": "colorAcceleratorForeground",
"acceleratorSelectionForeground": "colorAcceleratorSelectionForeground"
},
"CheckBoxMenuItem": {},
"ColorChooser": {
"swatchesDefaultRecentColor": "#CFD0C3"
},
@@ -263,8 +262,6 @@
"usedBackground": "#ADB5AF"
},
"Menu": {
"acceleratorForeground": "colorAcceleratorForeground",
"acceleratorSelectionForeground": "colorAcceleratorSelectionForeground",
"borderColor": "#D3D2C6",
"disabledBackground": "colorBackground",
"separatorColor": "colorSeparator"
@@ -378,10 +375,7 @@
"trackColor": "#BAC0B8"
},
"RadioButton": {},
"RadioButtonMenuItem": {
"acceleratorForeground": "colorAcceleratorForeground",
"acceleratorSelectionForeground": "colorAcceleratorSelectionForeground"
},
"RadioButtonMenuItem": {},
"ScrollBar": {
"background": "#F5F0E3",
"hoverThumbBorderColor": "#4B5A5F47",
@@ -445,6 +439,11 @@
"Separator": {
"separatorColor": "colorSeparator"
},
"Settings": {
"Spotlight": {
"borderColor": "#F6C00064"
}
},
"SidePanel": {
"background": "#E2E2D4"
},

View File

@@ -134,6 +134,7 @@ public class FlatComponentsTest
JLabel labelLabel = new JLabel();
JLabel label1 = new JLabel();
JLabel label2 = new JLabel();
FlatComponentsTest.TestMultiLineLabel testMultiLineLabel1 = new FlatComponentsTest.TestMultiLineLabel();
JLabel buttonLabel = new JLabel();
JButton button1 = new JButton();
JButton button17 = new JButton();
@@ -367,6 +368,10 @@ public class FlatComponentsTest
label2.setEnabled(false);
add(label2, "cell 2 0");
//---- testMultiLineLabel1 ----
testMultiLineLabel1.setText("Multi-line label based on JTextArea\n2nd line");
add(testMultiLineLabel1, "cell 3 0 2 1");
//---- buttonLabel ----
buttonLabel.setText("JButton:");
add(buttonLabel, "cell 0 1");
@@ -1402,4 +1407,24 @@ public class FlatComponentsTest
return true;
}
}
//---- class TestMultiLineLabel -------------------------------------------
private static class TestMultiLineLabel
extends JTextArea
{
public TestMultiLineLabel() {
setEditable( false );
setFocusable( false );
}
@Override
public void updateUI() {
super.updateUI();
setBackground( UIManager.getColor( "Label.background" ) );
setForeground( UIManager.getColor( "Label.foreground" ) );
setFont( UIManager.getFont( "Label.font" ) );
setBorder( null );
}
}
}

View File

@@ -33,6 +33,12 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0"
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatComponentsTest$TestMultiLineLabel" ) {
name: "testMultiLineLabel1"
"text": "Multi-line label based on JTextArea\n2nd line"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 0 2 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "buttonLabel"
"text": "JButton:"

View File

@@ -77,6 +77,9 @@ public class FlatTestFrame
// disable animated Laf change
System.setProperty( "flatlaf.animatedLafChange", "false" );
// test loading custom defaults from package
FlatLaf.registerCustomDefaultsSource( "com.formdev.flatlaf.testing.customdefaults" );
// set look and feel
DemoPrefs.initLaf( args );

View File

@@ -0,0 +1,2 @@
# Component.arc=9999
# TextComponent.arc=9999

View File

@@ -80,6 +80,7 @@ Button.default.pressedBackground #3f6796 com.formdev.flatlaf.util.DerivedColo
Button.defaultButtonFollowsFocus true
Button.disabledBackground #3c3f41 javax.swing.plaf.ColorUIResource [UI]
Button.disabledBorderColor #5e6060 javax.swing.plaf.ColorUIResource [UI]
Button.disabledSelectedBackground #53585a com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse)
Button.disabledText #777777 javax.swing.plaf.ColorUIResource [UI]
Button.focusedBorderColor #466d94 javax.swing.plaf.ColorUIResource [UI]
Button.font [active] $defaultFont [UI]
@@ -93,12 +94,15 @@ Button.margin 2,14,2,14 javax.swing.plaf.InsetsUIResource [U
Button.minimumWidth 72
Button.pressedBackground #5b5f62 com.formdev.flatlaf.util.DerivedColor [UI] lighten(6% autoInverse)
Button.rollover true
Button.selectedBackground #656a6c com.formdev.flatlaf.util.DerivedColor [UI] lighten(10% autoInverse)
Button.selectedForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
Button.shadow #646464 javax.swing.plaf.ColorUIResource [UI]
Button.textIconGap 4
Button.textShiftOffset 0
Button.toolbar.hoverBackground #4e5355 com.formdev.flatlaf.util.DerivedColor [UI] lighten(1% autoInverse)
Button.toolbar.margin 3,3,3,3 javax.swing.plaf.InsetsUIResource [UI]
Button.toolbar.pressedBackground #565a5d com.formdev.flatlaf.util.DerivedColor [UI] lighten(4% autoInverse)
Button.toolbar.selectedBackground #5d6265 com.formdev.flatlaf.util.DerivedColor [UI] lighten(7% autoInverse)
Button.toolbar.spacingInsets 1,2,1,2 javax.swing.plaf.InsetsUIResource [UI]
ButtonUI com.formdev.flatlaf.ui.FlatButtonUI

View File

@@ -80,6 +80,7 @@ Button.default.pressedBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColo
Button.defaultButtonFollowsFocus true
Button.disabledBackground #f2f2f2 javax.swing.plaf.ColorUIResource [UI]
Button.disabledBorderColor #cfcfcf javax.swing.plaf.ColorUIResource [UI]
Button.disabledSelectedBackground #dedede com.formdev.flatlaf.util.DerivedColor [UI] darken(13% autoInverse)
Button.disabledText #8c8c8c javax.swing.plaf.ColorUIResource [UI]
Button.focusedBackground #e3f1fa javax.swing.plaf.ColorUIResource [UI]
Button.focusedBorderColor #87afda javax.swing.plaf.ColorUIResource [UI]
@@ -94,12 +95,15 @@ Button.margin 2,14,2,14 javax.swing.plaf.InsetsUIResource [U
Button.minimumWidth 72
Button.pressedBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
Button.rollover true
Button.selectedBackground #cccccc com.formdev.flatlaf.util.DerivedColor [UI] darken(20% autoInverse)
Button.selectedForeground #000000 javax.swing.plaf.ColorUIResource [UI]
Button.shadow #c4c4c4 javax.swing.plaf.ColorUIResource [UI]
Button.textIconGap 4
Button.textShiftOffset 0
Button.toolbar.hoverBackground #e0e0e0 com.formdev.flatlaf.util.DerivedColor [UI] darken(12% autoInverse)
Button.toolbar.margin 3,3,3,3 javax.swing.plaf.InsetsUIResource [UI]
Button.toolbar.pressedBackground #d9d9d9 com.formdev.flatlaf.util.DerivedColor [UI] darken(15% autoInverse)
Button.toolbar.selectedBackground #cccccc com.formdev.flatlaf.util.DerivedColor [UI] darken(20% autoInverse)
Button.toolbar.spacingInsets 1,2,1,2 javax.swing.plaf.InsetsUIResource [UI]
ButtonUI com.formdev.flatlaf.ui.FlatButtonUI

View File

@@ -25,3 +25,29 @@ dependencies {
implementation( "com.fifesoft:rsyntaxtextarea:3.1.1" )
implementation( "com.fifesoft:autocomplete:3.1.0" )
}
tasks {
jar {
dependsOn( ":flatlaf-core:jar" )
dependsOn( ":flatlaf-extras:jar" )
manifest {
attributes( "Main-Class" to "com.formdev.flatlaf.themeeditor.FlatThemeFileEditor" )
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 )
attributes( "Multi-Release" to "true" )
}
exclude( "module-info.class" )
exclude( "META-INF/versions/*/module-info.class" )
// include all dependencies in jar
from( {
configurations.runtimeClasspath.get()
.filter { it.name.endsWith( "jar" ) }
.map { zipTree( it ).matching {
exclude( "META-INF/LICENSE" )
} }
} )
}
}

View File

@@ -28,6 +28,7 @@ Button.default.pressedBackground
Button.defaultButtonFollowsFocus
Button.disabledBackground
Button.disabledBorderColor
Button.disabledSelectedBackground
Button.disabledText
Button.focusInputMap
Button.focusedBackground
@@ -43,12 +44,15 @@ Button.margin
Button.minimumWidth
Button.pressedBackground
Button.rollover
Button.selectedBackground
Button.selectedForeground
Button.shadow
Button.textIconGap
Button.textShiftOffset
Button.toolbar.hoverBackground
Button.toolbar.margin
Button.toolbar.pressedBackground
Button.toolbar.selectedBackground
Button.toolbar.spacingInsets
ButtonUI
Caret.width

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

BIN
images/arc_orange.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
images/carbon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
images/cyan_light.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
images/dark_purple.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
images/flat_dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
images/flat_light.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

BIN
images/one_dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
images/solarized_light.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB