** Having trouble running this code as the compiler keeps having issues with the method 'public void mannipulate()', I'm new to java so forgive my ignorance, but I've been trying to rearrange everything in every which way to please this thing and its just not turning out right. I'm sure I'm missing something but it's just not apparent at the moment. Help would be much appreciated, thanks!**

public static void main(String []args) {

 public void manipulate()
 {


  String fileName = FileChooser.pickAFile();
        Picture picObj = new Picture(fileName);
   picObj.show();
  int y = picObj.getHeight();
        int x = picObj.getWidth();
        double xborder = (x*0.05);
        double yborder = y;
        Pixel leftPixel = null;
        Pixel rightPixel = null;
        Pixel pixelObj = null;
        Color colorObj = null;

        for (x=0;x<xborder;x++){

          for(y=0;y<yborder;y++){
            leftPixel = picObj.getPixel(x,y);
            rightPixel= picObj.getPixel(picObj.getWidth()-1-x,y);
            leftPixel.setColor(Color.BLACK);
            rightPixel.setColor(Color.BLACK);
            pixelObj = picObj.getPixel(x,y);
            colorObj = pixelObj.getColor();
            pixelObj.setColor(Color.BLACK);
            picObj.repaint();
            picObj.show();

          }
        }
 }
public void manipulate2()
{
  String fileName = FileChooser.pickAFile();
        Picture somePicture = new Picture(fileName);
    Pixel []pixelArray = somePicture.getPixels();
    Pixel pixelObj1 = null;
    int index = 0;
    int redValue = 0;
    int blueValue = 0;
    int greenValue = 0;

    while(index<pixelArray.length)
    {
      pixelObj1 = pixelArray[index];
      redValue = pixelObj1.getRed();
      blueValue = pixelObj1.getBlue();
      greenValue = pixelObj1.getGreen();
      pixelObj1.setRed(greenValue);
      pixelObj1.setBlue(redValue);
      pixelObj1.setGreen(blueValue);
      somePicture.repaint();
      index++;
    }
    somePicture.show();
}

Line 1 is the start of the definition of a method called main. (Every program needs this method - it's the one that is called first when you execute your program). Then on line 3 you start the definition of another method. You can't define one method inside another. You have to close the definition of main with a } before you can start the next method.

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.