Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1731
| From | "Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: right alignment of jt |
| Message-ID | <465ccb42$0$4729$4c368faf@roadrunner.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <1180441533.288224.255240@o5g2000hsb.googlegroups.com> |
| Date | 2011-04-27 15:35 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui
ashwinijain wrote:
> how can i set right alignment of jtextpane?
>
Try the following:
JTextPane edit=new JTextPane();
try {
SimpleAttributeSet attrs=new SimpleAttributeSet();
StyleConstants.setAlignment(attrs,StyleConstants.ALIGN_RIGHT);
StyledDocument doc=(StyledDocument)edit.getDocument();
doc.insertString(0,"test",attrs);
doc.setParagraphAttributes(0,doc.getLength()-1,attrs,false);
}
catch (Exception ex) {
ex.printStackTrace();
}
That came from
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=390611
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Find similar | Unroll thread
right alignment of jtextp "ashwinijain" <ashwinijain@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000 Re: right alignment of jt "Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
csiph-web