The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

graphics object and dynamic drawing

Posted by Saurabh Agrawal on May 27, 2001 at 10:06 PM

how to get a graphics object associated with the current JFrame. And how to use it to draw ,for instance a line. I mean what is wrong with the following line of code.

class abc extends JFrame{
abc(){
Container container=this.getContentPane();
Graphics g= container.getGraphics();
g.drawLine(10,10,30,30);
}
public static void main(String args[]){
new abc().show();
}
}




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us