本文整理汇总了Java中com.intellij.ui.JBColor.foreground方法的典型用法代码示例。如果您正苦于以下问题:Java JBColor.foreground方法的具体用法?Java JBColor.foreground怎么用?Java JBColor.foreground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.JBColor
的用法示例。
在下文中一共展示了JBColor.foreground方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintComponent
import com.intellij.ui.JBColor; //导入方法依赖的package包/类
@Override
public void paintComponent(final Graphics g) {
long result;
synchronized (this) {
checkForTimeJump(true);
result = state.totalTimeSeconds + runningForSeconds();
}
final String info = formatDuration(result);
final Dimension size = getSize();
final Insets insets = getInsets();
final int totalBarLength = size.width - insets.left - insets.right;
final int barHeight = Math.max(size.height, getFont().getSize() + 2);
final int yOffset = (size.height - barHeight) / 2;
final int xOffset = insets.left;
g.setColor(running ? COLOR_ON : (idle ? COLOR_IDLE : COLOR_OFF));
g.fillRect(insets.left, insets.bottom, totalBarLength, size.height - insets.bottom - insets.top);
final Color fg = getModel().isPressed() ? UIUtil.getLabelDisabledForeground() : JBColor.foreground();
g.setColor(fg);
UISettings.setupAntialiasing(g);
g.setFont(getWidgetFont());
final FontMetrics fontMetrics = g.getFontMetrics();
final int infoWidth = fontMetrics.charsWidth(info.toCharArray(), 0, info.length());
final int infoHeight = fontMetrics.getAscent();
g.drawString(info, xOffset + (totalBarLength - infoWidth) / 2, yOffset + infoHeight + (barHeight - infoHeight) / 2 - 1);
}
示例2: determineColors
import com.intellij.ui.JBColor; //导入方法依赖的package包/类
private void determineColors() {
switch (getWindowDecorationStyle()) {
case JRootPane.FRAME:
myActiveBackground = UIManager.getColor("activeCaption");
myActiveForeground = UIManager.getColor("activeCaptionText");
myActiveShadow = UIManager.getColor("activeCaptionBorder");
break;
case JRootPane.ERROR_DIALOG:
myActiveBackground = new Color(43, 43, 43);//UIManager.getColor("OptionPane.errorDialog.titlePane.background");
myActiveForeground = UIManager.getColor("OptionPane.errorDialog.titlePane.foreground");
myActiveShadow = UIManager.getColor("OptionPane.errorDialog.titlePane.shadow");
break;
case JRootPane.QUESTION_DIALOG:
case JRootPane.COLOR_CHOOSER_DIALOG:
case JRootPane.FILE_CHOOSER_DIALOG:
myActiveBackground = new Color(43, 43, 43);//UIManager.getColor("OptionPane.questionDialog.titlePane.background");
myActiveForeground = UIManager.getColor("OptionPane.questionDialog.titlePane.foreground");
myActiveShadow = UIManager.getColor("OptionPane.questionDialog.titlePane.shadow");
break;
case JRootPane.WARNING_DIALOG:
myActiveBackground = new Color(43, 43, 43);//UIManager.getColor("OptionPane.warningDialog.titlePane.background");
myActiveForeground = UIManager.getColor("OptionPane.warningDialog.titlePane.foreground");
myActiveShadow = UIManager.getColor("OptionPane.warningDialog.titlePane.shadow");
break;
case JRootPane.PLAIN_DIALOG:
case JRootPane.INFORMATION_DIALOG:
default:
myActiveBackground = new Color(43, 43, 43);//UIManager.getColor("activeCaption");
myActiveForeground = UIManager.getColor("activeCaptionText");
myActiveShadow = UIManager.getColor("activeCaptionBorder");
break;
}
myActiveBackground = new Color(43, 43, 43);//UIManager.getColor("activeCaption");
myActiveForeground = JBColor.foreground();//UIManager.getColor("activeCaptionText");
myActiveShadow = UIManager.getColor("activeCaptionBorder");
}
示例3: getForeground
import com.intellij.ui.JBColor; //导入方法依赖的package包/类
@Override
public Color getForeground() {
if (getModel().isSelected()) {
return JBColor.foreground();
}
else if (getModel().isRollover()) {
return JBColor.GRAY;
}
else {
return getColor();
}
}
示例4: FocusableHyperlinkLabel
import com.intellij.ui.JBColor; //导入方法依赖的package包/类
FocusableHyperlinkLabel(String text, Icon icon) {
super(text, JBColor.foreground(), JBColor.background(), JBColor.foreground());
setIcon(icon);
setOpaque(false);
setUseIconAsLink(true);
}