Forums Register Login

JScrollPane size problem

+Pie Number of slices to send: Send
I have the following window:



Code snippet:



What you don't see is the button panel, unless one resizes and moves the window. This is starting to make me think: How will this look on OS X? Ubuntu? Will I have to modify the application's behavior for all these systems? What should I do to make the buttons visible? Why are they hiding under the taskbar?

I'd be grateful for your help.

+Pie Number of slices to send: Send
Have you provided any preferred sizes or any other dimensions to your scroll pane? Looking at your image, it seems to be the case because he vertical scroll bar is showing.
The usual way is to add the scroll pane to a container which has a border layout
e.g.

This way the scroll bars show up as and when required.
+Pie Number of slices to send: Send
 

Maneesh Godbole wrote:Have you provided any preferred sizes or any other dimensions to your scroll pane? Looking at your image, it seems to be the case because he vertical scroll bar is showing.
The usual way is to add the scroll pane to a container which has a border layout
e.g.

This way the scroll bars show up as and when required.



Thanks for your input Maneesh.

The vertical scrollbar is showing because the content of the wrapped JPanel (childComponentToBeWrapped) doesn't fit. I've also disabled the horizontal scrollbar. I haven't set any preferred sizes, although I did try but it had no effect. I am probably doing something wrong, but I don't know why the JPanel below the JScrollPane is pushed under the taskbar.



+Pie Number of slices to send: Send
Could be the layout then. Please post your SSCCE (<=link, please read) so we can take a look
+Pie Number of slices to send: Send
 

Maneesh Godbole wrote:Could be the layout then. Please post your SSCCE (<=link, please read) so we can take a look



Okay, I tried to make it as SSCCE as possible and I'm pasting the code below. The only thing that makes this a bit nonstandard is the MigLayout package, available here. I'm also adding a GridLayout example if you want to compile right away, which I haven't tuned, and although the buttons show up, the rest of the window slides under the taskbar as well.[/url]

First MigLayout:



And GridLayout:



In both cases, the bottom of the window slides under the taskbar.


1
+Pie Number of slices to send: Send
I don't know MigLayout, but GridLayout makes all components equal in size.

I've tried your code, and since your scrollpane is 529 pixels high, the buttonpanel gets a height of 529 too. making the frame getting a height of about 1100 pixels. That's bigger than my screensize.

You could do the following:


and



I've tried it, and it works!

Greetz,
Piet

+Pie Number of slices to send: Send
 

Piet Souris wrote:I don't know MigLayout, but GridLayout makes all components equal in size.

I've tried your code, and since your scrollpane is 529 pixels high, the buttonpanel gets a height of 529 too. making the frame getting a height of about 1100 pixels. That's bigger than my screensize.



You're right, that's exactly what happens.


You could do the following:


and



I've tried it, and it works!

Greetz,
Piet



It certainly does, works like a charm with MigLayout as well. Thank you Piet!
+Pie Number of slices to send: Send
You're welcome!
Morning came much too soon and it brought along a friend named Margarita Hangover, and a tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 14998 times.
Similar Threads
Problem when initializing Label text or button text
Performans of Cyclic Shift Hash Codes in Turkish Dictionary
[Math] Draw Line Yaw
GUI help needs
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 15:53:57.