本文整理了Java中javax.swing.text.JTextComponent.getSelectedTextColor()
方法的一些代码示例,展示了JTextComponent.getSelectedTextColor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextComponent.getSelectedTextColor()
方法的具体详情如下:
包路径:javax.swing.text.JTextComponent
类名称:JTextComponent
方法名:getSelectedTextColor
暂无
代码示例来源:origin: bobbylight/RSyntaxTextArea
c = editor.getSelectedTextColor();
if (c==null) {
c = UIManager.getColor("nimbusSelectedText");
代码示例来源:origin: mucommander/mucommander
/**
* Returns the color of the right {@link #type type} used by the specified component.
* @param component component to analyse.
* @return the color of the right {@link #type type} used by the specified component.
*/
private Color getColor(JComponent component) {
// Foreground color.
if(type == FOREGROUND)
return component.getForeground();
// Background color.
else if(type == BACKGROUND)
return component.getBackground();
// Text component specific colors.
else if(component instanceof JTextComponent) {
JTextComponent comp;
comp = (JTextComponent)component;
// Selection foreground color.
if(type == SELECTION_FOREGROUND)
return comp.getSelectedTextColor();
// Selection background color.
else if(type == SELECTION_BACKGROUND)
return comp.getSelectionColor();
}
return null;
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/napkinlaf
public static void syncWithTheme(Graphics2D g, Component c) {
if (isPaper(c)) {
paperStack.push(c);
themeStack.push((NapkinTheme) ((JComponent) c).getClientProperty(
THEME_KEY));
dumpStacks();
}
NapkinTheme theme = currentTheme(c);
Color themePen = theme.getPenColor();
Color fgColor = ifReplace(c.getForeground(), themePen);
// explicitly check for equality because two things depend on it
if (!fgColor.equals(c.getForeground())) {
c.setForeground(fgColor);
if (g != null) {
g.setColor(fgColor);
}
}
if (c instanceof JTextComponent) {
JTextComponent tc = (JTextComponent) c;
Color selColor = ifReplace(tc.getSelectedTextColor(), themePen);
// just set, as the method does work only if it's different
tc.setSelectedTextColor(selColor);
}
}
代码示例来源:origin: com.fifesoft/rsyntaxtextarea
c = editor.getSelectedTextColor();
if (c==null) {
c = UIManager.getColor("nimbusSelectedText");
代码示例来源:origin: org.nuiton.thirdparty/rsyntaxtextarea
c = editor.getSelectedTextColor();
if (c==null) {
c = UIManager.getColor("nimbusSelectedText");
代码示例来源:origin: org.codehaus.jtstand/jtstand-editor
c = editor.getSelectedTextColor();
if (c==null) {
c = UIManager.getColor("nimbusSelectedText");
代码示例来源:origin: nz.ac.waikato.cms.weka.thirdparty/bounce
/**
* Invalidates the scanner, to make sure a new range is set later.
*
* @param g
* the graphics context.
* @param a
* the shape.
* @see View#paint(Graphics g, Shape a)
*/
public void paint(Graphics g, Shape a) {
JTextComponent component = (JTextComponent) getContainer();
Highlighter highlighter = component.getHighlighter();
Color unselected = component.isEnabled() ? component.getForeground() : component.getDisabledTextColor();
Caret caret = component.getCaret();
selected = !caret.isSelectionVisible() || highlighter == null ? unselected : component.getSelectedTextColor();
super.paint(g, a);
scanner.setValid(false);
}
代码示例来源:origin: org.jspresso.framework/jspresso-swing-application
/**
* {@inheritDoc}
*/
@Override
protected void protectedReadabilityChange() {
super.protectedReadabilityChange();
if (isReadable()) {
if (savedSelectedTextColor != null) {
getConnectedJComponent().setSelectedTextColor(savedSelectedTextColor);
}
savedSelectedTextColor = null;
} else if (savedSelectedTextColor == null) {
savedSelectedTextColor = getConnectedJComponent().getSelectedTextColor();
getConnectedJComponent().setSelectedTextColor(
getConnectedJComponent().getSelectionColor());
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf-testrunner-ui
@Override
public void paint(Graphics g, Shape a) {
((Graphics2D) g).addRenderingHints(getHints());
Container container = getContainer();
if (container instanceof JTextComponent) {
final JTextComponent textComp = (JTextComponent) container;
selStart = textComp.getSelectionStart();
selEnd = textComp.getSelectionEnd();
unselectedFg = textComp.isEnabled()
? textComp.getForeground()
: textComp.getDisabledTextColor();
selectedFg = textComp.getCaret().isSelectionVisible()
? textComp.getSelectedTextColor()
: unselectedFg;
}
super.paint(g, a);
}
代码示例来源:origin: nz.ac.waikato.cms.weka.thirdparty/bounce
unselected = (host.isEnabled()) ? host.getForeground() : host.getDisabledTextColor();
Caret c = host.getCaret();
selected = c.isSelectionVisible() ? host.getSelectedTextColor() : unselected;
代码示例来源:origin: org.jspresso/jspresso-swing-application
/**
* {@inheritDoc}
*/
@Override
protected void protectedUpdateState() {
super.protectedUpdateState();
if (isReadable()) {
if (savedSelectedTextColor != null) {
getConnectedJComponent().setSelectedTextColor(savedSelectedTextColor);
}
savedSelectedTextColor = null;
} else if (savedSelectedTextColor == null) {
savedSelectedTextColor = getConnectedJComponent().getSelectedTextColor();
getConnectedJComponent().setSelectedTextColor(
getConnectedJComponent().getSelectionColor());
}
getConnectedJComponent().setEditable(isWritable());
}
}
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
if (txt.isFocusOwner()
&& PromptSupport.getFocusBehavior(txt) == FocusBehavior.HIGHLIGHT_PROMPT) {
promptComponent.setForeground(txt.getSelectedTextColor());
try {
promptComponent.getHighlighter().addHighlight(0,
promptComponent.setSelectedTextColor(txt.getSelectedTextColor());
promptComponent.setSelectionColor(txt.getSelectionColor());
promptComponent.setEditable(txt.isEditable());
代码示例来源:origin: org.swinglabs.swingx/swingx-all
if (txt.isFocusOwner()
&& PromptSupport.getFocusBehavior(txt) == FocusBehavior.HIGHLIGHT_PROMPT) {
promptComponent.setForeground(txt.getSelectedTextColor());
try {
promptComponent.getHighlighter().addHighlight(0,
promptComponent.setSelectedTextColor(txt.getSelectedTextColor());
promptComponent.setSelectionColor(txt.getSelectionColor());
promptComponent.setEditable(txt.isEditable());
代码示例来源:origin: org.swinglabs.swingx/swingx-core
if (txt.isFocusOwner()
&& PromptSupport.getFocusBehavior(txt) == FocusBehavior.HIGHLIGHT_PROMPT) {
promptComponent.setForeground(txt.getSelectedTextColor());
try {
promptComponent.getHighlighter().addHighlight(0,
promptComponent.setSelectedTextColor(txt.getSelectedTextColor());
promptComponent.setSelectionColor(txt.getSelectionColor());
promptComponent.setEditable(txt.isEditable());
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
if (txt.isFocusOwner()
&& PromptSupport.getFocusBehavior(txt) == FocusBehavior.HIGHLIGHT_PROMPT) {
promptComponent.setForeground(txt.getSelectedTextColor());
try {
promptComponent.getHighlighter().addHighlight(0,
promptComponent.setSelectedTextColor(txt.getSelectedTextColor());
promptComponent.setSelectionColor(txt.getSelectionColor());
promptComponent.setEditable(txt.isEditable());
代码示例来源:origin: khuxtable/seaglass
Color sfg = c.getSelectedTextColor();
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(plaf.getColor(prefix + ".selectionForeground"));
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
Color sfg = editor.getSelectedTextColor();
if ((sfg == null) || (sfg instanceof UIResource)) {
editor.setSelectedTextColor(plaf.getColor(prefix + ".selectionForeground"));
内容来源于网络,如有侵权,请联系作者删除!