Computer Science Canada

jpanel size

Author:  matt271 [ Thu Apr 16, 2009 9:27 pm ]
Post subject:  jpanel size

in java if i have a jframe and say setSize(x, y); that will set the entire window to x by y, including the window decorations.

i want to say someMethod(x, y); and that will set the draw-on-able size to x by y. so the window size itself is greater then x by y.

i dunno if i am explaining this well?

imagine u create a jframe and say setSize(100, 100); then add a jpanel such that the jpanel covers the entire window. then say jpanel.getWidth(); and jpanel.getHeight(), they will not be 100. i want to setSize(something, something); suchthat jframe.getWidth(); will return 100.

in VB6 you could just use scalewidth and scaleheight. like form.scalewidth would return the width of drawable space on the window. u could use that to set the width to what u want. like width = width - scalewidth + realwidth. i wanna do this in java

ty Very Happy

Author:  [Gandalf] [ Fri Apr 17, 2009 4:20 pm ]
Post subject:  RE:jpanel size

Your explanation is a bit confusing... If you setSize on a JFrame to 100, 100, you're saying that jframe.getWidth() won't return 100? Besides, if the JPanel covers the entire window, isn't it's size also 100?

Author:  matt271 [ Fri Apr 17, 2009 10:13 pm ]
Post subject:  Re: jpanel size

no im saying a panel inside the jframe will not return 100

say i have 1 window w/ 1 panel in it. the panel covers 100% of the drawable space in the jframe

i want to make the jfame some size suchthat the panel will be 100 no matter how big the window decorations are

Author:  Bo0sT [ Wed Apr 22, 2009 3:55 am ]
Post subject:  Re: jpanel size

can't you just do setSize(100,100) on the jpanel?


: