mouse

How do I drag and drop a row in a JTable?

爷,独闯天下 提交于 2019-12-28 08:38:11
问题 How do you setup a JTable to be able to drag a row to a different index in the table. For example if I have 5 rows and I want to drag the 4th row to the 2nd position? 回答1: Check out the drag and drop section of the Java Tutorial. There are some examples on how to implement this for JTable . 回答2: The following allows JTable re-ordering of a single dragged row: table.setDragEnabled(true); table.setDropMode(DropMode.INSERT_ROWS); table.setTransferHandler(new TableRowTransferHandler(table)); Your

Retrieving X and Y values from Matlab Plot

十年热恋 提交于 2019-12-28 06:39:11
问题 I have a plot figure and I want to retreive x and y cordinates when we select particular data point using mouse from plot figure. Any ideas? 回答1: Another option is to use the button down function: function mouseExample() h = plot(rand(10,1), 'o-'); set(h, 'ButtonDownFcn',@buttonDownCallback) function buttonDownCallback(o,e) p = get(gca,'CurrentPoint'); p = p(1,1:2); title( sprintf('(%g,%g)',p) ) end end Note this will not only work on "data-points", but rather on interpolated (x,y) positions

How to get mouse position related to desktop in WPF?

£可爱£侵袭症+ 提交于 2019-12-28 06:33:26
问题 Problem When you search for such question using google you get a lot of hits but all solutions assume you have at least one window. But my question is just like I phrased it -- not assumptions at all. I can have a window, but I could have zero windows (because I didn't even show one or I just closed the last one). So in short the solution cannot rely on any widget or window -- the only thing is known, is there is a desktop (and app running, but it does not have any windows). So the question

Controlling mouse with Python

≡放荡痞女 提交于 2019-12-27 09:02:32
问题 How does one control the mouse cursor in Python, i.e. move it to certain position and click, under Windows? 回答1: Tested on WinXP, Python 2.6 (3.x also tested) after installing pywin32 (pywin32-214.win32-py2.6.exe in my case): import win32api, win32con def click(x,y): win32api.SetCursorPos((x,y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0) click(10,10) 回答2: Try with the PyAutoGUI module. It's multiplatform. pip install

JTabbedPane won't change panel on mouseclick

不羁的心 提交于 2019-12-26 02:43:44
问题 I have a Main class that stores a TabbedComponent(extending JTabbedPane) as a variable. Another class (ToolbarComponent(extending JMenuBar) is also stored as a variable within my main class. Upon a user event on the Toolbar, it calls the parent class (main), to get the TabbedComponent object and call a method to create a new tab. Which all works fine. My issue is that when I attempt to click on a ta with my mouse, nothing changes. I'm pretty sure that I don't need a listener on MouseAdapter

Telerik WinForms: Double clicking not distinguishing with single clicking

泄露秘密 提交于 2019-12-25 16:52:02
问题 We have inherited a project that uses RADGrid. It has both events for double and single clicking enabled. But when DoubleClick is fired, so are Click and CellBeginEdit,... I want to cancel Click, CellBeginEdit or others when DoubleClick is fired. 回答1: I have an Inherited class Sheet from Telerik.WinControls.UI.RadGridView that I use as grid control in my project. This resume what is needed to solve the problem: public partial class Sheet : Telerik.WinControls.UI.RadGridView { //System Time to

d3.js mouse events not working

谁都会走 提交于 2019-12-25 06:59:36
问题 I have the following problem: I made a force graph containing of only nodes rendered as circles. Everything worked fine, I could change the color on hover, click on them and delete some. I wrote this function to get the desired behavior depending on which data value is passed. It worked this morning but when I tried to show a friend what I had made suddenly the interaction stopped working completely. I don't get any error messages. Somehow something is wrong with the .on(mouseover) .on

Draw a triangle using mouse drag (how can I move the previous drawn triangle using mouse drag)

橙三吉。 提交于 2019-12-25 04:49:15
问题 How to move a triangle to a new location using mouse drag (which was previous drawn using mouse drag)? ... java.util.List<Polygon> triangles = new LinkedList<Polygon>(); Point startDrag, endDrag, midPoint; Polygon triangle; ... public PaintSurface() { this.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { startDrag = new Point(e.getX(), e.getY()); endDrag = startDrag; repaint(); }//end mousePressed public void mouseReleased(MouseEvent e) { ... int[] xs = {

Simulate mouse click on a minimized window

自作多情 提交于 2019-12-25 03:55:27
问题 I am currently writing an application in C# that will recognize certain patterns on the screen and move to mouse to click on it. Currently, the application needs to have the focus and the mouse cursor moves, so the computer is unusable while the program is running. I would like to simulate a mouse click on a window but without actually moving the mouse on the screen. My goal would be to be able to simulate mouse click on a application that is minimized. Would that be easy to make in C#? 回答1: