本文整理匯總了Java中java.awt.SystemColor.textHighlightText方法的典型用法代碼示例。如果您正苦於以下問題:Java SystemColor.textHighlightText方法的具體用法?Java SystemColor.textHighlightText怎麽用?Java SystemColor.textHighlightText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.SystemColor
的用法示例。
在下文中一共展示了SystemColor.textHighlightText方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: determineSelectionForeground
import java.awt.SystemColor; //導入方法依賴的package包/類
private Color determineSelectionForeground() {
Color c = UIManager.getColor("List.selectionForeground");
if (c==null) {
c = UIManager.getColor("nimbusSelectedText");
if (c==null) { // Not Nimbus, but still need a value - fallback
c = UIManager.getColor("textHighlightText");
if (c==null) {
c = SystemColor.textHighlightText;
}
}
}
// Nimbus unfortunately requires Color, not ColorUIResource, and "c"
// may actually be a ColorUIResource
return new Color(c.getRGB());
}
示例3: getDefaultSelectionFG
import java.awt.SystemColor; //導入方法依賴的package包/類
/**
* Returns the default "selected text" color to use if "default" is
* specified in a theme.
*
* @return The default selection foreground color to use.
* @see #getDefaultSelectionBG()
*/
private static Color getDefaultSelectionFG() {
Color c = UIManager.getColor("TextArea.selectionForeground");
if (c==null) {
c = UIManager.getColor("textHighlightText");
if (c==null) {
c = UIManager.getColor("nimbusSelectedText");
if (c==null) {
c = new ColorUIResource(SystemColor.textHighlightText);
}
}
}
return c;
}
示例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;
}