This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes problem with JPanel / JLabel zooming Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "problem with JPanel / JLabel zooming" Watch "problem with JPanel / JLabel zooming" New topic
Author

problem with JPanel / JLabel zooming

l madhu
Greenhorn

Joined: Mar 24, 2005
Posts: 3
hi friends,
i have some problem with JLabel zooming...

i have a JPanel with image as background and i am adding JLabel s dynamically to the JPanel. i have to move the JLabel on the image so i added mouse listener to JLabel. now i want to add zooming functionality to the JJPanel.

now if zoom out JPanel everything works well but JLabel mouse listener location is not changing so if i move mouse over JLabel its not activating listener - i need to move the mouse to original location when its 100% zoom to activate the listener. how can i correct this ?

while i am zooing label also zooming in and out. its only the location of mouse listener.

ex: its positioned at (100,100) while its 100% zoomed , when its zoom out to 50% label and image is zoom out but when i move mouse over label its not firing mouse listener but when i move mouse to (100,100) its firing listener and i am able to move the label. just check my code you guys can understand it.

i know its may be a simple thing i missed.

here is example code,
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
This will demonstrate how you find/locate the JLabels on the scaled image. It is set
up for j2se 1.5 with generics. Non-generic declaration/instantiations are included.
The classes are re–named so there shouldn't be trouble with name–clashing.
 
jQuery in Action, 2nd edition
 
subject: problem with JPanel / JLabel zooming
 
Similar Threads
Paint Drag Preview
Zoom with wheel and cut picture
Mouse and Key Listeners don't work on JPanel
Problems convering Applets to Applications
AWT Applet to Application conversion