| Author |
JTable and its size
|
Mihai Radulescu
Ranch Hand
Joined: Sep 18, 2003
Posts: 912
|
|
Hi I use a JTable with JScrollPane like this : JScrollPane scrollPane = new JScrollPane(table); where the table is my JTable but the resoult is a gigant table.For shrink it (make it smaller) I find two solution: 1.I set a preferred size for the frame and the table goes small 2.I set a prefferd size for the view port with : setPreferredScrollableViewportSize(.. The both solution require "hardcode" and I am not so happy with them. My question is : Thare are also other ways to resize the table without "hardcode" ?
|
SCJP, SCJD, SCWCD
|
 |
Eric Snell
Greenhorn
Joined: Jun 09, 2004
Posts: 28
|
|
Here is a class that will calculate the PreferredScrollableViewportSize (along with some other things). Hope you find it helpful.
|
 |
Mihai Radulescu
Ranch Hand
Joined: Sep 18, 2003
Posts: 912
|
|
|
Ok it works,Thanks!
|
 |
 |
|
|
subject: JTable and its size
|
|
|