mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-10 22:17:13 -06:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e869973d4 | ||
|
|
731c8962c9 | ||
|
|
294b8bb789 | ||
|
|
4f9b819f48 | ||
|
|
5318d5fa8e | ||
|
|
98b156bdde | ||
|
|
511dd02107 | ||
|
|
f1f7a2e7b6 | ||
|
|
d557cf5427 | ||
|
|
39d2941099 | ||
|
|
2a732306a1 | ||
|
|
8a72b30cbc | ||
|
|
ed9cb0f918 | ||
|
|
7e0915cb9c | ||
|
|
a51294d570 | ||
|
|
d962f218a1 | ||
|
|
7b248427f0 | ||
|
|
b99fb8b11f | ||
|
|
26250e790f | ||
|
|
b26dbe81f4 | ||
|
|
903212345b |
8
.gitbugtraq
Normal file
8
.gitbugtraq
Normal file
@@ -0,0 +1,8 @@
|
||||
# links issue numbers in git commit messages to issue tracker
|
||||
# https://github.com/mstrap/bugtraq
|
||||
# for SmartGit - https://www.syntevo.com/smartgit/
|
||||
|
||||
[bugtraq]
|
||||
url = "https://github.com/JFormDesigner/FlatLaf/issues/%BUGID%"
|
||||
loglinkregex = "#[0-9]{1,5}"
|
||||
logregex = "[0-9]{1,5}"
|
||||
21
CHANGELOG.md
21
CHANGELOG.md
@@ -1,6 +1,27 @@
|
||||
FlatLaf Change Log
|
||||
==================
|
||||
|
||||
## 1.3
|
||||
|
||||
#### New features and improvements
|
||||
|
||||
- TextComponents, ComboBox and Spinner: Support different background color when
|
||||
component is focused (use UI values `TextField.focusedBackground`,
|
||||
`PasswordField.focusedBackground`, `FormattedTextField.focusedBackground`,
|
||||
`TextArea.focusedBackground`, `TextPane.focusedBackground`,
|
||||
`EditorPane.focusedBackground`, `ComboBox.focusedBackground`,
|
||||
`ComboBox.buttonFocusedBackground`, `ComboBox.popupFocusedBackground` and
|
||||
`Spinner.focusedBackground`). (issue #335)
|
||||
|
||||
#### Fixed bugs
|
||||
|
||||
- Fixed white lines at bottom and right side of window (in dark themes on HiDPI
|
||||
screens with scaling enabled).
|
||||
- ScrollBar: Fixed left/top arrow icon location (if visible). (issue #329)
|
||||
- Spinner: Fixed up/down arrow icon location.
|
||||
- ToolTip: Fixed positioning of huge tooltips. (issue #333)
|
||||
|
||||
|
||||
## 1.2
|
||||
|
||||
#### New features and improvements
|
||||
|
||||
@@ -76,11 +76,11 @@ Addons
|
||||
Getting started
|
||||
---------------
|
||||
|
||||
To enable FlatLaf, add following code to your main method before you create any
|
||||
To use FlatLaf, add following code to your main method before you create any
|
||||
Swing component:
|
||||
|
||||
~~~java
|
||||
FlatLightLaf.install();
|
||||
FlatLightLaf.setup();
|
||||
|
||||
// create UI here...
|
||||
~~~
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
val releaseVersion = "1.2"
|
||||
val developmentVersion = "1.3-SNAPSHOT"
|
||||
val releaseVersion = "1.3"
|
||||
val developmentVersion = "1.4-SNAPSHOT"
|
||||
|
||||
version = if( java.lang.Boolean.getBoolean( "release" ) ) releaseVersion else developmentVersion
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ class LinuxFontPolicy
|
||||
// find last word in family
|
||||
int index = family.lastIndexOf( ' ' );
|
||||
if( index < 0 )
|
||||
return createFont( "Dialog", style, size, dsize );;
|
||||
return createFont( "Dialog", style, size, dsize );
|
||||
|
||||
// check whether last work contains some font weight (e.g. Ultra-Bold or Heavy)
|
||||
String lastWord = family.substring( index + 1 ).toLowerCase();
|
||||
|
||||
@@ -48,8 +48,8 @@ public class FlatArrowButton
|
||||
protected final Color pressedBackground;
|
||||
|
||||
private int arrowWidth = DEFAULT_ARROW_WIDTH;
|
||||
private int xOffset = 0;
|
||||
private int yOffset = 0;
|
||||
private float xOffset = 0;
|
||||
private float yOffset = 0;
|
||||
|
||||
private boolean hover;
|
||||
private boolean pressed;
|
||||
@@ -117,19 +117,19 @@ public class FlatArrowButton
|
||||
return pressed;
|
||||
}
|
||||
|
||||
public int getXOffset() {
|
||||
public float getXOffset() {
|
||||
return xOffset;
|
||||
}
|
||||
|
||||
public void setXOffset( int xOffset ) {
|
||||
public void setXOffset( float xOffset ) {
|
||||
this.xOffset = xOffset;
|
||||
}
|
||||
|
||||
public int getYOffset() {
|
||||
public float getYOffset() {
|
||||
return yOffset;
|
||||
}
|
||||
|
||||
public void setYOffset( int yOffset ) {
|
||||
public void setYOffset( float yOffset ) {
|
||||
this.yOffset = yOffset;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,17 +22,12 @@ import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Insets;
|
||||
import java.awt.KeyboardFocusManager;
|
||||
import java.awt.Paint;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSpinner;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.JViewport;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.basic.BasicBorders;
|
||||
import com.formdev.flatlaf.FlatClientProperties;
|
||||
@@ -164,37 +159,13 @@ public class FlatBorder
|
||||
}
|
||||
|
||||
protected boolean isFocused( Component c ) {
|
||||
if( c instanceof JScrollPane ) {
|
||||
JViewport viewport = ((JScrollPane)c).getViewport();
|
||||
Component view = (viewport != null) ? viewport.getView() : null;
|
||||
if( view != null ) {
|
||||
if( FlatUIUtils.isPermanentFocusOwner( view ) )
|
||||
return true;
|
||||
|
||||
if( (view instanceof JTable && ((JTable)view).isEditing()) ||
|
||||
(view instanceof JTree && ((JTree)view).isEditing()) )
|
||||
{
|
||||
Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
|
||||
if( focusOwner != null )
|
||||
return SwingUtilities.isDescendingFrom( focusOwner, view );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else if( c instanceof JComboBox && ((JComboBox<?>)c).isEditable() ) {
|
||||
Component editorComponent = ((JComboBox<?>)c).getEditor().getEditorComponent();
|
||||
return (editorComponent != null) ? FlatUIUtils.isPermanentFocusOwner( editorComponent ) : false;
|
||||
} else if( c instanceof JSpinner ) {
|
||||
if( FlatUIUtils.isPermanentFocusOwner( c ) )
|
||||
return true;
|
||||
|
||||
JComponent editor = ((JSpinner)c).getEditor();
|
||||
if( editor instanceof JSpinner.DefaultEditor ) {
|
||||
JTextField textField = ((JSpinner.DefaultEditor)editor).getTextField();
|
||||
if( textField != null )
|
||||
return FlatUIUtils.isPermanentFocusOwner( textField );
|
||||
}
|
||||
return false;
|
||||
} else
|
||||
if( c instanceof JScrollPane )
|
||||
return FlatScrollPaneUI.isPermanentFocusOwner( (JScrollPane) c );
|
||||
else if( c instanceof JComboBox )
|
||||
return FlatComboBoxUI.isPermanentFocusOwner( (JComboBox<?>) c );
|
||||
else if( c instanceof JSpinner )
|
||||
return FlatSpinnerUI.isPermanentFocusOwner( (JSpinner) c );
|
||||
else
|
||||
return FlatUIUtils.isPermanentFocusOwner( c );
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ import javax.swing.UIManager;
|
||||
import javax.swing.border.AbstractBorder;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.UIResource;
|
||||
import javax.swing.plaf.basic.BasicComboBoxUI;
|
||||
import javax.swing.plaf.basic.BasicComboPopup;
|
||||
import javax.swing.plaf.basic.ComboPopup;
|
||||
@@ -92,14 +93,17 @@ import com.formdev.flatlaf.util.UIScale;
|
||||
* @uiDefault Component.borderColor Color
|
||||
* @uiDefault Component.disabledBorderColor Color
|
||||
* @uiDefault ComboBox.editableBackground Color optional; defaults to ComboBox.background
|
||||
* @uiDefault ComboBox.focusedBackground Color optional
|
||||
* @uiDefault ComboBox.disabledBackground Color
|
||||
* @uiDefault ComboBox.disabledForeground Color
|
||||
* @uiDefault ComboBox.buttonBackground Color
|
||||
* @uiDefault ComboBox.buttonEditableBackground Color
|
||||
* @uiDefault ComboBox.buttonFocusedBackground Color optional; defaults to ComboBox.focusedBackground
|
||||
* @uiDefault ComboBox.buttonArrowColor Color
|
||||
* @uiDefault ComboBox.buttonDisabledArrowColor Color
|
||||
* @uiDefault ComboBox.buttonHoverArrowColor Color
|
||||
* @uiDefault ComboBox.buttonPressedArrowColor Color
|
||||
* @uiDefault ComboBox.popupBackground Color optional
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
@@ -115,16 +119,20 @@ public class FlatComboBoxUI
|
||||
protected Color disabledBorderColor;
|
||||
|
||||
protected Color editableBackground;
|
||||
protected Color focusedBackground;
|
||||
protected Color disabledBackground;
|
||||
protected Color disabledForeground;
|
||||
|
||||
protected Color buttonBackground;
|
||||
protected Color buttonEditableBackground;
|
||||
protected Color buttonFocusedBackground;
|
||||
protected Color buttonArrowColor;
|
||||
protected Color buttonDisabledArrowColor;
|
||||
protected Color buttonHoverArrowColor;
|
||||
protected Color buttonPressedArrowColor;
|
||||
|
||||
protected Color popupBackground;
|
||||
|
||||
private MouseListener hoverListener;
|
||||
protected boolean hover;
|
||||
protected boolean pressed;
|
||||
@@ -195,16 +203,20 @@ public class FlatComboBoxUI
|
||||
disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" );
|
||||
|
||||
editableBackground = UIManager.getColor( "ComboBox.editableBackground" );
|
||||
focusedBackground = UIManager.getColor( "ComboBox.focusedBackground" );
|
||||
disabledBackground = UIManager.getColor( "ComboBox.disabledBackground" );
|
||||
disabledForeground = UIManager.getColor( "ComboBox.disabledForeground" );
|
||||
|
||||
buttonBackground = UIManager.getColor( "ComboBox.buttonBackground" );
|
||||
buttonFocusedBackground = UIManager.getColor( "ComboBox.buttonFocusedBackground" );
|
||||
buttonEditableBackground = UIManager.getColor( "ComboBox.buttonEditableBackground" );
|
||||
buttonArrowColor = UIManager.getColor( "ComboBox.buttonArrowColor" );
|
||||
buttonDisabledArrowColor = UIManager.getColor( "ComboBox.buttonDisabledArrowColor" );
|
||||
buttonHoverArrowColor = UIManager.getColor( "ComboBox.buttonHoverArrowColor" );
|
||||
buttonPressedArrowColor = UIManager.getColor( "ComboBox.buttonPressedArrowColor" );
|
||||
|
||||
popupBackground = UIManager.getColor( "ComboBox.popupBackground" );
|
||||
|
||||
// set maximumRowCount
|
||||
int maximumRowCount = UIManager.getInt( "ComboBox.maximumRowCount" );
|
||||
if( maximumRowCount > 0 && maximumRowCount != 8 && comboBox.getMaximumRowCount() == 8 )
|
||||
@@ -224,16 +236,20 @@ public class FlatComboBoxUI
|
||||
disabledBorderColor = null;
|
||||
|
||||
editableBackground = null;
|
||||
focusedBackground = null;
|
||||
disabledBackground = null;
|
||||
disabledForeground = null;
|
||||
|
||||
buttonBackground = null;
|
||||
buttonEditableBackground = null;
|
||||
buttonFocusedBackground = null;
|
||||
buttonArrowColor = null;
|
||||
buttonDisabledArrowColor = null;
|
||||
buttonHoverArrowColor = null;
|
||||
buttonPressedArrowColor = null;
|
||||
|
||||
popupBackground = null;
|
||||
|
||||
MigLayoutVisualPadding.uninstall( comboBox );
|
||||
}
|
||||
|
||||
@@ -423,7 +439,11 @@ public class FlatComboBoxUI
|
||||
|
||||
// paint arrow button background
|
||||
if( enabled && !isCellRenderer ) {
|
||||
g2.setColor( paintButton ? buttonEditableBackground : buttonBackground );
|
||||
g2.setColor( paintButton
|
||||
? buttonEditableBackground
|
||||
: (buttonFocusedBackground != null || focusedBackground != null) && isPermanentFocusOwner( comboBox )
|
||||
? (buttonFocusedBackground != null ? buttonFocusedBackground : focusedBackground)
|
||||
: buttonBackground );
|
||||
Shape oldClip = g2.getClip();
|
||||
if( isLeftToRight )
|
||||
g2.clipRect( arrowX, 0, width - arrowX, height );
|
||||
@@ -483,9 +503,20 @@ public class FlatComboBoxUI
|
||||
}
|
||||
|
||||
protected Color getBackground( boolean enabled ) {
|
||||
return enabled
|
||||
? (editableBackground != null && comboBox.isEditable() ? editableBackground : comboBox.getBackground())
|
||||
: (isIntelliJTheme ? FlatUIUtils.getParentBackground( comboBox ) : disabledBackground);
|
||||
if( enabled ) {
|
||||
Color background = comboBox.getBackground();
|
||||
|
||||
// always use explicitly set color
|
||||
if( !(background instanceof UIResource) )
|
||||
return background;
|
||||
|
||||
// focused
|
||||
if( focusedBackground != null && isPermanentFocusOwner( comboBox ) )
|
||||
return focusedBackground;
|
||||
|
||||
return (editableBackground != null && comboBox.isEditable()) ? editableBackground : background;
|
||||
} else
|
||||
return isIntelliJTheme ? FlatUIUtils.getParentBackground( comboBox ) : disabledBackground;
|
||||
}
|
||||
|
||||
protected Color getForeground( boolean enabled ) {
|
||||
@@ -576,6 +607,17 @@ public class FlatComboBoxUI
|
||||
return parentParent != null && !comboBox.getBackground().equals( parentParent.getBackground() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.3
|
||||
*/
|
||||
public static boolean isPermanentFocusOwner( JComboBox<?> comboBox ) {
|
||||
if( comboBox.isEditable() ) {
|
||||
Component editorComponent = comboBox.getEditor().getEditorComponent();
|
||||
return (editorComponent != null) ? FlatUIUtils.isPermanentFocusOwner( editorComponent ) : false;
|
||||
} else
|
||||
return FlatUIUtils.isPermanentFocusOwner( comboBox );
|
||||
}
|
||||
|
||||
//---- class FlatComboBoxButton -------------------------------------------
|
||||
|
||||
protected class FlatComboBoxButton
|
||||
@@ -688,6 +730,8 @@ public class FlatComboBoxUI
|
||||
super.configureList();
|
||||
|
||||
list.setCellRenderer( new PopupListCellRenderer() );
|
||||
if( popupBackground != null )
|
||||
list.setBackground( popupBackground );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,15 +17,16 @@
|
||||
package com.formdev.flatlaf.ui;
|
||||
|
||||
import static com.formdev.flatlaf.util.UIScale.scale;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.UIResource;
|
||||
import javax.swing.plaf.basic.BasicEditorPaneUI;
|
||||
import javax.swing.text.JTextComponent;
|
||||
import com.formdev.flatlaf.FlatClientProperties;
|
||||
@@ -53,6 +54,7 @@ import com.formdev.flatlaf.util.HiDPIUtils;
|
||||
*
|
||||
* @uiDefault Component.minimumWidth int
|
||||
* @uiDefault Component.isIntelliJTheme boolean
|
||||
* @uiDefault EditorPane.focusedBackground Color optional
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
@@ -61,8 +63,10 @@ public class FlatEditorPaneUI
|
||||
{
|
||||
protected int minimumWidth;
|
||||
protected boolean isIntelliJTheme;
|
||||
protected Color focusedBackground;
|
||||
|
||||
private Object oldHonorDisplayProperties;
|
||||
private FocusListener focusListener;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
return new FlatEditorPaneUI();
|
||||
@@ -72,8 +76,10 @@ public class FlatEditorPaneUI
|
||||
protected void installDefaults() {
|
||||
super.installDefaults();
|
||||
|
||||
String prefix = getPropertyPrefix();
|
||||
minimumWidth = UIManager.getInt( "Component.minimumWidth" );
|
||||
isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
|
||||
focusedBackground = UIManager.getColor( prefix + ".focusedBackground" );
|
||||
|
||||
// use component font and foreground for HTML text
|
||||
oldHonorDisplayProperties = getComponent().getClientProperty( JEditorPane.HONOR_DISPLAY_PROPERTIES );
|
||||
@@ -84,9 +90,28 @@ public class FlatEditorPaneUI
|
||||
protected void uninstallDefaults() {
|
||||
super.uninstallDefaults();
|
||||
|
||||
focusedBackground = null;
|
||||
|
||||
getComponent().putClientProperty( JEditorPane.HONOR_DISPLAY_PROPERTIES, oldHonorDisplayProperties );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
|
||||
// necessary to update focus background
|
||||
focusListener = new FlatUIUtils.RepaintFocusListener( getComponent(), c -> focusedBackground != null );
|
||||
getComponent().addFocusListener( focusListener );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
super.uninstallListeners();
|
||||
|
||||
getComponent().removeFocusListener( focusListener );
|
||||
focusListener = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void propertyChange( PropertyChangeEvent e ) {
|
||||
super.propertyChange( e );
|
||||
@@ -128,14 +153,11 @@ public class FlatEditorPaneUI
|
||||
|
||||
@Override
|
||||
protected void paintBackground( Graphics g ) {
|
||||
JTextComponent c = getComponent();
|
||||
paintBackground( g, getComponent(), isIntelliJTheme, focusedBackground );
|
||||
}
|
||||
|
||||
// for compatibility with IntelliJ themes
|
||||
if( isIntelliJTheme && (!c.isEnabled() || !c.isEditable()) && (c.getBackground() instanceof UIResource) ) {
|
||||
FlatUIUtils.paintParentBackground( g, c );
|
||||
return;
|
||||
}
|
||||
|
||||
super.paintBackground( g );
|
||||
static void paintBackground( Graphics g, JTextComponent c, boolean isIntelliJTheme, Color focusedBackground ) {
|
||||
g.setColor( FlatTextFieldUI.getBackground( c, isIntelliJTheme, focusedBackground ) );
|
||||
g.fillRect( 0, 0, c.getWidth(), c.getHeight() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import javax.swing.plaf.ComponentUI;
|
||||
* @uiDefault Component.minimumWidth int
|
||||
* @uiDefault Component.isIntelliJTheme boolean
|
||||
* @uiDefault FormattedTextField.placeholderForeground Color
|
||||
* @uiDefault FormattedTextField.focusedBackground Color optional
|
||||
* @uiDefault TextComponent.selectAllOnFocusPolicy String never, once (default) or always
|
||||
* @uiDefault TextComponent.selectAllOnMouseClick boolean
|
||||
*
|
||||
|
||||
@@ -60,6 +60,7 @@ import com.formdev.flatlaf.util.HiDPIUtils;
|
||||
* @uiDefault Component.minimumWidth int
|
||||
* @uiDefault Component.isIntelliJTheme boolean
|
||||
* @uiDefault PasswordField.placeholderForeground Color
|
||||
* @uiDefault PasswordField.focusedBackground Color optional
|
||||
* @uiDefault PasswordField.showCapsLock boolean
|
||||
* @uiDefault PasswordField.capsLockIcon Icon
|
||||
* @uiDefault TextComponent.selectAllOnFocusPolicy String never, once (default) or always
|
||||
@@ -73,6 +74,7 @@ public class FlatPasswordFieldUI
|
||||
protected int minimumWidth;
|
||||
protected boolean isIntelliJTheme;
|
||||
protected Color placeholderForeground;
|
||||
protected Color focusedBackground;
|
||||
protected boolean showCapsLock;
|
||||
protected Icon capsLockIcon;
|
||||
|
||||
@@ -91,6 +93,7 @@ public class FlatPasswordFieldUI
|
||||
minimumWidth = UIManager.getInt( "Component.minimumWidth" );
|
||||
isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
|
||||
placeholderForeground = UIManager.getColor( prefix + ".placeholderForeground" );
|
||||
focusedBackground = UIManager.getColor( prefix + ".focusedBackground" );
|
||||
showCapsLock = UIManager.getBoolean( "PasswordField.showCapsLock" );
|
||||
capsLockIcon = UIManager.getIcon( "PasswordField.capsLockIcon" );
|
||||
|
||||
@@ -104,6 +107,7 @@ public class FlatPasswordFieldUI
|
||||
super.uninstallDefaults();
|
||||
|
||||
placeholderForeground = null;
|
||||
focusedBackground = null;
|
||||
capsLockIcon = null;
|
||||
|
||||
MigLayoutVisualPadding.uninstall( getComponent() );
|
||||
@@ -113,7 +117,10 @@ public class FlatPasswordFieldUI
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
|
||||
focusListener = new FlatUIUtils.RepaintFocusListener( getComponent() );
|
||||
// necessary to update focus border and background
|
||||
focusListener = new FlatUIUtils.RepaintFocusListener( getComponent(), null );
|
||||
|
||||
// update caps lock indicator
|
||||
capsLockListener = new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed( KeyEvent e ) {
|
||||
@@ -157,7 +164,7 @@ public class FlatPasswordFieldUI
|
||||
|
||||
@Override
|
||||
protected void paintSafely( Graphics g ) {
|
||||
FlatTextFieldUI.paintBackground( g, getComponent(), isIntelliJTheme );
|
||||
FlatTextFieldUI.paintBackground( g, getComponent(), isIntelliJTheme, focusedBackground );
|
||||
FlatTextFieldUI.paintPlaceholder( g, getComponent(), placeholderForeground );
|
||||
paintCapsLock( g );
|
||||
|
||||
|
||||
@@ -20,12 +20,16 @@ import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Insets;
|
||||
import java.awt.MouseInfo;
|
||||
import java.awt.Panel;
|
||||
import java.awt.Point;
|
||||
import java.awt.PointerInfo;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
@@ -63,7 +67,7 @@ public class FlatPopupFactory
|
||||
public Popup getPopup( Component owner, Component contents, int x, int y )
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
Point pt = fixToolTipLocation( contents, x, y );
|
||||
Point pt = fixToolTipLocation( owner, contents, x, y );
|
||||
if( pt != null ) {
|
||||
x = pt.x;
|
||||
y = pt.y;
|
||||
@@ -207,13 +211,13 @@ public class FlatPopupFactory
|
||||
/**
|
||||
* Usually ToolTipManager places a tooltip at (mouseLocation.x, mouseLocation.y + 20).
|
||||
* In case that the tooltip would be partly outside of the screen,
|
||||
* ToolTipManagerthe changes the location so that the entire tooltip fits on screen.
|
||||
* the ToolTipManager changes the location so that the entire tooltip fits on screen.
|
||||
* But this can place the tooltip under the mouse location and hide the owner component.
|
||||
* <p>
|
||||
* This method checks whether the current mouse location is within tooltip bounds
|
||||
* and corrects the y-location so that the tooltip is placed above the mouse location.
|
||||
*/
|
||||
private Point fixToolTipLocation( Component contents, int x, int y ) {
|
||||
private Point fixToolTipLocation( Component owner, Component contents, int x, int y ) {
|
||||
if( !(contents instanceof JToolTip) || !wasInvokedFromToolTipManager() )
|
||||
return null;
|
||||
|
||||
@@ -229,8 +233,30 @@ public class FlatPopupFactory
|
||||
if( !tipBounds.contains( mouseLocation ) )
|
||||
return null;
|
||||
|
||||
// place tooltip above mouse location
|
||||
return new Point( x, mouseLocation.y - tipSize.height - UIScale.scale( 20 ) );
|
||||
// find GraphicsConfiguration at mouse location (similar to ToolTipManager.getDrawingGC())
|
||||
GraphicsConfiguration gc = null;
|
||||
for( GraphicsDevice device : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices() ) {
|
||||
GraphicsConfiguration dgc = device.getDefaultConfiguration();
|
||||
if( dgc.getBounds().contains( mouseLocation ) ) {
|
||||
gc = dgc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( gc == null )
|
||||
gc = owner.getGraphicsConfiguration();
|
||||
if( gc == null )
|
||||
return null;
|
||||
|
||||
Rectangle screenBounds = gc.getBounds();
|
||||
Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets( gc );
|
||||
int screenTop = screenBounds.y + screenInsets.top;
|
||||
|
||||
// place tooltip above mouse location if there is enough space
|
||||
int newY = mouseLocation.y - tipSize.height - UIScale.scale( 20 );
|
||||
if( newY < screenTop )
|
||||
return null;
|
||||
|
||||
return new Point( x, newY );
|
||||
}
|
||||
|
||||
private boolean wasInvokedFromToolTipManager() {
|
||||
|
||||
@@ -27,6 +27,8 @@ import java.awt.Insets;
|
||||
import java.awt.LayoutManager;
|
||||
import java.awt.LayoutManager2;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.HierarchyEvent;
|
||||
import java.awt.event.HierarchyListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.util.function.Function;
|
||||
import javax.swing.JComponent;
|
||||
@@ -79,6 +81,7 @@ public class FlatRootPaneUI
|
||||
|
||||
private Object nativeWindowBorderData;
|
||||
private LayoutManager oldLayout;
|
||||
private HierarchyListener hierarchyListener;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
return new FlatRootPaneUI();
|
||||
@@ -136,6 +139,39 @@ public class FlatRootPaneUI
|
||||
c.putClientProperty( "jetbrains.awt.windowDarkAppearance", FlatLaf.isLafDark() );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners( JRootPane root ) {
|
||||
super.installListeners( root );
|
||||
|
||||
if( SystemInfo.isJava_9_orLater ) {
|
||||
// On HiDPI screens, where scaling is used, there may be white lines at the
|
||||
// bottom and at the right side of the window when it is initially shown.
|
||||
// This is very disturbing in dark themes, but hard to notice in light themes.
|
||||
// Seems to be a rounding issue when Swing adds dirty region of window
|
||||
// using RepaintManager.nativeAddDirtyRegion().
|
||||
hierarchyListener = e -> {
|
||||
if( (e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0 &&
|
||||
rootPane.getParent() instanceof Window )
|
||||
{
|
||||
// add whole root pane to dirty regions when window is initially shown
|
||||
rootPane.getParent().repaint( rootPane.getX(), rootPane.getY(),
|
||||
rootPane.getWidth(), rootPane.getHeight() );
|
||||
}
|
||||
};
|
||||
root.addHierarchyListener( hierarchyListener );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners( JRootPane root ) {
|
||||
super.uninstallListeners( root );
|
||||
|
||||
if( SystemInfo.isJava_9_orLater ) {
|
||||
root.removeHierarchyListener( hierarchyListener );
|
||||
hierarchyListener = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.1.2
|
||||
*/
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.formdev.flatlaf.ui;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Insets;
|
||||
import java.awt.KeyboardFocusManager;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ContainerEvent;
|
||||
import java.awt.event.ContainerListener;
|
||||
@@ -34,11 +35,13 @@ import javax.swing.JComponent;
|
||||
import javax.swing.JScrollBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.JViewport;
|
||||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.Scrollable;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicScrollPaneUI;
|
||||
@@ -329,6 +332,31 @@ public class FlatScrollPaneUI
|
||||
paint( g, c );
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.3
|
||||
*/
|
||||
public static boolean isPermanentFocusOwner( JScrollPane scrollPane ) {
|
||||
JViewport viewport = scrollPane.getViewport();
|
||||
Component view = (viewport != null) ? viewport.getView() : null;
|
||||
if( view == null )
|
||||
return false;
|
||||
|
||||
// check whether view is focus owner
|
||||
if( FlatUIUtils.isPermanentFocusOwner( view ) )
|
||||
return true;
|
||||
|
||||
// check whether editor component in JTable or JTree is focus owner
|
||||
if( (view instanceof JTable && ((JTable)view).isEditing()) ||
|
||||
(view instanceof JTree && ((JTree)view).isEditing()) )
|
||||
{
|
||||
Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
|
||||
if( focusOwner != null )
|
||||
return SwingUtilities.isDescendingFrom( focusOwner, view );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//---- class Handler ------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -350,11 +378,13 @@ public class FlatScrollPaneUI
|
||||
|
||||
@Override
|
||||
public void focusGained( FocusEvent e ) {
|
||||
// necessary to update focus border
|
||||
scrollpane.repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost( FocusEvent e ) {
|
||||
// necessary to update focus border
|
||||
scrollpane.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import javax.swing.LookAndFeel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.UIResource;
|
||||
import javax.swing.plaf.basic.BasicSpinnerUI;
|
||||
import com.formdev.flatlaf.FlatClientProperties;
|
||||
|
||||
@@ -65,6 +66,7 @@ import com.formdev.flatlaf.FlatClientProperties;
|
||||
* @uiDefault Component.disabledBorderColor Color
|
||||
* @uiDefault Spinner.disabledBackground Color
|
||||
* @uiDefault Spinner.disabledForeground Color
|
||||
* @uiDefault Spinner.focusedBackground Color optional
|
||||
* @uiDefault Spinner.buttonBackground Color
|
||||
* @uiDefault Spinner.buttonArrowColor Color
|
||||
* @uiDefault Spinner.buttonDisabledArrowColor Color
|
||||
@@ -87,6 +89,7 @@ public class FlatSpinnerUI
|
||||
protected Color disabledBorderColor;
|
||||
protected Color disabledBackground;
|
||||
protected Color disabledForeground;
|
||||
protected Color focusedBackground;
|
||||
protected Color buttonBackground;
|
||||
protected Color buttonArrowColor;
|
||||
protected Color buttonDisabledArrowColor;
|
||||
@@ -112,6 +115,7 @@ public class FlatSpinnerUI
|
||||
disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" );
|
||||
disabledBackground = UIManager.getColor( "Spinner.disabledBackground" );
|
||||
disabledForeground = UIManager.getColor( "Spinner.disabledForeground" );
|
||||
focusedBackground = UIManager.getColor( "Spinner.focusedBackground" );
|
||||
buttonBackground = UIManager.getColor( "Spinner.buttonBackground" );
|
||||
buttonArrowColor = UIManager.getColor( "Spinner.buttonArrowColor" );
|
||||
buttonDisabledArrowColor = UIManager.getColor( "Spinner.buttonDisabledArrowColor" );
|
||||
@@ -133,6 +137,7 @@ public class FlatSpinnerUI
|
||||
disabledBorderColor = null;
|
||||
disabledBackground = null;
|
||||
disabledForeground = null;
|
||||
focusedBackground = null;
|
||||
buttonBackground = null;
|
||||
buttonArrowColor = null;
|
||||
buttonDisabledArrowColor = null;
|
||||
@@ -221,10 +226,34 @@ public class FlatSpinnerUI
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.3
|
||||
*/
|
||||
public static boolean isPermanentFocusOwner( JSpinner spinner ) {
|
||||
if( FlatUIUtils.isPermanentFocusOwner( spinner ) )
|
||||
return true;
|
||||
|
||||
JTextField textField = getEditorTextField( spinner.getEditor() );
|
||||
return (textField != null)
|
||||
? FlatUIUtils.isPermanentFocusOwner( textField )
|
||||
: false;
|
||||
}
|
||||
|
||||
protected Color getBackground( boolean enabled ) {
|
||||
return enabled
|
||||
? spinner.getBackground()
|
||||
: (isIntelliJTheme ? FlatUIUtils.getParentBackground( spinner ) : disabledBackground);
|
||||
if( enabled ) {
|
||||
Color background = spinner.getBackground();
|
||||
|
||||
// always use explicitly set color
|
||||
if( !(background instanceof UIResource) )
|
||||
return background;
|
||||
|
||||
// focused
|
||||
if( focusedBackground != null && isPermanentFocusOwner( spinner ) )
|
||||
return focusedBackground;
|
||||
|
||||
return background;
|
||||
} else
|
||||
return isIntelliJTheme ? FlatUIUtils.getParentBackground( spinner ) : disabledBackground;
|
||||
}
|
||||
|
||||
protected Color getForeground( boolean enabled ) {
|
||||
@@ -250,7 +279,7 @@ public class FlatSpinnerUI
|
||||
FlatArrowButton button = new FlatArrowButton( direction, arrowType, buttonArrowColor,
|
||||
buttonDisabledArrowColor, buttonHoverArrowColor, null, buttonPressedArrowColor, null );
|
||||
button.setName( name );
|
||||
button.setYOffset( (direction == SwingConstants.NORTH) ? 1 : -1 );
|
||||
button.setYOffset( (direction == SwingConstants.NORTH) ? 1.25f : -1.25f );
|
||||
if( direction == SwingConstants.NORTH )
|
||||
installNextButtonListeners( button );
|
||||
else
|
||||
@@ -405,6 +434,7 @@ public class FlatSpinnerUI
|
||||
|
||||
@Override
|
||||
public void focusGained( FocusEvent e ) {
|
||||
// necessary to update focus border
|
||||
spinner.repaint();
|
||||
|
||||
// if spinner gained focus, transfer it to the editor text field
|
||||
@@ -417,6 +447,7 @@ public class FlatSpinnerUI
|
||||
|
||||
@Override
|
||||
public void focusLost( FocusEvent e ) {
|
||||
// necessary to update focus border
|
||||
spinner.repaint();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JTextArea;
|
||||
@@ -52,6 +53,7 @@ import com.formdev.flatlaf.util.HiDPIUtils;
|
||||
* @uiDefault Component.isIntelliJTheme boolean
|
||||
* @uiDefault TextArea.disabledBackground Color used if not enabled
|
||||
* @uiDefault TextArea.inactiveBackground Color used if not editable
|
||||
* @uiDefault TextArea.focusedBackground Color optional
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
@@ -63,6 +65,9 @@ public class FlatTextAreaUI
|
||||
protected Color background;
|
||||
protected Color disabledBackground;
|
||||
protected Color inactiveBackground;
|
||||
protected Color focusedBackground;
|
||||
|
||||
private FocusListener focusListener;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
return new FlatTextAreaUI();
|
||||
@@ -84,6 +89,7 @@ public class FlatTextAreaUI
|
||||
background = UIManager.getColor( "TextArea.background" );
|
||||
disabledBackground = UIManager.getColor( "TextArea.disabledBackground" );
|
||||
inactiveBackground = UIManager.getColor( "TextArea.inactiveBackground" );
|
||||
focusedBackground = UIManager.getColor( "TextArea.focusedBackground" );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,6 +99,24 @@ public class FlatTextAreaUI
|
||||
background = null;
|
||||
disabledBackground = null;
|
||||
inactiveBackground = null;
|
||||
focusedBackground = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
|
||||
// necessary to update focus background
|
||||
focusListener = new FlatUIUtils.RepaintFocusListener( getComponent(), c -> focusedBackground != null );
|
||||
getComponent().addFocusListener( focusListener );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
super.uninstallListeners();
|
||||
|
||||
getComponent().removeFocusListener( focusListener );
|
||||
focusListener = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -156,14 +180,6 @@ public class FlatTextAreaUI
|
||||
|
||||
@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 );
|
||||
FlatEditorPaneUI.paintBackground( g, getComponent(), isIntelliJTheme, focusedBackground );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ import com.formdev.flatlaf.util.JavaCompatibility;
|
||||
* @uiDefault Component.minimumWidth int
|
||||
* @uiDefault Component.isIntelliJTheme boolean
|
||||
* @uiDefault TextField.placeholderForeground Color
|
||||
* @uiDefault TextField.focusedBackground Color optional
|
||||
* @uiDefault TextComponent.selectAllOnFocusPolicy String never, once (default) or always
|
||||
* @uiDefault TextComponent.selectAllOnMouseClick boolean
|
||||
*
|
||||
@@ -75,6 +76,7 @@ public class FlatTextFieldUI
|
||||
protected int minimumWidth;
|
||||
protected boolean isIntelliJTheme;
|
||||
protected Color placeholderForeground;
|
||||
protected Color focusedBackground;
|
||||
|
||||
private FocusListener focusListener;
|
||||
|
||||
@@ -90,6 +92,7 @@ public class FlatTextFieldUI
|
||||
minimumWidth = UIManager.getInt( "Component.minimumWidth" );
|
||||
isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
|
||||
placeholderForeground = UIManager.getColor( prefix + ".placeholderForeground" );
|
||||
focusedBackground = UIManager.getColor( prefix + ".focusedBackground" );
|
||||
|
||||
LookAndFeel.installProperty( getComponent(), "opaque", false );
|
||||
|
||||
@@ -101,6 +104,7 @@ public class FlatTextFieldUI
|
||||
super.uninstallDefaults();
|
||||
|
||||
placeholderForeground = null;
|
||||
focusedBackground = null;
|
||||
|
||||
MigLayoutVisualPadding.uninstall( getComponent() );
|
||||
}
|
||||
@@ -109,7 +113,8 @@ public class FlatTextFieldUI
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
|
||||
focusListener = new FlatUIUtils.RepaintFocusListener( getComponent() );
|
||||
// necessary to update focus border and background
|
||||
focusListener = new FlatUIUtils.RepaintFocusListener( getComponent(), null );
|
||||
getComponent().addFocusListener( focusListener );
|
||||
}
|
||||
|
||||
@@ -148,7 +153,7 @@ public class FlatTextFieldUI
|
||||
|
||||
@Override
|
||||
protected void paintSafely( Graphics g ) {
|
||||
paintBackground( g, getComponent(), isIntelliJTheme );
|
||||
paintBackground( g, getComponent(), isIntelliJTheme, focusedBackground );
|
||||
paintPlaceholder( g, getComponent(), placeholderForeground );
|
||||
|
||||
super.paintSafely( HiDPIUtils.createGraphicsTextYCorrection( (Graphics2D) g ) );
|
||||
@@ -159,7 +164,7 @@ public class FlatTextFieldUI
|
||||
// background is painted elsewhere
|
||||
}
|
||||
|
||||
static void paintBackground( Graphics g, JTextComponent c, boolean isIntelliJTheme ) {
|
||||
static void paintBackground( Graphics g, JTextComponent c, boolean isIntelliJTheme, Color focusedBackground ) {
|
||||
// do not paint background if:
|
||||
// - not opaque and
|
||||
// - border is not a flat border and
|
||||
@@ -180,18 +185,31 @@ public class FlatTextFieldUI
|
||||
try {
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
|
||||
Color background = c.getBackground();
|
||||
g2.setColor( !(background instanceof UIResource)
|
||||
? background
|
||||
: (isIntelliJTheme && (!c.isEnabled() || !c.isEditable())
|
||||
? FlatUIUtils.getParentBackground( c )
|
||||
: background) );
|
||||
g2.setColor( getBackground( c, isIntelliJTheme, focusedBackground ) );
|
||||
FlatUIUtils.paintComponentBackground( g2, 0, 0, c.getWidth(), c.getHeight(), focusWidth, arc );
|
||||
} finally {
|
||||
g2.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
static Color getBackground( JTextComponent c, boolean isIntelliJTheme, Color focusedBackground ) {
|
||||
Color background = c.getBackground();
|
||||
|
||||
// always use explicitly set color
|
||||
if( !(background instanceof UIResource) )
|
||||
return background;
|
||||
|
||||
// focused
|
||||
if( focusedBackground != null && FlatUIUtils.isPermanentFocusOwner( c ) )
|
||||
return focusedBackground;
|
||||
|
||||
// for compatibility with IntelliJ themes
|
||||
if( isIntelliJTheme && (!c.isEnabled() || !c.isEditable()) )
|
||||
return FlatUIUtils.getParentBackground( c );
|
||||
|
||||
return background;
|
||||
}
|
||||
|
||||
static void paintPlaceholder( Graphics g, JTextComponent c, Color placeholderForeground ) {
|
||||
// check whether text component is empty
|
||||
if( c.getDocument().getLength() > 0 )
|
||||
|
||||
@@ -16,17 +16,17 @@
|
||||
|
||||
package com.formdev.flatlaf.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.UIResource;
|
||||
import javax.swing.plaf.basic.BasicTextPaneUI;
|
||||
import javax.swing.text.JTextComponent;
|
||||
import com.formdev.flatlaf.util.HiDPIUtils;
|
||||
|
||||
/**
|
||||
@@ -51,6 +51,7 @@ import com.formdev.flatlaf.util.HiDPIUtils;
|
||||
*
|
||||
* @uiDefault Component.minimumWidth int
|
||||
* @uiDefault Component.isIntelliJTheme boolean
|
||||
* @uiDefault TextPane.focusedBackground Color optional
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
@@ -59,8 +60,10 @@ public class FlatTextPaneUI
|
||||
{
|
||||
protected int minimumWidth;
|
||||
protected boolean isIntelliJTheme;
|
||||
protected Color focusedBackground;
|
||||
|
||||
private Object oldHonorDisplayProperties;
|
||||
private FocusListener focusListener;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
return new FlatTextPaneUI();
|
||||
@@ -70,8 +73,10 @@ public class FlatTextPaneUI
|
||||
protected void installDefaults() {
|
||||
super.installDefaults();
|
||||
|
||||
String prefix = getPropertyPrefix();
|
||||
minimumWidth = UIManager.getInt( "Component.minimumWidth" );
|
||||
isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
|
||||
focusedBackground = UIManager.getColor( prefix + ".focusedBackground" );
|
||||
|
||||
// use component font and foreground for HTML text
|
||||
oldHonorDisplayProperties = getComponent().getClientProperty( JEditorPane.HONOR_DISPLAY_PROPERTIES );
|
||||
@@ -82,9 +87,28 @@ public class FlatTextPaneUI
|
||||
protected void uninstallDefaults() {
|
||||
super.uninstallDefaults();
|
||||
|
||||
focusedBackground = null;
|
||||
|
||||
getComponent().putClientProperty( JEditorPane.HONOR_DISPLAY_PROPERTIES, oldHonorDisplayProperties );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
|
||||
// necessary to update focus background
|
||||
focusListener = new FlatUIUtils.RepaintFocusListener( getComponent(), c -> focusedBackground != null );
|
||||
getComponent().addFocusListener( focusListener );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
super.uninstallListeners();
|
||||
|
||||
getComponent().removeFocusListener( focusListener );
|
||||
focusListener = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void propertyChange( PropertyChangeEvent e ) {
|
||||
super.propertyChange( e );
|
||||
@@ -108,14 +132,6 @@ public class FlatTextPaneUI
|
||||
|
||||
@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 );
|
||||
FlatEditorPaneUI.paintBackground( g, getComponent(), isIntelliJTheme, focusedBackground );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -660,7 +660,7 @@ public class FlatUIUtils
|
||||
* @since 1.1
|
||||
*/
|
||||
public static void paintArrow( Graphics2D g, int x, int y, int width, int height,
|
||||
int direction, boolean chevron, int arrowSize, int xOffset, int yOffset )
|
||||
int direction, boolean chevron, int arrowSize, float xOffset, float yOffset )
|
||||
{
|
||||
// compute arrow width/height
|
||||
int aw = UIScale.scale( arrowSize + (chevron ? 0 : 1) );
|
||||
@@ -679,8 +679,10 @@ public class FlatUIUtils
|
||||
int extra = chevron ? 1 : 0;
|
||||
|
||||
// compute arrow location
|
||||
int ax = x + Math.round( ((width - (aw + extra)) / 2f) + UIScale.scale( (float) xOffset ) );
|
||||
int ay = y + Math.round( ((height - (ah + extra)) / 2f) + UIScale.scale( (float) yOffset ) );
|
||||
float ox = ((width - (aw + extra)) / 2f) + UIScale.scale( xOffset );
|
||||
float oy = ((height - (ah + extra)) / 2f) + UIScale.scale( yOffset );
|
||||
int ax = x + ((direction == SwingConstants.WEST) ? -Math.round( -ox ) : Math.round( ox ));
|
||||
int ay = y + ((direction == SwingConstants.NORTH) ? -Math.round( -oy ) : Math.round( oy ));
|
||||
|
||||
// paint arrow
|
||||
g.translate( ax, ay );
|
||||
@@ -837,19 +839,23 @@ debug*/
|
||||
implements FocusListener
|
||||
{
|
||||
private final Component repaintComponent;
|
||||
private final Predicate<Component> repaintCondition;
|
||||
|
||||
public RepaintFocusListener( Component repaintComponent ) {
|
||||
public RepaintFocusListener( Component repaintComponent, Predicate<Component> repaintCondition ) {
|
||||
this.repaintComponent = repaintComponent;
|
||||
this.repaintCondition = repaintCondition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusGained( FocusEvent e ) {
|
||||
repaintComponent.repaint();
|
||||
if( repaintCondition == null || repaintCondition.test( repaintComponent ) )
|
||||
repaintComponent.repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost( FocusEvent e ) {
|
||||
repaintComponent.repaint();
|
||||
if( repaintCondition == null || repaintCondition.test( repaintComponent ) )
|
||||
repaintComponent.repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import java.awt.event.WindowListener;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import javax.swing.AbstractButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLayeredPane;
|
||||
@@ -64,6 +65,7 @@ import javax.swing.plaf.UIResource;
|
||||
import javax.swing.text.JTextComponent;
|
||||
import com.formdev.flatlaf.FlatClientProperties;
|
||||
import com.formdev.flatlaf.ui.FlatUIUtils;
|
||||
import com.formdev.flatlaf.util.SystemInfo;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
|
||||
/**
|
||||
@@ -478,9 +480,17 @@ public class FlatInspector
|
||||
|
||||
if( c instanceof JComponent ) {
|
||||
try {
|
||||
Field f = JComponent.class.getDeclaredField( "ui" );
|
||||
f.setAccessible( true );
|
||||
Object ui = f.get( c );
|
||||
Object ui;
|
||||
if( SystemInfo.isJava_9_orLater ) {
|
||||
// Java 9+: use public method JComponent.getUI()
|
||||
Method m = JComponent.class.getMethod( "getUI" );
|
||||
ui = m.invoke( c );
|
||||
} else {
|
||||
// Java 8: read protected field 'ui'
|
||||
Field f = JComponent.class.getDeclaredField( "ui" );
|
||||
f.setAccessible( true );
|
||||
ui = f.get( c );
|
||||
}
|
||||
appendRow( buf, "UI", (ui != null ? toString( ui.getClass(), classHierarchy ) : "null") );
|
||||
} catch( Exception ex ) {
|
||||
// ignore
|
||||
@@ -553,6 +563,9 @@ public class FlatInspector
|
||||
String simpleName = (dot >= 0) ? name.substring( dot + 1 ) : name;
|
||||
buf.append( simpleName ).append( ' ' ).append( toDimmedText( "(" + pkg + ")" ) );
|
||||
|
||||
if( UIResource.class.isAssignableFrom( cls ) )
|
||||
buf.append( " UI" );
|
||||
|
||||
if( !classHierarchy )
|
||||
break;
|
||||
|
||||
@@ -613,11 +626,14 @@ public class FlatInspector
|
||||
|
||||
String s = toString( b.getClass(), classHierarchy );
|
||||
|
||||
if( b instanceof EmptyBorder )
|
||||
s += '(' + toString( ((EmptyBorder)b).getBorderInsets() ) + ')';
|
||||
|
||||
if( b instanceof UIResource )
|
||||
s += " UI";
|
||||
if( b instanceof EmptyBorder ) {
|
||||
String borderInsets = " (" + toString( ((EmptyBorder)b).getBorderInsets() ) + ')';
|
||||
int brIndex = s.indexOf( "<br>" );
|
||||
if( brIndex >= 0 )
|
||||
s = s.substring( 0, brIndex ) + borderInsets + s.substring( brIndex );
|
||||
else
|
||||
s += borderInsets;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ dependencies {
|
||||
implementation( project( ":flatlaf-core" ) )
|
||||
|
||||
// use compileOnly() because there are various JIDE libraries available on Maven Central
|
||||
compileOnly( "com.formdev:jide-oss:3.7.11.1" )
|
||||
compileOnly( "com.formdev:jide-oss:3.7.12" )
|
||||
}
|
||||
|
||||
java {
|
||||
|
||||
@@ -156,7 +156,7 @@ public class FlatDatePickerUI
|
||||
editor.setName( "dateField" );
|
||||
editor.setBorder( BorderFactory.createEmptyBorder() );
|
||||
editor.setOpaque( false );
|
||||
editor.addFocusListener( new FlatUIUtils.RepaintFocusListener( datePicker ) );
|
||||
editor.addFocusListener( new FlatUIUtils.RepaintFocusListener( datePicker, null ) );
|
||||
return editor;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ dependencies {
|
||||
implementation( "com.jgoodies:jgoodies-forms:1.9.0" )
|
||||
implementation( "org.swinglabs.swingx:swingx-all:1.6.5-1" )
|
||||
implementation( "org.swinglabs.swingx:swingx-beaninfo:1.6.5-1" )
|
||||
implementation( "com.formdev:jide-oss:3.7.11.1" )
|
||||
implementation( "com.formdev:jide-oss:3.7.12" )
|
||||
implementation( "com.glazedlists:glazedlists:1.11.0" )
|
||||
implementation( "org.netbeans.api:org-openide-awt:RELEASE112" )
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ public class FlatAnimatedIconTest
|
||||
|
||||
@Override
|
||||
public void paintIconAnimated( Component c, Graphics g, int x, int y, float animatedValue ) {
|
||||
Color color = ColorFunctions.mix( onColor, offColor, animatedValue );;
|
||||
Color color = ColorFunctions.mix( onColor, offColor, animatedValue );
|
||||
|
||||
// border
|
||||
g.setColor( color );
|
||||
@@ -190,7 +190,7 @@ public class FlatAnimatedIconTest
|
||||
|
||||
@Override
|
||||
public void paintIconAnimated( Component c, Graphics g, int x, int y, float animatedValue ) {
|
||||
Color color = ColorFunctions.mix( onColor, offColor, animatedValue );;
|
||||
Color color = ColorFunctions.mix( onColor, offColor, animatedValue );
|
||||
|
||||
g.setColor( color );
|
||||
g.fillRoundRect( x, y, width, height, height, height );
|
||||
|
||||
@@ -73,6 +73,25 @@ public class FlatPaintingTest
|
||||
repaint();
|
||||
}
|
||||
|
||||
private void offsetChanged() {
|
||||
float offset = (float) offsetSpinner.getValue();
|
||||
System.out.println( offset );
|
||||
|
||||
arrowPainter5.setYOffset( offset );
|
||||
arrowPainter6.setYOffset( -offset );
|
||||
|
||||
arrowPainter7.setXOffset( offset );
|
||||
arrowPainter8.setXOffset( -offset );
|
||||
|
||||
arrowPainter13.setYOffset( offset );
|
||||
arrowPainter14.setYOffset( -offset );
|
||||
|
||||
arrowPainter15.setXOffset( offset );
|
||||
arrowPainter16.setXOffset( -offset );
|
||||
|
||||
repaint();
|
||||
}
|
||||
|
||||
private void vectorChanged() {
|
||||
boolean vector = vectorCheckBox.isSelected();
|
||||
|
||||
@@ -84,7 +103,7 @@ public class FlatPaintingTest
|
||||
repaint();
|
||||
}
|
||||
|
||||
private void checkBox1ActionPerformed() {
|
||||
private void arrowButtonChanged() {
|
||||
boolean button = buttonCheckBox.isSelected();
|
||||
|
||||
FlatTestFrame.updateComponentsRecur( (Container) getViewport().getView(), (c, type) -> {
|
||||
@@ -143,11 +162,11 @@ public class FlatPaintingTest
|
||||
FlatPaintingTest.ArrowPainter arrowPainter3 = new FlatPaintingTest.ArrowPainter();
|
||||
FlatPaintingTest.ArrowPainter arrowPainter4 = new FlatPaintingTest.ArrowPainter();
|
||||
JPanel panel1 = new JPanel();
|
||||
FlatPaintingTest.ArrowPainter arrowPainter5 = new FlatPaintingTest.ArrowPainter();
|
||||
FlatPaintingTest.ArrowPainter arrowPainter6 = new FlatPaintingTest.ArrowPainter();
|
||||
arrowPainter5 = new FlatPaintingTest.ArrowPainter();
|
||||
arrowPainter6 = new FlatPaintingTest.ArrowPainter();
|
||||
JPanel panel2 = new JPanel();
|
||||
FlatPaintingTest.ArrowPainter arrowPainter7 = new FlatPaintingTest.ArrowPainter();
|
||||
FlatPaintingTest.ArrowPainter arrowPainter8 = new FlatPaintingTest.ArrowPainter();
|
||||
arrowPainter7 = new FlatPaintingTest.ArrowPainter();
|
||||
arrowPainter8 = new FlatPaintingTest.ArrowPainter();
|
||||
JPanel panel5 = new JPanel();
|
||||
JLabel arrowWidthLabel = new JLabel();
|
||||
arrowWidthSpinner = new JSpinner();
|
||||
@@ -155,6 +174,8 @@ public class FlatPaintingTest
|
||||
arrowHeightSpinner = new JSpinner();
|
||||
JLabel arrowSizeLabel = new JLabel();
|
||||
arrowSizeSpinner = new JSpinner();
|
||||
JLabel offsetLabel = new JLabel();
|
||||
offsetSpinner = new JSpinner();
|
||||
vectorCheckBox = new JCheckBox();
|
||||
buttonCheckBox = new JCheckBox();
|
||||
FlatPaintingTest.ArrowPainter arrowPainter9 = new FlatPaintingTest.ArrowPainter();
|
||||
@@ -162,11 +183,11 @@ public class FlatPaintingTest
|
||||
FlatPaintingTest.ArrowPainter arrowPainter11 = new FlatPaintingTest.ArrowPainter();
|
||||
FlatPaintingTest.ArrowPainter arrowPainter12 = new FlatPaintingTest.ArrowPainter();
|
||||
JPanel panel3 = new JPanel();
|
||||
FlatPaintingTest.ArrowPainter arrowPainter13 = new FlatPaintingTest.ArrowPainter();
|
||||
FlatPaintingTest.ArrowPainter arrowPainter14 = new FlatPaintingTest.ArrowPainter();
|
||||
arrowPainter13 = new FlatPaintingTest.ArrowPainter();
|
||||
arrowPainter14 = new FlatPaintingTest.ArrowPainter();
|
||||
JPanel panel4 = new JPanel();
|
||||
FlatPaintingTest.ArrowPainter arrowPainter15 = new FlatPaintingTest.ArrowPainter();
|
||||
FlatPaintingTest.ArrowPainter arrowPainter16 = new FlatPaintingTest.ArrowPainter();
|
||||
arrowPainter15 = new FlatPaintingTest.ArrowPainter();
|
||||
arrowPainter16 = new FlatPaintingTest.ArrowPainter();
|
||||
|
||||
//======== this ========
|
||||
setBorder(null);
|
||||
@@ -519,6 +540,7 @@ public class FlatPaintingTest
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- arrowWidthLabel ----
|
||||
@@ -548,17 +570,26 @@ public class FlatPaintingTest
|
||||
arrowSizeSpinner.addChangeListener(e -> arrowSizeChanged());
|
||||
panel5.add(arrowSizeSpinner, "cell 1 2");
|
||||
|
||||
//---- offsetLabel ----
|
||||
offsetLabel.setText("Offset:");
|
||||
panel5.add(offsetLabel, "cell 0 3");
|
||||
|
||||
//---- offsetSpinner ----
|
||||
offsetSpinner.setModel(new SpinnerNumberModel(1.0F, null, null, 0.05F));
|
||||
offsetSpinner.addChangeListener(e -> offsetChanged());
|
||||
panel5.add(offsetSpinner, "cell 1 3");
|
||||
|
||||
//---- vectorCheckBox ----
|
||||
vectorCheckBox.setText("vector");
|
||||
vectorCheckBox.addActionListener(e -> vectorChanged());
|
||||
panel5.add(vectorCheckBox, "cell 0 3 2 1,alignx left,growx 0");
|
||||
panel5.add(vectorCheckBox, "cell 0 4 2 1,alignx left,growx 0");
|
||||
|
||||
//---- buttonCheckBox ----
|
||||
buttonCheckBox.setText("FlatArrowButton");
|
||||
buttonCheckBox.addActionListener(e -> checkBox1ActionPerformed());
|
||||
panel5.add(buttonCheckBox, "cell 0 4 2 1,alignx left,growx 0");
|
||||
buttonCheckBox.addActionListener(e -> arrowButtonChanged());
|
||||
panel5.add(buttonCheckBox, "cell 0 5 2 1,alignx left,growx 0");
|
||||
}
|
||||
flatTestPanel1.add(panel5, "cell 6 5,aligny top,growy 0");
|
||||
flatTestPanel1.add(panel5, "cell 6 5 1 2,aligny top,growy 0");
|
||||
|
||||
//---- arrowPainter9 ----
|
||||
arrowPainter9.setScale(8.0F);
|
||||
@@ -635,11 +666,20 @@ public class FlatPaintingTest
|
||||
}
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
private FlatPaintingTest.ArrowPainter arrowPainter5;
|
||||
private FlatPaintingTest.ArrowPainter arrowPainter6;
|
||||
private FlatPaintingTest.ArrowPainter arrowPainter7;
|
||||
private FlatPaintingTest.ArrowPainter arrowPainter8;
|
||||
private JSpinner arrowWidthSpinner;
|
||||
private JSpinner arrowHeightSpinner;
|
||||
private JSpinner arrowSizeSpinner;
|
||||
private JSpinner offsetSpinner;
|
||||
private JCheckBox vectorCheckBox;
|
||||
private JCheckBox buttonCheckBox;
|
||||
private FlatPaintingTest.ArrowPainter arrowPainter13;
|
||||
private FlatPaintingTest.ArrowPainter arrowPainter14;
|
||||
private FlatPaintingTest.ArrowPainter arrowPainter15;
|
||||
private FlatPaintingTest.ArrowPainter arrowPainter16;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
|
||||
//---- class BorderPainter ------------------------------------------------
|
||||
@@ -792,8 +832,8 @@ public class FlatPaintingTest
|
||||
private int direction = SwingConstants.SOUTH;
|
||||
private boolean chevron = true;
|
||||
private int arrowSize = FlatArrowButton.DEFAULT_ARROW_WIDTH;
|
||||
private int xOffset = 0;
|
||||
private int yOffset = 0;
|
||||
private float xOffset = 0;
|
||||
private float yOffset = 0;
|
||||
private float scale = 1;
|
||||
private boolean halfWidth;
|
||||
private boolean halfHeight;
|
||||
@@ -845,19 +885,19 @@ public class FlatPaintingTest
|
||||
this.arrowSize = arrowSize;
|
||||
}
|
||||
|
||||
public int getXOffset() {
|
||||
public float getXOffset() {
|
||||
return xOffset;
|
||||
}
|
||||
|
||||
public void setXOffset( int xOffset ) {
|
||||
public void setXOffset( float xOffset ) {
|
||||
this.xOffset = xOffset;
|
||||
}
|
||||
|
||||
public int getYOffset() {
|
||||
public float getYOffset() {
|
||||
return yOffset;
|
||||
}
|
||||
|
||||
public void setYOffset( int yOffset ) {
|
||||
public void setYOffset( float yOffset ) {
|
||||
this.yOffset = yOffset;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.4.0.360" Java: "16" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -383,6 +383,9 @@ new FormModel {
|
||||
"h": 10
|
||||
"halfHeight": true
|
||||
"YOffset": 1
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatPaintingTest$ArrowPainter" ) {
|
||||
name: "arrowPainter6"
|
||||
@@ -390,6 +393,9 @@ new FormModel {
|
||||
"h": 10
|
||||
"halfHeight": true
|
||||
"YOffset": -1
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 5,align left top,grow 0 0"
|
||||
@@ -403,6 +409,9 @@ new FormModel {
|
||||
"w": 10
|
||||
"halfWidth": true
|
||||
"XOffset": 1
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatPaintingTest$ArrowPainter" ) {
|
||||
name: "arrowPainter8"
|
||||
@@ -411,6 +420,9 @@ new FormModel {
|
||||
"w": 10
|
||||
"halfWidth": true
|
||||
"XOffset": -1
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 5,align left top,grow 0 0"
|
||||
@@ -418,7 +430,7 @@ new FormModel {
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "hidemode 3"
|
||||
"$columnConstraints": "[fill][fill]"
|
||||
"$rowConstraints": "[][][][][]"
|
||||
"$rowConstraints": "[][][][][][]"
|
||||
} ) {
|
||||
name: "panel5"
|
||||
"border": new javax.swing.border.TitledBorder( "Arrow Control" )
|
||||
@@ -479,6 +491,25 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "offsetLabel"
|
||||
"text": "Offset:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||
name: "offsetSpinner"
|
||||
"model": new javax.swing.SpinnerNumberModel {
|
||||
stepSize: 0.05f
|
||||
value: 1.0f
|
||||
}
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "offsetChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "vectorCheckBox"
|
||||
"text": "vector"
|
||||
@@ -487,7 +518,7 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "vectorChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3 2 1,alignx left,growx 0"
|
||||
"value": "cell 0 4 2 1,alignx left,growx 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "buttonCheckBox"
|
||||
@@ -495,12 +526,12 @@ new FormModel {
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "checkBox1ActionPerformed", false ) )
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "arrowButtonChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4 2 1,alignx left,growx 0"
|
||||
"value": "cell 0 5 2 1,alignx left,growx 0"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 6 5,aligny top,growy 0"
|
||||
"value": "cell 6 5 1 2,aligny top,growy 0"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatPaintingTest$ArrowPainter" ) {
|
||||
name: "arrowPainter9"
|
||||
@@ -545,6 +576,9 @@ new FormModel {
|
||||
"chevron": false
|
||||
"halfHeight": true
|
||||
"YOffset": 1
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatPaintingTest$ArrowPainter" ) {
|
||||
name: "arrowPainter14"
|
||||
@@ -553,6 +587,9 @@ new FormModel {
|
||||
"chevron": false
|
||||
"halfHeight": true
|
||||
"YOffset": -1
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 6,align left top,grow 0 0"
|
||||
@@ -567,6 +604,9 @@ new FormModel {
|
||||
"chevron": false
|
||||
"halfWidth": true
|
||||
"XOffset": 1
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatPaintingTest$ArrowPainter" ) {
|
||||
name: "arrowPainter16"
|
||||
@@ -576,6 +616,9 @@ new FormModel {
|
||||
"chevron": false
|
||||
"halfWidth": true
|
||||
"XOffset": -1
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 6,align left top,grow 0 0"
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.awt.event.KeyEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
@@ -284,6 +285,8 @@ public class FlatTestFrame
|
||||
Properties properties = new Properties();
|
||||
try( InputStream in = new FileInputStream( "lafs.properties" ) ) {
|
||||
properties.load( in );
|
||||
} catch( FileNotFoundException ex ) {
|
||||
// ignore
|
||||
} catch( IOException ex ) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -130,6 +130,10 @@ ComboBox.background = #fff
|
||||
ComboBox.buttonBackground = #f0f0f0
|
||||
ComboBox.buttonEditableBackground = #ccc
|
||||
|
||||
ComboBox.focusedBackground = #ff8
|
||||
ComboBox.buttonFocusedBackground = #ff0
|
||||
ComboBox.popupBackground = #ffc
|
||||
|
||||
|
||||
#---- Component ----
|
||||
|
||||
@@ -152,6 +156,16 @@ Desktop.background = #afe
|
||||
DesktopIcon.background = darken($Desktop.background,20%)
|
||||
|
||||
|
||||
#---- EditorPane ----
|
||||
|
||||
EditorPane.focusedBackground = #ff8
|
||||
|
||||
|
||||
#---- FormattedTextField ----
|
||||
|
||||
FormattedTextField.focusedBackground = #ff8
|
||||
|
||||
|
||||
#---- HelpButton ----
|
||||
|
||||
HelpButton.focusedBackground = #0ff
|
||||
@@ -223,6 +237,11 @@ OptionPane.icon.warningColor = #fc0
|
||||
OptionPane.icon.foreground = #fff
|
||||
|
||||
|
||||
#---- PasswordField ----
|
||||
|
||||
PasswordField.focusedBackground = #ff8
|
||||
|
||||
|
||||
#---- Popup ----
|
||||
|
||||
Popup.dropShadowColor = #0f0
|
||||
@@ -280,6 +299,11 @@ Slider.disabledTrackColor = #ff8
|
||||
Slider.disabledThumbColor = #880
|
||||
|
||||
|
||||
#---- Spinner ----
|
||||
|
||||
Spinner.focusedBackground = #ff8
|
||||
|
||||
|
||||
#---- SplitPane ----
|
||||
|
||||
SplitPaneDivider.draggingColor = #800
|
||||
@@ -332,6 +356,21 @@ TableHeader.separatorColor = #0f0
|
||||
TableHeader.bottomSeparatorColor = #0f0
|
||||
|
||||
|
||||
#---- TextArea ----
|
||||
|
||||
TextArea.focusedBackground = #ff8
|
||||
|
||||
|
||||
#---- TextField ----
|
||||
|
||||
TextField.focusedBackground = #ff8
|
||||
|
||||
|
||||
#---- TextPane ----
|
||||
|
||||
TextPane.focusedBackground = #ff8
|
||||
|
||||
|
||||
#---- TitledBorder ----
|
||||
|
||||
TitledBorder.titleColor = #f0f
|
||||
|
||||
Reference in New Issue
Block a user