File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Graphics inside Frame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Graphics inside Frame" Watch "Graphics inside Frame" New topic
Author

Graphics inside Frame

ajithsasi kumar
Greenhorn

Joined: Apr 06, 2008
Posts: 21
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
Marshal

Joined: Mar 22, 2005
Posts: 41509
    
  53
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.


Ping & DNS - my free Android networking tools app
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

Inside paintComponent that is:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41509
    
  53
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Graphics inside Frame