This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

tab not recognised in JList  RSS feed

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> but the string is separated by tabs into different fields.

sounds like a JTable would suit better
 
Ramu Eedupalli
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to have tab stop whereever there is a tab charecter in a string of JList
 
Rancher
Posts: 3000
20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't we repeat single tab stop for multiple tabs?
 
Rob Camick
Rancher
Posts: 3000
20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ramu Eedupalli wrote:Can't we repeat single tab stop for multiple tabs?



Yes.

 
Ramu Eedupalli
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 3000
20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
I suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!