public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus){ String s = (String)value; this.setText(getCountryText(s)); this.setIcon(getCountryIcon(s)); this.setEnabled(list.isEnabled()); this.setFont(list.getFont()); if (isSelected) { this.setBackground(list.getSelectionBackground()); this.setForeground(list.getSelectionForeground()); } else { this.setBackground(list.getBackground()); this.setForeground(list.getForeground()); } return this; } }
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus){ String s = (String)value; this.setText(getCountryText(s)); this.setIcon(getCountryIcon(s)); this.setEnabled(list.isEnabled()); this.setFont(list.getFont()); if (isSelected) { this.setBackground(list.getSelectionBackground()); this.setForeground(list.getSelectionForeground()); } else { this.setBackground(list.getBackground()); this.setForeground(list.getForeground()); } return this; } }