PDA

View Full Version : Java - Swing question


LoD
19-12-2005, 14:36:32
Does any kind soul knowing this f**** up GUI toolkit tell me, how can I resize a JPanel?

The situation is - I have made a custom JPanel class, containing a graph/map. Thsi map can be resized. However, even though I first (sucessfully) resize the containing JFrame, I can't resize the JPanel.

Asher
22-12-2005, 21:22:32
Can't you just use setSize(Dimension D)?

Dimension API: http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Dimension.html

setSize API: http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#setSize(java.awt.Dimension)

LoD
22-12-2005, 22:44:17
Thanks, Asher, but that's exactly what I'm doing - so the answer to the problem is not that trivial unfortunately :).

The problem is that I can't past the "initial" size the Panel had - i.e. I can shrink the frame and the panel succefully to any size, and then back again to the size which it was created. However, anything more, and the JFrame resizes, but not the JPanel. And yes, I've tried playing with setMaximumSize() for the JPanel.