File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Why doesn Watch "Why doesn New topic

Why doesn't paint

Fernando hiar

Joined: Jan 11, 2008
Posts: 29

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

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

Joined: Oct 14, 2005
Posts: 19973

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: 10825

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

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
I agree. Here's the link:
subject: Why doesn't paint
It's not a secret anymore!