Page 1 of 2 12 LastLast
Results 1 to 20 of 30
Like Tree1Likes

Thread: Please Help With ActionListener

  1. #1
    Daman12 is offline Member
    Join Date
    Oct 2011
    Posts
    22
    Rep Power
    0

    Default Please Help With ActionListener

    ..............................
    Last edited by Daman12; 10-26-2011 at 08:21 AM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Please Help With ActionListener

    Please don't paraphrase the error message, but rather when asking here, show the actual error message in its entirety so we don't have to guess what's really wrong. So, speaking of guessing, I'm going to guess now: do you import ActionListener?

  3. #3
    Daman12 is offline Member
    Join Date
    Oct 2011
    Posts
    22
    Rep Power
    0

    Default Re: Please Help With ActionListener

    Yes your guess was correct. I am now having another problem.

    Java Code:
    displayMessage = new JLabel (guiDie1.getMessage()); //cannot find symbol - method getMessage()
    In that line.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Please Help With ActionListener

    Again, please show the entire error message.

    Also show the pertinent code. I don't even see where you declare the variable you're using on that line. Your class's code is not fully shown in your post.
    Thanks.

  5. #5
    Daman12 is offline Member
    Join Date
    Oct 2011
    Posts
    22
    Rep Power
    0

    Default Re: Please Help With ActionListener

    Quote Originally Posted by Fubarable View Post
    Again, please show the entire error message..

    Thanks.
    Give me an example of showing the entire error message...im confused.

  6. #6
    Daman12 is offline Member
    Join Date
    Oct 2011
    Posts
    22
    Rep Power
    0

    Default Re: Please Help With ActionListener

    .................
    Last edited by Daman12; 10-26-2011 at 08:21 AM.

  7. #7
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

    Default Re: Please Help With ActionListener

    Test.java:5: ';' expected
    Scanner kybd = new Scanner(System.in)
    ^
    1 error

    The full message provides useful info such as the class and line number where it occurs. it also attempts to place the ^ reasonably close to exactly where on the line the error is.

  8. #8
    Daman12 is offline Member
    Join Date
    Oct 2011
    Posts
    22
    Rep Power
    0

    Default Re: Please Help With ActionListener

    Quote Originally Posted by Junky View Post
    Test.java:5: ';' expected
    Scanner kybd = new Scanner(System.in)
    ^
    1 error

    The full message provides useful info such as the class and line number where it occurs. it also attempts to place the ^ reasonably close to exactly where on the line the error is.
    How do you get it show the error message like that? Im using BlueJ.

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Please Help With ActionListener

    Your code has changed?!

    You were posting:
    Java Code:
    displayMessage = new JLabel (guiDie1.getMessage());
    And now your posting:
    Java Code:
    displayMessage = new JLabel (GVDie1.getMessage());
    This is getting too confusing for me.

  10. #10
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

    Default Re: Please Help With ActionListener

    Where in the GVdie class is the getMessage method?

  11. #11
    Daman12 is offline Member
    Join Date
    Oct 2011
    Posts
    22
    Rep Power
    0

    Default Re: Please Help With ActionListener

    Quote Originally Posted by Fubarable View Post
    Your code has changed?!

    You were posting:
    Java Code:
    displayMessage = new JLabel (guiDie1.getMessage());
    And now your posting:
    Java Code:
    displayMessage = new JLabel (GVDie1.getMessage());
    This is getting too confusing for me.
    I changed it due to not correctly naming it in the first place. GVDie is the correct name. Sorry.

  12. #12
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Please Help With ActionListener

    So the error is telling your that your GVdie class doesn't have a getMessage() method, not with that message signature. So the obvious place to look is in the ... GVdie class. Does it have such a method with the correct signature? The error messages aren't very cryptic and usually tell you exactly what's wrong -- as is the case here.

  13. #13
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

    Default Re: Please Help With ActionListener

    Quote Originally Posted by Daman12 View Post
    How do you get it show the error message like that? Im using BlueJ.
    By compiling on the command line. It has been awhile since I used BlueJ so I cannot remember but most IDE's have a console window (or similar) for displaying messages.

  14. #14
    Daman12 is offline Member
    Join Date
    Oct 2011
    Posts
    22
    Rep Power
    0

    Default Re: Please Help With ActionListener

    No there isnt a method with that signature. I was provided the GVdie class and have to use the one provided for the program. getMessage isnt in GVdie class....but i need it to display the current message.

  15. #15
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

    Default Re: Please Help With ActionListener

    Well you cannot call a method that does not exist. So either call a method that does exist or change what you are trying to do.
    Fubarable likes this.

  16. #16
    Daman12 is offline Member
    Join Date
    Oct 2011
    Posts
    22
    Rep Power
    0

    Default Re: Please Help With ActionListener

    Would anyone be able to help me on MSN or another form of messenger? This project is due tomorrow.

  17. #17
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

    Default Re: Please Help With ActionListener

    What's wrong with the help you are getting so far?

  18. #18
    Daman12 is offline Member
    Join Date
    Oct 2011
    Posts
    22
    Rep Power
    0

    Default Re: Please Help With ActionListener

    Quote Originally Posted by Junky View Post
    What's wrong with the help you are getting so far?
    Nothing there is just more to the code that is wrong and its hard to keep pasting it all here. I dont want it to be confusing. If someone could one on one help me that would be great. There is 4 different classes in this program and im having some trouble linking them all together correctly.

  19. #19
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Please Help With ActionListener

    Quote Originally Posted by Daman12 View Post
    Would anyone be able to help me on MSN or another form of messenger? This project is due tomorrow.
    We are all volunteers and so our time is valuable to us, and I doubt anyone will be able to IM you. If you have a question, then ask it and we'll help as best you can.

  20. #20
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Please Help With ActionListener

    Quote Originally Posted by Daman12 View Post
    Nothing there is just more to the code that is wrong and its hard to keep pasting it all here. I dont want it to be confusing. If someone could one on one help me that would be great. There is 4 different classes in this program and im having some trouble linking them all together correctly.
    You'd be fastest to try to debug most of this yourself. Again, look carefully at the error messages as they often tell you most of what you need to know.

    You may also want to start your projects a little earlier next time. :)

Page 1 of 2 12 LastLast

Similar Threads

  1. Need help adding an actionListener
    By HbJgd in forum New To Java
    Replies: 1
    Last Post: 06-12-2011, 06:33 PM
  2. Best way to implement an ActionListener.
    By VisionIncision in forum New To Java
    Replies: 4
    Last Post: 12-07-2010, 01:52 AM
  3. ActionListener new user
    By AmyHill in forum Java Applets
    Replies: 1
    Last Post: 11-16-2009, 08:15 PM
  4. How to access the ActionListener
    By jboy in forum New To Java
    Replies: 3
    Last Post: 10-15-2009, 07:04 PM
  5. Java actionlistener help
    By justsomeguy in forum AWT / Swing
    Replies: 1
    Last Post: 05-27-2008, 06:42 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
  •