jQuery in Action, 2nd edition*
The moose likes Swing / AWT / SWT and the fly likes How to determine the JWindow location ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to determine the JWindow location ?" Watch "How to determine the JWindow location ?" New topic
Author

How to determine the JWindow location ?

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
How to determine the JWindow location ?

I have JApplet, which contain a Canvas in BorderLayout.center. The canvas has mouse events. When I click a Point in the canvas, it will pop up a JWindow below&left that Point. The problem is how to determine the location the JWindow show up ?

I try setLocationRelativeTo(), it doesn't work.

Any help is welcome. Thanks
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I'm confused. You said how to determine where it will show up? To me that means you want to know the coordinates of the JWindow when it displays. On the other hand, you might mean that you want to control where the JWindow pops up meaning you want to specifcy the location instead of having it show at the point explained.

Can you clear this up?


GenRocket - Experts at Building Test Data
Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
Originally posted by Gregg Bolinger:
you might mean that you want to control where the JWindow pops up meaning you want to specifcy the location instead of having it show at the point explained.


This is what I mean.

I am doing an interactive map. When mouse over a city in the map, a JWindow will pop up , its left&top point should be mouse clicking point.


Thanks
 
Don't get me started about those stupid light bulbs.
 
subject: How to determine the JWindow location ?
 
Similar Threads
How draw background (behind image) in only one part, and draw buttons/components?
moving a JWindow
In JNI (C++ code) how get reference to JWindow's hwnd?
anyone used Canvas + graphics ?
Problem with setLocation()