File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Scrolling with JDialog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Scrolling with JDialog" Watch "Scrolling with JDialog" New topic

Scrolling with JDialog

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Hi there. I have a JDialog that has quite a few components in it. Depending on what the user chooses in the first JComboBox, certain components below that are made visible. The problem I am running into, is there are some users who have their resolution set pretty low... so when they choose a selection that makes all components visible on the JDialog, it resizes to accommodate the components, and then goes off of the screen, and they are unable to access the JButtons at the bottom. I was contemplating putting a JScrollPane in the JDialog, but I didn't think that would work because I already resized the dialog, so the scroll bar wouldn't ever appear. Any ideas?
Rob Spoor

Joined: Oct 27, 2005
Posts: 20276

Use GraphicsEnvironment.getMaximumWindowBounds() to get the desktop size (i.e. without the task bar etc), then set the size as the minimum of the desired size and this size.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Scrolling with JDialog
It's not a secret anymore!