private void updateSelection(JTable table, Component comp, boolean isSelected) { if (comp instanceof RSyntaxTextArea) { if (isSelected) { comp.setBackground(codeSelectedColor); } else { comp.setBackground(codeBackground); } } else { if (isSelected) { comp.setBackground(table.getSelectionBackground()); comp.setForeground(table.getSelectionForeground()); } else { comp.setBackground(table.getBackground()); comp.setForeground(table.getForeground()); } } }
if ("active".equals(status)) { c.setBackground(Color.BLACK); c.setForeground(Color.WHITE); } else { c.setBackground(super.getBackground()); c.setForeground(super.getForeground());
if (enabledFlags[index]) { if (isSelected & cellHasFocus) { comp.setForeground(Color.black); comp.setBackground(Color.red); } else { comp.setForeground(Color.blue); comp.setForeground(Color.orange); comp.setBackground(Color.magenta);
boolean type1 = (Boolean) getModel().getValueAt(modelRow, 3); boolean type2 = (Boolean) getModel().isCellEditable(row, column); comp.setForeground(Color.black); if ((type) && (!type1)) { comp.setBackground(Color.yellow); comp.setForeground(Color.blue); comp.setBackground(Color.lightGray); comp.setForeground(Color.red); comp.setBackground(Color.magenta);
if (selected) { component.setFont(component.getFont().deriveFont(Font.BOLD)); component.setForeground(Color.red); } else { component.setFont(component.getFont().deriveFont(Font.PLAIN));
class TableRendererExample extends DefaultTableCellRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (column == 1) { c.setForeground(Color.gray); } return c; } }
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component cellComponent = super.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, column); cellComponent.setForeground(isMyConditionFullfilled(value) ? Color.GREEN : Color.RED); return cellComponent; }
if (MediatorGui.tabConsoles().getSelectedIndex() != tabIndex) { tabHeader.setFont(tabHeader.getFont().deriveFont(Font.BOLD)); tabHeader.setForeground(color);
if (currentTabHeader != null) { currentTabHeader.setFont(currentTabHeader.getFont().deriveFont(Font.PLAIN)); currentTabHeader.setForeground(Color.BLACK);
@Override public Component add(Component comp, int index) { comp.setForeground(null); comp.setBackground(null); return super.add(comp, index); }
@Override public Component add(Component comp) { comp.setForeground(null); comp.setBackground(null); return super.add(comp); } }
public void setForeground(Color c) { if (comp != null) { //Can be called from setUI in superclass constructor comp.setForeground(c); } super.setForeground(c); }
public void setForeground(Color c) { if (inner != null) { inner.setForeground(c); } super.setForeground(c); }
/** * Set the foreground color of the TreeTableCellPanel and node component. */ @Override public void setForeground(Color fg) { super.setForeground(fg); if (nodeComponent != null) nodeComponent.setForeground(fg); }
public void setForeground(Color c) { if (comp != null) { //Can be called from setUI in superclass constructor comp.setForeground(c); } super.setForeground(c); }
private void setNormal(Component label) { label.setBackground(originalCellBGColor); label.setForeground(Color.BLACK); label.setFont(label.getFont().deriveFont(Font.PLAIN)); }
public void setForeground(Color col) { super.setForeground(col); Component[] c = getComponents(); for (int i = 0; i < c.length; i++) { c[i].setForeground(col); } }
@Override protected void applyForeground(Component renderer, ComponentAdapter adapter) { if (!adapter.isSelected()) { Object colorMemory = ((JComponent) renderer).getClientProperty("rendererColorMemory.foreground"); if (colorMemory instanceof ColorMemory) { renderer.setForeground(((ColorMemory) colorMemory).color); } else { ((JComponent) renderer).putClientProperty("rendererColorMemory.foreground", new ColorMemory(renderer.getForeground())); } } }
/** Overridden to set the colors apropriately - we always want the editor * to appear selected */ public Component prepareEditor(TableCellEditor editor, int row, int col) { Component result = editor.getTableCellEditorComponent(this, getValueAt(row, col), false, row, col); if (result != null) { result.setBackground(getSelectionBackground()); result.setForeground(getSelectionForeground()); result.setFont(getFont()); } return result; }
private void updateSelectedTabForeground() { if (UIUtil.isUnderAquaLookAndFeel() && SystemInfo.isMacOSLion) { if (getSelectedIndex() != -1 && getTabComponentAt(getSelectedIndex()) != null) { getTabComponentAt(getSelectedIndex()).setForeground(Color.WHITE); } if (previousSelectedIndex != -1 && getTabComponentAt(previousSelectedIndex) != null) { getTabComponentAt(previousSelectedIndex).setForeground(JBColor.foreground()); } } }