mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 23:37:13 -06:00
ComboBox: fixed StackOverflowError when switching LaF (#14)
This commit is contained in:
@@ -8,6 +8,7 @@ FlatLaf Change Log
|
|||||||
- OptionPane: Fixed rendering of longer HTML text. (issue #12)
|
- OptionPane: Fixed rendering of longer HTML text. (issue #12)
|
||||||
- EditorPane and TextPane: Fixed font and text color when using HTML content.
|
- EditorPane and TextPane: Fixed font and text color when using HTML content.
|
||||||
(issue #9)
|
(issue #9)
|
||||||
|
- ComboBox: Fixed `StackOverflowError` when switching LaF. (issue #14)
|
||||||
- SwingX: Support `JXBusyLabel`, `JXDatePicker`, `JXHeader`, `JXHyperlink`,
|
- SwingX: Support `JXBusyLabel`, `JXDatePicker`, `JXHeader`, `JXHyperlink`,
|
||||||
`JXMonthView`, `JXTaskPaneContainer` and `JXTaskPane`. (issue #8)
|
`JXMonthView`, `JXTaskPaneContainer` and `JXTaskPane`. (issue #8)
|
||||||
|
|
||||||
|
|||||||
@@ -368,9 +368,9 @@ public class FlatComboBoxUI
|
|||||||
@SuppressWarnings( { "rawtypes", "unchecked" } )
|
@SuppressWarnings( { "rawtypes", "unchecked" } )
|
||||||
private class FlatComboPopup
|
private class FlatComboPopup
|
||||||
extends BasicComboPopup
|
extends BasicComboPopup
|
||||||
implements ListCellRenderer
|
|
||||||
{
|
{
|
||||||
private CellPaddingBorder paddingBorder;
|
private CellPaddingBorder paddingBorder;
|
||||||
|
private final ListCellRenderer renderer = new PopupListCellRenderer();
|
||||||
|
|
||||||
FlatComboPopup( JComboBox combo ) {
|
FlatComboPopup( JComboBox combo ) {
|
||||||
super( combo );
|
super( combo );
|
||||||
@@ -405,7 +405,7 @@ public class FlatComboBoxUI
|
|||||||
protected void configureList() {
|
protected void configureList() {
|
||||||
super.configureList();
|
super.configureList();
|
||||||
|
|
||||||
list.setCellRenderer( this );
|
list.setCellRenderer( renderer );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -416,27 +416,33 @@ public class FlatComboBoxUI
|
|||||||
super.propertyChange( e );
|
super.propertyChange( e );
|
||||||
|
|
||||||
if( e.getPropertyName() == "renderer" )
|
if( e.getPropertyName() == "renderer" )
|
||||||
list.setCellRenderer( FlatComboPopup.this );
|
list.setCellRenderer( renderer );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
//---- class PopupListCellRenderer -----
|
||||||
public Component getListCellRendererComponent( JList list, Object value,
|
|
||||||
int index, boolean isSelected, boolean cellHasFocus )
|
private class PopupListCellRenderer
|
||||||
|
implements ListCellRenderer
|
||||||
{
|
{
|
||||||
ListCellRenderer renderer = comboBox.getRenderer();
|
@Override
|
||||||
CellPaddingBorder.uninstall( renderer );
|
public Component getListCellRendererComponent( JList list, Object value,
|
||||||
|
int index, boolean isSelected, boolean cellHasFocus )
|
||||||
|
{
|
||||||
|
ListCellRenderer renderer = comboBox.getRenderer();
|
||||||
|
CellPaddingBorder.uninstall( renderer );
|
||||||
|
|
||||||
Component c = renderer.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus );
|
Component c = renderer.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus );
|
||||||
|
|
||||||
if( c instanceof JComponent ) {
|
if( c instanceof JComponent ) {
|
||||||
if( paddingBorder == null )
|
if( paddingBorder == null )
|
||||||
paddingBorder = new CellPaddingBorder( padding );
|
paddingBorder = new CellPaddingBorder( padding );
|
||||||
paddingBorder.install( (JComponent) c );
|
paddingBorder.install( (JComponent) c );
|
||||||
|
}
|
||||||
|
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user