mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
mod: combobox does not support alternate row color
This commit is contained in:
@@ -28,6 +28,7 @@ import java.awt.event.FocusEvent;
|
|||||||
import java.awt.event.FocusListener;
|
import java.awt.event.FocusListener;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import javax.swing.DefaultComboBoxModel;
|
||||||
import javax.swing.DefaultListCellRenderer;
|
import javax.swing.DefaultListCellRenderer;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JList;
|
import javax.swing.JList;
|
||||||
@@ -309,15 +310,6 @@ public class FlatListUI
|
|||||||
dataModel.getElementAt( row ), row, isSelected,
|
dataModel.getElementAt( row ), row, isSelected,
|
||||||
FlatUIUtils.isPermanentFocusOwner( list ) && (row == leadIndex) );
|
FlatUIUtils.isPermanentFocusOwner( list ) && (row == leadIndex) );
|
||||||
|
|
||||||
if( alternateRowColor != null && row % 2 != 0 ) {
|
|
||||||
g.setColor( alternateRowColor );
|
|
||||||
|
|
||||||
// paint respecting selection arc
|
|
||||||
final float arc = UIScale.scale( selectionArc / 2f );
|
|
||||||
FlatUIUtils.paintSelection( (Graphics2D) g, 0, rowBounds.y, list.getWidth(), rowBounds.height,
|
|
||||||
UIScale.scale( selectionInsets ), arc, arc, arc, arc, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
boolean isFileList = Boolean.TRUE.equals( list.getClientProperty( "List.isFileList" ) );
|
boolean isFileList = Boolean.TRUE.equals( list.getClientProperty( "List.isFileList" ) );
|
||||||
int cx, cw;
|
int cx, cw;
|
||||||
@@ -332,6 +324,18 @@ public class FlatListUI
|
|||||||
cw = rowBounds.width;
|
cw = rowBounds.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// filelist/combobox does not support alternate row color
|
||||||
|
if( !isFileList && !(dataModel instanceof DefaultComboBoxModel) ) {
|
||||||
|
if( alternateRowColor != null && row % 2 != 0 ) {
|
||||||
|
g.setColor( alternateRowColor );
|
||||||
|
|
||||||
|
// paint respecting selection arc
|
||||||
|
final float arc = UIScale.scale( selectionArc / 2f );
|
||||||
|
FlatUIUtils.paintSelection( (Graphics2D) g, 0, rowBounds.y, list.getWidth(), rowBounds.height,
|
||||||
|
UIScale.scale( selectionInsets ), arc, arc, arc, arc, 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// rounded selection or selection insets
|
// rounded selection or selection insets
|
||||||
if( isSelected &&
|
if( isSelected &&
|
||||||
!isFileList && // rounded selection is not supported for file list
|
!isFileList && // rounded selection is not supported for file list
|
||||||
|
|||||||
Reference in New Issue
Block a user