javax.swing.JTable.getSelectionForeground()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中javax.swing.JTable.getSelectionForeground()方法的一些代码示例,展示了JTable.getSelectionForeground()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTable.getSelectionForeground()方法的具体详情如下:
包路径:javax.swing.JTable
类名称:JTable
方法名:getSelectionForeground

JTable.getSelectionForeground介绍

暂无

代码示例

代码示例来源:origin: skylot/jadx

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());
    }
  }
}

代码示例来源:origin: stackoverflow.com

public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) 
{
    setText((String)value);
    setSize(table.getColumnModel().getColumn(column).getWidth(),getPreferredSize().height);
    setSelectionColor(Color.GREEN);

    if (isSelected)
    {
      setBackground(table.getSelectionBackground());
      setForeground(table.getSelectionForeground());
    }
    else
    {
      setBackground(table.getBackground());
      setForeground(table.getForeground());
    }
    return this;
  }

代码示例来源:origin: magefree/mage

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
  if (hasFocus) {
    renderButton.setForeground(table.getForeground());
    renderButton.setBackground(UIManager.getColor("Button.background"));
  } else if (isSelected) {
    renderButton.setForeground(table.getSelectionForeground());
    renderButton.setBackground(table.getSelectionBackground());
  } else {
    renderButton.setForeground(table.getForeground());
    renderButton.setBackground(UIManager.getColor("Button.background"));
  }
  renderButton.setText((value == null) ? "" : value.toString());
  return renderButton;
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

public Component getTableCellRendererComponent(
  JTable table, Object value, boolean selected, boolean leadSelection, int row, int column
) {
  reset();
  configureFrom(value, table, selected, leadSelection);
  type = Type.TABLE;
  if (swingRendering && selected) {
    setBackground(table.getSelectionBackground());
    setForeground(table.getSelectionForeground());
    setOpaque(true);
  }
  return this;
}

代码示例来源:origin: stackoverflow.com

boolean isSelected, boolean hasFocus, int row, int column) {
if (isSelected) {
  setForeground(table.getSelectionForeground());
  setBackground(table.getSelectionBackground());
} else {
  boolean isSelected, int row, int column) {
if (isSelected) {
  button.setForeground(table.getSelectionForeground());
  button.setBackground(table.getSelectionBackground());
} else {

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

/**
 * {@inheritDoc}
 */
@Override
protected Color getSelectionForeground() {
  return getComponent() != null ? getComponent()
      .getSelectionForeground() : null;
}

代码示例来源:origin: org.jclarion/clarion-runtime

@Override
public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) 
{
  return getCellRenderer(table,value,isSelected,hasFocus,row,column,
      table.getSelectionForeground(),
      table.getSelectionBackground());
}

代码示例来源:origin: protegeproject/protege

@Override
protected void fillPage(Page page, JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
  render(table.getSelectionForeground(), table.getSelectionBackground(), page, value, isSelected);
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
  int width = table.getColumnModel().getColumn(column).getWidth();
  int height = table.getRowHeight(row);
  this.render_col = column;
  this.render_row = row;
  return renderComponent(table, value, row, column, isSelected, width, table.getSelectionBackground(), table.getSelectionForeground());
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
  public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    if (isSelected) {
      this.setForeground(table.getSelectionForeground());
    } else {
      this.setForeground(null);
    }
    return this;
  }
}

代码示例来源:origin: protegeproject/protege

@Override
protected void fillPage(Page page, JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
  Color foreground = isSelected ? table.getSelectionForeground() : table.getForeground();
  Color background = isSelected ? table.getSelectionBackground() : table.getBackground();
  renderCellValue(page, value, foreground, background, isSelected);
}

代码示例来源:origin: edu.stanford.protege/protege-editor-owl

@Override
protected void fillPage(Page page, JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
  Color foreground = isSelected ? table.getSelectionForeground() : table.getForeground();
  Color background = isSelected ? table.getSelectionBackground() : table.getBackground();
  renderCellValue(page, value, foreground, background, isSelected);
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl

@Override
protected void fillPage(Page page, JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
  Color foreground = isSelected ? table.getSelectionForeground() : table.getForeground();
  Color background = isSelected ? table.getSelectionBackground() : table.getBackground();
  renderCellValue(page, value, foreground, background, isSelected);
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

/**
 * {@inheritDoc}
 */
@Override
protected Color getSelectionForeground() {
  Color selection = null;
  if (isDropOn()) {
    selection = getDropCellForeground();
    if (selection != null) return selection;
  }
  return getComponent() != null ? getComponent()
      .getSelectionForeground() : null;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf

@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      JButton button = (JButton)value;
      if (isSelected) {
        button.setForeground(table.getSelectionForeground());
        button.setBackground(table.getSelectionBackground());
      } else {
        button.setForeground(table.getForeground());
        button.setBackground(UIManager.getColor("Button.background"));
      }
      return button;
    }
}

代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-misc-swing

private void setupEditable(JTable table, boolean isSelected) {
  if (isSelected) {
    super.setForeground(table.getSelectionForeground());
    super.setBackground(table.getSelectionBackground());
  } else {
    super.setForeground(unselectedForeground);
    super.setBackground(unselectedBackground);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public Component getTableCellRendererComponent(JTable table, Object value, boolean selected, boolean leadSelection,
                        int row, int column) {
  reset();
  configureFrom (value, table, selected, leadSelection);
  type = TYPE_TABLE;
  if (swingRendering && selected) {
    setBackground (table.getSelectionBackground());
    setForeground (table.getSelectionForeground());
    setOpaque (true);
  }
  return this;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public Component getTableCellRendererComponent(JTable table, Object value, boolean selected, boolean leadSelection,
                        int row, int column) {
  reset();
  configureFrom (value, table, selected, leadSelection);
  type = TYPE_TABLE;
  if (swingRendering && selected) {
    setBackground (table.getSelectionBackground());
    setForeground (table.getSelectionForeground());
    setOpaque (true);
  }
  return this;
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_http

@Override
  public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
      boolean hasFocus, int row, int column) {
    setText((String) value);
    setBackground(isSelected && !hasFocus ? table.getSelectionBackground() : table.getBackground());
    setForeground(isSelected && !hasFocus ? table.getSelectionForeground() : table.getForeground());
    setFont(table.getFont());
    return this;
  }
}

代码示例来源:origin: com.synaptix/SynaptixSwing

public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
  if (isSelected) {
    setBackground(table.getSelectionBackground());
    setForeground(table.getSelectionForeground());
  } else {
    setBackground(table.getBackground());
    setForeground(table.getForeground());
  }
  setValue(value);
  return this;
}

相关文章

JTable类方法