Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.alt.net!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "Brandon McCombs" Subject: Re: right alignment of jt Message-ID: <465ccb42$0$4729$4c368faf@roadrunner.com> X-Comment-To: comp.lang.java.gui Newsgroups: comp.lang.java.gui In-Reply-To: <1180441533.288224.255240@o5g2000hsb.googlegroups.com> References: <1180441533.288224.255240@o5g2000hsb.googlegroups.com> Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 26 Date: Wed, 27 Apr 2011 15:35:01 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303918501 96.60.20.240 (Wed, 27 Apr 2011 10:35:01 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:35:01 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.gui:1731 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