本文整理匯總了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;
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}