This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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