there is a outer panel with border layout, then a panelUpper at BorderLayout.NORTH and a panelBottom at BorderLayout.BorderLayout.SOUTH and a JScrollPane scrForm at BorderLayout.CENTRE.
the scrForm contain a panel pnlForm
scrForm.getViewport().add(pnlForm)
and at runtime, the pnlForm will add a panel panelPAMM
pnlForm.add(pnlPAMM)
so the pnlForm will increase its height at runtime,
now the problem is when the pnlForm incrrease its height, the outer JScrollpane scrForm shows a vertical scrollbar to let user scroll down to the increased area, but I want the scrForm to increase its height to accomodate the pnlForm instead of showing the vertical scrollbar, only when the JScrollpane scrForm increase to a maximum height then it show the vertical scrollbar instead, how to implement it?
peter tong
Ranch Hand
Joined: Mar 15, 2008
Posts: 234
posted
0
I have try to increase the JViewport.viewsize by
scrForm.getViewport().setViewSize(new Dimension(400, 800));
but it does not help, the scrForm height has not been increased.
scrForm at BorderLayout.CENTER will occupy all the available space
leftover in the frame after allocating the other BorderLayout positions.
so, do you mean that when pnlForm increases its height you want the
actual JFrame to also increase its height (which will increase scrForm's height),
until scrForm's max height has been reached, then the scrollbars appear?
if so, that would look really weird
peter tong
Ranch Hand
Joined: Mar 15, 2008
Posts: 234
posted
0
Michael Dunn wrote:your description makes little sense.
scrForm at BorderLayout.CENTER will occupy all the available space
leftover in the frame after allocating the other BorderLayout positions.
so, do you mean that when pnlForm increases its height you want the
actual JFrame to also increase its height (which will increase scrForm's height),
until scrForm's max height has been reached, then the scrollbars appear?
if so, that would look really weird
yes, this is what I want to archieve, is there any way to implement it?