This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JScrollPane size problem

 
Paul Mrozik
Ranch Hand
Posts: 117
Chrome Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Mrozik
Ranch Hand
Posts: 117
Chrome Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.



 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could be the layout then. Please post your SSCCE (<=link, please read) so we can take a look
 
Paul Mrozik
Ranch Hand
Posts: 117
Chrome Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.


 
Piet Souris
Ranch Hand
Posts: 1099
16
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Paul Mrozik
Ranch Hand
Posts: 117
Chrome Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Piet Souris
Ranch Hand
Posts: 1099
16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic