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 3842486
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:48:02+00:00 2026-05-19T15:48:02+00:00

Alright, I know HOW to do but It’s doing something weird. I am trying

  • 0

Alright, I know HOW to do but It’s doing something weird.

I am trying to get the correct X Y coords for a JMenu to appear. I’ve found a way but it’s only a hack. All the right-clicking takes place on the JList, for now until I add character panel, so let’s say you right-click near the top-left. You expect the Y coord to be around 40~ pixels and the Y coord to be around 100~ pixels right? Because you’re clicking on the near left where the JList is. Wrong. The x y coords count from the top left of the JList when I want it to count from the top left of the WHOLE application. :S

So, what did I do? Since the Y coord is correct, I added 512 pixels to the X coord so it’s always in the JList. Like so:

                int newMouseX = 512+e.getX();
                popup.show(tileOffline.this, newMouseX, e.getY()); // show item at mouse

However, as you can tell I will not be right-clicking in the JList forever.

How can I make it so I get the exact X Y coords of the mouse from the WHOLE applet?

Here’s a pic to describe the situation WITHOUT the 512 hack:
enter image description here

  • 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-05-19T15:48:02+00:00Added an answer on May 19, 2026 at 3:48 pm

    I wonder if you’re making this harder than it needs to be. The popup menu will position itself relative to the component you pass into the show method (JPopupMenu API). You should just be able to show the popupmenu doing something like this in order to get it to show at the correct location:

    popup.show(myJList, e.getX(), e.getY());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, I know this is a simple question, but I can't seem to get
Alright, I know there's a simple way to do this, but it's been years
Alright, so I know about the Settings.Properties.Default.* Stuff, but thats not what im trying
Alright, after doing a ton of research and trying almost every managed CPP Redist
Alright, I know I've asked similar questions, but I feel this is hopefully a
Alright, i dont know how to explain it well.. but i have a switch
Alright, I know my title is a little obscure but it best describes the
Alright, I know questions like this have probably been asked dozens of times, but
Alright, I know how the fieldset / legend works out in HTML. Say you
Alright. So I figure it's about time I get into unit testing, since everyone's

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.