Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scrolling with JDialog

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
Thanks!
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic