javax.swing.text.StyledDocument.setParagraphAttributes()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中javax.swing.text.StyledDocument.setParagraphAttributes()方法的一些代码示例,展示了StyledDocument.setParagraphAttributes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StyledDocument.setParagraphAttributes()方法的具体详情如下:
包路径:javax.swing.text.StyledDocument
类名称:StyledDocument
方法名:setParagraphAttributes

StyledDocument.setParagraphAttributes介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

  1. StyledDocument doc = textPane.getStyledDocument();
  2. SimpleAttributeSet center = new SimpleAttributeSet();
  3. StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
  4. doc.setParagraphAttributes(0, doc.getLength(), center, false);

代码示例来源:origin: kiegroup/optaplanner

  1. private JComponent createNoPlannerFoundTextField() {
  2. String infoMessage = "No planner benchmarks have been found in the benchmarkDirectory ("
  3. + benchmarkAggregator.getBenchmarkDirectory() + ").";
  4. JTextPane textPane = new JTextPane();
  5. textPane.setEditable(false);
  6. textPane.setText(infoMessage);
  7. // center info message
  8. StyledDocument styledDocument = textPane.getStyledDocument();
  9. SimpleAttributeSet center = new SimpleAttributeSet();
  10. StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
  11. StyleConstants.setBold(center, true);
  12. styledDocument.setParagraphAttributes(0, styledDocument.getLength(),
  13. center, false);
  14. return textPane;
  15. }

代码示例来源:origin: org.swinglabs.swingx/swingx-all

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void setParagraphAttributes(int offset, int length,
  6. AttributeSet s, boolean replace) {
  7. ((StyledDocument) delegate).setParagraphAttributes(offset, length, s, replace);
  8. }
  9. }

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public void setParagraphAttributes(int offset, int length,
  5. AttributeSet s, boolean replace) {
  6. ((StyledDocument) delegate).setParagraphAttributes(offset, length, s, replace);
  7. }
  8. }

代码示例来源:origin: tmyroadctfig/swingx

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void setParagraphAttributes(int offset, int length,
  6. AttributeSet s, boolean replace) {
  7. ((StyledDocument) delegate).setParagraphAttributes(offset, length, s, replace);
  8. }
  9. }

代码示例来源:origin: stackoverflow.com

  1. StyledDocument document = new DefaultStyledDocument():
  2. SimpleAttributeSet attributes = new SimpleAttributeSet();
  3. TabStop[] tabStops = new TabStop[3];
  4. tabStops[0] = new TabStop(4.0, TabStop.ALIGN_LEFT, TabStop.LEAD_DOTS);
  5. tabStops[1] = new TabStop(20.0, TabStop.ALIGN_LEFT, TabStop.LEAD_DOTS);
  6. tabStops[2] = new TabStop(30.0, TabStop.ALIGN_LEFT, TabStop.LEAD_DOTS);
  7. TabSet tabSet = new TabSet(tabStops);
  8. StyleConstants.setTabSet(attributes, tabSet);
  9. document.setParagraphAttributes(0, 0, attributes, false);

代码示例来源:origin: stackoverflow.com

  1. JTextPane textPane = new JTextPane();
  2. textPane.setText( "one\ntwo\nthree\nfour\nfive\nsix\nseven\neight" );
  3. StyledDocument doc = textPane.getStyledDocument();
  4. // Set alignment to be centered for all paragraphs
  5. SimpleAttributeSet center = new SimpleAttributeSet();
  6. StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
  7. doc.setParagraphAttributes(0, doc.getLength(), center, false);

代码示例来源:origin: stackoverflow.com

  1. StyledDocument doc = textPane.getStyledDocument();
  2. SimpleAttributeSet attrs = new SimpleAttributeSet();
  3. StyleConstants.setForeground(attrs, myColor);
  4. doc.setParagraphAttributes(0, doc.getLength(), attrs, false);
  5. textPane.setDocument(doc);

代码示例来源:origin: ontop/ontop

  1. private void resetStyles() {
  2. doc.setParagraphAttributes(0, doc.getLength(), plainStyle, true);
  3. StyleConstants.setFontSize(fontSizeStyle, 14);
  4. Font f = plainFont;
  5. StyleConstants.setFontFamily(fontSizeStyle, f.getFamily());
  6. doc.setParagraphAttributes(0, doc.getLength(), fontSizeStyle, false);
  7. setupFont();
  8. }

代码示例来源:origin: ontop/ontop

  1. private void resetStyles(StyledDocument doc) {
  2. doc.setParagraphAttributes(0, doc.getLength(), plainStyle, true);
  3. StyleConstants.setFontSize(fontSizeStyle, 14);
  4. Font f = plainFont;
  5. StyleConstants.setFontFamily(fontSizeStyle, f.getFamily());
  6. doc.setParagraphAttributes(0, doc.getLength(), fontSizeStyle, false);
  7. setupFont();
  8. }

