mousemotionevent

matlab get mouse coordinates on image without clicking (on mouse over)

被刻印的时光 ゝ 提交于 2020-01-04 10:17:41
问题 I've been googling for a while to find a solution to this apparently simple problem: getting mouse coordinates in image axes while the mouse is moving (without clicking). I've found that impixelinfoval does exactly this but I'm not able to extract the pixel coordinates from this uicontrol in the script (are they stored in some field?). I've also found that ginput gives you the coordinates but only if you click. Do you know any workaround for one of these two issues? Are you aware of any

Detect current screen bounds

允我心安 提交于 2019-12-17 20:56:18
问题 I am working on an application that has setDecoration(false) and I have a MouseMotionlistener so I can move it around, and at the moment I am trying to make a maximize button. On the default monitor it works perfectly, but on a second monitor if I click the maximize button it will maximize to the default screen. How would I get the X & Y coordinates of the screen the application is currently on? I.E. I have 2 monitors both at 1600x900, so if the application is on monitor 1, the X & Y would be

how are the appropriate methods of MouseMotionListener in Java Swing?

不羁岁月 提交于 2019-12-12 02:35:38
问题 consider this class : public class mycomponent extends JComponent { public mycomponent(){ addMouseMotionListener(new MouseMotionHandler()); } class MouseMotionHandler implements MouseMotionListener{ public void mouseMoved(MouseEvent event){ //do something } public void mouseDragged(MouseEvent event){ //do something } } } Now Lets say a mouse drag event occurs. How does the MouseMotionHandler knows which method to call. of the two methods implemented. Or how is the method to be called resolved

Hovering over JButtons and displaying a message

删除回忆录丶 提交于 2019-12-04 04:33:51
问题 I want to hover over a number of JButtons on my GUI (map) and display the name of that location e.g. Manchester and London. I have the code working for one button, but it does not work for more than one button and prints the last out message (as i have 10 buttons) for all button locations. If button1 is true it then draws the text on the GUI in the specified area via my paintComponent() method. How can i resolve this? button1.addMouseMotionListener(this); button2.addMouseMotionListener(this);