List of usage examples for javax.swing JList isEnabled
public boolean isEnabled()
From source file:Main.java
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { setEnabled(list.isEnabled()); setSelected(((CheckListItem) value).isSelected()); setFont(list.getFont());//from w w w .j a va 2 s . c om setBackground(list.getBackground()); setForeground(list.getForeground()); setText(value.toString()); return this; }
From source file:de.unidue.inf.is.ezdl.gframedl.components.checkboxlist.CheckBoxListCellRenderer.java
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { choice.setEnabled(list.isEnabled()); choice.setSelected(((CheckBoxListItem) value).isSelected()); choice.setFont(list.getFont());//from www.jav a2s.c om choice.setText("<html>" + highlight(value.toString(), false) + "</html>"); description.setFont(list.getFont()); String text = ((CheckBoxListItem) value).getDescription(); ImageIcon icon = ((CheckBoxListItem) value).getIcon(); this.iconLabel.setIcon(icon); description.setText(text); shortenDescription(); int type = index % 2; if (isSelected && type == 0) { type = EVEN_SELECTED; } if (isSelected && type == 1) { type = ODD_SELECTED; } switch (type) { case ODD_SELECTED: { paintCell(Color.WHITE, SELECTION); break; } case EVEN_SELECTED: { paintCell(Color.WHITE, SELECTION); break; } case ODD: { paintCell(Color.BLACK, HIGHLIGHT); break; } case EVEN: { paintCell(Color.BLACK, Color.WHITE); break; } } return panel; }