mouseevent

JFrame Glasspane is also over JDialog but shouldn't

谁都会走 提交于 2019-12-20 06:28:27
问题 I have a JFrame (undecorated) with a Glasspane. This Frame opens a JDialog (also undecorated and has also a glassPane) and hides itself (setVisible(false)). The Glasspanes are set with .setGlassPane(). The Dialog is opened with the Frame as owner. The GlassPane extends a JPanel and implements AWTEventListener. I use it for resizing the Frames and Dialogs, so it knows it's parent (the Frame/Dialog) - this is called "target". The Events inside the GlassPane are handled like this: public void

Java Swing draw lines with mouse click and drag

ⅰ亾dé卋堺 提交于 2019-12-20 05:36:34
问题 I want to bring back a question that was asked before: java draw line as the mouse is moved "I would like to add a feature to my application which allows the user to draw a straight line by clicking the mouse at the start location and releasing it at the end location. The line should move as the mouse moves until it is finally released; similar to the way that a line can be drawn using the Microsoft Paint application. How can implement this so that the line is repainted as it moves without

pointer motion. why are numbers so high? why does it print info in blocks not a constant stream?

主宰稳场 提交于 2019-12-20 04:43:11
问题 Hi! I am trying to write a program where I need to report the position of every mouse motion. I have called the XSelectInput() function with a PointerMotionMask mask. Everything seems to work alright but the numbers after printing don't appear after every movement, they appear in blocks and also the numbers in event.xmotion.x and event.xmotion.y are very high, in the hundred thousands. What is causing these large numbers? Also is my program getting every number and reporting it immediately or

Java Read Raw Mouse Input

a 夏天 提交于 2019-12-20 04:34:11
问题 I'm looking for a way in Java to read in raw mouse input and not just the event listeners. I'll tell you what I'm doing. Essentially, there is a game where if you move the mouse to the right, I want Java to send key signals of the 'd' key being pushed down, and when the mouse is moved to the left, the 'a' key being held down. But, when you move the mouse, the game quickly corrects the mouse position and sends it right back into the middle of the screen. So, if you use mouse listener, you get

Python Tkinter: Display description in status bar

放肆的年华 提交于 2019-12-20 04:25:10
问题 For my Tkinter GUI, I have already created a Menu and a Status Bar. However, how to display description when mouse is over menu items? Please run the following code (eg. when mouse is over menu item "About", status bar should write "Information": from Tkinter import Tk, Frame, BOTH, Menu, Label, SUNKEN, X, BOTTOM class Application(Frame): def __init__(self, parent): Frame.__init__(self, parent, background = "white") parent.configure(bg = "black") self.pack(fill = BOTH, expand = True, padx =

KineticJS - update text layer with new mouse position

佐手、 提交于 2019-12-20 04:22:45
问题 I am using the following to get the mouse position: var coordinate = 0; ............ canvas1.addEventListener('mousemove', function (evt) { var mousePos = getMousePos(canvas1, evt); var nY = Math.round(mousePos.y); var nX = Math.round(mousePos.x); coordinate = "x=" + nX + ", y=" + nY; $('#pValue').val(coordinate); }, false); It works great if I display the value in a text field; however I could not update a text layer: dlayerA1Text = new Kinetic.Layer(); var simpleTextRight = new Kinetic.Text

mousedown event on options in select is not working in IE, Is there any workaround?

落花浮王杯 提交于 2019-12-20 04:12:26
问题 This following code snippet is to avoid the need for ctrl-click in a multi-select box but it does not work in IE 8 . Is there any work around to achive the same in IE and other IE version? $('option').mousedown(function(e) { e.preventDefault(); $(this).prop('selected', !$(this).prop('selected')); return false; }); 回答1: I don't believe there's any way to get the mousedown or click event on an option element in IE8. If you really want the behavior you describe, I suggest that you use a

How to display clickable RGB image similar to pyqtgraph ImageView?

廉价感情. 提交于 2019-12-20 03:44:06
问题 Despite not being a proficient GUI programmer, I figured out how to use the pyqtgraph module's ImageView function to display an image that I can pan/zoom and click on to get precise pixel coordinates. The complete code is given below. The only problem is that ImageView can apparently only display a single-channel (monochrome) image. My question: How do I do EXACTLY the same thing as this program (ignoring histogram, norm, and ROI features, which I don't really need), but with the option to

Make Qlabel clickable or double clickable in Qt

那年仲夏 提交于 2019-12-20 02:56:15
问题 I am beginner in Qt, now I want to make my label clickable, I have searched so much online, but no one gives my a real example of how they made it. So can someone teach me step by step? Now my basic thinking is creating a new .c file and new .h file respectively and then include them into my mainwindow.c and then connect it with the existing label in ui form. These are what I was trying to do, but can not make it. Hope someone can teach and better put the step picture in the command, thanks.

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

梦想与她 提交于 2019-12-20 02:27:42
问题 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