Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JScrollPand and components

 
John Galt
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTabbedPane in which new tab are added by reading lines of a file. In each tab I have a JScrollPane with a JTable
jScrollPane.add(jTable);
Since these are created on the fly I do not know which tab will be selected and therefore must access the JTable by accessing the JScrollPane.
I can access the JScrollPane alright, but do not know how to access the JTable inside this JScrollPane. Any ideas?
 
John Galt
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found the solution, but thank you anyway, in case someone else asks the question

JScrollPane jsp = (JScrollPane)displayPane.getComponent(index);
JTable jt = (JTable)jsp.getViewport().getComponent(0);
if there is only one component.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic