DigiGod Q Frasch� wrote:
>
> hows this for a screensaver class?
<snip>
> public abstract class ScreenSaver implements Runnable {
If ScreenSaver extends Window, we don't need ...
> private Graphics2D g;
Graphics handling can get messy if you keep a reference to your own
graphics context. There was once a problem with a Windows JVM where you
could not have open more than 5 or 6 graphics contexts without exceeding
the resource limit. Graphics contexts are intended to be short term
objects. They are also intended to be used from within the AWT thread -
I'm not sure exactly what could go wrong if you don't but I could
imagine swing getting confused. It likes to manage Graphics contexts
itself since most of the graphics handling stuff is written in Java
(instead of native peers).
> public Toolkit getDefaultToolkit() { //convience method
> return Toolkit.getDefaultToolkit();
> }
If you extend Window, you will inherit a similar method. It may sound
like I'm suggesting that you extend Window. I don't actually mind. You
could extend Canvas. You could define an interface with a paint() method
just like Component. Luckily, the screensaver module is isolated enough
that you can easily change your design as many times without breaking
much.
--
Ryan Heise
http://www.progsoc.uts.edu.au/~rheise/
_______________________________________________
UI maillist - [EMAIL PROTECTED]
http://jos.org/mailman/listinfo/ui