• 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JScrollPane within JTable cell issue

 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guy,

im having a problem with not being able to scroll inside a JTable's cell. I have a cell with JScroll pane added to it. Within that there is a JLabel representing the text to be displayed. But the horizontal scroll bar does not seem to work. Following i have added the test code i have used for this.



Any help in this regard is much appreciated guys. I even looked at the threads here and there was one issue listed here but did not have a clear answer.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A renderer isn't added to any visible component hierarchy and can't receive input events. What you see in a JTable's cells is the image of the renderer component.

Use a custom editor. An editor responds to input events (obviously!)

I even looked at the threads here and there was one issue listed here but did not have a clear answer.


A link to that thread might help us to help you better.
 
Dinuka Arsakularatne
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Darryl Burke wrote:A renderer isn't added to any visible component hierarchy and can't receive input events. What you see in a JTable's cells is the image of the renderer component.

Use a custom editor. An editor responds to input events (obviously!)

I even looked at the threads here and there was one issue listed here but did not have a clear answer.


A link to that thread might help us to help you better.



Hi Darryl,

Thank you for the prompt response. This is the thread i looked at but could not a get a complete idea on it https://coderanch.com/t/335150/GUI/java/JScrollPane-inside-JTable-cell#1483844.
 
Darryl Burke
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that the linked thread suggests the same solution.

Chantal Ackermann wrote:you have to write a custom TableCellEditor for this



So, problem solved?
 
Dinuka Arsakularatne
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Darryl Burke wrote:Note that the linked thread suggests the same solution.

Chantal Ackermann wrote:you have to write a custom TableCellEditor for this



So, problem solved?



Hi Daryl,

Im trying it out right now. still was not successful where the horizontal scroll bar wont move. Will try more and post my findings here to find out from you guys what i am doing wrong. Thank you so much for your prompt responses. appreciate it alot.


Dinuka
 
Dinuka Arsakularatne
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Daryl

This is the latest example i tried out. Still no luck. Please if you have the time go through the following and let me know what im doing wrong. Your help is much appreciated.

 
Dinuka Arsakularatne
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found the answer guys. This is a working example of scrollable table data cell;

 
A wop bop a lu bob a womp bam boom. Tutti frutti ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic