Archived

This topic is now archived and is closed to further replies.

Stiby

[java] Swing and roundabouts

Recommended Posts

Stiby    122
Hi all again, Thanks for the replies from my last message I have solved one of the problems the keyboard input problem I will work on later. I have recently invested in the "Java Foundation Classes in a nut shell" reference book and have come across a few words about Swing components that inherites from JComponent can enable double buffering! Now Swing seems to be a more complete graphics solution and probably contains more native code than the other API's I don't know for sure. The only problem is that I can't get much information on the implmentation and use of double buffering? If any one has any usefull knowledge would be omst appriciated about the use I have actually one specific question about the double buffer. -When enabling the double buffer does this mean the Graphics object is related to the back buffer instead of the primary surface (sorry for the DirectX wording) and does this reference stay constant as long as you don't resize the window? ie. I should draw once to the back buffer on intilisation of my application and then if I move the window off the screen and then back on the image should automatically redraw without modifying the primary surface. Thanks in advance. Phillip Stiby BSc(HONS) I program therefore cant spell! Edited by - Stiby on 11/2/00 8:30:19 AM

Share this post


Link to post
Share on other sites
Jim_Ross    122
Swing contains no native code. That''s why it is called ''light-weight''. All swing widgets should look the same on all platforms, unline AWT frames and such. When a JComponent is set to use double buffering all drawing is done in an off-screen buffer. If any of the component''s ancestors is double buffered then that buffer will be used to paint the component. I think the graphics object you get in a paint routine will then be taken from the off-screen buffer.

Share this post


Link to post
Share on other sites