Ok well i have a function called drawVerticalLine and it's method header is the following : void drawVerticalLine(int[][] img,int lineWidth, int linePosition)

so what happenes is a picture is converted to a 2d array etc and passed on to this function, now the goal is to draw a red verticle line on the picture.

also i have a declared variable called : final static int RED = Color.RED.getRGB();

to set the color of the vertical line

Now so far i've figured this out :

  public static void drawVerticalLine(int[][] img,int lineWidth, int linePosition)
  {
     for(int i=0;i = linePosition;i++)
     {
         for(int j=0; j=lineWidth; j++)
         {
        // have no idea what to do  
         }
     } 
  }

Now i dont have any experience with images, i do more calculating stuff, however i've been asked to try to accomplish this task. some help would be really appreciated.

Thank You.

To drawing a line one has to use the instance of Graphics : Graphics g so that the method in drawing a line can be applied:
g.drawLine(int x1, int y1, int x2, int y2) ;
which draws a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics context's coordinate .

Hence the method drawVerticalLine you posted should have a parameter of the type of Graphics (or use other way to obtain the instance of Graphics).

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.