Wow, great idea! :o 8)
I’m no expert on this and if I were you I’d ask this question on the these forums: http://forums.java.net/jive/forum.jspa?forumID=74. There are some serious Swing experts there, including the Sun Swing/AWT team.
But let me suggest something. This is java.awt.Component’s getGraphics method:
public Graphics getGraphics() {
if (peer instanceof LightweightPeer) {
// This is for a lightweight component, need to
// translate coordinate spaces and clip relative
// to the parent.
if (parent == null) return null;
Graphics g = parent.getGraphics();
if (g == null) return null;
if (g instanceof ConstrainableGraphics) {
((ConstrainableGraphics) g).constrain(x, y, width, height);
} else {
g.translate(x,y);
g.setClip(0, 0, width, height);
}
g.setFont(getFont());
return g;
} else {
ComponentPeer peer = this.peer;
return (peer != null) ? peer.getGraphics() : null;
}
}
Since JFrames are heavyweight they must use the red code, and I don’t know how to over-ride ComponentPeer.getGraphics() (it isn’t even in the java docs). However if you sub-class JFrame and over-ride its getGraphics() method so that it returns your custom Graphics2D object then any components that you add to the JFrame should recieve your custom Graphics object. This isn’t an ideal solution though since any new Window or Dialog you create will have the default Graphics2D object and not yours. Let us know how this project of yours turns out!
Keith
PS: Under the DirectX mode does Scenic do everything using DirectX and not software rendering? If so this could be better than the Java2D windows pipeline which doesn’t do everything using DirectX hardware acceleration (I’m not sure what exactly the pipeline doesn’t do, but I know it runs at 2 FPS as soon as you start scaling translucent images, even with all of the VM options on).