Results 1 to 5 of 5
Thread: help with Graphics method
- 05-21-2012, 08:06 PM #1
Member
- Join Date
- Dec 2011
- Location
- Belgium
- Posts
- 17
- Rep Power
- 0
help with Graphics method
Hey, I'm looking for help with a Graphics methode.
I want a method to paint an image based on a number (int) value.
Something like this:
public void PaintImage(int value, Graphics g) {
Graphics2D g2 = (Graphics2D) g;
g2.drawImage(Images[value],780,10,null);
}
Images is a bufferedImage[].
the problem starts when I try to access this method from an other class.
Something like this doesn't work:
int pictogramValue = 1;
plaatserPictogram.PaintImage(pictogramValue,Graphi cs g);
why not? And what's the solution for this, so I can paint the right image on my canvas?Last edited by The original stinger; 05-21-2012 at 08:13 PM.
- 05-21-2012, 08:41 PM #2
Re: help with Graphics method
I don't really know what you're asking. If you want help, you should provide an SSCCE that demonstrates the problem.
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 05-21-2012, 08:59 PM #3
Re: help with Graphics method
Can you explain what happens? Post the full text of any error messages.doesn't workIf you don't understand my response, don't ignore it, ask a question.
- 05-21-2012, 09:27 PM #4
Re: help with Graphics method
Why do they call it rush hour when nothing moves? - Robin Williams
- 05-21-2012, 09:29 PM #5
Re: help with Graphics method
That's not the way you invoke a method. Step back from graphics and GUI coding and first learn about Passing Information to a Method or a Constructor (The Java™ Tutorials > Learning the Java Language > Classes and Objects)Java Code:plaatserPictogram.PaintImage(pictogramValue,Graphics g);
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Putting graphics into the run() method.
By theCardboardBox in forum New To JavaReplies: 11Last Post: 11-17-2010, 06:33 PM -
Using Graphics outside of a paint method
By Catfish1 in forum New To JavaReplies: 6Last Post: 10-26-2010, 08:57 PM -
Paint(Graphics g) method is not called on its run.
By vsanandan in forum Java 2DReplies: 5Last Post: 10-22-2010, 01:55 PM -
Method Graphics.drawString() - Symbol not found
By km0r3 in forum AWT / SwingReplies: 1Last Post: 08-27-2010, 02:55 PM -
java graphics within main method
By jforce93 in forum New To JavaReplies: 4Last Post: 02-02-2010, 10:33 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks