本文整理匯總了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);
}