List of usage examples for javax.swing.text StyleConstants setFontFamily
public static void setFontFamily(MutableAttributeSet a, String fam)
From source file:org.zephyrsoft.sdb2.presenter.SongView.java
private Style addStyle(String styleName, boolean italic, boolean bold, String fontFamily, int fontSize) { Style style = document.addStyle(styleName, DEFAULT_STYLE); StyleConstants.setItalic(style, italic); StyleConstants.setBold(style, bold); StyleConstants.setFontFamily(style, fontFamily); StyleConstants.setFontSize(style, fontSize); return style; }
From source file:pl.otros.logview.gui.message.pattern.StyleProperties.java
public static Style getStyle(StyleContext styleContext, DataConfiguration styleConfig, String styleName, int group) { Style style = styleContext.addStyle(styleName, styleContext.getStyle(StyleContext.DEFAULT_STYLE)); String groupSuffix = "." + group; if (group <= 0) { groupSuffix = ""; }/*from www. jav a 2 s . c om*/ String fontFamily = styleConfig.getString(PROP_FONT_FAMILY + groupSuffix, ""); if (fontFamily.trim().length() > 0) { StyleConstants.setFontFamily(style, styleConfig.getString(PROP_FONT_FAMILY + groupSuffix)); } if (styleConfig.getString(PROP_FONT_SIZE + groupSuffix, "").trim().length() > 0) { StyleConstants.setFontSize(style, styleConfig.getInt(PROP_FONT_SIZE + groupSuffix)); } if (styleConfig.getString(PROP_FONT_BOLD + groupSuffix, "").trim().length() > 0) { StyleConstants.setBold(style, styleConfig.getBoolean(PROP_FONT_BOLD + groupSuffix)); } if (styleConfig.getString(PROP_FONT_ITALIC + groupSuffix, "").trim().length() > 0) { StyleConstants.setItalic(style, styleConfig.getBoolean(PROP_FONT_ITALIC + groupSuffix)); } if (styleConfig.getString(PROP_FONT_UNDERLINE + groupSuffix, "").trim().length() > 0) { StyleConstants.setUnderline(style, styleConfig.getBoolean(PROP_FONT_UNDERLINE + groupSuffix)); } if (styleConfig.getString(PROP_BACKGROUND + groupSuffix, "").trim().length() > 0) { StyleConstants.setBackground(style, styleConfig.getColor(PROP_BACKGROUND + groupSuffix)); } if (styleConfig.getString(PROP_FOREGROUND + groupSuffix, "").trim().length() > 0) { StyleConstants.setForeground(style, styleConfig.getColor(PROP_FOREGROUND + groupSuffix)); } return style; }
From source file:pl.otros.logview.gui.message.update.LogDataFormatter.java
public LogDataFormatter(LogData logData, // DateFormat dateFormat, // MessageUpdateUtils messageUtils, // PluginableElementsContainer<MessageColorizer> colorizersContainer, // PluginableElementsContainer<MessageFormatter> formattersContainer, // CancelStatus cancelStatus, int maximumMessageSize) { this.ld = logData; this.dateFormat = dateFormat; this.messageUtils = messageUtils; this.colorizersContainer = colorizersContainer; this.formattersContainer = formattersContainer; this.cancelStatus = cancelStatus; this.maximumMessageSize = maximumMessageSize; sc = new StyleContext(); defaultStyle = sc.getStyle(StyleContext.DEFAULT_STYLE); mainStyle = sc.addStyle("MainStyle", defaultStyle); StyleConstants.setFontSize(mainStyle, 12); StyleConstants.setForeground(mainStyle, Color.BLACK); classMethodStyle = sc.addStyle("classMethod", null); StyleConstants.setFontFamily(classMethodStyle, "monospaced"); StyleConstants.setForeground(classMethodStyle, Color.BLUE); boldArialStyle = sc.addStyle("note", mainStyle); StyleConstants.setFontFamily(boldArialStyle, "arial"); StyleConstants.setBold(boldArialStyle, true); propertyNameStyle = sc.addStyle("propertyValue", classMethodStyle); StyleConstants.setForeground(propertyNameStyle, new Color(0, 0, 128)); propertyValueStyle = sc.addStyle("propertyValue", classMethodStyle); StyleConstants.setForeground(propertyNameStyle, new Color(0, 128, 0)); }
From source file:pl.otros.logview.gui.MessageDetailListener.java
public MessageDetailListener(JTable table, JTextPane logDetailTextArea, LogDataTableModel dataTableModel, SimpleDateFormat dateFormat, PluginableElementsContainer<MessageFormatter> formattersContainer, PluginableElementsContainer<MessageColorizer> colorizersContainer) { super();/* w w w . j a v a 2 s . c om*/ this.table = table; this.logDetailTextArea = logDetailTextArea; this.dataTableModel = dataTableModel; this.dateFormat = dateFormat; this.formattersContainer = formattersContainer; this.colorizersContainer = colorizersContainer; sc = new StyleContext(); defaultStyle = sc.getStyle(StyleContext.DEFAULT_STYLE); mainStyle = sc.addStyle("MainStyle", defaultStyle); StyleConstants.setFontSize(mainStyle, 12); StyleConstants.setForeground(mainStyle, Color.BLACK); classMethodStyle = sc.addStyle("classMethod", null); StyleConstants.setFontFamily(classMethodStyle, "monospaced"); StyleConstants.setForeground(classMethodStyle, Color.BLUE); noteStyle = sc.addStyle("note", mainStyle); StyleConstants.setFontFamily(noteStyle, "arial"); StyleConstants.setBold(noteStyle, true); formattersContainer.addListener(new PluginableElementEventListenerImplementation<MessageFormatter>()); colorizersContainer.addListener(new PluginableElementEventListenerImplementation<MessageColorizer>()); }