當前位置: 首頁>>代碼示例>>Java>>正文


Java UIUtil.getTableSelectionForeground方法代碼示例

本文整理匯總了Java中com.intellij.util.ui.UIUtil.getTableSelectionForeground方法的典型用法代碼示例。如果您正苦於以下問題:Java UIUtil.getTableSelectionForeground方法的具體用法?Java UIUtil.getTableSelectionForeground怎麽用?Java UIUtil.getTableSelectionForeground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.util.ui.UIUtil的用法示例。


在下文中一共展示了UIUtil.getTableSelectionForeground方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTreeCellRendererComponent

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@NotNull
@Override
public Component getTreeCellRendererComponent(@NotNull JTree tree,
                                              Object value,
                                              boolean selected,
                                              boolean expanded,
                                              boolean leaf,
                                              int row,
                                              boolean hasFocus) {
  if (value instanceof MyTreeNode) {
    MyTreeNode node = (MyTreeNode)value;
    myLabel.setText(getRenamedTitle(node.getKey().field.getName(), node.getText()));
    myLabel.setFont(myLabel.getFont().deriveFont(node.getKey().groupName == null ? Font.BOLD : Font.PLAIN));
    myLabel.setEnabled(node.isEnabled());
  }
  else {
    myLabel.setText(getRenamedTitle(value.toString(), value.toString()));
    myLabel.setFont(myLabel.getFont().deriveFont(Font.BOLD));
    myLabel.setEnabled(true);
  }

  Color foreground = selected ? UIUtil.getTableSelectionForeground() : UIUtil.getTableForeground();
  myLabel.setForeground(foreground);

  return myLabel;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:OptionTableWithPreviewPanel.java

示例2: customizeCellRenderer

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
protected void customizeCellRenderer(JTable table, Object value, boolean selected) {
  myPanel.removeAll();
  myPanel.setBackground(null);
  myRenderer.clear();
  myRenderer.setBackground(null);

  // 7-8, a hack
  if (value instanceof SvnChangeList) {
    final SvnChangeList changeList = (SvnChangeList)value;
    myRenderer.renderChangeList(table, changeList);

    final Color bg = selected ? UIUtil.getTableSelectionBackground() : UIUtil.getTableBackground();
    final Color fg = selected ? UIUtil.getTableSelectionForeground() : UIUtil.getTableForeground();

    myRenderer.setBackground(bg);
    myRenderer.setForeground(fg);
    myCheckBox.setBackground(bg);
    myCheckBox.setForeground(fg);

    myPanel.setBackground(bg);
    myPanel.setForeground(fg);

    myCheckBox.setSelected(myWiseSelection.isSelected(changeList.getNumber()));
    myPanel.add(myCheckBox, BorderLayout.WEST);
    myPanel.add(myRenderer, BorderLayout.CENTER);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:ToBeMergedDialog.java

示例3: getTableCellRendererComponent

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public Component getTableCellRendererComponent(final JTable table, Object value, boolean isSelected, boolean hasFocus, final int row, final int column) {
  final DirDiffTableModel model = (DirDiffTableModel)table.getModel();
  final DirDiffElementImpl element = model.getElementAt(row);
  if (element == null) return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
  final int modelColumn = table.convertColumnIndexToModel(column);

  if (element.isSeparator()) {
    return new SimpleColoredComponent() {
      {
        setIcon(ObjectUtils.chooseNotNull(element.getSourceIcon(), element.getTargetIcon()));
        append(element.getName());
      }
      @Override
      protected void doPaint(Graphics2D g) {
        int offset = 0;
        int i = 0;
        final TableColumnModel columnModel = table.getColumnModel();
        while (i < column) {
          offset += columnModel.getColumn(i).getWidth();
          i++;
        }
        g.translate(-offset, 0);
        super.doPaint(g);
        g.translate(offset, 0);
      }
    };
  }
  final Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
  if (c instanceof JLabel) {
    final JLabel label = (JLabel)c;
    Border border = label.getBorder();
    if ((hasFocus || isSelected) && border != null) {
      label.setBorder(new EmptyBorder(border.getBorderInsets(label)));
    }
    label.setIcon(null);

    final DirDiffOperation op = element.getOperation();
    if (modelColumn == (table.getColumnCount() - 1) / 2) {
      label.setIcon(op.getIcon());
      label.setHorizontalAlignment(CENTER);
      return label;
    }

    Color fg = isSelected ? UIUtil.getTableSelectionForeground() : op.getTextColor();
    label.setForeground(fg);
    final String name = table.getColumnName(column);
    if (DirDiffTableModel.COLUMN_DATE.equals(name)) {
      label.setHorizontalAlignment(CENTER);
    } else if (DirDiffTableModel.COLUMN_SIZE.equals(name)) {
      label.setHorizontalAlignment(RIGHT);
    } else {
      label.setHorizontalAlignment(LEFT);
      final String text = label.getText();
      label.setText("  " + text);
      if (text != null && text.trim().length() > 0) {
        label.setIcon(modelColumn == 0 ? element.getSourceIcon() : element.getTargetIcon());
      }
    }
  }
  return c;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:63,代碼來源:DirDiffTableCellRenderer.java

示例4: updateColors

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private void updateColors(boolean isSelected) {
  Color bg = isSelected ? UIUtil.getTableSelectionBackground() : UIUtil.getTableBackground();
  Color fg = isSelected ? UIUtil.getTableSelectionForeground() : UIUtil.getTableForeground();

  setColors(bg, fg, myPanel, myActionLabel, myDateLabel, mySpacePanel);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:RecentChangesPopup.java

示例5: updateColors

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private void updateColors(boolean isSelected) {
  Color bg = isSelected ? UIUtil.getTableSelectionBackground() : UIUtil.getTableBackground();
  Color fg = isSelected ? UIUtil.getTableSelectionForeground() : UIUtil.getTableForeground();

  setColors(bg, fg, myPanel, myNameLabel);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:SchemesToImportPopup.java


注:本文中的com.intellij.util.ui.UIUtil.getTableSelectionForeground方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。