Questions tagged [mousemotionevent]

28 questions
9
votes
1 answer

MouseAdapter methods - why `mouseDragged`, `mouseMoved` and `mouseWheelMoved` included?

My goal was to simplify this code (all works fine): package test; import java.awt.Window; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.JWindow; public class A…
Ernestas Gruodis
  • 8,567
  • 14
  • 55
  • 117
4
votes
3 answers

Hovering over JButtons and displaying a message

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…
nsc010
  • 395
  • 3
  • 5
  • 12
3
votes
2 answers

Detect current screen bounds

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…
MRVDOG
  • 1,717
  • 2
  • 13
  • 20
2
votes
1 answer

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

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…
2
votes
1 answer

Simple Java Paint Program: How to change the color without changing the previous painted

I am writing simple Paint program, where you paint whatever you want by dragging the mouse. You can change the color and the size of the brush, but in this version, when I change the color or the size of the brush, everything painted before is…
2
votes
1 answer

Stackoverflow error when trying to dispatch MouseEvents. mouseMoved works but mouseDragged does not

I've been trying to implement mouse motion event dispatches but I continue to get a stack overflow error. It works for the mouseMoved(MouseEvent e) method but not for mouseDragged(MouseEvent e). Does anybody have a clue as to why? Are there any…
Klungo
  • 39
  • 1
  • 3
1
vote
1 answer

how to stop mouse motion event in particular stage

am new to android. i have small issue in mouse motion use, i don't know to handle . when scroll up or down in mouse to change the button value when reach the particular value stop the mouse motion or not change the values. Please suggest me and…
dhineshkumar
  • 51
  • 1
  • 6
1
vote
1 answer

Error finding the angle between two points

This problem is hard to explain, so I'll use an image to aid me: I'm trying to find an angle between the middle of the tank, to the mouse. The orange dot denotes the mouse position, the red line separates the two instances, and the green/lime line…
TheBrenny
  • 528
  • 3
  • 19
1
vote
1 answer

Is it possible to add MouseMotionListener to BufferedImage?

I am developing an application that drag and scale image in Jpanel. The image is stored inside a JLabel. But when i am adding the MouseMotionListener to the panel, then whole window is dragging and when i am trying to add MouseMotionListener to I…
Java Curious ღ
  • 3,622
  • 8
  • 39
  • 63
1
vote
2 answers

How to find the mouse position relative to a panel constantly?

I'm using MouseListeners and I want it to tell me the mouse position without th mouse being clicked or held down. So I know where it is hovering over. How do I do this? I have code such as this, to find the position when it is pressed but i'm…
Michael Haywood
  • 319
  • 2
  • 4
  • 10
1
vote
0 answers

JAVA: MouseDragged Event Precision

While setting up a dynamic component in my program, I noticed that there was some flickering whenever the component (a JPanel) was relocated. So, I printed the mouse position at each drag event using: public void mouseDragged(MouseEvent e) { …
Kyle
  • 151
  • 1
  • 2
  • 14
1
vote
1 answer

Using Java Swing, mouseEntered is being overshadowed by mouseMoved. Is there an easy fix for this?

Basically, I have to simply paint the text "Mouse entered at" followed by its coordinates. My code does this successfully when mouseMoved is not implemented. When it is, it never shows that the mouse entered and goes directly to "Mouse moved at". …
The Rationalist
  • 743
  • 1
  • 10
  • 23
0
votes
0 answers

Simulate touch_up event in kivy

To simulate a touch_down event I followed the code in this post text However it does not work for touch_up. it seems that more information must be passed to the mousemotionevent in order for the tocuh_up event to be processed. Any ideas? This code…
0
votes
0 answers

How should I split joined lines for my paint app in java

I am new to using paint and lines in java, sorry if the answer is obvious. Never the less I would like to have my lines smooth and that is why I have the "Circles" join as to make a line with rounded corners, the problem is it doesn't recognize when…
0
votes
0 answers

How to make a moving ball with mouse motion listener

addMouseMotionListener(new MouseAdapter() { public void mouseMoved(MouseEvent e) { relativeX = e.getX(); relativeY = e.getY(); System.out.println(relativeX + "," + relativeY); …
Dumpq
  • 1
1
2