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

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

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

StyledDocument.setParagraphAttributes介绍

暂无

代码示例

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

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

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

private JComponent createNoPlannerFoundTextField() {
  String infoMessage = "No planner benchmarks have been found in the benchmarkDirectory ("
      + benchmarkAggregator.getBenchmarkDirectory() + ").";
  JTextPane textPane = new JTextPane();
  textPane.setEditable(false);
  textPane.setText(infoMessage);
  // center info message
  StyledDocument styledDocument = textPane.getStyledDocument();
  SimpleAttributeSet center = new SimpleAttributeSet();
  StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
  StyleConstants.setBold(center, true);
  styledDocument.setParagraphAttributes(0, styledDocument.getLength(),
      center, false);
  return textPane;
}

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

/**
   * {@inheritDoc}
   */
  @Override
  public void setParagraphAttributes(int offset, int length,
      AttributeSet s, boolean replace) {
        ((StyledDocument) delegate).setParagraphAttributes(offset, length, s, replace);
      }
}

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

/**
   * {@inheritDoc}
   */
  public void setParagraphAttributes(int offset, int length,
      AttributeSet s, boolean replace) {
        ((StyledDocument) delegate).setParagraphAttributes(offset, length, s, replace);
      }
}

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

/**
   * {@inheritDoc}
   */
  @Override
  public void setParagraphAttributes(int offset, int length,
      AttributeSet s, boolean replace) {
        ((StyledDocument) delegate).setParagraphAttributes(offset, length, s, replace);
      }
}

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

StyledDocument document = new DefaultStyledDocument():

SimpleAttributeSet attributes = new SimpleAttributeSet();

TabStop[] tabStops = new TabStop[3];
tabStops[0] = new TabStop(4.0, TabStop.ALIGN_LEFT, TabStop.LEAD_DOTS);
tabStops[1] = new TabStop(20.0, TabStop.ALIGN_LEFT, TabStop.LEAD_DOTS);
tabStops[2] = new TabStop(30.0, TabStop.ALIGN_LEFT, TabStop.LEAD_DOTS);

TabSet tabSet = new TabSet(tabStops);
StyleConstants.setTabSet(attributes, tabSet);
document.setParagraphAttributes(0, 0, attributes, false);

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

JTextPane textPane = new JTextPane();
textPane.setText( "one\ntwo\nthree\nfour\nfive\nsix\nseven\neight" );
StyledDocument doc = textPane.getStyledDocument();

//  Set alignment to be centered for all paragraphs
SimpleAttributeSet center = new SimpleAttributeSet();
StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);

doc.setParagraphAttributes(0, doc.getLength(), center, false);

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

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

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

private void resetStyles() {
  doc.setParagraphAttributes(0, doc.getLength(), plainStyle, true);
  StyleConstants.setFontSize(fontSizeStyle, 14);
  Font f = plainFont;
  StyleConstants.setFontFamily(fontSizeStyle, f.getFamily());
  doc.setParagraphAttributes(0, doc.getLength(), fontSizeStyle, false);
  setupFont();
}

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

private void resetStyles(StyledDocument doc) {
  doc.setParagraphAttributes(0, doc.getLength(), plainStyle, true);
  StyleConstants.setFontSize(fontSizeStyle, 14);
  Font f = plainFont;
  StyleConstants.setFontFamily(fontSizeStyle, f.getFamily());
  doc.setParagraphAttributes(0, doc.getLength(), fontSizeStyle, false);
  setupFont();
}

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

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

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

public JTextPane createTextPane(String text){
 JTextPane textPane = new JTextPane();
 tp.setText(text);
 StyledDocument doc = textPane.getStyledDocument();
 SimpleAttributeSet center = new SimpleAttributeSet();
 StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
 doc.setParagraphAttributes(0, doc.getLength(), center, false);+
}

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

JTextPane textPane = new JTextPane();
StyledDocument doc = textPane.getStyledDocument();
SimpleAttributeSet style = new SimpleAttributeSet();
StyleConstants.setLeftIndent(style, 20);
StyleConstants.setFirstLineIndent(style, -20);
StyleConstants.setForeground(style, Color.BLUE);
doc.setParagraphAttributes(0, doc.getLength(), style, true);

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

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

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

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

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

private void resetStyles(StyledDocument doc) {
  doc.setParagraphAttributes(0, doc.getLength(), plainStyle, true);
  StyleConstants.setFontSize(fontSizeStyle, getFontSize());
  Font f = OWLRendererPreferences.getInstance().getFont();
  StyleConstants.setFontFamily(fontSizeStyle, f.getFamily());
  doc.setParagraphAttributes(0, doc.getLength(), fontSizeStyle, false);
  setupFont();
}

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

private void resetStyles(StyledDocument doc) {
  doc.setParagraphAttributes(0, doc.getLength(), plainStyle, true);
  StyleConstants.setFontSize(fontSizeStyle, getFontSize());
  Font f = OWLRendererPreferences.getInstance().getFont();
  StyleConstants.setFontFamily(fontSizeStyle, f.getFamily());
  doc.setParagraphAttributes(0, doc.getLength(), fontSizeStyle, false);
  setupFont();
}

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

private void resetStyles(StyledDocument doc) {
  doc.setParagraphAttributes(0, doc.getLength(), plainStyle, true);
  StyleConstants.setFontSize(fontSizeStyle, getFontSize());
  Font f = OWLRendererPreferences.getInstance().getFont();
  StyleConstants.setFontFamily(fontSizeStyle, f.getFamily());
  doc.setParagraphAttributes(0, doc.getLength(), fontSizeStyle, false);
  setupFont();
}

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

private void resetStyles(StyledDocument doc) {
  doc.setParagraphAttributes(0, doc.getLength(), plainStyle, true);
  StyleConstants.setFontSize(fontSizeStyle, getFontSize());
  Font f = OWLRendererPreferences.getInstance().getFont();
  StyleConstants.setFontFamily(fontSizeStyle, f.getFamily());
  doc.setParagraphAttributes(0, doc.getLength(), fontSizeStyle, false);
  setupFont();
}

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

private void resetStyles() {
  setupFont();
  StyleConstants.setFontSize(fontSizeStyle, getFontSize());
  StyleConstants.setFontFamily(fontSizeStyle, plainFont.getFamily());
  StyleConstants.setForeground(fontSizeStyle, Color.black);
  fontSizeStyle.addAttribute(StyleConstants.CharacterConstants.Foreground, Color.black);
  doc.setParagraphAttributes(0, doc.getLength(), fontSizeStyle, true);
}

相关文章