How to change the cursor
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a gui form and there're axes.
When the graph has built in the axes by plot(), is it possible to set the cursor at the position of the last point of the graph?
Thank you.
7 Kommentare
Antworten (1)
Image Analyst
am 4 Feb. 2018
Here's some code to get you started with Java Robot:
import java.awt.Robot
import java.awt.event.*
mouse = Robot;
plot(1:10, 'bo-', 'LineWidth', 2);
grid on;
% ResetZoom(mouse);
% Reset the zoom so that the links will be at the same place every time.
y = 500
for x = 500 : 50 : 700
fprintf('x = %d, y = %d\n', x, y);
mouse.mouseMove(x, y);
% Set a breakpoint on the next line and wiggle your mouse to see if it put it in the right place.
% % Press the mouse button.
% mouse.mousePress(InputEvent.BUTTON1_MASK);
% mouse.mouseRelease(InputEvent.BUTTON1_MASK);
pause(0.5); % Wait at that spot for user to see it.
end
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!