wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Fixed drawing area Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Fixed drawing area" Watch "Fixed drawing area" New topic
Author

Fixed drawing area

Mihai Popa
Greenhorn

Joined: Dec 04, 2011
Posts: 5
I have a JFrame that contains a JPanel used as a drawing area. I want to set a fixed size for this drawing area but the JPanel dimension is set based on the layout manager of the JFrame. What should I do?
Tarun Bolla
Ranch Hand

Joined: Jun 20, 2011
Posts: 89
Depends on the layout you use...
E.g., BorderLayout or GridLayout etc., automatically resizes your internal components whereas FlowLayout etc., doesn't
So you might use a FlowLayout Panel inside a BorderLayout Panel so that just the FlowLayout panel gets resized but the panels inside the FlowLayout will remain intact (Basically a Panel in a Panel sort of thing)
Mihai Popa
Greenhorn

Joined: Dec 04, 2011
Posts: 5
Tarun Bolla wrote:Depends on the layout you use...
E.g., BorderLayout or GridLayout etc., automatically resizes your internal components whereas FlowLayout etc., doesn't
So you might use a FlowLayout Panel inside a BorderLayout Panel so that just the FlowLayout panel gets resized but the panels inside the FlowLayout will remain intact (Basically a Panel in a Panel sort of thing)



Thank you verry much!
 
wood burning stoves
 
subject: Fixed drawing area