• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

problem with JPanel / JLabel zooming

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic