mouse

JavaScript how to change mouse cursor to an image?

巧了我就是萌 提交于 2019-11-27 22:11:09
问题 I've seen examples where you can change it to preset images that your operating system has; example: $('body').css('cursor', 'wait'); But how about my own /img/my_image.png? Thanks for any help. 回答1: You can, by specifying a url to it in CSS: div { cursor:url(smiley.gif),url(myBall.cur),auto; } See http://www.w3schools.com/cssref/pr_class_cursor.asp 回答2: The Jquery way to set a custom cursor (or default cursor as a fallback): $('selector').css({'cursor': 'url(/cursors/customMoveCursor.cur),

Get Mouse Position on Canvas (But NOT on window)?

时间秒杀一切 提交于 2019-11-27 22:05:35
I have a project in WPF 4 and vb.net 2010. I have a canvas inside a window. The window is full screen, but the canvas is set to a solid 640x480 in the center of the window. I need to get the mouse position inside of the canvas, but NOT inside of the window. How do I do this? Doesn't this work? Point p = Mouse.GetPosition(canvas); The position of the mouse pointer is calculated relative to the specified element with the upper-left corner of element being the point of origin, Phillip Hi the important thing is the NOT on the Window the canvas is part of the window as well. one example: the Window

Simulate swipe with mouse in javascript

[亡魂溺海] 提交于 2019-11-27 21:42:54
问题 I'm trying to make an image rotator that works on mobile devices using swipe for navigation. I'm also trying to make the same rotator to work on PC browsers but to be able to use the mouse drag to simulate swipe. Any good ideeas? 回答1: You'll want to handle onmousedown , onmousemove , and onmouseup events, keeping track of the mouse position and manipulating your image rotator accordingly. 回答2: I've looked into most of these... I'd recommend looking into Hammer.Js From what little I've seen,

How to get location of mouse in JavaFX?

别说谁变了你拦得住时间么 提交于 2019-11-27 20:53:31
I am a beginner in java(fx). How do you get the mouse location in x and y in JavaFX? I tried using AWT's MouseInfo (also imported it), but it's not working. I also saw the code for it in Ensembles(that dragging the ball-window in "advanced stage", that's what I need to do, drag my undecorated JavaFX stage), but it also doesn't work. I am using FXML with controller, and I guess that's the main problem. Should I switch back to the single-file simple JavaFX? I know FXML is better for laying out the UI, but I can't get many of such codes to work. Or do I need some other sort of code for my

Copying stuff from vim running in putty

谁都会走 提交于 2019-11-27 20:17:17
问题 I am running Vim 6.3 through putty and putty connection manager. I have the mouse option set (set mouse = a). I am able to paste things from the (windows) clipboard to vim by but selecting text in vim isn't copying anything to the clipboard. Does anyone know how do I do this? Note: I can't update Vim to a newer version. 回答1: You can select some text with the mouse and then type: "*y to yank the selected text to the clipboard, then you should be able to use the clipboard content in another

Change background color on mouseover and remove it after mouseout

ぃ、小莉子 提交于 2019-11-27 20:05:06
I have table which class is forum . My jquery code: <script type="text/javascript"> $(document).ready(function() { $('.forum').bind("mouseover", function(){ var color = $(this).css("background-color"); $(this).css("background", "#380606"); $(this).bind("mouseout", function(){ $(this).css("background", color); }) }) }) </script> It perfectly works, but is it possible to do it in more efficient way without var color = $(this).css("background-color"); . Just after mouseout leave the previous background-color and remove #380606 ? Thank you. If you don't care about IE ≤6, you could use pure CSS ...

Matplotlib: draw a selection area in the shape of a rectangle with the mouse

和自甴很熟 提交于 2019-11-27 19:55:23
I want to be able to draw a selection area on a matplotlib plot with a mouse event. I didn't find information on how to do it with python. In the end, I want to be able to draw a region of interest with my mouse on a map created with matplotlib basemap and retrieve the corner coordinates. Anyone has an idea, example, references? Thanks, Greg class Annotate(object): def __init__(self): self.ax = plt.gca() self.rect = Rectangle((0,0), 1, 1, facecolor='None', edgecolor='green') self.x0 = None self.y0 = None self.x1 = None self.y1 = None self.ax.add_patch(self.rect) self.ax.figure.canvas.mpl

Mouse tracking daemon

蹲街弑〆低调 提交于 2019-11-27 19:30:05
I need to write something using Cocoa to surface raw mouse movement data. Optimally, the app would just be a little daemon that would run, passing the data to a socket server which another application could tap into to gain access to the events. Can anyone point me in the right direction with regard to approach and tools? I am not even sure where to begin with this right now. The other simple way to do this is to add a global event monitor (10.6 only, however): id eventHandler = [NSEvent addGlobalMonitorForEventsMatchingMask:NSMouseMovedMask handler:^(NSEvent * mouseEvent) { NSLog(@"Mouse

Image change on hover Java

*爱你&永不变心* 提交于 2019-11-27 19:26:28
问题 I know that item1.setToolTipText("This shows up on mouse hover"); will allow text to show up if the mouse hovers over it. I was wondering if I could make the image change on mouse hover? Thanks in advance. 回答1: I would add a MouseListener to your component that holds the image. Then just override the methods mouseEntered(MouseEvent e) and mouseExited(MouseEvent e) to change the image. Here's a full working example : public class JFrameExample { public static void main(String[] args) throws

Java Mouse Event Right Click

北慕城南 提交于 2019-11-27 18:14:25
On my three button mouse MouseEvent.BUTTON2 = Middle Click and MouseEvent.BUTTON3 = Right Click. Is this the case on a two button mouse? Thanks To avoid any ambiguity, use the utilities methods from SwingUtilities : SwingUtilities.isLeftMouseButton(MouseEvent anEvent) SwingUtilities.isRightMouseButton(MouseEvent anEvent) SwingUtilities.isMiddleMouseButton(MouseEvent anEvent) Codemwnci Yes, take a look at this thread which talks about the differences between platforms. How to detect right-click event for Mac OS BUTTON3 is the same across all platforms, being equal to the right mouse button.