How to implement expand/collapse nature to JTables in java swing application

Dyapa Srikanth picture Dyapa Srikanth · May 10, 2011 · Viewed 8.7k times · Source

In my application i am displaying a list of tables with huge data. All of the tables may not fit in the window, we need to scroll to see the bottom tables. Here i need expand/collapse nature to the tables. User may select which tables he would like to see among all of the tables. This is my sample screen shot of the application. enter image description here

How can i do it. Any suggestions would be greatly appreciated.

Answer

Harry Joy picture Harry Joy · May 10, 2011
  1. You can try JXTreeTable or TreeTable

  2. or you can switch jtable's visibility to make a expand/collapse effect. First when it is visible and use selects collapse use setVisible(false); and do reverse in expand. [Not sure this will work or not.]