Need Help using Expo Graphics
2 hours ago, ZXL_115 said:I probably do.
//previously you have used:
public void paint(Graphics Expo)
//Graphics is the class name of the object being passed into the function. the word after class name can be anything you want; it is your object of type Graphics. What you have done here is wrong because Expo is also a Class; a helper class for abstracting away code the author does not want you to write yourself.
//use this as per the instruction/exercise document:
public void paint(Graphics g)
//g is the variable name applied to the java graphics library. passing this into functions basically gives you a connection to the hidden code that does the actual drawing. You can call it anything you want but keep it g for simplicity. Its common practice to keep the first letter lower case and to keep it called g so its easier for other people to pickup your work
Expo.drawPoint(g, 50, 20);
//this uses the draw point function from the Expo class. you are passing in the Graphics object, g, to draw on and the x,y coords.
//i dont know what was going on in your head with the things you were trying
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now