Questions tagged [mousemotionevent]

28 questions
0
votes
0 answers

SDL MOUSEMOTION yrel is not giving a proper value

I created this easy function and it seems there is something wrong with it that I really don't see what it is... Evnt.motion.yrel output crazy number. void EnthropyGenerator::OpenWindow() { SDL_Window *EnthropyGeneratorWindow; SDL_Renderer*…
0
votes
1 answer

Updating screen with MouseMotionListener

My question is why won't paddleOne move with the mouse??? Is it because the graphic isn't updating???? package ballGame; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import…
wolowiz68
  • 7
  • 2
0
votes
1 answer

Kivy: Access MouseMotionEvent information from Button on_release/on_press

I want to create a button widget with Kivy that uses information from the touch event when clicked, i.e. The mouse position and the mouse button used for clicking. If I re-implement on_release or on_press like this: from kivy.uix.button import…
VinGarcia
  • 1,015
  • 12
  • 19
0
votes
2 answers

how to know if mouse dragged left or right inside jpanel in java

I have mouseMotionListener in my jpanel code. But how can I know if the mouse dragged to left or right inside the jpanel?
Dor Cohen
  • 117
  • 1
  • 4
  • 10
0
votes
2 answers

how are the appropriate methods of MouseMotionListener in Java Swing?

consider this class: public class mycomponent extends JComponent { public mycomponent(){ addMouseMotionListener(new MouseMotionHandler()); } class MouseMotionHandler implements MouseMotionListener{ public void…
brain storm
  • 30,124
  • 69
  • 225
  • 393
0
votes
0 answers

Why does my label not move until after I drag it when I call it to after my mouse wheel event?

public void mouseWheelMoved(MouseWheelEvent arg0) { if(dragging) { drag.rotate(); drag.setLocation(getMousePosition()); getContentPane().repaint(); } } drag is the label I'm dragging and it doesn't set the…
0
votes
2 answers

Java: Filling in Graphics based on 2D array as mouse held down

So I have a JPanel that is populated by the contents of a 2D array. I have a mouse listener which changes the colour of a cell when pressed. My question is, is it possible to have the user drag the mouse over a line of cells and colour them all in…
mark
  • 2,841
  • 4
  • 25
  • 23
0
votes
1 answer

I want to move GRect. I used mouseMotionListener, but it doesn't work. Check the code, and try to help. Thanks

import acm.graphics.*; import acm.program.*; import java.awt.Color; import java.awt.event.*; public class TestingClass2 extends GraphicsProgram implements MouseMotionListener{ //dimensions of play board private static final int boardWidth…
user2263005
  • 1
  • 1
  • 6
0
votes
2 answers

Mousedragged is not being recognized

Can someone please tell me why mousedragged isn't being recognized in the following code, and possibly help me fix this problem? public class Hello extends JPanel implements KeyListener, MouseListener, MouseMotionListener{ JPanel panel = new…
0
votes
0 answers

Java Draggable Label

I am creating a game interface and I have a panel which has a grid layout for inventory spaces. The game has items which are JLabels with icons added to them. I want the items to be draggable, specifically draggable on the inventory spaces and the…
0
votes
1 answer

In Java, how do I find the time since the last mouse moved?

Say, for example, if I have a circle drawn in a JFrame, and I want to paint over it if I hover over it for three seconds. I've got a MouseMotionListener that tells me the point of the cursor in the JFrame, but so far that's about it. public void…
KebertX
  • 304
  • 1
  • 6
0
votes
3 answers

Java Dragging Drawn Balls

I have created a program which draws a circle when I click on the screen. I have it working so that I can draw as many circles as I want. I can even drag one circle and not the others if I hard code which circle I am dragging. The code is: import…
nomad2986
  • 185
  • 1
  • 1
  • 6
0
votes
1 answer

Register 1 mouseDragged event for multiple JPanels

I have a Main JPanel with two other JPanels on top of it (Panel A and Panel B) as illustrated in the following image: I want to track the mouseDragged event on these JPanels, and at the moment to do that I am tracking it for all of the 3 JPanels as…
jadrijan
  • 1,438
  • 4
  • 31
  • 48
1
2