• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JScrollPand and components

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic