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

Fixed drawing area

 
Mihai Popa
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic