本文整理汇总了Java中javax.swing.text.Style.addAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java Style.addAttributes方法的具体用法?Java Style.addAttributes怎么用?Java Style.addAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.text.Style
的用法示例。
在下文中一共展示了Style.addAttributes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbstractDetailGUI
import javax.swing.text.Style; //导入方法依赖的package包/类
/** Creates new form AbstractDetailGUI */
protected AbstractDetailGUI() {
bundle = ResourceBundle.getBundle("jMovieManager.swing.resources.MovieManager");
genreKeyAndCodecBundle = LocaleManager.getInstance().getGenreKeyAndCodecBundle();
initComponents();
//Fuer Linux
jScrollPane1.setViewportBorder(null);
//pictureThread = new Thread();
//Neues Attributset
SimpleAttributeSet as = new SimpleAttributeSet();
//Füge dem AttributSet, Blocksatz hinzu
StyleConstants.setAlignment( as, StyleConstants.ALIGN_JUSTIFIED );
StyleConstants.setFontSize(as, 14);
StyleConstants.setFontFamily(as, "Tahoma");
StyleConstants.setForeground(as, UIManager.getColor("TextPane.foreground"));
//Neues StyleDokument
StyledDocument doc = jTextPane1.getStyledDocument();
Style style = doc.addStyle( "ALIGN_JUSTIFIED", null );
style.addAttributes( as );
doc.setLogicalStyle( 0, style );
jTextPane1.setFont(JMMFont.largeIOFont);
}
示例2: writeTextNode
import javax.swing.text.Style; //导入方法依赖的package包/类
private static void writeTextNode(DefaultStyledDocument doc,
StyleContext styles, Node node, int indent,
Collection<IdentifierLocation> idLocations, boolean flagged)
throws BadLocationException {
String text = CoqDoc.getTextFromTextNode(node);
Style style = styles.getStyle(STYLE_TEXT);
if(flagged) style.addAttributes(styles.getStyle(STYLE_FLAGGED));
doc.insertString(doc.getLength(), text, style);
}
示例3: writeKeywordNode
import javax.swing.text.Style; //导入方法依赖的package包/类
private static void writeKeywordNode(DefaultStyledDocument doc,
StyleContext styles, Node node, int indent,
Collection<IdentifierLocation> idLocations, boolean flagged)
throws BadLocationException {
Style style = styles.getStyle(STYLE_KEYWORD);
if(flagged) style.addAttributes(styles.getStyle(STYLE_FLAGGED));
doc.insertString(doc.getLength(), getKeywordFromKeywordNode(node), style);
}
示例4: writeIdentifierNode
import javax.swing.text.Style; //导入方法依赖的package包/类
private static void writeIdentifierNode(DefaultStyledDocument doc,
StyleContext styles, Node node, int indent,
Collection<IdentifierLocation> idLocations, boolean flagged)
throws BadLocationException {
String id = CoqDoc.getIDFromIdentifierNode(node);
int offset = doc.getLength();
Style style = styles.getStyle(STYLE_IDENTIFIER);
if(flagged) style.addAttributes(styles.getStyle(STYLE_FLAGGED));
doc.insertString(offset, id, style);
if(idLocations != null) {
idLocations.add(new IdentifierLocation(offset, id.length(), id));
}
}
示例5: addStyle
import javax.swing.text.Style; //导入方法依赖的package包/类
public void addStyle (final String name, final AttributeSet attrs) {
final Style styleBase = textPane.getStyle(StyleContext.DEFAULT_STYLE);
final Style style = textPane.addStyle(name, styleBase);
style.addAttributes(attrs);
}