mouse

How can I use the back and forward mouse buttons in a Swing application?

社会主义新天地 提交于 2019-12-01 01:15:47
问题 The question is pretty simple. I couldn't find many links regarding this issue, and the ones I found didn't seemed to avoid the real question. My application must handle the mouse pressed/released events for the back and forward mouse buttons. How can I handle this? EDIT: This is using JDK 1.6 . 回答1: Check if additional mouse buttons are detected by calling: MouseInfo.getNumberOfButtons(); Check if MouseEvents are fired when you click those additional buttons. If so, what does MouseInfo

Transform screen coordinates to model coordinates

只愿长相守 提交于 2019-12-01 00:21:58
I've got some sort of newbie question. In my application (processingjs) i use scale() and translate() to allow the user to zoom and scroll through the scene. As long as i keep the scale set to 1.0 i've got no issues. BUT whenever i use the scale (i.e. scale(0.5)) i'm lost... I need the mouseX and mouseY translated to the scene coordinates, which i use to determine the mouseOver state of the object I draw on the scene. Can anybody help me how to translate these coordinates? Thanks in advance! /Richard Unfortunately for me this required a code modification. I'll look at submitting this to the

How to detect shift key pressed state when on mouse move

江枫思渺然 提交于 2019-11-30 22:31:23
问题 I'm trying to show a zoomed in overlay on an image when mouse over and shift key pressed. The problem is that user might have pressed the shift key before even the window has focus, so KeyDown monitoring is not a solution. Is there a way to access modifier key states during mouse events? In Java for example the mouse event contains flags for modifier keys, not so in .NET. 回答1: Try using the Control.ModifierKeys property: if ((Control.ModifierKeys & Keys.Shift) != Keys.None) { // do my stuff }

How to Detect Forward and Back Mouse Button Events in Delphi?

China☆狼群 提交于 2019-11-30 20:15:24
If a mouse has other buttons in addition to the standard left/right/middle (e.g. forward/back), how can we detect those button clicks in Delphi? An example of how this is used is the Internet Explorer, where the forward/back button on the side of a Logitech or MS mouse cycles forward and back between any loaded web pages. This seems to replicate the Backspace/CTRL+Backspace on the keyboard but I tried to detect that using KeyPreview and the KeyPress event but it does not pick it up. Any idea how to detect clicks on these extended mouse buttons? Zoë Peterson You need to capture the WM

Transform screen coordinates to model coordinates

醉酒当歌 提交于 2019-11-30 19:14:35
问题 I've got some sort of newbie question. In my application (processingjs) i use scale() and translate() to allow the user to zoom and scroll through the scene. As long as i keep the scale set to 1.0 i've got no issues. BUT whenever i use the scale (i.e. scale(0.5)) i'm lost... I need the mouseX and mouseY translated to the scene coordinates, which i use to determine the mouseOver state of the object I draw on the scene. Can anybody help me how to translate these coordinates? Thanks in advance!

Releasing mouse capture and letting mouse click pass through

ⅰ亾dé卋堺 提交于 2019-11-30 18:35:57
I have a control that is similar to a Popup or Menu. I want to display it and when the user clicks outside the bounds of the box, have it hide itself. I've used Mouse.Capture(this, CaptureMode.SubTree) as well as re-acquired the capture the same way Menu/Popup do in OnLostMouseCapture. When the user clicks outside the bounds of the control, I release the mouse capture in OnPreviewMouseDown. I don't set e.Handled to true. The mouse click will make it to other controls on the main UI, but not to the close button (Red X) for the window. It requires 2 clicks to close the app. Is there a way to

Java MouseEvent position is inaccurate

社会主义新天地 提交于 2019-11-30 16:56:43
I've got a problem in Java using a "canvas" class I created, which is an extended JPanel , to draw an animated ring chart. This chart is using a MouseListener to fetch click events. The problem is that the mouse position does not seem to be accurate, meaning it does not seem to be relative to the "canvas" but instead relative to the window (in the left, upper corner I got about 30px for y coord). This is my code: I created a class, that extends JPanel and does have a BufferedImage as member. public class Canvas extends JPanel { public BufferedImage buf; private RingChart _parent; public Canvas

Releasing mouse capture and letting mouse click pass through

旧城冷巷雨未停 提交于 2019-11-30 16:51:31
问题 I have a control that is similar to a Popup or Menu. I want to display it and when the user clicks outside the bounds of the box, have it hide itself. I've used Mouse.Capture(this, CaptureMode.SubTree) as well as re-acquired the capture the same way Menu/Popup do in OnLostMouseCapture. When the user clicks outside the bounds of the control, I release the mouse capture in OnPreviewMouseDown. I don't set e.Handled to true. The mouse click will make it to other controls on the main UI, but not

Simulate mouse on Mac

扶醉桌前 提交于 2019-11-30 15:58:21
I have a virtual trackpad on my iPhone and to move my mouse I'm using : CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, CGPointMake(((float)aD.msg)+location.x, ((float)aD.msg2)+location.y)); It's working well but this not a real mouse because when I put my mouse on my hidden dock, this one doesn't display it self. I don't understand why. More over I tried to simulate mouse click with : case MOUSECLICK: [self postMouseEventWithButton:0 withType:kCGEventLeftMouseDown andPoint:CGEventGetLocation(CGEventCreate(NULL))]; [self postMouseEventWithButton:0 withType:kCGEventLeftMouseUp andPoint

Pass mouse events to applications behind from a Java UI

丶灬走出姿态 提交于 2019-11-30 15:47:40
The question I have is exactly same in requirement as How to pass mouse events to applications behind mine in C#/Vista? , but I need the same for a Transparent Java UI. I can easily create a transparent Java UI using 6.0 but couldn't get any info about passing events through the app to any applications(say a browser) behind. Savvas Dalkitsis I believe this will answer your question. To run it you will need Java 6 update 10 and above. I tested it on Windows Vista import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics