Hey whats up im pretty new here and new to java. I have no idea when it comes to methods. (this is my first java course so im completly lost)

I have a test coming up and Im just trying to review. We got a couple examples of things that will be on the test... So we are given this complex "for loop" and we have to turn it into a few simple"ler" methods. I am having trouple doing this. the first method is supposed to draw some Stripes on an HTML file. I am having trouble "calling" or "invoking" the "drawStripes" method i created so far i have

import java.applet.*;  //applet stuff
import java.awt.*;     //graphics stuff
//   "extends Applet" tells Java this is applet code.
public class DrawingOvals extends Applet {
  // Variables to store the width and height of the desired rectangle.
 int width, height;
 // Standard applet method to initialize the applet.
 public void init() {
  width = getSize().width; //Get width info from HTML file
  height = getSize().height; //Get height info from HTML file
  setBackground(Color.black);
 }
 /******* Everything above this line IS correct******/


  public void drawStripes(Graphics g, int numItemsToDraw, int stripe_width)
{

   int x=0;
   stripe_width = width / numItemsToDraw;
                        //draw a solid (filled in) rectangle
                        g.fillRect(x, 0, (stripe_width), height);
    //add the stripe_with to x so the next stripe can start drawing where the last finished
   x+=stripe_width;  
 }




 // method in Java graphics for "painting" graphics on screen
 public void paint(Graphics g) { 
     g.drawStripes();
 }
}

any one have any clue whats wrong?
is that even on the right track?

I am trying to draw a certain number of stripes depending on what i input in the drawStripes();
for example if i want to draw 5 stripes i want to just type in 5 in the () so it looks drawStripes(5);
but idk how to do that... sorry for the real noob question guys/girls

any ideas are welcome on how to aproach this.

( its a longer thing but once i figure out how to create and call this method i should be able to do the rest on my own.)

anyone?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.