diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9b8aa99..60a2ce19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index dc868857..8d15eca2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,8 +59,13 @@ FlatLaf Change Log `InputStream`. (issues #419 and #325) - `FlatSVGUtils`: Support loading SVG from `URL` (for JPMS). (issue #325) + +## 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) diff --git a/build.gradle.kts b/build.gradle.kts index d1401962..d9b018d8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,7 +14,7 @@ * limitations under the License. */ -val releaseVersion = "1.6.2" +val releaseVersion = "1.6.3" val developmentVersion = "2.0-SNAPSHOT" version = if( java.lang.Boolean.getBoolean( "release" ) ) releaseVersion else developmentVersion diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java index 89352d87..e6cc5773 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java @@ -575,22 +575,6 @@ public class FlatComboBoxUI @Override @SuppressWarnings( "unchecked" ) 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(); ListCellRenderer renderer = comboBox.getRenderer(); @@ -604,11 +588,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 diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatCustomBordersTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatCustomBordersTest.java index fecc5730..2d2bd064 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatCustomBordersTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatCustomBordersTest.java @@ -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 comboBox ) { - applyCustomComboBoxEditorBorder( comboBox, new LineBorder( ORANGE, UIScale.scale( 6 ) ) ); + applyCustomComboBoxEditorBorder( comboBox, new LineBorder( BLUE, UIScale.scale( 6 ) ) ); } private void applyCustomComboBoxEditorBorderWithIcon( JComboBox comboBox ) { @@ -180,7 +180,7 @@ public class FlatCustomBordersTest } private void applyCustomComboBoxRendererBorder( JComboBox comboBox ) { - applyCustomComboBoxRendererBorder( comboBox, new LineBorder( ORANGE, UIScale.scale( 6 ) ) ); + applyCustomComboBoxRendererBorder( comboBox, new LineBorder( BLUE, UIScale.scale( 6 ) ) ); } private void applyCustomComboBoxRendererBorderWithIcon( JComboBox comboBox ) {