• Post Reply Bookmark Topic Watch Topic
  • New Topic

What's the best rule for fitting a dynamic JTable inside a dialog or a frame?(height issue)

 
nizar ben mansour
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I want to calculate the height of a dialog that contain only a table depending on how many rows that table it has so I'm using the cross multiplication rule.For example i check initially that my table is well fitting into the dialog(Without space at the bottom) for some value and after that i use the cross multiplication rule because data are dynamic.But unfortunately this rule does not solve the problem.What's the best rule for fitting a dynamic table inside a dialog or a frame? Here is my code.

 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

The recommend way is to
1) Set the layout of the parent container to BorderLayout
2) Add the table to a JScrollPane instance
3) Add the scroll pane to the parent container
 
nizar ben mansour
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but my client wants me that if i have a table i must fill it and gain the space with no use of Jscrollpane what must i do ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!