• 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

JDialog resize question

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have a JDialog. I add components(label, buttons, checkbox, panel) to it. The panel holds
a scrollpane with a jtable. The table contents change depending on the checkbox selection.
The table shows 3 rows of data when the checkbox is not selected and 7 rows of data when the
check box is selected. I do not want the vertical scroll bars to be displayed instead would
like the dialog to change the size depending on the check box selection. Is this possible?
Any hints?

Thanks
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi seema,

Yes, it's possible. First, if the JScrollpane is not used, remove it from the panel. When you add or remove components from the dialog, call pack() to resize the dialog. This will cause the LayoutManager to layout the components again, and resize the dialog if needed.
Here is a sample dialog I did in Netbeans: take a look at the AddRemoveCheckBoxItemStateChanged method.



Notice that the LayoutManager determines how the dialog is resized.

Darrin
[ May 17, 2007: Message edited by: Darrin Cartwright ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic