mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-09 08:15:09 +03:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb70fb4e82 | ||
|
|
2593a43d72 | ||
|
|
e44ff5b72a | ||
|
|
22cb1b50a6 |
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@@ -34,6 +34,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: gradle/wrapper-validation-action@v1
|
- uses: gradle/wrapper-validation-action@v1
|
||||||
|
if: matrix.java == '1.8'
|
||||||
|
|
||||||
- name: Setup Java ${{ matrix.java }}
|
- name: Setup Java ${{ matrix.java }}
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
|
|||||||
10
CHANGELOG.md
10
CHANGELOG.md
@@ -1,6 +1,16 @@
|
|||||||
FlatLaf Change Log
|
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
|
## 1.6.2
|
||||||
|
|
||||||
#### Fixed bugs
|
#### Fixed bugs
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
val releaseVersion = "1.6.2"
|
val releaseVersion = "1.6.3"
|
||||||
val developmentVersion = "2.0-SNAPSHOT"
|
val developmentVersion = "2.0-SNAPSHOT"
|
||||||
|
|
||||||
version = if( java.lang.Boolean.getBoolean( "release" ) ) releaseVersion else developmentVersion
|
version = if( java.lang.Boolean.getBoolean( "release" ) ) releaseVersion else developmentVersion
|
||||||
|
|||||||
@@ -482,22 +482,6 @@ public class FlatComboBoxUI
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings( "unchecked" )
|
@SuppressWarnings( "unchecked" )
|
||||||
public void paintCurrentValue( Graphics g, Rectangle bounds, boolean hasFocus ) {
|
public void paintCurrentValue( Graphics g, Rectangle bounds, boolean hasFocus ) {
|
||||||
// apply clipping using rounded rectangle to avoid that renderer paints
|
|
||||||
// outside of border if combobox uses larger arc for edges
|
|
||||||
// (e.g. FlatClientProperties.COMPONENT_ROUND_RECT is true)
|
|
||||||
FlatBorder border = FlatUIUtils.getOutsideFlatBorder( comboBox );
|
|
||||||
if( border != null ) {
|
|
||||||
int clipArc = border.getArc( comboBox ) - (border.getLineWidth( comboBox ) * 2);
|
|
||||||
if( clipArc > 0 ) {
|
|
||||||
int x = bounds.x;
|
|
||||||
int width = bounds.width + bounds.height;
|
|
||||||
if( !comboBox.getComponentOrientation().isLeftToRight() )
|
|
||||||
x -= bounds.height;
|
|
||||||
((Graphics2D)g).clip( FlatUIUtils.createComponentRectangle(
|
|
||||||
x, bounds.y, width, bounds.height, scale( (float) clipArc ) ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
paddingBorder.uninstall();
|
paddingBorder.uninstall();
|
||||||
|
|
||||||
ListCellRenderer<Object> renderer = comboBox.getRenderer();
|
ListCellRenderer<Object> renderer = comboBox.getRenderer();
|
||||||
@@ -511,11 +495,23 @@ public class FlatComboBoxUI
|
|||||||
c.setBackground( getBackground( enabled ) );
|
c.setBackground( getBackground( enabled ) );
|
||||||
c.setForeground( getForeground( 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);
|
boolean shouldValidate = (c instanceof JPanel);
|
||||||
|
|
||||||
paddingBorder.install( c );
|
paddingBorder.install( c );
|
||||||
currentValuePane.paintComponent( g, c, comboBox, bounds.x, bounds.y, bounds.width, bounds.height, shouldValidate );
|
currentValuePane.paintComponent( g, c, comboBox, bounds.x, bounds.y, bounds.width, bounds.height, shouldValidate );
|
||||||
paddingBorder.uninstall();
|
paddingBorder.uninstall();
|
||||||
|
|
||||||
|
if( c instanceof JComponent )
|
||||||
|
((JComponent)c).setOpaque( oldOpaque );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -263,9 +263,19 @@ public class FlatTreeUI
|
|||||||
boolean isDropRow = isDropRow( row );
|
boolean isDropRow = isDropRow( row );
|
||||||
boolean needsSelectionPainting = (isSelected || isDropRow) && isPaintSelection();
|
boolean needsSelectionPainting = (isSelected || isDropRow) && isPaintSelection();
|
||||||
|
|
||||||
// do not paint row if editing, except if selection needs painted
|
// do not paint row if editing
|
||||||
if( isEditing && !needsSelectionPainting )
|
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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean hasFocus = FlatUIUtils.isPermanentFocusOwner( tree );
|
boolean hasFocus = FlatUIUtils.isPermanentFocusOwner( tree );
|
||||||
boolean cellHasFocus = hasFocus && (row == getLeadSelectionRow());
|
boolean cellHasFocus = hasFocus && (row == getLeadSelectionRow());
|
||||||
@@ -322,14 +332,7 @@ public class FlatTreeUI
|
|||||||
|
|
||||||
if( isWideSelection() ) {
|
if( isWideSelection() ) {
|
||||||
// wide selection
|
// wide selection
|
||||||
g.fillRect( 0, bounds.y, tree.getWidth(), bounds.height );
|
paintWideSelection( g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf );
|
||||||
|
|
||||||
// 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 );
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// non-wide selection
|
// non-wide selection
|
||||||
paintCellBackground( g, rendererComponent, bounds );
|
paintCellBackground( g, rendererComponent, bounds );
|
||||||
@@ -353,8 +356,7 @@ public class FlatTreeUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// paint renderer
|
// paint renderer
|
||||||
if( !isEditing )
|
rendererPane.paintComponent( g, rendererComponent, tree, bounds.x, bounds.y, bounds.width, bounds.height, true );
|
||||||
rendererPane.paintComponent( g, rendererComponent, tree, bounds.x, bounds.y, bounds.width, bounds.height, true );
|
|
||||||
|
|
||||||
// restore background selection color and border selection color
|
// restore background selection color and border selection color
|
||||||
if( oldBackgroundSelectionColor != null )
|
if( oldBackgroundSelectionColor != null )
|
||||||
@@ -363,6 +365,19 @@ public class FlatTreeUI
|
|||||||
((DefaultTreeCellRenderer)rendererComponent).setBorderSelectionColor( oldBorderSelectionColor );
|
((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 ) {
|
private void paintCellBackground( Graphics g, Component rendererComponent, Rectangle bounds ) {
|
||||||
int xOffset = 0;
|
int xOffset = 0;
|
||||||
int imageOffset = 0;
|
int imageOffset = 0;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class FlatCustomBordersTest
|
|||||||
private static final Color RED = new Color( 0x60ff0000, true );
|
private static final Color RED = new Color( 0x60ff0000, true );
|
||||||
private static final Color GREEN = new Color( 0x6000ff00, true );
|
private static final Color GREEN = new Color( 0x6000ff00, true );
|
||||||
private static final Color MAGENTA = new Color( 0x60ff00ff, 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 ) {
|
public static void main( String[] args ) {
|
||||||
SwingUtilities.invokeLater( () -> {
|
SwingUtilities.invokeLater( () -> {
|
||||||
@@ -127,7 +127,7 @@ public class FlatCustomBordersTest
|
|||||||
@SuppressWarnings( "unchecked" )
|
@SuppressWarnings( "unchecked" )
|
||||||
private void applySpecialComboBoxRenderers() {
|
private void applySpecialComboBoxRenderers() {
|
||||||
BasicComboBoxRenderer sharedRenderer = new BasicComboBoxRenderer();
|
BasicComboBoxRenderer sharedRenderer = new BasicComboBoxRenderer();
|
||||||
sharedRenderer.setBorder( new LineBorder( ORANGE, UIScale.scale( 2 ) ) );
|
sharedRenderer.setBorder( new LineBorder( BLUE, UIScale.scale( 2 ) ) );
|
||||||
comboBox29.setRenderer( sharedRenderer );
|
comboBox29.setRenderer( sharedRenderer );
|
||||||
comboBox30.setRenderer( sharedRenderer );
|
comboBox30.setRenderer( sharedRenderer );
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ public class FlatCustomBordersTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void applyCustomComboBoxEditorBorder( JComboBox<String> comboBox ) {
|
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 ) {
|
private void applyCustomComboBoxEditorBorderWithIcon( JComboBox<String> comboBox ) {
|
||||||
@@ -180,7 +180,7 @@ public class FlatCustomBordersTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void applyCustomComboBoxRendererBorder( JComboBox<String> comboBox ) {
|
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 ) {
|
private void applyCustomComboBoxRendererBorderWithIcon( JComboBox<String> comboBox ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user