Jump to content

Need Help using Expo Graphics

ZXL_115
Go to solution Solved by SCHISCHKA,
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

Welp, im in programming at my school, and i have no idea how to program these expo graphics. i have no idea where to start, as i can't even write Expo.drawPoint. I'll link my work as a screenshot which is probably a mess as well as the Lab and the expo java file. Any help would be great.

Expo.java

Lab04B.docx

A mess.PNG

Link to comment
Share on other sites

Link to post
Share on other sites

You appear to have experimented so much that your code is no longer making any sense. You have put the Expo class name in as the variable name in the paint() method; Change Graphics Expo to Graphics g like in the instructions. Also change all of your method calls to match the api: Expo.drawPoint(g, 50, 20);

drawPoint(java.awt.Graphics g, int x, int y) 
          Draws a 3 pixel X 3 pixel "point" whose center is at the specified x,y location.
Quote

public class Lab04Bst extends Applet

{

        public void paint(Graphics g)

        {

                // DRAW CUBE

 

                // DRAW TARGET

                                        

                // DRAW TRIANGLE

 

                // DRAW SMILEY FACE

                

                // DRAW JPII

        }

}

 

 

             ☼

ψ ︿_____︿_ψ_   

Link to comment
Share on other sites

Link to post
Share on other sites

22 hours ago, SCHISCHKA said:

You appear to have experimented so much that your code is no longer making any sense. You have put the Expo class name in as the variable name in the paint() method; Change Graphics Expo to Graphics g like in the instructions. Also change all of your method calls to match the api: Expo.drawPoint(g, 50, 20);


drawPoint(java.awt.Graphics g, int x, int y) 
          Draws a 3 pixel X 3 pixel "point" whose center is at the specified x,y location.

 

When i try it, it shows me this 

What.png

 

edit: corrected all of them to g, drawpoint still doesn't work, as shown below

What 2.0.png

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, ZXL_115 said:

edit: corrected all of them to g, drawpoint still doesn't work, as shown below

  1. Stop taking screen shots of your code + IDE it's awful
  2. Get rid of Eclipse and instead use IntelliJ, there's no comparison

Expo is a class that is full of static methods that operate on a Graphics object. Look at the signature of one of them:

public static void drawOval(Graphics g, int centerX, int centerY, int hRadius, int vRadius)
  1. What have you been trying to supply to it?
  2. What should you be supplying to it instead?

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

I think you need to go refresh the basics of java syntax

             ☼

ψ ︿_____︿_ψ_   

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, Nuluvius said:
  1. Stop taking screen shots of your code + IDE it's awful
  2. Get rid of Eclipse and instead use IntelliJ, there's no comparison

Expo is a class that is full of static methods that operate on a Graphics object. Look at the signature of one of them:


public static void drawOval(Graphics g, int centerX, int centerY, int hRadius, int vRadius)
  1. What have you been trying to supply to it?
  2. What should you be supplying to it instead?

My school makes me use Eclipse. It's all they provide me while at school. I'm extremely sorry for my bad code, my teacher practically doesn't teach me as he has a bigger class in the same room and theres 5 students in my actual class, who i dont even know. (its total bs imo) I also figured out how to work with expo. all i need help on is positing 

 

3 hours ago, SCHISCHKA said:

I think you need to go refresh the basics of java syntax

I probably do.

Link to comment
Share on other sites

Link to post
Share on other sites

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

             ☼

ψ ︿_____︿_ψ_   

Link to comment
Share on other sites

Link to post
Share on other sites

On 1/11/2017 at 8:51 PM, SCHISCHKA said:

//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

Thanks so much. I'm understanding Expo alot better.

Heres my completed assignment. I know it isnt amazing, but im glad i did it correct

Lab04Bst.java

Link to comment
Share on other sites

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×