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 Why doesn't paint Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Why doesn Watch "Why doesn New topic
Author

Why doesn't paint

Fernando hiar
Greenhorn

Joined: Jan 11, 2008
Posts: 29

What is wrong with my code!?!?!??!? Why doesn´t paint?!?!?!



I´m using active rendering, thanks...
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18651
    
    8

Something passes your method a Graphics object. You cast it to Graphics2D. So far so good.

Then you load an image from somewhere, somehow. Then you create a new Graphics2D object and draw the image on it. You never display this Graphics2D object to the user, and you never do anything with the Graphics object which was passed to the method.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

In addition to what Paul said,

Is any piece of your code, calling this method? If all it does is paint(!) why create a new method? The usual recommended way of custom painting is overriding the paintComponent method.
More on custom painting here http://docs.oracle.com/javase/tutorial/uiswing/painting/


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why doesn't paint