mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb70fb4e82 | ||
|
|
2593a43d72 | ||
|
|
e44ff5b72a | ||
|
|
22cb1b50a6 | ||
|
|
95a15c3cf8 | ||
|
|
ab320684f5 | ||
|
|
a284b69a1e | ||
|
|
b590f41254 | ||
|
|
a97076ead5 | ||
|
|
0b6df8be1c | ||
|
|
150bab0b57 | ||
|
|
a253b6c0cf | ||
|
|
efcbc1fbdb |
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@@ -34,6 +34,7 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: gradle/wrapper-validation-action@v1
|
||||
if: matrix.java == '1.8'
|
||||
|
||||
- name: Setup Java ${{ matrix.java }}
|
||||
uses: actions/setup-java@v1
|
||||
|
||||
40
CHANGELOG.md
40
CHANGELOG.md
@@ -1,6 +1,44 @@
|
||||
FlatLaf Change Log
|
||||
==================
|
||||
|
||||
## 1.6.3
|
||||
|
||||
#### Fixed bugs
|
||||
|
||||
- ComboBox (not editable): Fixed regression in FlatLaf 1.6.2 that may display
|
||||
text in non-editable combo boxes in bold. (issue #423)
|
||||
- Tree: Fixed editing cell issue with custom cell renderer and cell editor that
|
||||
use same component for rendering and editing. (issue #385)
|
||||
|
||||
|
||||
## 1.6.2
|
||||
|
||||
#### Fixed bugs
|
||||
|
||||
- ComboBox (not editable): Fixed background painted outside of border if round
|
||||
edges are enabled (client property `JComponent.roundRect` is `true`). (similar
|
||||
to issue #382; regression since fixing #330 in FlatLaf 1.4)
|
||||
- ComboBox: Fixed `NullPointerException`, which may occur under special
|
||||
circumstances. (issue #408)
|
||||
- Table: Do not select text in cell editor when it gets focus (when
|
||||
`JTable.surrendersFocusOnKeystroke` is `true`) and
|
||||
`TextComponent.selectAllOnFocusPolicy` is `once` (the default) or `always`.
|
||||
(issue #395)
|
||||
- Linux: Fixed NPE when using `java.awt.TrayIcon`. (issue #405)
|
||||
- FileChooser: Workaround for crash on Windows with Java 17 32-bit (disabled
|
||||
Windows icons). Java 17 64-bit is not affected. (issue #403)
|
||||
- Native window decorations: Fixed layout loop, which may occur under special
|
||||
circumstances and slows down the application. (issue #420)
|
||||
|
||||
|
||||
## 1.6.1
|
||||
|
||||
#### Fixed bugs
|
||||
|
||||
- Native window decorations: Catch `UnsatisfiedLinkError` when trying to load
|
||||
`jawt.dll` to avoid an application crash (Java 8 on Windows 10 only).
|
||||
|
||||
|
||||
## 1.6
|
||||
|
||||
#### New features and improvements
|
||||
@@ -25,7 +63,7 @@ FlatLaf Change Log
|
||||
- ComboBox (editable): Fixed wrong border of internal text field under special
|
||||
circumstances.
|
||||
- Spinner: Fixed painting of border corners on left side. (issue #382;
|
||||
regression since FlatLaf 1.4)
|
||||
regression since fixing #330 in FlatLaf 1.4)
|
||||
- TableHeader: Do not show resize cursor for last column if resizing last column
|
||||
is not possible because auto resize mode of table is not off. (issue #332)
|
||||
- TableHeader: Fixed missing trailing vertical separator line if used in upper
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
val releaseVersion = "1.6"
|
||||
val releaseVersion = "1.6.3"
|
||||
val developmentVersion = "2.0-SNAPSHOT"
|
||||
|
||||
version = if( java.lang.Boolean.getBoolean( "release" ) ) releaseVersion else developmentVersion
|
||||
|
||||
@@ -264,6 +264,12 @@ public abstract class FlatLaf
|
||||
}
|
||||
};
|
||||
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
||||
|
||||
// make sure that AWT desktop properties are initialized (on Linux)
|
||||
// before invoking toolkit.addPropertyChangeListener()
|
||||
// https://github.com/JFormDesigner/FlatLaf/issues/405#issuecomment-960242342
|
||||
toolkit.getDesktopProperty( "dummy" );
|
||||
|
||||
toolkit.addPropertyChangeListener( desktopPropertyName, desktopPropertyListener );
|
||||
if( desktopPropertyName2 != null )
|
||||
toolkit.addPropertyChangeListener( desktopPropertyName2, desktopPropertyListener );
|
||||
|
||||
@@ -108,7 +108,7 @@ public class FlatCaret
|
||||
protected void selectAllOnFocusGained() {
|
||||
JTextComponent c = getComponent();
|
||||
Document doc = c.getDocument();
|
||||
if( doc == null || !c.isEnabled() || !c.isEditable() )
|
||||
if( doc == null || !c.isEnabled() || !c.isEditable() || FlatUIUtils.isCellEditor( c ) )
|
||||
return;
|
||||
|
||||
Object selectAllOnFocusPolicy = c.getClientProperty( SELECT_ALL_ON_FOCUS_POLICY );
|
||||
|
||||
@@ -495,11 +495,23 @@ public class FlatComboBoxUI
|
||||
c.setBackground( getBackground( enabled ) );
|
||||
c.setForeground( getForeground( enabled ) );
|
||||
|
||||
// make renderer component temporary non-opaque to avoid that renderer paints
|
||||
// background outside of border if combobox uses larger arc for edges
|
||||
// (e.g. FlatClientProperties.COMPONENT_ROUND_RECT is true)
|
||||
boolean oldOpaque = true;
|
||||
if( c instanceof JComponent ) {
|
||||
oldOpaque = ((JComponent)c).isOpaque();
|
||||
((JComponent)c).setOpaque( false );
|
||||
}
|
||||
|
||||
boolean shouldValidate = (c instanceof JPanel);
|
||||
|
||||
paddingBorder.install( c );
|
||||
currentValuePane.paintComponent( g, c, comboBox, bounds.x, bounds.y, bounds.width, bounds.height, shouldValidate );
|
||||
paddingBorder.uninstall();
|
||||
|
||||
if( c instanceof JComponent )
|
||||
((JComponent)c).setOpaque( oldOpaque );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -819,7 +831,7 @@ public class FlatComboBoxUI
|
||||
|
||||
// remember old border and replace it
|
||||
rendererBorder = jc.getBorder();
|
||||
rendererComponent.setBorder( this );
|
||||
jc.setBorder( this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -262,14 +262,22 @@ public class FlatFileChooserUI
|
||||
|
||||
@Override
|
||||
public FileView getFileView( JFileChooser fc ) {
|
||||
return fileView;
|
||||
return doNotUseSystemIcons() ? super.getFileView( fc ) : fileView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearIconCache() {
|
||||
if( doNotUseSystemIcons() )
|
||||
super.clearIconCache();
|
||||
else
|
||||
fileView.clearIconCache();
|
||||
}
|
||||
|
||||
private boolean doNotUseSystemIcons() {
|
||||
// Java 17 32bit craches on Windows when using system icons
|
||||
return SystemInfo.isWindows && SystemInfo.isJava_17_orLater && !SystemInfo.isX86_64;
|
||||
}
|
||||
|
||||
//---- class FlatFileView -------------------------------------------------
|
||||
|
||||
private class FlatFileView
|
||||
|
||||
@@ -508,7 +508,7 @@ public class FlatTitlePane
|
||||
|
||||
protected void menuBarLayouted() {
|
||||
updateNativeTitleBarHeightAndHitTestSpotsLater();
|
||||
revalidate();
|
||||
doLayout();
|
||||
}
|
||||
|
||||
/*debug
|
||||
|
||||
@@ -263,9 +263,19 @@ public class FlatTreeUI
|
||||
boolean isDropRow = isDropRow( row );
|
||||
boolean needsSelectionPainting = (isSelected || isDropRow) && isPaintSelection();
|
||||
|
||||
// do not paint row if editing, except if selection needs painted
|
||||
if( isEditing && !needsSelectionPainting )
|
||||
// do not paint row if editing
|
||||
if( isEditing ) {
|
||||
// paint wide selection
|
||||
// (do not access cell renderer here to avoid side effect
|
||||
// if renderer component is also used as editor component)
|
||||
if( isSelected && isWideSelection() ) {
|
||||
Color oldColor = g.getColor();
|
||||
g.setColor( selectionInactiveBackground );
|
||||
paintWideSelection( g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf );
|
||||
g.setColor( oldColor );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
boolean hasFocus = FlatUIUtils.isPermanentFocusOwner( tree );
|
||||
boolean cellHasFocus = hasFocus && (row == getLeadSelectionRow());
|
||||
@@ -322,14 +332,7 @@ public class FlatTreeUI
|
||||
|
||||
if( isWideSelection() ) {
|
||||
// wide selection
|
||||
g.fillRect( 0, bounds.y, tree.getWidth(), bounds.height );
|
||||
|
||||
// paint expand/collapse icon
|
||||
// (was already painted before, but painted over with wide selection)
|
||||
if( shouldPaintExpandControl( path, row, isExpanded, hasBeenExpanded, isLeaf ) ) {
|
||||
paintExpandControl( g, clipBounds, insets, bounds,
|
||||
path, row, isExpanded, hasBeenExpanded, isLeaf );
|
||||
}
|
||||
paintWideSelection( g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf );
|
||||
} else {
|
||||
// non-wide selection
|
||||
paintCellBackground( g, rendererComponent, bounds );
|
||||
@@ -353,7 +356,6 @@ public class FlatTreeUI
|
||||
}
|
||||
|
||||
// paint renderer
|
||||
if( !isEditing )
|
||||
rendererPane.paintComponent( g, rendererComponent, tree, bounds.x, bounds.y, bounds.width, bounds.height, true );
|
||||
|
||||
// restore background selection color and border selection color
|
||||
@@ -363,6 +365,19 @@ public class FlatTreeUI
|
||||
((DefaultTreeCellRenderer)rendererComponent).setBorderSelectionColor( oldBorderSelectionColor );
|
||||
}
|
||||
|
||||
private void paintWideSelection( Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds,
|
||||
TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf )
|
||||
{
|
||||
g.fillRect( 0, bounds.y, tree.getWidth(), bounds.height );
|
||||
|
||||
// paint expand/collapse icon
|
||||
// (was already painted before, but painted over with wide selection)
|
||||
if( shouldPaintExpandControl( path, row, isExpanded, hasBeenExpanded, isLeaf ) ) {
|
||||
paintExpandControl( g, clipBounds, insets, bounds,
|
||||
path, row, isExpanded, hasBeenExpanded, isLeaf );
|
||||
}
|
||||
}
|
||||
|
||||
private void paintCellBackground( Graphics g, Component rendererComponent, Rectangle bounds ) {
|
||||
int xOffset = 0;
|
||||
int imageOffset = 0;
|
||||
|
||||
@@ -96,6 +96,11 @@ class FlatWindowsNativeWindowBorder
|
||||
// Java 9 and later does not have this problem.
|
||||
try {
|
||||
System.loadLibrary( "jawt" );
|
||||
} catch( UnsatisfiedLinkError ex ) {
|
||||
// log error only if native library jawt.dll not already loaded
|
||||
String message = ex.getMessage();
|
||||
if( message == null || !message.contains( "already loaded in another classloader" ) )
|
||||
LoggingFacade.INSTANCE.logSevere( null, ex );
|
||||
} catch( Exception ex ) {
|
||||
LoggingFacade.INSTANCE.logSevere( null, ex );
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ public class SystemInfo
|
||||
public static final boolean isJava_9_orLater;
|
||||
public static final boolean isJava_11_orLater;
|
||||
public static final boolean isJava_15_orLater;
|
||||
/** @since 2 */ public static final boolean isJava_17_orLater;
|
||||
|
||||
// Java VMs
|
||||
public static final boolean isJetBrainsJVM;
|
||||
@@ -82,6 +83,7 @@ public class SystemInfo
|
||||
isJava_9_orLater = (javaVersion >= toVersion( 9, 0, 0, 0 ));
|
||||
isJava_11_orLater = (javaVersion >= toVersion( 11, 0, 0, 0 ));
|
||||
isJava_15_orLater = (javaVersion >= toVersion( 15, 0, 0, 0 ));
|
||||
isJava_17_orLater = (javaVersion >= toVersion( 17, 0, 0, 0 ));
|
||||
|
||||
// Java VMs
|
||||
isJetBrainsJVM = System.getProperty( "java.vm.vendor", "Unknown" )
|
||||
|
||||
@@ -34,7 +34,7 @@ public class FlatCustomBordersTest
|
||||
private static final Color RED = new Color( 0x60ff0000, true );
|
||||
private static final Color GREEN = new Color( 0x6000ff00, true );
|
||||
private static final Color MAGENTA = new Color( 0x60ff00ff, true );
|
||||
private static final Color ORANGE = new Color( 0x60ffc800, true );
|
||||
private static final Color BLUE = new Color( 0x300000ff, true );
|
||||
|
||||
public static void main( String[] args ) {
|
||||
SwingUtilities.invokeLater( () -> {
|
||||
@@ -127,7 +127,7 @@ public class FlatCustomBordersTest
|
||||
@SuppressWarnings( "unchecked" )
|
||||
private void applySpecialComboBoxRenderers() {
|
||||
BasicComboBoxRenderer sharedRenderer = new BasicComboBoxRenderer();
|
||||
sharedRenderer.setBorder( new LineBorder( ORANGE, UIScale.scale( 2 ) ) );
|
||||
sharedRenderer.setBorder( new LineBorder( BLUE, UIScale.scale( 2 ) ) );
|
||||
comboBox29.setRenderer( sharedRenderer );
|
||||
comboBox30.setRenderer( sharedRenderer );
|
||||
|
||||
@@ -160,7 +160,7 @@ public class FlatCustomBordersTest
|
||||
}
|
||||
|
||||
private void applyCustomComboBoxEditorBorder( JComboBox<String> comboBox ) {
|
||||
applyCustomComboBoxEditorBorder( comboBox, new LineBorder( ORANGE, UIScale.scale( 6 ) ) );
|
||||
applyCustomComboBoxEditorBorder( comboBox, new LineBorder( BLUE, UIScale.scale( 6 ) ) );
|
||||
}
|
||||
|
||||
private void applyCustomComboBoxEditorBorderWithIcon( JComboBox<String> comboBox ) {
|
||||
@@ -180,7 +180,7 @@ public class FlatCustomBordersTest
|
||||
}
|
||||
|
||||
private void applyCustomComboBoxRendererBorder( JComboBox<String> comboBox ) {
|
||||
applyCustomComboBoxRendererBorder( comboBox, new LineBorder( ORANGE, UIScale.scale( 6 ) ) );
|
||||
applyCustomComboBoxRendererBorder( comboBox, new LineBorder( BLUE, UIScale.scale( 6 ) ) );
|
||||
}
|
||||
|
||||
private void applyCustomComboBoxRendererBorderWithIcon( JComboBox<String> comboBox ) {
|
||||
|
||||
Reference in New Issue
Block a user