This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 41035
    
  43
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: 19649
    
  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: 41035
    
  43
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
 
Similar Threads
refresh whole frameset
Problem of graphics
JTable inside a Graphics Rectangle
confusion in ==
Flagging duplicate lines when comparing the input from two seperate text files