Results 1 to 2 of 2
  1. #1
    Methos is offline Member
    Join Date
    Jan 2012
    Posts
    1
    Rep Power
    0

    Unhappy "The Method X in the Type Y is not applicable for the arguments"

    Hey, everyone. Teaching myself Java and I wanted to write a program that modified the colors of a picture. Here is the code I have written so far, but I can't get around these two error codes I keep recieving. Both which say pretty much the same thing: "The Method GreenFilter(Landscape) in the Type Landscape is not applicable for the arguments" and "The Method PinkFilter(Landscape) in the Type Landscape is not applicable for the arguments".

    Java Code:
    import java.util.Scanner;
    import java.awt.image.Raster;
    import java.util.*;
    
    public class Landscape extends Picture
    {
      public void increaseGreen(Picture beach)
      {
       Pixel[] pixelArray = this.getPixels();
       Pixel pixel = null;
       int value = 0;
       int index = 0;
       while(index < pixelArray.length)
       {
         pixel = pixelArray[index];
         value = (int) (value * 1.3);
         pixel.setGreen(value);
         index = index + 1;
       }
       System.out.println(beach);
       beach.show();
      }
      
      public void increasePink(Picture beach)
      {
       Pixel[] pixelArray = this.getPixels();
       Pixel pixel = null;
       int value = 0;
       int index = 0;
       while(index < pixelArray.length)
       {
         pixel = pixelArray[index];
         value = (int) (value * 1.3);
         pixel.setGreen(value);
         pixel.setRed(value);
         index = index + 1;
       }
       System.out.println(beach);
       beach.show();
      }
      public void main(String[] args) 
      {
        String typevalue = "Filter";
        String pink = "Pink";
        String green = "Green";
        String fileName = FileChooser.pickAFile();
        System.out.println(fileName);
        Picture beach = new Picture(fileName);
        beach.show();
        
        //public boolean equals(Object anObject)
        
        
        Scanner keyboard = new Scanner(System.in);
          System.out.println("Please type either 'Green' or 'Pink' to decide which filter to apply.");
          while ((typevalue) != green || (typevalue != pink))
      {
        System.out.println("You have made an invalid selection. Please type either 'Green' or 'Pink' to decide which filter to apply.");
        typevalue = keyboard.nextLine();
      }
        if (typevalue == pink){
        System.out.println("Now displaying picture with pink filter...");
        increasePink(beach);
      }
      else if (typevalue == green){
        System.out.println("Now displaying picture with green filter...");
        increaseGreen(beach);
      }
      }
    }
    Any help would be appreciated.
    Last edited by Methos; 01-25-2012 at 11:40 PM. Reason: quick

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default Re: "The Method X in the Type Y is not applicable for the arguments"

    "The Method GreenFilter(Landscape) in the Type Landscape is not applicable for the arguments"
    The code you posted does not include a method GreenFilter() or any code calling it.

    Perhaps you could post the code that is being called and the complete compiler message. (The message includes a reference to the precise line, and position on it, where the syntax error occurs.) If you are using an IDE that does not give complete compiler messages it would be a good idea to compile the program at the command line so that you can copy and post the entire output from the compiler.

Similar Threads

  1. Replies: 23
    Last Post: 01-26-2012, 10:29 AM
  2. Replies: 10
    Last Post: 12-07-2010, 01:29 PM
  3. [SOLVED] method not applicable for the arguments
    By jon80 in forum New To Java
    Replies: 2
    Last Post: 05-31-2009, 05:13 PM
  4. Replies: 1
    Last Post: 05-20-2009, 09:46 PM
  5. Replies: 1
    Last Post: 10-20-2008, 08:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •