本文整理了Java中javax.swing.JTextPane.setParagraphAttributes()
方法的一些代码示例,展示了JTextPane.setParagraphAttributes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextPane.setParagraphAttributes()
方法的具体详情如下:
包路径:javax.swing.JTextPane
类名称:JTextPane
方法名:setParagraphAttributes
暂无
代码示例来源:origin: marytts/marytts
StyleConstants.setLeftIndent(set, left);
StyleConstants.setRightIndent(set, right);
pane.setParagraphAttributes(set, false);
代码示例来源:origin: stackoverflow.com
JTextPane output = new JTextPane();
SimpleAttributeSet attribs = new SimpleAttributeSet();
StyleConstants.setAlignment(attribs, StyleConstants.ALIGN_RIGHT);
output.setParagraphAttributes(attribs, true);
代码示例来源:origin: stackoverflow.com
JTextPane text = new JTextPane();
SimpleAttributeSet attributes = new SimpleAttributeSet();
StyleConstants.setAlignment(attributes, StyleConstants.ALIGN_RIGHT);
StyleConstants.setFontFamily(attributes, "Default");
text.setParagraphAttributes(attributes, true);
text.setEditable(false);
text.setOpaque(false);
text.setText("Search\nBy:");
代码示例来源:origin: stackoverflow.com
import javax.swing.SwingUtilities;
import javax.swing.JFrame;
import javax.swing.JTextPane;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
class Demo{
public static void main(String[]args){
SwingUtilities.invokeLater(()->{
JFrame frame=new JFrame("Right-Left");
JTextPane box=new JTextPane();
frame.getContentPane().add(box);
SimpleAttributeSet attr = new SimpleAttributeSet();
StyleConstants.setAlignment(attr, StyleConstants.ALIGN_RIGHT);
box.setParagraphAttributes(attr, true);
frame.setSize(300,200);
frame.setLocationByPlatform(true);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
});
}
}
代码示例来源:origin: stackoverflow.com
ta.setParagraphAttributes(set, false);
代码示例来源:origin: stackoverflow.com
AttributeSet aset = sc.addAttribute(SimpleAttributeSet.EMPTY,
StyleConstants.TabSet, tabset);
pane.setParagraphAttributes(aset, false);
pane.setText("\tright\tleft\tcenter\tdecimal\n" + "\t1\t1\t1\t1.0\n"
+ "\t200.002\t200.002\t200.002\t200.002\n"
代码示例来源:origin: stackoverflow.com
StyleConstants.setAlignment(centerStyle, StyleConstants.ALIGN_CENTER);
StyleConstants.setFontFamily(centerStyle, textPane.getFont().getFamily());
textPane.setParagraphAttributes(centerStyle, true);
代码示例来源:origin: stackoverflow.com
pane.setParagraphAttributes(ATTRIBS, false);
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
SimpleAttributeSet sas = new SimpleAttributeSet();
StyleConstants.setLineSpacing( sas, -.2f );
_outputPanel.setParagraphAttributes( sas, false );
_outputPanel.setEditable( false );
_outputPanel.setCaretColor( Color.white );
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
sasPara.addAttribute(HTML.Attribute.ALIGN, a_);
if (textLength > 0) parentTextPane.select(caretOffset, caretOffset + textLength);
parentTextPane.setParagraphAttributes(sasPara, true);
} else if (textLength < 0) {
if (sasPara.getAttribute(StyleConstants.NameAttribute) == Tag.IMPLIED) sasPara.addAttribute(
StyleConstants.NameAttribute, Tag.P);
sasPara.addAttribute(HTML.Attribute.ALIGN, a_);
parentTextPane.setParagraphAttributes(sasPara, true);
} else {
SimpleAttributeSet attribs = new SimpleAttributeSet();
attribs.addAttribute(HTML.Attribute.ALIGN, a_);
parentTextPane.setParagraphAttributes(sasPara, true);
sasText.addAttribute(p_, attribs);
if (textLength > 0) parentTextPane.select(caretOffset, caretOffset + textLength);
代码示例来源:origin: stackoverflow.com
AttributeSet aset=
tabStyle.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.TabSet,tabset);
textPane.setParagraphAttributes(aset, false);
代码示例来源:origin: vasl-developers/vasl
private void RebuildStyles()
{
send(" ");
StyleConstants.setAlignment(m_objMainStyle, StyleConstants.ALIGN_LEFT);
StyleConstants.setFontFamily(m_objMainStyle, m_objChatterFont.getFamily());
StyleConstants.setFontSize(m_objMainStyle, m_objChatterFont.getSize());
StyleConstants.setSpaceAbove(m_objMainStyle, 2);
StyleConstants.setSpaceBelow(m_objMainStyle, 2);
send("- Chatter font changed");
send(" ");
FontMetrics l_objFM = m_objChatPanel.getFontMetrics(m_objChatterFont);
float l_f = (float)l_objFM.stringWidth(BEFORE_CATEGORY + ASLDiceBot.OTHER_CATEGORY + "XXX");
TabStop[] lar_objTabs = new TabStop[10]; // this sucks
for(int l_i = 0; l_i < lar_objTabs.length; l_i++)
{
lar_objTabs[l_i] = new TabStop(l_f * (l_i + 1), TabStop.ALIGN_LEFT, TabStop.LEAD_NONE);
}
TabSet l_objTabset = new TabSet(lar_objTabs);
StyleConstants.setTabSet(m_objMainStyle, new TabSet(new TabStop[0]));
StyleConstants.setTabSet(m_objMainStyle, l_objTabset);
m_objChatPanel.setParagraphAttributes(m_objMainStyle, true);
}
代码示例来源:origin: stackoverflow.com
MutableAttributeSet att = new SimpleAttributeSet();
StyleConstants.setAlignment(att, align);
this.setParagraphAttributes(att, false);
MutableAttributeSet att = new SimpleAttributeSet();
StyleConstants.setFirstLineIndent(att, indent);
this.setParagraphAttributes(att, false);
MutableAttributeSet att = new SimpleAttributeSet();
StyleConstants.setSpaceAbove(att, space);
this.setParagraphAttributes(att, false);
MutableAttributeSet att = new SimpleAttributeSet();
StyleConstants.setSpaceBelow(att, space);
this.setParagraphAttributes(att, false);
MutableAttributeSet att = new SimpleAttributeSet();
StyleConstants.setLineSpacing(att, space);
this.setParagraphAttributes(att, false);
内容来源于网络,如有侵权,请联系作者删除!