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

Graphics inside Frame

 
ajithsasi kumar
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir is it possible to use Graphics class inside Frame. My aim is to draw lines,polygon etc.. in Frame as if it where drawn in Applet using paint(Graphics g) method. Help me sir, thanks in advance.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd need to add a component that extends Panel to the Frame. Then you can perform any drawing you wish inside of the panel's paint method.
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inside paintComponent that is:
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For Swing it'd be paintComponent, but for AWT it would be paint. I'm assuming we're talking about AWT, since the post mentions Frame and paint, which are AWT classes/methods. Maybe we can get clarification on this.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic