Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1726 > unrolled thread

right alignment of jtextp

Started by"ashwinijain" <ashwinijain@THRWHITE.remove-dii-this>
First post2011-04-27 15:34 +0000
Last post2011-04-27 15:35 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.java.gui


Contents

  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

#1726 — right alignment of jtextp

From"ashwinijain" <ashwinijain@THRWHITE.remove-dii-this>
Date2011-04-27 15:34 +0000
Subjectright alignment of jtextp
Message-ID<1180441533.288224.255240@o5g2000hsb.googlegroups.com>
  To: comp.lang.java.gui
how can i set right alignment of jtextpane?

---
 * 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

[toc] | [next] | [standalone]


#1731 — Re: right alignment of jt

From"Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this>
Date2011-04-27 15:35 +0000
SubjectRe: right alignment of jt
Message-ID<465ccb42$0$4729$4c368faf@roadrunner.com>
In reply to#1726
  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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web