• 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

resize jdialog

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to resize a component on a JDialog at the same time the user is resizing the JDialog itself to match dimensions?
Is this possible? (Without using GridBagLayout)
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many other layout managers will also resize components in respect to their parents. BorderLayout is also very good at this. (at least for the component in the CENTER region) Even if you have no layout manager, you can attach a ComponentListener to the parent component and listen for resize events and resize the child component.

A lot of layout managers work off the preferred size of the child components... if you are having trouble with a component not sizing correctly, see what dimensions getPreferredSize() is returning.
 
Cy Bird
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess that is my question. Is there an example of how to listen for resize events? I tried WindowAdapter and didn't find I want I neeeded there.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You would use the componentResized( ComponentEvent ) method of ComponentListener.
 
reply
    Bookmark Topic Watch Topic
  • New Topic