This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 18541
    
    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: 10175
    
    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
 
Similar Threads
Why jvm don´t call paintComponent(Graphics g)?
JOptionPane. showMessageDialog() problem
Help! Having trouble animating translucent window.
MouseEvent
Printing: How to disable doubleBuffering on Graphics2D?