当前位置: 首页>>代码示例>>Java>>正文


Java SystemColor.textText方法代码示例

本文整理汇总了Java中java.awt.SystemColor.textText方法的典型用法代码示例。如果您正苦于以下问题:Java SystemColor.textText方法的具体用法?Java SystemColor.textText怎么用?Java SystemColor.textText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.SystemColor的用法示例。


在下文中一共展示了SystemColor.textText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setItem

import java.awt.SystemColor; //导入方法依赖的package包/类
public void setItem(Object anObject) {
    value = anObject;
    if (value instanceof String) {
        setText(NbBundle.getMessage(SplashUISupport.class, "SplashUISupport_color_default"));
        super.setForeground(SystemColor.textText);
        super.setBackground(SystemColor.text);
    } else {
        setText("");
        super.setBackground((Color) value);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:SplashUISupport.java

示例2: TextBoxPaintable

import java.awt.SystemColor; //导入方法依赖的package包/类
public TextBoxPaintable(String string,Font font,float maxWidth,float insets,Paint paint) {
	if(paint==null)
		paint = SystemColor.textText;
	this.insets = insets;
	this.text = string;
	this.paint = paint;
	
	List<String> lines = new ArrayList<String>();
	Map<TextAttribute, Object> attributes = new HashMap<TextAttribute, Object>();
	attributes.put( TextAttribute.FONT, font);
	AttributedString attrString = new AttributedString(string, attributes);
	LineBreakMeasurer lbm = new LineBreakMeasurer( attrString.getIterator(), frc);
	TextLayout tl = lbm.nextLayout(maxWidth);
	float dy = 0;
	GeneralPath path = new GeneralPath();
	int startIndex = 0;
	while(tl!=null) {
		path.append( tl.getOutline( AffineTransform.getTranslateInstance(0, dy) ), false );
		dy += tl.getAscent()+tl.getDescent()+tl.getLeading();
		int charCount = tl.getCharacterCount();
		lines.add( text.substring(startIndex, startIndex+charCount) );
		startIndex += charCount;
		tl = lbm.nextLayout(maxWidth);
	}
	this.lines = lines.toArray(new String[lines.size()]);
	untransformedShape = path;
	Rectangle2D b = ShapeBounds.getBounds(untransformedShape);
	b.setFrame(b.getX(), b.getY(), b.getWidth() + 2*insets, b.getHeight() + 2*insets);
	untransformedBounds = b.getBounds();
}
 
开发者ID:mickleness,项目名称:pumpernickel,代码行数:31,代码来源:TextBoxPaintable.java

示例3: 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;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:30,代码来源:BasicLookAndFeel.java

示例4: tweakTipEditorPane

import java.awt.SystemColor; //导入方法依赖的package包/类
/**
 * Tweaks a <code>JEditorPane</code> so it can be used to render the
 * content in a focusable pseudo-tool tip.  It is assumed that the editor
 * pane is using an <code>HTMLDocument</code>.
 *
 * @param textArea The editor pane to tweak.
 */
public static void tweakTipEditorPane(JEditorPane textArea) {

	// Jump through a few hoops to get things looking nice in Nimbus
	boolean isNimbus = isNimbusLookAndFeel();
	if (isNimbus) {
		Color selBG = textArea.getSelectionColor();
		Color selFG = textArea.getSelectedTextColor();
		textArea.setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
		textArea.setSelectedTextColor(selFG);
		textArea.setSelectionColor(selBG);
	}

	textArea.setEditable(false); // Required for links to work!
	textArea.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));

	// Make selection visible even though we are not (initially) focusable.
	textArea.getCaret().setSelectionVisible(true);

	// Set the foreground color.  Important because when rendering HTML,
	// default foreground becomes black, which may not match all LAF's
	// (e.g. Substance).
	Color fg = UIManager.getColor("Label.foreground");
	if (fg==null || (isNimbus && isDerivedColor(fg))) {
		fg = SystemColor.textText;
	}
	textArea.setForeground(fg);

	// Make it use the "tool tip" background color.
	textArea.setBackground(TipUtil.getToolTipBackground());

	// Force JEditorPane to use a certain font even in HTML.
	// All standard LookAndFeels, even Nimbus (!), define Label.font.
	Font font = UIManager.getFont("Label.font");
	if (font == null) { // Try to make a sensible default
		font = new Font("SansSerif", Font.PLAIN, 12);
	}
	HTMLDocument doc = (HTMLDocument) textArea.getDocument();
	doc.getStyleSheet().addRule(
			"body { font-family: " + font.getFamily() +
					"; font-size: " + font.getSize() + "pt" +
					"; color: " + getHexString(fg) + "; }");

	// Always add link foreground rule.  Unfortunately these CSS rules
	// stack each time the LaF is changed (how can we overwrite them
	// without clearing out the important "standard" ones?).
	Color linkFG = RSyntaxUtilities.getHyperlinkForeground();
	doc.getStyleSheet().addRule(
			"a { color: " + getHexString(linkFG) + "; }");

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:58,代码来源:TipUtil.java

示例5: tweakTipEditorPane

import java.awt.SystemColor; //导入方法依赖的package包/类
/**
 * Tweaks a <code>JEditorPane</code> so it can be used to render the
 * content in a focusable pseudo-tool tip.  It is assumed that the editor
 * pane is using an <code>HTMLDocument</code>.
 *
 * @param textArea The editor pane to tweak.
 */
public static void tweakTipEditorPane(JEditorPane textArea) {

	// Jump through a few hoops to get things looking nice in Nimbus
	boolean isNimbus = isNimbusLookAndFeel();
	if (isNimbus) {
		Color selBG = textArea.getSelectionColor();
		Color selFG = textArea.getSelectedTextColor();
		textArea.setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
		textArea.setSelectedTextColor(selFG);
		textArea.setSelectionColor(selBG);
	}

	textArea.setEditable(false); // Required for links to work!
	textArea.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));

	// Make selection visible even though we are not (initially) focusable.
	textArea.getCaret().setSelectionVisible(true);

	// Set the foreground color.  Important because when rendering HTML,
	// default foreground becomes black, which may not match all LAF's
	// (e.g. Substance).
	Color fg = UIManager.getColor("Label.foreground");
	if (fg==null || (isNimbus && isDerivedColor(fg))) {
		fg = SystemColor.textText;
	}
	textArea.setForeground(fg);

	// Make it use the "tool tip" background color.
	textArea.setBackground(TipUtil.getToolTipBackground());

	// Force JEditorPane to use a certain font even in HTML.
	// All standard LookAndFeels, even Nimbus (!), define Label.font.
	Font font = UIManager.getFont("Label.font");
	if (font == null) { // Try to make a sensible default
		font = new Font("SansSerif", Font.PLAIN, 12);
	}
	HTMLDocument doc = (HTMLDocument) textArea.getDocument();
	doc.getStyleSheet().addRule(
			"body { font-family: " + font.getFamily() +
					"; font-size: " + font.getSize() + "pt" +
					"; color: " + Util.getHexString(fg) + "; }");

	// Always add link foreground rule.  Unfortunately these CSS rules
	// stack each time the LaF is changed (how can we overwrite them
	// without clearing out the important "standard" ones?).
	Color linkFG = Util.getHyperlinkForeground();
	doc.getStyleSheet().addRule(
			"a { color: " + Util.getHexString(linkFG) + "; }");

	URL url = TipUtil.class.getResource("bullet_black.png");
	if (url!=null) {
		doc.getStyleSheet().addRule(
			"ul { list-style-image: '" + url.toString() + "'; }");
	}

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:64,代码来源:TipUtil.java

