File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes TabStops Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "TabStops" Watch "TabStops" New topic
Author

TabStops

Steve Sinai
Greenhorn

Joined: Aug 21, 2004
Posts: 25
Hi - Does anyone know if there's a way to set TabStop.ALIGN_DECIMAL on a JTextPane as a default, i.e., without creating a TabSet containing lots of TabStops? I have a JTextPane with lots of numbers I'd like to align using tabs.

Thanks,
Steve Sinai
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
The short answer is no. Nothing is impossible and you could muck around with the Views and ViewFactories and such, but that would be much more work than just using TabStop and TabSet. Why are you reluctant to use those?


bitguru blog
Steve Sinai
Greenhorn

Joined: Aug 21, 2004
Posts: 25
I actually do use TabStops and TabSets now, but I was hoping there was an easy way to set the default behavior to align tabs along a decimal point in a number, rather than creating a bunch of TabStops and a TabSet. My pages are pretty dynamic, and it's hard to know how many TabStops will be needed on a page. Right now I'm just creating an array of 100 TabStops, but it's inevitable that someone's going to come up with a document that needs more than 100.
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
I've been thinking about this off and on, and I've decided it's actually not all that difficult to customize a View to do this.



Alas, it is cumbersome to actually use DecimalParagraphView in a JTextPane. I'll post some sample code in a subsequent post.
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Originally posted by Brian Cole:
Alas, it is cumbersome to actually use DecimalParagraphView in a JTextPane. I'll post some sample code in a subsequent post.



[ January 04, 2007: Message edited by: Brian Cole ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TabStops
 
Similar Threads
Formatting text in JTextArea
Browsing HTML and XML files in text area
How the heck do you enter a image into a JEditorPane???
change the text color momentarily
calling browser from Standalone Java application