Thread: error: non-static method getAmount [PI] COOking

Results 1 to 5 of 5
  1. #1 error: non-static method getAmount [PI] COOking 
    Donator
    noelbudo's Avatar
    Join Date
    Jul 2012
    Posts
    300
    Thanks given
    19
    Thanks received
    26
    Rep Power
    42
    ok i added everything but when i click whit the food on object i get like the 1x, 5x dialogue thingy so what i thougt is i had to go clickingbuttons.java so i went there and added
    Code:
    		       case 53152: Cooking.getAmount(c, 1); break;
    			case 53151: Cooking.getAmount(c, 5); break;
    			case 53150: Cooking.getAmount(c, 10); break;
    			case 53149: Cooking.getAmount(c, 28); break;
    and this is the error i get:
    Code:
    src\server\model\players\packets\ClickingButtons.java:124: error: non-static met
    hod getAmount(Client,int) cannot be referenced from a static context
                            case 53152: Cooking.getAmount(c, 1); break;
                                               ^
    src\server\model\players\packets\ClickingButtons.java:125: error: non-static met
    hod getAmount(Client,int) cannot be referenced from a static context
                            case 53151: Cooking.getAmount(c, 5); break;
                                               ^
    src\server\model\players\packets\ClickingButtons.java:126: error: non-static met
    hod getAmount(Client,int) cannot be referenced from a static context
                            case 53150: Cooking.getAmount(c, 10); break;
                                               ^
    src\server\model\players\packets\ClickingButtons.java:127: error: non-static met
    hod getAmount(Client,int) cannot be referenced from a static context
                            case 53149: Cooking.getAmount(c, 28); break;
                                               ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    4 errors
    Druk op een toets om door te gaan. . .
    i hope someone can help *if this is not the right thing to do correct me*
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Oct 2010
    Posts
    716
    Thanks given
    82
    Thanks received
    131
    Rep Power
    0
    You are making a static reference to your method, you either instantiate the class as an object, and refer to your method as an instant, or you make the method it references to static.
    Reply With Quote  
     

  3. #3  
    Donator
    noelbudo's Avatar
    Join Date
    Jul 2012
    Posts
    300
    Thanks given
    19
    Thanks received
    26
    Rep Power
    42
    and how will i do it i tried adding: Object Cooking; above the switch actionButtonId but then i still get errors :l
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Oct 2010
    Posts
    716
    Thanks given
    82
    Thanks received
    131
    Rep Power
    0
    Code:
    Cooking cooking = new Cooking();
    then change Cooking to cooking without a captical C in your method calls
    Reply With Quote  
     

  5. #5  
    Donator
    noelbudo's Avatar
    Join Date
    Jul 2012
    Posts
    300
    Thanks given
    19
    Thanks received
    26
    Rep Power
    42
    i don't get what you mean like where do i add Cooking cooking = new Cooking();
    and where are the methods in cooking.java?
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. non static method
    By devildreams54 in forum Help
    Replies: 10
    Last Post: 03-17-2013, 06:11 AM
  2. error: non-static variable ?
    By Milf in forum Help
    Replies: 1
    Last Post: 09-17-2012, 06:26 AM
  3. [PI] Non-Static method????
    By arcane-scape in forum Help
    Replies: 3
    Last Post: 06-18-2012, 12:01 PM
  4. [Rep++] non-static method error help
    By Slay No More in forum Help
    Replies: 1
    Last Post: 04-13-2010, 04:39 AM
  5. Replies: 7
    Last Post: 07-07-2009, 11:12 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •