mouseevent

How to programmatically fire a MouseEvent to a MouseListener with Java?

孤街醉人 提交于 2019-12-30 08:53:09
问题 I have a JTree with a custom associated MouseListener (for showing popup etc.). I need to fire a MouseEvent that will be caught by the MouseListener . How should I do that programmatically? 回答1: You could create your own MouseEvent and loop through all the listeners and make the call. For example: MouseEvent me = new MouseEvent(tree, 0, 0, 0, 100, 100, 1, false); for(MouseListener ml: tree.getMouseListeners()){ ml.mousePressed(me); } 回答2: The Robot class might be what you're looking for. This

How to programmatically fire a MouseEvent to a MouseListener with Java?

僤鯓⒐⒋嵵緔 提交于 2019-12-30 08:52:19
问题 I have a JTree with a custom associated MouseListener (for showing popup etc.). I need to fire a MouseEvent that will be caught by the MouseListener . How should I do that programmatically? 回答1: You could create your own MouseEvent and loop through all the listeners and make the call. For example: MouseEvent me = new MouseEvent(tree, 0, 0, 0, 100, 100, 1, false); for(MouseListener ml: tree.getMouseListeners()){ ml.mousePressed(me); } 回答2: The Robot class might be what you're looking for. This

How to track mouse position from on page load as well as on mouse move?

↘锁芯ラ 提交于 2019-12-30 08:11:26
问题 I am tracking mouse movements using the following JavaScript: var mouseX = 0; var mouseY = 0; document.onmousemove = function (e) { mouseX = e.clientX; mouseY = e.clientY; } My problem is that if the mouse hasn't been moved since the page had been loaded, the mouseX and mouseY values both equal 0. How can I get the mouse values when the page is loaded as well as when the mouse is moved? 回答1: The browser doesn't know where the mouse is until it moves. It's more complicated than just "get me

Scrolling the Window Under the Mouse

杀马特。学长 韩版系。学妹 提交于 2019-12-30 07:02:15
问题 If you take a look at Visual Studio 2012, you'll notice that if you use the mouse wheel, the window under your mouse will scroll, and not the focused window. That is, if you have your cursor in the code editor, and move your mouse over the Solution Explorer window and scroll, the Solution Explorer will scroll, and not the code editor. The WM_MOUSEWHEEL message, though, only gets sent to the focused window, so in this case, the code editor. How can we implement our program such that the WM

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

放肆的年华 提交于 2019-12-30 06:29:48
问题 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

Emacs font sizing with Ctrl key and mouse scroll

牧云@^-^@ 提交于 2019-12-30 03:58:09
问题 notepad++ allow me to increase the font size when I hold the Ctrl Key and rotate the mouse middle scroll button to forward. In the same way, the when I hold Ctrl and rotate the mouse middle scroll button backward, the fond size reduces. How can I get the same with Emacs? 回答1: code for AlexCombas' answer: (defun font-big () (interactive) (set-face-attribute 'default nil :height (+ (face-attribute 'default :height) 10))) (defun font-small () (interactive) (set-face-attribute 'default nil

Google Map's Double Click Event Propagation

不羁岁月 提交于 2019-12-30 03:50:12
问题 This question is asked often, but never really answered well. Let's see if we can remedy it! Event Propagation Google allows you to bind to events in a Google Map View via their API using event handlers. Sometimes you may bind your event handler to an event that Google itself is already bound to. Thus, when your event fires and does whatever you told it to do you may find Google also doing its own little thing at the same time. Hmm, can I handle the event so my code runs, but stop the event

Stopping propagation of mousedown/mouseup from a click handler

依然范特西╮ 提交于 2019-12-30 03:03:08
问题 Here's a DEMO . I have two divs , an inner and an outer: <div id="outer"> <div id="inner"></div> </div> With some CSS so you can see which is which: #outer { width: 250px; height: 250px; padding: 50px; background: yellow; } #inner { width: 250px; height: 250px; background: blue; } I try to stop propagation of mousedown and mouseup events from within a click handler like so: $('#inner').on('click', function(e) { e.stopPropagation(); $(this).css({'background': 'green'}); return false; }); $('

WatiN FireEvent not passing event properties in FireFox

余生长醉 提交于 2019-12-29 08:15:27
问题 This had been logged as a bug in sourceforge though now deleted. I'm using FireFox 3.6 with associated jssh. I can see in Firebug that the Event Properties are not being set. I'm trying to drag and drop with code below var mouseDownEvent = new NameValueCollection {{"button", "1"}, {"clientX", "0"}, {"clientY", "0"}}; firstStoryRow.FireEventNoWait("onmousedown", mouseDownEvent); There are workarounds for passing these properties but not they're not nice. Does anyone know if this is an genuine

How to highlight the entire row on mouse hover in QTableWidget: Qt5

假装没事ソ 提交于 2019-12-29 07:44:13
问题 I want to highlight the row on mouse hover in my QTableWidget . When I hover the mouse, only single cell highlighted. I have tried this approach : bool MyTabWidget::eventFilter(QObject *target, QEvent *event) { if( target == ui->MyTableWidget ) { //Just to print the event type qDebug() <<"EventType : "<<event->type(); } } Output : EventType : 13 . `(13 = QEvent::Move)` I have done lost of googling. but not get any proper solution. Is there any other approach to fulfill my requirment (to