aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes tab not recognised in JList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "tab not recognised in JList" Watch "tab not recognised in JList" New topic
Author

tab not recognised in JList

Ramu Eedupalli
Greenhorn

Joined: Apr 10, 2009
Posts: 9
Hi,

I'm using a JList to display a string, but the string is separated by tabs into different fields. The JList doesnt recognise the tabs, and shows all the fields without spaces between them. To address this issue I used below code.

This code is working but the problem is if we have 3 tab characters in a single string only first tab character is getting replaced with the given width of tab stop other tab charecters are not getting replaced with the given width of tab stop.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> but the string is separated by tabs into different fields.

sounds like a JTable would suit better
Ramu Eedupalli
Greenhorn

Joined: Apr 10, 2009
Posts: 9
I want to have tab stop whereever there is a tab charecter in a string of JList
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2216
    
    7
if we have 3 tab characters in a single string only first tab character is getting replaced with the given width of tab stop other tab charecters are not getting replaced with the given width of tab stop.


Because you only set 1 tab stop. If you have 3 tabs then you need 3 tab stops.
Ramu Eedupalli
Greenhorn

Joined: Apr 10, 2009
Posts: 9
Can't we repeat single tab stop for multiple tabs?
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2216
    
    7
Ramu Eedupalli wrote:Can't we repeat single tab stop for multiple tabs?


Yes.

Ramu Eedupalli
Greenhorn

Joined: Apr 10, 2009
Posts: 9
How can we achieve this?

I tried like having multiple tabs of same width


But still I am getting one tab stop only. I want to have only one tab stop and it should get repeated for multiple tabs.

If my string is "t\th\tr\te\te"
and if I define tab stop like this


All \ts in the above string should get replaced with a blank space of width of 10 pixels.

Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2216
    
    7
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tab not recognised in JList