Skip to content

Commit 1db986b

Browse files
committed
Now the Chart Colors combobox looks correct when disabled.
1 parent 864b63a commit 1db986b

File tree

1 file changed

+7
-2
lines changed
  • EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/control

1 file changed

+7
-2
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/control/ControlPanel.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -796,17 +796,22 @@ JComboBox<ColorScheme> getChartColorsCombo() {
796796
ColorScheme value, int index, boolean isSelected, boolean cellHasFocus) -> {
797797
String bg = isSelected ? "Table.selectionBackground" : "Table.background";
798798
String fg = isSelected ? "Table.selectionForeground" : "Table.foreground";
799+
800+
if (!chartColorsCombo.isEnabled())
801+
fg = "ComboBox.disabledForeground";
802+
799803
cell.setBackground(UIManager.getColor(bg));
800804
nameLabel.setForeground(UIManager.getColor(fg));
801805

802806
nameLabel.setText(value != null ? value.getName() : " ");
803807
cell.setToolTipText(value != null ? value.getDescription() : null);
804808

805-
List<Color> colors = value != null ? value.getColors() : Collections.emptyList();
809+
List<Color> colors = value != null && chartColorsCombo.isEnabled() ?
810+
value.getColors() : Collections.emptyList();
806811

807812
for (int i = 0; i < 3; i++) {
808813
colorLabels[i].setBackground(colors.size() > 2 ? colors.get(i) : cell.getBackground());
809-
colorLabels[i].setVisible(value != null);
814+
colorLabels[i].setVisible(value != null && chartColorsCombo.isEnabled());
810815
}
811816

812817
cell.revalidate();

0 commit comments

Comments
 (0)