diff --git a/CHANGELOG.md b/CHANGELOG.md index 97afed73..80ccabbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ FlatLaf Change Log ================== +## 1.6.4 + +#### Fixed bugs + +- ComboBox: Fixed regression in FlatLaf 1.6.3 that makes selected item invisible + in popup list if `DefaultListCellRenderer` is used as renderer. If using + default renderer, it works. (issue #426) + + ## 1.6.3 #### Fixed bugs 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 259fb550..d991ee3a 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 @@ -498,11 +498,8 @@ public class FlatComboBoxUI // 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(); + if( c instanceof JComponent ) ((JComponent)c).setOpaque( false ); - } boolean shouldValidate = (c instanceof JPanel); @@ -511,7 +508,7 @@ public class FlatComboBoxUI paddingBorder.uninstall(); if( c instanceof JComponent ) - ((JComponent)c).setOpaque( oldOpaque ); + ((JComponent)c).setOpaque( true ); } @Override diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.java index d63e1fd4..4756b04f 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.java @@ -1621,6 +1621,7 @@ public class FlatComponentsTest // customRenderer.setBorder( new LineBorder( Color.red ) ); // comboBox1.setRenderer( customRenderer ); // comboBox3.setRenderer( customRenderer ); +// comboBox5.setRenderer( new DefaultListCellRenderer() ); // for testing issue #382 // spinner1.setModel( new SpinnerNumberModel( 0, null, 100, 1 ) );