This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDesktopPane Graphics

 
roger denton
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to draw graphics (lines, rects, and such) in a JDesktopPane. Below is a snippet of code...
desktop = new JDesktopPane();
Graphics g = desktop.getGraphics();
System.out.println("g = " + g);
g.drawLine(x,y,xend,yend);
g is null and drawLine dies as you might expect (null pointer exception).
So, my question is, is it possible to draw directly in a JDesktopPane? If so, how?
Thanks,
Roger
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know too much about Swing but this program draws the line.
 
roger denton
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Barry,
Thanks...I had the order wrong with setVisible.
Many thanks.
Roger
Originally posted by Barry Gaunt:
I don't know too much about Swing but this program draws the line.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic