Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Graphics inside Frame

 
ajithsasi kumar
Greenhorn
Posts: 21
  • 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
Posts: 42967
73
  • 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: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inside paintComponent that is:
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic