Java Code Examples for com.intellij.util.ui.UIUtil#TRANSPARENT_COLOR

The following examples show how to use com.intellij.util.ui.UIUtil#TRANSPARENT_COLOR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BooleanTableCellRenderer.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSel, boolean hasFocus, int row, int column) {
  final Color bg = UIUtil.isUnderNimbusLookAndFeel() && row % 2 == 1 ? UIUtil.TRANSPARENT_COLOR : table.getBackground();
  final Color fg = table.getForeground();
  final Color selBg = table.getSelectionBackground();
  final Color selFg = table.getSelectionForeground();

  if (value == null) {
    myPanel.setBackground(isSel ? selBg : bg);
    return myPanel;
  }

  setForeground(isSel ? selFg : fg);
  setBackground(isSel ? selBg : bg);

  if (value instanceof String) {
    setSelected(Boolean.parseBoolean((String)value));
  }
  else {
    setSelected(((Boolean)value).booleanValue());
  }
  setEnabled(table.isCellEditable(row, column));
  return this;
}
 
Example 2
Source File: ThreeStateCheckBoxRenderer.java    From consulo with Apache License 2.0 6 votes vote down vote up
private JCheckBox tune(final Object value, final boolean isSelected, final int row, final JTable table) {
  final Color bg = UIUtil.isUnderNimbusLookAndFeel() && row % 2 == 1 ? UIUtil.TRANSPARENT_COLOR : table.getBackground();
  final Color fg = table.getForeground();
  final Color selBg = table.getSelectionBackground();
  final Color selFg = table.getSelectionForeground();

  setForeground(isSelected ? selFg : fg);
  setBackground(isSelected ? selBg : bg);

  if (value == null) {
    setState(State.DONT_CARE);
  } else {
    setSelected((Boolean) value);
  }
  return this;
}