• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JScrollPane size problem

 
Ranch Hand
Posts: 117
Mac Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Bartender
Posts: 5465
212
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 5465
212
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome!
 
reply
    Bookmark Topic Watch Topic
  • New Topic