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