private AttributeSet getAttributeSet(String tag) { MutableAttributeSet attr = new SimpleAttributeSet(); Color color = tagToColorMap.get(tag); StyleConstants.setBackground(attr, color); StyleConstants.setForeground(attr, Color.WHITE); return attr; }
private AttributeSet getAttributeSet(String tag) { MutableAttributeSet attr = new SimpleAttributeSet(); Color color = tagToColorMap.get(tag); StyleConstants.setBackground(attr, color); StyleConstants.setForeground(attr, Color.WHITE); return attr; }
private void removeTags() { if (editorPane.getContentType().equals("text/html")) { editorPane.setText(htmlContents); editorPane.revalidate(); editorPane.repaint(); } else { DefaultStyledDocument doc = (DefaultStyledDocument)editorPane.getDocument(); SimpleAttributeSet attr = new SimpleAttributeSet(); StyleConstants.setForeground(attr, Color.BLACK); StyleConstants.setBackground(attr, Color.WHITE); doc.setCharacterAttributes(0, doc.getLength(), attr, false); } saveTaggedAs.setEnabled(false); }
private void removeTags() { if (editorPane.getContentType().equals("text/html")) { if (htmlContents != null) { editorPane.setText(htmlContents); } editorPane.revalidate(); editorPane.repaint(); } else { DefaultStyledDocument doc = (DefaultStyledDocument)editorPane.getDocument(); SimpleAttributeSet attr = new SimpleAttributeSet(); StyleConstants.setForeground(attr, Color.BLACK); StyleConstants.setBackground(attr, Color.WHITE); doc.setCharacterAttributes(0, doc.getLength(), attr, false); } saveTaggedAs.setEnabled(false); }
/** * Creates new form ParserPanel */ public ParserPanel() { initComponents(); // create dialogs for file selection jfc = new JFileChooser(System.getProperty("user.dir")); pageDialog = new OpenPageDialog(new Frame(), true); pageDialog.setFileChooser(jfc); jfcLocation = new JFileChooserLocation(jfc); tlp = new PennTreebankLanguagePack(); encoding = tlp.getEncoding(); setFont(); // create a timer timer = new javax.swing.Timer(ONE_SECOND, new TimerListener()); // for (un)highlighting text highlightStyle = new SimpleAttributeSet(); normalStyle = new SimpleAttributeSet(); StyleConstants.setBackground(highlightStyle, Color.yellow); StyleConstants.setBackground(normalStyle, textPane.getBackground()); this.chooseJarParser = new JarFileChooser(".*\\.ser\\.gz", this); }
private static void addStyle(String name, Color bg, Color fg, boolean bold, boolean italic) { SimpleAttributeSet style = new SimpleAttributeSet(); StyleConstants.setFontFamily(style, HelperUi.FONT_UBUNTU_MONO.getFontName()); StyleConstants.setFontSize(style, HelperUi.FONT_UBUNTU_MONO.getSize()); StyleConstants.setBackground(style, bg); StyleConstants.setForeground(style, fg); StyleConstants.setBold(style, bold); StyleConstants.setItalic(style, italic); styles.put(name, style); }
levelText = "Fatal"; StyleConstants.setForeground(levelStyle, Color.WHITE); StyleConstants.setBackground(levelStyle, Color.BLACK); fatalCount++; break; levelText = "Error"; StyleConstants.setForeground(levelStyle, new Color(0xFF291F)); StyleConstants.setBackground(levelStyle, new Color(0xFFF0F0)); errorCount++; break; levelText = "Warning"; StyleConstants.setForeground(levelStyle, new Color(0x614201)); StyleConstants.setBackground(levelStyle, new Color(0xFFFCE5)); warnCount++; break; levelText = "Info"; StyleConstants.setForeground(levelStyle, new Color(0x203261)); StyleConstants.setBackground(levelStyle, new Color(0xE2E8FF)); otherCount++; break; levelText = "Debug"; StyleConstants.setForeground(levelStyle, new Color(0x32612E)); StyleConstants.setBackground(levelStyle, new Color(0xF4FFEC)); otherCount++; break;
/********************************/ public final void setHandleColor(Color _color) { StyleConstants.setBackground(defaultActiveHandleStyle, _color); }
SegmentHighlighter() { MutableAttributeSet attrNormal = new SimpleAttributeSet(); StyleConstants.setBackground(attrNormal, getBackground()); this.attrNormal = attrNormal; MutableAttributeSet attrActive = new SimpleAttributeSet(); // This is the same as the default value for // Styles.EditorColor.COLOR_ACTIVE_SOURCE, but we hard-code it here // because this panel does not currently support customized colors. StyleConstants.setBackground(attrActive, Color.decode("#c0ffc0")); this.attrActive = attrActive; }
public Style getNormalTextStyle() { if (normalTextStyle == null) { Color foregroundColor = Color.decode(theme.findProperty("text-foreground-color")); Color backgroundColor = Color.decode(theme.findProperty("text-background-color")); this.normalTextStyle = pane.addStyle("normalText", null); StyleConstants.setForeground(this.normalTextStyle, foregroundColor); StyleConstants.setBackground(this.normalTextStyle, backgroundColor); StyleConstants.setFontSize(this.normalTextStyle, 14); return this.normalTextStyle; } return normalTextStyle; }
public Style getHighlightStyle() { if (matchedTextStyle == null) { Color highlightForegroundColor = Color.decode(theme.findProperty("text-highlight-foreground-color")); Color highlightBackgroundColor = Color.decode(theme.findProperty("text-highlight-background-color")); this.matchedTextStyle = pane.addStyle("highlight", null); StyleConstants.setForeground(this.matchedTextStyle, highlightForegroundColor); StyleConstants.setBackground(this.matchedTextStyle, highlightBackgroundColor); StyleConstants.setFontSize(this.matchedTextStyle, 14); } return matchedTextStyle; }
@Override public void actionPerformed(ActionEvent event) { Color color = JColorChooser.showDialog(AnnotationDisplayCustomizationFrame.this, "Choose color", AnnotationDisplayCustomizationFrame.this.bgColor); if (color != null) { AnnotationDisplayCustomizationFrame.this.bgColor = color; AnnotationDisplayCustomizationFrame.this.bgIcon.setColor(color); StyleConstants.setBackground(AnnotationDisplayCustomizationFrame.this.currentStyle, color); setTextPane(); enableButtons(true); AnnotationDisplayCustomizationFrame.this.repaint(); } }
/** * Sets the current style. * * @param style the new current style */ private void setCurrentStyle(Style style) { // Copy style. this.currentStyle = this.textPane.addStyle(currentStyleName, style); StyleConstants.setForeground(this.currentStyle, StyleConstants.getForeground(style)); StyleConstants.setBackground(this.currentStyle, StyleConstants.getBackground(style)); }
private static void addStyle(String name, Color bg, Color fg, boolean bold, boolean italic) { SimpleAttributeSet style = new SimpleAttributeSet(); StyleConstants.setFontFamily(style, "Monospaced"); StyleConstants.setFontSize(style, 12); StyleConstants.setBackground(style, bg); StyleConstants.setForeground(style, fg); StyleConstants.setBold(style, bold); StyleConstants.setItalic(style, italic); styles.put(name, style); }
public Document3(final EditorController controller) { this.controller = controller; Style defaultStyle = getDefaultStyle(); StyleConstants.setForeground(defaultStyle, Styles.EditorColor.COLOR_FOREGROUND.getColor()); StyleConstants.setBackground(defaultStyle, Styles.EditorColor.COLOR_BACKGROUND.getColor()); setFont(controller.font); }
MultilineCellRenderer() { // textArea.setLineWrap(true); // textArea.setWrapStyleWord(true); textArea.setOpaque(true); checkBox.setHorizontalAlignment(JLabel.CENTER); checkBox.setBorderPainted(true); SimpleAttributeSet sas = new SimpleAttributeSet(); StyleConstants.setBackground(sas, Styles.EditorColor.COLOR_ALIGNER_HIGHLIGHT.getColor()); highlight = sas; }
protected MutableAttributeSet getMessageStyle() { final MutableAttributeSet style = new SimpleAttributeSet(); StyleConstants.setFontFamily( style, "Dialog" ); StyleConstants.setFontSize( style, SettingsManager.getLocalPreferences().getChatRoomFontSize() ); StyleConstants.setForeground( style, messageColor ); StyleConstants.setBackground( style, backgroundColor ); return style; }
protected MutableAttributeSet getPrefixStyle() { final MutableAttributeSet style = new SimpleAttributeSet(); StyleConstants.setFontFamily( style, "Dialog" ); StyleConstants.setFontSize( style, SettingsManager.getLocalPreferences().getChatRoomFontSize() ); StyleConstants.setForeground( style, prefixColor ); StyleConstants.setBackground( style, backgroundColor ); return style; }
private Style getStyleForMarkerColor(MarkerColors markerColors) { String styleName = "MarkerColor" + markerColors.name(); Style style = sc.getStyle(styleName); if (style == null) { style = sc.addStyle(styleName, mainStyle); StyleConstants.setForeground(style, markerColors.getForeground()); StyleConstants.setBackground(style, markerColors.getBackground()); } return style; }
/** * Initialise bold, emph and regular styles */ private void initStyles() { Style def = StyleContext.getDefaultStyleContext().getStyle( StyleContext.DEFAULT_STYLE); regular = addStyle("regular", def); StyleConstants.setFontFamily(def, "SansSerif"); emph = addStyle("currentTransition", regular); StyleConstants.setBackground(emph, Color.LIGHT_GRAY); bold = addStyle("title", regular); StyleConstants.setBold(bold, true); }