@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } String text; if (value instanceof Node) { Node node = (Node) value; StringBuffer sb = new StringBuffer(); String name = node.getClass().getName().substring(node.getClass().getName().lastIndexOf('.') + 1); if (Proxy.isProxyClass(value.getClass())) { name = value.toString(); } sb.append(name).append(" at line ").append(node.getBeginLine()).append(" column ") .append(node.getBeginColumn()).append(PMD.EOL); text = sb.toString(); } else { text = value.toString(); } setText(text); return this; } }
@Override public Component getListCellRendererComponent(JList<? extends Webcam> list, Webcam webcam, int i, boolean selected, boolean focused) { if (selected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } setText(webcam.getName()); setFont(list.getFont()); return this; } }
} else { testLabel.setBackground(list.getBackground()); testLabel.setForeground(list.getForeground());
/** * Return a component that has been configured to display the specified * value. * * @param list The JList we're painting. * @param value The value returned by list.getModel().getElementAt(index). * @param index The cells index. * @param isSelected True if the specified cell was selected. * @param cellHasFocus True if the specified cell has the focus. * @return A component whose paint() method will render the specified value. */ @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { setText(value.toString()); setSelected(((CheckBoxList) list).getChecked(index)); setBackground(isSelected ? list.getSelectionBackground() : list .getBackground()); setForeground(isSelected ? list.getSelectionForeground() : list .getForeground()); setFocusPainted(false); return this; } }
} else { setBackground(list.getBackground()); setForeground(list.getForeground());
private Color getForeground(RemoteConfiguration remoteConfig, JList list, boolean isSelected) { if (remoteConfig == RunConfigRemote.MISSING_REMOTE_CONFIGURATION || remoteConfig == RunConfigRemote.NO_REMOTE_CONFIGURATION) { return UIManager.getColor("nb.errorForeground"); // NOI18N } return isSelected ? list.getSelectionForeground() : list.getForeground(); }
TreeItemListCellRenderer(final boolean supplySide, final JList list) { super(); _supplySide = supplySide; _defaultBackground = list.getBackground(); _defaultForeground = list.getForeground(); _disabledForeground = Color.gray; _disabledBackground = _defaultBackground; _enabledSelectedBackground = list.getSelectionBackground(); _enabledSelectedForeground = list.getSelectionForeground(); _disabledSelectedBackground = Color.lightGray; _disabledSelectedForeground = Color.darkGray; }
@Override protected void fillPage(final Page page, JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Color foreground = isSelected ? list.getSelectionForeground() : list.getForeground(); Color background = isSelected ? list.getSelectionBackground() : list.getBackground(); renderCellValue(page, value, foreground, background, isSelected); }
@Override protected void fillPage(final Page page, JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Color foreground = isSelected ? list.getSelectionForeground() : list.getForeground(); Color background = isSelected ? list.getSelectionBackground() : list.getBackground(); renderCellValue(page, value, foreground, background, isSelected); }
@Override protected void fillPage(final Page page, JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Color foreground = isSelected ? list.getSelectionForeground() : list.getForeground(); Color background = isSelected ? list.getSelectionBackground() : list.getBackground(); renderCellValue(page, value, foreground, background, isSelected); }
public Renderer(JList list) { setFont(list.getFont()); fgColor = list.getForeground(); bgColor = list.getBackground(); bgColorDarker = new Color( Math.abs(bgColor.getRed() - DARKER_COLOR_COMPONENT), Math.abs(bgColor.getGreen() - DARKER_COLOR_COMPONENT), Math.abs(bgColor.getBlue() - DARKER_COLOR_COMPONENT)); bgSelectionColor = list.getSelectionBackground(); fgSelectionColor = list.getSelectionForeground(); }
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if( !(value instanceof TreeListNode) ) { //shoudln't happen return new JLabel(); } TreeListNode node = (TreeListNode) value; int rowHeight = list.getFixedCellHeight(); Color background = isSelected ? list.getSelectionBackground() : list.getBackground(); Color foreground = isSelected ? list.getSelectionForeground() : list.getForeground(); return node.getRenderer(foreground, background, isSelected, cellHasFocus, rowHeight); } }
@Override public void paintComponent(Graphics g) { Insets i = this.getInsets(); Rectangle box = new Rectangle(i.left, i.top, this.getWidth() - i.right, this.getHeight() - i.bottom); g.setColor(isSelected ? list.getSelectionBackground() : list .getBackground()); g.fillRect(0, 0, this.getWidth(), this.getHeight()); g.setColor(isSelected ? list.getSelectionForeground() : list .getForeground()); e.paintValue(g, box); }
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (value == null) { //apple JDK bug return this; } RailsDatabaseConfiguration dbConf = (RailsDatabaseConfiguration) value; setText(dbConf.getDisplayName()); setForeground(isSelected ? list.getSelectionForeground() : list.getForeground()); setBackground(isSelected ? list.getSelectionBackground() : list.getBackground()); return this; } }
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { setText( Utilities.keySequenceToString( (KeyStroke[])value ) ); setBackground(isSelected ? list.getSelectionBackground() : list.getBackground() ); setForeground(isSelected ? list.getSelectionForeground() : list.getForeground() ); return this; } }
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { RubyInstance server = (RubyInstance) value; if (server != null) { setText(server.getDisplayName()); setForeground(isSelected ? list.getSelectionForeground() : list.getForeground()); setBackground(isSelected ? list.getSelectionBackground() : list.getBackground()); } return this; } }
@Override public Component getListCellRendererComponent( final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus ) { final ListView.Item item = (ListView.Item)value; setFile( item.getFile(), item.getThumbnail() ); setForeground( isSelected ? list.getSelectionForeground() : list.getForeground() ); setBackground( isSelected ? list.getSelectionBackground() : list.getBackground() ); return this; }
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } setValue(value); return this; }
public Component getListCellRendererComponent(JList/*<? extends Block>*/ list, Object/*Block*/ value, int index, boolean isSelected, boolean cellHasFocus) { Block block = (Block)value; setText(block.toString()); setBackground(block.getColor()); setForeground(isSelected ? list.getSelectionForeground() : list.getForeground()); return this; } }
public final Component getListCellRendererComponent (JList _list, Object _value, int _index, boolean _selected, boolean _cellHasFocus) { setTask((BuTask)_value); this.setFont(_list.getFont()); this.setBackground(_list.getBackground()); this.setForeground(_list.getForeground()); return this; } }