Results 1 to 2 of 2
  1. #1
    wahhaj is offline Member
    Join Date
    Jun 2012
    Rep Power

    Default interaction with mouse

    I just need some general help with how to input data from the mouse and use it. I have a class which makes rectangles and ovals. The user has to click on the correct shape which is stated by a text image. My problem is how would the user let the program know which shape it has clicked so the appropriate action can be taken. I'm using coordinates but that hasnt been working out too well. I've never used the mouse in my coding before as well so this is new. you shouldn't need me code but in case you do just ask

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: interaction with mouse

    how would the user let the program know which shape it has clicked
    By using a mouse listener, the program would have its mouse listener method called with an event object describing the event.
    See the tutorial: How to Write a Mouse Listener (The Java™ Tutorials > Creating a GUI With JFC/Swing > Writing Event Listeners)
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. want help about ArrayList and interaction
    By chmo in forum New To Java
    Replies: 2
    Last Post: 11-03-2010, 02:45 PM
  2. GUI interaction
    By Glyph in forum New To Java
    Replies: 6
    Last Post: 10-19-2010, 08:43 PM
  3. Mouse Listener for mouse floating over object?
    By Krooger in forum AWT / Swing
    Replies: 1
    Last Post: 11-18-2009, 05:34 AM
  4. program interaction possible?
    By Pierced1 in forum Advanced Java
    Replies: 3
    Last Post: 02-19-2009, 01:54 AM
  5. Object Interaction
    By Jinxes in forum New To Java
    Replies: 1
    Last Post: 12-03-2007, 01:05 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