代码示例来源:origin: stackoverflow.com

  1. static class TextAreaRenderer extends JTextPane implements TableCellRenderer {
  2. private final DefaultTableCellRenderer adaptee = new DefaultTableCellRenderer();
  3. /** map from table to map of rows to map of column heights */
  4. private final Map cellSizes = new HashMap();
  5. public TextAreaRenderer() {
  6. // !! setLineWrap(true);
  7. // setWrapStyleWord(true);
  8. StyledDocument doc = getStyledDocument();
  9. SimpleAttributeSet center = new SimpleAttributeSet();
  10. StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
  11. doc.setParagraphAttributes(0, doc.getLength(), center, false);
  12. }

代码示例来源:origin: stackoverflow.com

  1. public JTextPane createTextPane(String text){
  2. JTextPane textPane = new JTextPane();
  3. tp.setText(text);
  4. StyledDocument doc = textPane.getStyledDocument();
  5. SimpleAttributeSet center = new SimpleAttributeSet();
  6. StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
  7. doc.setParagraphAttributes(0, doc.getLength(), center, false);+
  8. }

代码示例来源:origin: stackoverflow.com

  1. JTextPane textPane = new JTextPane();
  2. StyledDocument doc = textPane.getStyledDocument();
  3. SimpleAttributeSet style = new SimpleAttributeSet();
  4. StyleConstants.setLeftIndent(style, 20);
  5. StyleConstants.setFirstLineIndent(style, -20);
  6. StyleConstants.setForeground(style, Color.BLUE);
  7. doc.setParagraphAttributes(0, doc.getLength(), style, true);

代码示例来源:origin: stackoverflow.com

  1. JTextPane textPane = new JTextPane();
  2. StyledDocument doc = textPane.getStyledDocument();
  3. SimpleAttributeSet center = new SimpleAttributeSet();
  4. StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
  5. doc.setParagraphAttributes(0, doc.getLength(), center, false);

代码示例来源:origin: net.sf.ingenias/editor

  1. @Override
  2. public void setText(String t) {
  3. // TODO Auto-generated method stub
  4. super.setText(t);
  5. StyledDocument doc = this.getStyledDocument();
  6. SimpleAttributeSet center = new SimpleAttributeSet();
  7. StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
  8. doc.setParagraphAttributes(0, doc.getLength(), center, false);
  9. }

代码示例来源:origin: protegeproject/protege

  1. private void resetStyles(StyledDocument doc) {
  2. doc.setParagraphAttributes(0, doc.getLength(), plainStyle, true);
  3. StyleConstants.setFontSize(fontSizeStyle, getFontSize());
  4. Font f = OWLRendererPreferences.getInstance().getFont();
  5. StyleConstants.setFontFamily(fontSizeStyle, f.getFamily());
  6. doc.setParagraphAttributes(0, doc.getLength(), fontSizeStyle, false);
  7. setupFont();
  8. }

代码示例来源:origin: org.protege/protege-editor-owl

  1. private void resetStyles(StyledDocument doc) {
  2. doc.setParagraphAttributes(0, doc.getLength(), plainStyle, true);
  3. StyleConstants.setFontSize(fontSizeStyle, getFontSize());
  4. Font f = OWLRendererPreferences.getInstance().getFont();
  5. StyleConstants.setFontFamily(fontSizeStyle, f.getFamily());
  6. doc.setParagraphAttributes(0, doc.getLength(), fontSizeStyle, false);
  7. setupFont();
  8. }

代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl

  1. private void resetStyles(StyledDocument doc) {
  2. doc.setParagraphAttributes(0, doc.getLength(), plainStyle, true);
  3. StyleConstants.setFontSize(fontSizeStyle, getFontSize());
  4. Font f = OWLRendererPreferences.getInstance().getFont();
  5. StyleConstants.setFontFamily(fontSizeStyle, f.getFamily());
  6. doc.setParagraphAttributes(0, doc.getLength(), fontSizeStyle, false);
  7. setupFont();
  8. }

代码示例来源:origin: edu.stanford.protege/protege-editor-owl

  1. private void resetStyles(StyledDocument doc) {
  2. doc.setParagraphAttributes(0, doc.getLength(), plainStyle, true);
  3. StyleConstants.setFontSize(fontSizeStyle, getFontSize());
  4. Font f = OWLRendererPreferences.getInstance().getFont();
  5. StyleConstants.setFontFamily(fontSizeStyle, f.getFamily());
  6. doc.setParagraphAttributes(0, doc.getLength(), fontSizeStyle, false);
  7. setupFont();
  8. }

代码示例来源:origin: ontop/ontop

  1. private void resetStyles() {
  2. setupFont();
  3. StyleConstants.setFontSize(fontSizeStyle, getFontSize());
  4. StyleConstants.setFontFamily(fontSizeStyle, plainFont.getFamily());
  5. StyleConstants.setForeground(fontSizeStyle, Color.black);
  6. fontSizeStyle.addAttribute(StyleConstants.CharacterConstants.Foreground, Color.black);
  7. doc.setParagraphAttributes(0, doc.getLength(), fontSizeStyle, true);
  8. }

相关文章