Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JScrollPane within JTable cell issue

 
Dinuka Arsakularatne
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.
 
Darryl Burke
Bartender
Posts: 5126
11
Java Netbeans IDE Opera
  • 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 http://www.coderanch.com/t/335150/GUI/java/JScrollPane-inside-JTable-cell#1483844.
 
Darryl Burke
Bartender
Posts: 5126
11
Java Netbeans IDE Opera
  • 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;

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic