• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JTree expansion & collapse programatically

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

I am trying to do JTree expand & collapse one level at a time whenever user presses Expand & collapse button.

few questins ?

there are so many implementations if found for above way using getRowcount,
getRootToPaht(rootNode) and expand recursively etc

while expand is working , collapse wont work if both are implemented using same logic

Also, JTree.getRowCount() API returns no. of rows ? I dont understand this
JTree is stored as row & columns in array and does some body can explain this that will be great ?

int row = m_deficiencyTree.getRowCount();

while(row >= 0){

above code is for whole Tree collapse but i want to do one at a time ?
similary with Tree expansion ?

Also, Swing is becoming tougher for me since it looks like i have to master API or what is better way to mast SWING
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Switching from electric heat to a rocket mass heater reduces your carbon footprint as much as parking 7 cars. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic