Article View: borland.public.jbuilder.java.swing
Article #10468Re: JEditorPane
From: Patrick H. Ryan
Date: Mon, 04 Oct 1999 00:00
Date: Mon, 04 Oct 1999 00:00
26 lines
1294 bytes
1294 bytes
Steve, Here's how to align text: MutableAttributeSet attr = new SimpleAttributeSet(); StyleConstants.setAlignment(attr, StyleConstants.ALIGN_CENTER); int p0 = getSelectionStart(); int p1 = getSelectionEnd(); StyledDocument doc = (StyledDocument)getDocument(); doc.setParagraphAttributes(p0, p1 - p0, attr, false); Oreilly's book Java Swing has alot of detailed information on this. -Patrick. Steve Johnson wrote: > Hi, > I'm trying to build a mini-editor to have some basic rich-text > functionality. Could someone please send me > some code sample showing how to programatically change the attribute of the > selected text in a JEditorPane. > > Thanks, > > Steve
Technical Details
Message-ID:
<37F8A2BE.70F987D4@pmifeg.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7sbc40$qg74@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,b85bb0c10aee4d3f X-Google-Attributes: gid111d45,public From: "Patrick H. Ryan" <ryanxpx@pmifeg.com> Subject: Re: JEditorPane Date: 1999/10/04 Message-ID: <37F8A2BE.70F987D4@pmifeg.com> X-Deja-AN: 532629284 Content-Transfer-Encoding: 7bit References: <7sbc40$qg74@forums.borland.com> To: steve@entersol.hypermart.net X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing