jralexander137 0 Light Poster

So I have to create a method that creates a custom arrow object and then returns it. No drawing is to be done in the method, it will be drawn once it's returned.

I think I'm utilizing GeneralPath the correct way and then casting it to a shape properly but I can't seem to figure out how to draw the returned shape to my window. Any thoughts on what I'm doing wrong and/or how to get the arrow drawn? Thanks!

This is the method to create the arrow.

public Shape createCompass(Graphics g)
		{
            g.setColor(Color.red);
            GeneralPath path = new GeneralPath();
            path.moveTo(40f, 75f);
            path.lineTo(50f, 85f);
            path.lineTo(40f, 55f);
            path.lineTo(30f, 85f);
            //path.lineTo(40f, 75f);
            path.closePath();
            Shape arrow = (Shape) path;
            return path;
		}

This is the method where all the drawing will be done.

// Draw the board
	public void paintComponent(Graphics g)
		{
            super.paintComponent(g);
		Graphics2D graphics = (Graphics2D) g;
                int xcoord=0;
                int ycoord=0;
                int height = 0;
                int width = 0;
		// Step 1. Turn off antialiasing

		// Step 2. Compute the width and height of a checkerboard square.
                height = this.getHeight()/8;
                System.out.println("height is " + height);
                width = this.getWidth()/8;
                System.out.println("width is " + width);

                //g.drawRect(xcoord, ycoord, width, height);
                int i = 0;
                int j = 0;
                /*while(j != 8){
                    System.out.println("xcoord is " + xcoord);
                    while(i != 8){
                        System.out.println("i is " + i);
                        if(j == 0 || j == 2 || j == 4 || j == 6){
                            if(i == 0 || i == 2 || i == 4 || i == 6)
                                g.setColor(Color.black);
                            if(i == 1 || i == 3 || i == 5 || i == 7)
                                g.setColor(Color.white);}
                        else if(j == 1 || j == 3 || j == 5 || j == 7){
                            if(i == 0 || i == 2 || i == 4 || i == 6)
                                g.setColor(Color.white);
                            if(i == 1 || i == 3 || i == 5 || i == 7)
                                g.setColor(Color.black);}
                        
                        g.fillRect(xcoord, ycoord, width, height);

                        xcoord = xcoord + width;
                        i++;
                    }
                    System.out.println("first row done");
                    i = 0;
                    j = j + 1;
                    xcoord = 0;
                    ycoord = ycoord + height;
                }*/
                g.setColor(Color.pink);
                Shape arrow = this.createCompass(g);
                
//            int h = 0;
//            int w = 0;
//            h = this.getHeight()/2;
//            w = this.getWidth()/2;
//
//            g.drawImage((Image) arrow,w, h, this);

		// Step 3.  Draw the squares, including possible hilighting.

		// Step 4.  Create a compass, then rotate and translate it to the right place.
		//          then draw it.

		graphics.dispose();
		}