mouseevent

Changing the mouse pointer in JtextPane

痴心易碎 提交于 2019-12-01 21:21:16
I have a JTextPane which has the content type text/plain . I set some texts to that JTextPane and it contain some texts which display URLs . I want to change the mouse pointer when I point the mouse to that text only into the hand pointer. Is this function achievable? Note: I have the content of the JTextPane as text/plain . It cannot be changed to text/html thanx You could try this: pane.setCursor(new Cursor(Cursor.HAND_CURSOR)); Where pane is your JTextPane . camickr Did you read my answer in your posting on Adding tooltips to JTextPane ? Well the concept is the same. You use a MouseListener

Is it possible to include the box-shadow in the div area that responds to a click event?

天大地大妈咪最大 提交于 2019-12-01 21:01:36
I have a div acting as a round button. It is styled so that a significant part of its overall appearance comes from a box-shadow : <body style="background:black"> <div id="button" style="width: 50px; height: 50px; background: yellow; border: none; border-radius: 50px; box-shadow: 0 0 0 5px #c03, 0 0 2px 7px #fff"></div> </body> I have a click event listener attached to the button div . Unfortunately, it doesn't respond if the div is clicked on the box-shadow as the box-shadow is rendered outside the div . This is particularly a problem on touch devices where the finger sometimes doesn't hit

handle click event outside of button

旧街凉风 提交于 2019-12-01 20:09:43
I am trying to practice c# by reproduce an App that is in the Apple AppStore. In the app, there is a rectangle with the text: "Touch me" . When you touch it, the rectangle repositions itself. After you do this a few times, the text changes to "Do not Touch me". In that case you have to Touch outside of the rectangle. It all went well, up to the point where you have to touch outside the rectangle. Here is my event handler: private void Canvas_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e) { if (click == 0) { if (rectangle1.IsMouseOver || textBlock1.IsMouseOver) { // reposition and

handle click event outside of button

社会主义新天地 提交于 2019-12-01 19:33:44
问题 I am trying to practice c# by reproduce an App that is in the Apple AppStore. In the app, there is a rectangle with the text: "Touch me" . When you touch it, the rectangle repositions itself. After you do this a few times, the text changes to "Do not Touch me". In that case you have to Touch outside of the rectangle. It all went well, up to the point where you have to touch outside the rectangle. Here is my event handler: private void Canvas_MouseLeftButtonDown_1(object sender,

C# - WPF - Mousemove event on canvas will overload the mouse events so click event is not fired

删除回忆录丶 提交于 2019-12-01 19:33:41
I use Shapes and Canvas, I want to make something like a mapeditor. When the mouse move over the canvas I draw the actually selected object to the canvas at the mouse position on every move, so who use the program can see how it will look like if the object is placed there. And on mouse click I add the current object/position to a list, which contains the placed elements which need to be drawn on the canvas in every update. The problem is if the mouse move handler is active (binded to canvas) then the click event is not fired alway, I need to click continuously For about ten clicks to place

MouseEvent on JPanel - wrong coordinate

不打扰是莪最后的温柔 提交于 2019-12-01 18:46:28
I have written the following micro-paintbrush program in Java: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; class AuxClass1 extends JFrame implements MouseListener, MouseMotionListener{ private JPanel panel1 = new JPanel(); private JPanel panel2 =

Get element currently under mouse without using mouse events

自作多情 提交于 2019-12-01 18:42:23
WRT building a Firefox Add-on. Is it possible to get the element under the mouse via some XPCOM or javascript method? (non-js-ctypes please as that requires OS specificity) I want to detect what is under the mouse when user presses Ctrl + Shift + M . Right now I'm adding a mouseover listener to the document when the user presses this hotkey, so I can get the element under the mouse when he moves it, but not the element that was under the mouse exactly when he pressed the hotkey combination. I just looked through the source for code that gets (or stores and makes available) the cursor position.

How to set target property when simulating mouseclick in javascript?

試著忘記壹切 提交于 2019-12-01 18:08:53
I want to simulate a mouseclick in my javascript code which uses dojo. The action for a real mouseclick will be registered using dojo-stuff with "ondijitclick". I know which method/function gets called and I also have the dijit object to call this method. The method expects an function object as parameter, so I'm creating a new MouseEvent object. This all works fine, except that I need to set the target value of this event and I can't figure out how to do this. This is needed because later exception handling is accessing the target-property and I can't avoid this. So far the code I have: dojo

How to set target property when simulating mouseclick in javascript?

只谈情不闲聊 提交于 2019-12-01 17:24:35
问题 I want to simulate a mouseclick in my javascript code which uses dojo. The action for a real mouseclick will be registered using dojo-stuff with "ondijitclick". I know which method/function gets called and I also have the dijit object to call this method. The method expects an function object as parameter, so I'm creating a new MouseEvent object. This all works fine, except that I need to set the target value of this event and I can't figure out how to do this. This is needed because later

Chrome mousedown and mouseup events no longer working, other browsers are fine

白昼怎懂夜的黑 提交于 2019-12-01 15:51:24
As of today (or yesterday, didn't notice it then), mousedown and mouseup events are no longer working. I am on Chrome Version 55.0.2883.95 (64-bit). Safari and FireFox are working fine (I am on a mac computer). Here is the code: document.getElementById("floorplan-backdrop-rect").addEventListener('mousedown', function(ev) { o.clickDown(ev); }, false); document.getElementById("floorplan-backdrop-rect").addEventListener('mouseup', function(ev) { o.clickUp(ev); }, false); Were there any API changes regarding mouse-events that we missed? Chrome does not throw any warning when registering the events