in an applet is a breeze. applications just present me with too many hoops. I can never remember what or where they are and all the examples I can find are for applets. Just pissed off at a silly quirk in a great
Here is a working sample. It draws a red X across the canvas.
public class Test extends Frame
{
public Test() throws HeadlessException
{
setLayout(new BorderLayout());
add(new Button("top"), BorderLayout.NORTH);
add(new Button("bottom"), BorderLayout.SOUTH);
add(new Button("left"), BorderLayout.WEST);
add(new Button("right"), BorderLayout.EAST);
add(new MyCanvas(), BorderLayout.CENTER);
} public static void main(String[] args)
{
Frame f = new Test();
f.setSize(400, 300);
f.setVisible(true); f.addWindowListener(new WindowListener()
{
public void windowClosed(WindowEvent e) {}
public void windowOpened(WindowEvent e) {}
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
public void windowIconified(WindowEvent e) {}
public void windowDeiconified(WindowEvent e) {}
public void windowActivated(WindowEvent e) {}
public void windowDeactivated(WindowEvent e) {}
});
}}
class MyCanvas extends Canvas
{
public void paint(Graphics g)
{
super.paint(g); Dimension d = getSize();
g.setColor(Color.red);
g.drawLine(0, 0, d.width-1, d.height-1);
g.drawLine(0, d.height-1, d.width-1, 0);
g.setColor(Color.black);
}
}-- ------------------------------------------------------------------------- Chris Merrill | http://www.webperformanceinc.com Web Performance Inc. | http://www.webperformancemonitoring.net
Website Load Testing, Stress Testing, and Performance Monitoring Software -------------------------------------------------------------------------
_______________________________________________ Juglist mailing list [EMAIL PROTECTED] http://trijug.org/mailman/listinfo/juglist_trijug.org