示例6: tweakTipEditorPane

import java.awt.SystemColor; //导入方法依赖的package包/类
/**
 * Tweaks a <code>JEditorPane</code> so it can be used to render the
 * content in a focusable pseudo-tool tip.  It is assumed that the editor
 * pane is using an <code>HTMLDocument</code>.
 *
 * @param textArea The editor pane to tweak.
 */
public static void tweakTipEditorPane(JEditorPane textArea) {

	// Jump through a few hoops to get things looking nice in Nimbus
	boolean isNimbus = isNimbusLookAndFeel();
	if (isNimbus) {
		Color selBG = textArea.getSelectionColor();
		Color selFG = textArea.getSelectedTextColor();
		textArea.setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
		textArea.setSelectedTextColor(selFG);
		textArea.setSelectionColor(selBG);
	}

	textArea.setEditable(false); // Required for links to work!
	textArea.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));

	// Make selection visible even though we are not (initially) focusable.
	textArea.getCaret().setSelectionVisible(true);

	// Set the foreground color.  Important because when rendering HTML,
	// default foreground becomes black, which may not match all LAF's
	// (e.g. Substance).
	Color fg = UIManager.getColor("Label.foreground");
	if (fg==null || (isNimbus && isDerivedColor(fg))) {
		fg = SystemColor.textText;
	}
	textArea.setForeground(fg);

	// Make it use the "tool tip" background color.
	textArea.setBackground(TipUtil.getToolTipBackground());

	// Force JEditorPane to use a certain font even in HTML.
	// All standard LookAndFeels, even Nimbus (!), define Label.font.
	Font font = UIManager.getFont("Label.font");
	if (font == null) { // Try to make a sensible default
		font = new Font("SansSerif", Font.PLAIN, 12);
	}
	HTMLDocument doc = (HTMLDocument) textArea.getDocument();
	doc.getStyleSheet().addRule(
			"body { font-family: " + font.getFamily() +
					"; font-size: " + font.getSize() + "pt" +
					"; color: " + getHexString(fg) + "; }");

}
 
开发者ID:Nanonid,项目名称:RSyntaxTextArea,代码行数:51,代码来源:TipUtil.java

示例7: Style

import java.awt.SystemColor; //导入方法依赖的package包/类
private Style(String name) {
    this.name = name;
    foreground = SystemColor.textText;
    background = SystemColor.text;
}
 
开发者ID:montsuqi,项目名称:monsiaj,代码行数:6,代码来源:Style.java


注:本文中的java.awt.SystemColor.textText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。