Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8673571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:29:32+00:00 2026-06-12T19:29:32+00:00

So here is the entire file I am using, and in desperation, I put

  • 0

So here is the entire file I am using, and in desperation, I put the x and y to be defined in every event but I still get nothing.. this is a multi-class project, where should I do addMouseListener()? and why isnt this picking up the event? (note: the printing of the coordinates in run() works.) This is an applet project and the applet works fine just doesnt register this event.

public class ClickCheck implements Runnable, java.awt.event.MouseListener {
public int x, y;

public ClickCheck() {

    Thread t = new Thread(this);
    t.start();
}

public void mouseClicked(java.awt.event.MouseEvent ev) {

    x = ev.getX();
    y = ev.getY();
    System.out.println(x + "," + y);
}

public void mousePressed(java.awt.event.MouseEvent ev) {
    x = ev.getX();
    y = ev.getY();
    System.out.println(x + "," + y);
}

public void mouseReleased(java.awt.event.MouseEvent ev) {
    x = ev.getX();
    y = ev.getY();
    System.out.println(x + "," + y);
}

public void mouseEntered(java.awt.event.MouseEvent ev) {
    x = ev.getX();
    y = ev.getY();
    System.out.println(x + "," + y);
}

public void mouseExited(java.awt.event.MouseEvent ev) {
    x = ev.getX();
    y = ev.getY();
    System.out.println(x + "," + y);
}

public void run() {
    System.out.println(x + "," + y);

}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:29:33+00:00Added an answer on June 12, 2026 at 7:29 pm

    Assuming you want to add a MouseListener to the main window/panel area of your applet you would add this to your applet init() method:

    public void init()
    {
       addMouseListener(new ClickCheck());
       ...
    

    Also it’s very unusual to have Thread included in your MouseListener. The thread itself will print out co-ordinates & exit immediately.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason my code here (this is the entire thing) doesnt actually render
REVISED: Here is my entire compilable program. It is menu driven, but the part
i want to copy the entire contents of a file using emacs copy mode
I am parsing a JSON file using C#. Here is what I got from
I am trying to get text from an html file using the simplehtmldom lib
I'm reading lines from a text file using (line-seq (reader input.txt)) . This collection
Ok, so here's the entire structure I'm trying to create. I need to create
Here is the code in a function I'm trying to revise. This example works
Here is the script I'm using, copied directly from Google: <script type=text/javascript> var _gaq
Using C#, I need to read a packed binary file created using FORTRAN. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.