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,
posted 9 years ago
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.