本文整理汇总了Java中java.awt.SystemColor.controlText方法的典型用法代码示例。如果您正苦于以下问题:Java SystemColor.controlText方法的具体用法?Java SystemColor.controlText怎么用?Java SystemColor.controlText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.SystemColor
的用法示例。
在下文中一共展示了SystemColor.controlText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawBackground
import java.awt.SystemColor; //导入方法依赖的package包/类
public static void drawBackground(Graphics g, ButtonState s) {
Rectangle rect = s.getBounds();
Color bkColor = s.isBackgroundSet() ? s.getBackground() :
SystemColor.control;
g.setColor(bkColor);
g.fillRect(0, 0, rect.width, rect.height);
drawButtonFrame(g, s.getBounds(), s.isPressed());
if (s.isFocused()) {
Color foreColor = s.isTextColorSet() ?
s.getTextColor() :
SystemColor.controlText;
g.setColor(foreColor);
drawFocusRect(g, 3, 3, rect.width - 7, rect.height - 7);
}
}
示例2: getTreeCellRendererComponent
import java.awt.SystemColor; //导入方法依赖的package包/类
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded,
boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
Color colorForeground;
Color colorBackground;
if (sel) {
if (tree.hasFocus()) {
colorBackground = SystemColor.textHighlight;
colorForeground = SystemColor.textHighlightText;
}
else {
colorForeground = SystemColor.controlText;
colorBackground = SystemColor.control;
}
setBackgroundSelectionColor(colorBackground);
}
else {
colorForeground = tree.getForeground();
colorBackground = tree.getBackground();
setBackgroundNonSelectionColor(colorBackground);
}
setForeground(colorForeground);
return this;
}
示例3: drawText
import java.awt.SystemColor; //导入方法依赖的package包/类
public static void drawText(Graphics g, ButtonState s) {
String text = s.getText();
boolean pressed = s.isPressed();
Color foreColor = s.isTextColorSet() ?
s.getTextColor() :
SystemColor.controlText;
if (text != null) {
int labelHeight = s.getTextSize().height;
Dimension prefSize = s.getDefaultMinimumSize();
Dimension realSize = s.getSize();
int baseX = ABS_MARGIN + (int) (REL_MARGIN * labelHeight) +
(realSize.width - prefSize.width) / 2;
int baseY = ABS_MARGIN + (int) ((REL_MARGIN + 1) * labelHeight) +
(realSize.height - prefSize.height) / 2;
g.setFont(s.getFont());
if (s.isEnabled()) {
g.setColor(foreColor);
if (pressed) {
g.drawString(text, baseX + 1, baseY + 1);
} else {
g.drawString(text, baseX, baseY);
}
} else {
drawDisabledString(g, text, baseX, baseY);
}
}
}
示例4: getBasicSystemColors
import java.awt.SystemColor; //导入方法依赖的package包/类
private Object[] getBasicSystemColors() {
Object[] basicSystemColors = {"desktop", SystemColor.desktop,
"activeCaption", SystemColor.activeCaption,
"activeCaptionText", SystemColor.activeCaptionText,
"activeCaptionBorder", SystemColor.activeCaptionBorder,
"inactiveCaption", SystemColor.inactiveCaption,
"inactiveCaptionText", SystemColor.inactiveCaptionText,
"inactiveCaptionBorder", SystemColor.inactiveCaptionBorder,
"window", SystemColor.window,
"windowBorder", SystemColor.windowBorder,
"windowText", SystemColor.windowText,
"menu", SystemColor.menu,
"menuText", SystemColor.menuText,
"text", SystemColor.text,
"textText", SystemColor.textText,
"textHighlight", SystemColor.textHighlight,
"textHighlightText", SystemColor.textHighlightText,
"textInactiveText", SystemColor.textInactiveText,
"control", SystemColor.control,
"controlText", SystemColor.controlText,
"controlHighlight", SystemColor.controlHighlight,
"controlLtHighlight", SystemColor.controlLtHighlight,
"controlShadow", SystemColor.controlShadow,
"controlDkShadow", SystemColor.controlDkShadow,
"scrollbar", SystemColor.scrollbar,
"info", SystemColor.info,
"infoText", SystemColor.infoText };
return basicSystemColors;
}