StyledDocument doc = textPane.getStyledDocument(); SimpleAttributeSet center = new SimpleAttributeSet(); StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER); doc.setParagraphAttributes(0, doc.getLength(), center, false);
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; }
/** * {@inheritDoc} */ @Override public void setParagraphAttributes(int offset, int length, AttributeSet s, boolean replace) { ((StyledDocument) delegate).setParagraphAttributes(offset, length, s, replace); } }
/** * {@inheritDoc} */ public void setParagraphAttributes(int offset, int length, AttributeSet s, boolean replace) { ((StyledDocument) delegate).setParagraphAttributes(offset, length, s, replace); } }
/** * {@inheritDoc} */ @Override public void setParagraphAttributes(int offset, int length, AttributeSet s, boolean replace) { ((StyledDocument) delegate).setParagraphAttributes(offset, length, s, replace); } }
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);
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);
StyledDocument doc = textPane.getStyledDocument(); SimpleAttributeSet attrs = new SimpleAttributeSet(); StyleConstants.setForeground(attrs, myColor); doc.setParagraphAttributes(0, doc.getLength(), attrs, false); textPane.setDocument(doc);
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(); }
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(); }
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); }
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);+ }
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);
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);
@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); }
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(); }
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(); }
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(); }
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(); }
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); }