Board index » jbuilder » sort of solved

sort of solved


2004-09-19 12:41:07 PM
jbuilder10
Thanks for your help. I still want to figure out how to do as you said, and subclass jPanel so that the program works, but I figured out a work around. Previous programs did not use a jPanel, except when we used buttons. Instead, we drew directly onto the jFrame, using the paint method. I did the same thing in this case, and it worked. Of course, resizing the window causes multiple redraws, but I think I can fix that. Thanks again!
Steve
 
 

Re:sort of solved

Oops. This was supposed to be posted under "Disappearing graphics".
"xavier (Steve)" < XXXX@XXXXX.COM >wrote:
Quote

Thanks for your help. I still want to figure out how to do as you said, and subclass jPanel so that the program works, but I figured out a work around. Previous programs did not use a jPanel, except when we used buttons. Instead, we drew directly onto the jFrame, using the paint method. I did the same thing in this case, and it worked. Of course, resizing the window causes multiple redraws, but I think I can fix that. Thanks again!

Steve
 

Re:sort of solved

"xavier (Steve)" < XXXX@XXXXX.COM >writes:
Quote
Thanks for your help. I still want to figure out how to do as you
said, and subclass jPanel so that the program works, but I figured
out a work around. Previous programs did not use a jPanel, except
when we used buttons. Instead, we drew directly onto the jFrame,
using the paint method. I did the same thing in this case, and it
worked. Of course, resizing the window causes multiple redraws, but
I think I can fix that. Thanks again!
The general fix is to draw to an "off-creen" image, and paint that.
However, unless I am mistaken, Swing already uses "double buffering"
(as the technique is called), so the Graphics passed to
paintComponent() should be that offscreen image, as long as the
property controlling that is set (which is default on for JPanel).
 

{smallsort}