private static AttributeSet getHyperlinkAS () { if (hyperlinkAS == null) { SimpleAttributeSet as = new SimpleAttributeSet (); as.addAttribute (StyleConstants.Foreground, Color.blue); as.addAttribute (StyleConstants.Underline, Color.blue); hyperlinkAS = as; } return hyperlinkAS; }
private static AttributeSet getHyperlinkPressedAS () { if (hyperlinkPressedAS == null) { SimpleAttributeSet as = new SimpleAttributeSet (); as.addAttribute (StyleConstants.Foreground, Color.red); as.addAttribute (StyleConstants.Underline, Color.red); hyperlinkPressedAS = as; } return hyperlinkPressedAS; } }
public MutableAttributeSet user(User user, AttributeSet style) { SimpleAttributeSet userStyle = new SimpleAttributeSet(style); userStyle.addAttribute(Attribute.USER, user); return userStyle; }
private AttributeSet getHighlightAS () { if (highlightAS == null) { SimpleAttributeSet as = new SimpleAttributeSet (); as.addAttribute (StyleConstants.Background, color); highlightAS = as; } return highlightAS; }
public MutableAttributeSet replacement(String text, String replacement) { SimpleAttributeSet style = new SimpleAttributeSet(standard()); StyleConstants.setUnderline(style, true); style.addAttribute(Attribute.IS_REPLACEMENT, true); style.addAttribute(Attribute.REPLACEMENT_FOR, text); style.addAttribute(Attribute.REPLACED_WITH, replacement); return style; }
private static AttributeSet getUnusedLocalVariableAttributes () { if (unusedLocalVariableAttributeSet == null) { SimpleAttributeSet sas = new SimpleAttributeSet (); sas.addAttribute (EditorStyleConstants.WaveUnderlineColor, new Color (153, 153, 153)); unusedLocalVariableAttributeSet = sas; } return unusedLocalVariableAttributeSet; }
private AttributeSet getLinkAttribute(final String url) { // TODO: Verdana? Java is platform-independent, if this introduces a // platform dependency, it needs to be thrown out, quickly! final SimpleAttributeSet style = getStyle(Color.blue, false, false, "Verdana", 12); style.addAttribute(LINK_ATTRIBUTE, url); return style; }
SimpleAttributeSet a=new SimpleAttributeSet(); a.addAttribute("DUMMY_ATTRIBUTE_NAME","DUMMY_ATTRIBUTE_VALUE"); doc.setCharacterAttributes(start, text.length(), a, false); Element elem=doc.getCharacterElement(start); String html="<a href='"+text+"'>"+text+"</a>"; doc.setOuterHTML(elem, html);
SimpleAttributeSet a=new SimpleAttributeSet(); a.addAttribute("DUMMY_ATTRIBUTE_NAME","DUMMY_ATTRIBUTE_VALUE"); doc.setCharacterAttributes(start, text.length(), a, false); Element elem=doc.getCharacterElement(start); String html="<a href='"+text+"'>"+text+"</a>"; doc.setOuterHTML(elem, html);
private static AttributeSet getSyntaxErrorAttributes () { if (syntaxErrorAttributeSet == null) { SimpleAttributeSet sas = new SimpleAttributeSet (); sas.addAttribute (EditorStyleConstants.WaveUnderlineColor, Color.red); syntaxErrorAttributeSet = sas; } return syntaxErrorAttributeSet; }
private static AttributeSet getUnusedFieldAttributes () { if (unusedFieldAttributeSet == null) { SimpleAttributeSet sas = new SimpleAttributeSet (); sas.addAttribute (EditorStyleConstants.WaveUnderlineColor, new Color (153, 153, 153)); StyleConstants.setForeground (sas, new Color (0, 153, 0)); unusedFieldAttributeSet = sas; } return unusedFieldAttributeSet; }
/** * Make a link style for the given URL. * * @param url * @return */ public MutableAttributeSet url(String url) { SimpleAttributeSet urlStyle = new SimpleAttributeSet(); StyleConstants.setUnderline(urlStyle, true); urlStyle.addAttribute(HTML.Attribute.HREF, url); return urlStyle; }
private void setLineHighlighted(int offset) { SimpleAttributeSet attr = new SimpleAttributeSet(); attr.addAttribute(Attribute.HIGHLIGHT_LINE, true); doc.setParagraphAttributes(offset, 1, attr, false); }
private void setCustomBackgroundColor(int offset, Color color) { SimpleAttributeSet attr = new SimpleAttributeSet(); attr.addAttribute(Attribute.CUSTOM_BACKGROUND, color); doc.setParagraphAttributes(offset, 1, attr, false); }
private void setLineCommand(int offset, String command) { SimpleAttributeSet attr = new SimpleAttributeSet(); attr.addAttribute(Attribute.COMMAND, command); doc.setParagraphAttributes(offset, 1, attr, false); }
private void printRunningMessage( String runConfigName ) { SimpleAttributeSet attr = new SimpleAttributeSet(); attr.addAttribute( StyleConstants.Foreground, new Color( 192, 192, 192 ) ); TextComponentWriter out = (TextComponentWriter)System.out; out.setAttributes( attr ); System.out.println( "Running: " + runConfigName + "...\n" ); out.setAttributes( null ); }
/** * Make a link style for the given URL. * * @param url * @param baseStyle * @return */ public MutableAttributeSet url(String url, AttributeSet baseStyle) { SimpleAttributeSet urlStyle = new SimpleAttributeSet(baseStyle); StyleConstants.setUnderline(urlStyle, true); urlStyle.addAttribute(HTML.Attribute.HREF, url); return urlStyle; }
private void insertAttr(SimpleAttributeSet attrs, Object key, Object value) { while(attrs.isDefined(key)) { attrs.removeAttribute(key); } attrs.addAttribute(key, value); } }
public void setTextFontWeight(String weight) { boolean isBold = "bold".equals(weight); textAttribs.removeAttribute(Bold); textAttribs.addAttribute(Bold, isBold); setFont(getAttributeSetFont(textAttribs)); Font font = getFont(); }
public TextComponentWriter( Color color, BatchDocument document, PrintStream... echoWriters ) { super( new NullOutputStream() ); _document = document; _echoWriters = echoWriters; _defaultAttributes = new SimpleAttributeSet(); _defaultAttributes.addAttribute( StyleConstants.Foreground, color ); GosuEventQueue.instance().addIdleListener( new ConsoleDrainer() ); }