This has got to be easy, but I'm not getting it. I am displaying a JTable in a JPanel. I am setting the size of the JTable using: setPreferredScrollableViewportSize( new Dimension( 685, 180 ) ) ...but what I'd really like is to have it sized to fit the display area of the JPanel. How do I get that Dimension?
Hi Peter, Use the JPanel layout to perform it for you. If you set the JPanel layout to BorderLayout you can add your JTable to the CENTER (default if not specified) then it will work for you.
That way your table will be the size of the panel! Regards, Manfred.
Thanks Manfred! That works. Do you have an idea how to do the same thing when I'm placing a JPanel in a tab on a JTabbedPane? It doesn't look like a layout manager can be used for that. Thanks again... Peter