JInternalFrame does not automatically resize when i add a row to a table

Posted on 2003-03-10
Medium Priority
Last Modified: 2010-05-19
Hi All,

When I add a row to a table, the JInternalFrame does not resize to accomodate this. Instead the JScrollPane viewport resizes and I get a vertical scroll bar.
Any ideas how to resolve this?
Thanks for looking
Question by:colin812
  • 2
LVL 35

Expert Comment

ID: 8102807
Errrr....A ScrollPane is supposed to be there to stop the JInternalPane resizing, and add a Vertical scrollbar when you add rows to the table...

Expert Comment

ID: 8102887
If you really have to do this (as TimYates said, everything works as designed in your example), you have to do it manually everytime you add a row:

Recatangle formerbounds = internalframe.getBounds();
internalpane.reshape(formerbounds.x, formerbounds.y, table.getSize().width, formerbounds.height);

You may have to add some pixels to the width because there is always some margin.


Accepted Solution

karlika earned 150 total points
ID: 8102916
oh, sorry, you meant the height to adjust:

Recatangle formerbounds = internalframe.getBounds();
internalpane.reshape(formerbounds.x, formerbounds.y, formerbounds.width, table.getSize().height);

There you also have to add the size of the margin and all other components that are contained by this JInternalFrame

Author Comment

ID: 8104359
I gave the points to karlika for suggesting an alternative although both answers are correct,
many thanks to both of you,

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month4 days, 11 hours left to enroll

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question