本文整理了Java中javax.swing.JFrame.addMouseMotionListener()
方法的一些代码示例,展示了JFrame.addMouseMotionListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.addMouseMotionListener()
方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:addMouseMotionListener
暂无
代码示例来源:origin: kevin-wayne/algs4
/**
* Adds a {@link DrawListener} to listen to keyboard and mouse events.
*
* @param listener the {\tt DrawListener} argument
*/
public void addListener(DrawListener listener) {
// ensure there is a window for listenting to events
show();
listeners.add(listener);
frame.addKeyListener(this);
frame.addMouseListener(this);
frame.addMouseMotionListener(this);
frame.setFocusable(true);
}
代码示例来源:origin: stackoverflow.com
MouseAdapter adapter = ...
JFrame frame = ...
frame.addMouseListener(adapter);
frame.addMouseMotionListener(adapter);
代码示例来源:origin: fossasia/neurolab-desktop
audioFeedbackFrame.setVisible(true);
audioFeedbackFrame.setResizable(false);
audioFeedbackFrame.addMouseMotionListener(new MouseMotionListener()
代码示例来源:origin: RaiMan/SikuliX2
box.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseDragged(MouseEvent e) {
代码示例来源:origin: RaiMan/SikuliX2
frame.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseDragged(MouseEvent e) {
代码示例来源:origin: klamonte/jexer
/**
* Adds the specified mouse motion listener to receive mouse motion
* events from this component. If listener l is null, no exception is
* thrown and no action is performed.
*
* @param l the mouse motion listener
*/
public void addMouseMotionListener(MouseMotionListener l) {
if (frame != null) {
frame.addMouseMotionListener(l);
} else {
component.addMouseMotionListener(l);
}
}
代码示例来源:origin: stackoverflow.com
public void setup() {
JFrame frame = new JFrame();
frame.setSize(500, 500);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocation(0, 0);
frame.setTitle("Circles");
JPanel p = new MouseHandler();
frame.add(p);
frame.addMouseListener(p);
frame.addMouseMotionListener(p);
frame.setVisible(true);
}
代码示例来源:origin: openimaj/openimaj
/**
* Construct the demo
*
* @throws IOException
*/
public PiecewiseMeshWarpDemo() throws IOException {
img = ImageUtilities.readMBF(getClass().getResource("/org/openimaj/demos/image/bird.png"));
frame = DisplayUtilities.displaySimple(img);
frame.addMouseMotionListener(this);
}
代码示例来源:origin: org.openimaj/demos
/**
* Construct the demo
*
* @throws IOException
*/
public PiecewiseMeshWarpDemo() throws IOException {
img = ImageUtilities.readMBF(getClass().getResource("/org/openimaj/demos/image/bird.png"));
frame = DisplayUtilities.displaySimple(img);
frame.addMouseMotionListener(this);
}
代码示例来源:origin: stackoverflow.com
public void setup() {
JFrame frame = new JFrame();
frame.setSize(500, 500);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocation(0, 0);
frame.setTitle("Circles");
frame.add(new MouseHandler());// your panel
frame.addMouseListener(new MouseHandler()); // your listener, also a panel, but not the one you added to your frame
frame.addMouseMotionListener(new MouseHandler()); // yet another listener, also not the panel you added to your frame
frame.setVisible(true);
}
代码示例来源:origin: martin-lizner/trezor-ssh-agent
f.addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseMoved(MouseEvent e) {
代码示例来源:origin: org.jbehave.web/jbehave-web-selenium
frame.addMouseMotionListener(mia);
代码示例来源:origin: stackoverflow.com
private static void debugMousePosition(JFrame frame) {
final JFrame box = new JFrame("Mouse Position");
box.setAlwaysOnTop(true);
box.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
box.setLocation(frame.getX() + 800,frame.getY());
box.setSize(300, 100);
box.setLayout(new GridLayout(1,2));
box.setVisible(true);
final JLabel X = new JLabel();
final JLabel Y = new JLabel();
frame.addMouseMotionListener(new MouseAdapter() {
public void mouseMoved(MouseEvent me) {
X.setText(String.valueOf("X Position: " + me.getX()));
Y.setText(String.valueOf("Y Position: " + me.getY()));
box.repaint();
}
});
box.add(X);
box.add(Y);
}
代码示例来源:origin: jbehave/jbehave-web
frame.addMouseMotionListener(mia);
代码示例来源:origin: com.github.fracpete/princeton-java-stdlib
/*************************************************************************
* Event-based interactions.
*************************************************************************/
public void addListener(DrawListener listener) {
// ensure there is a window for listenting to events
show();
listeners.add(listener);
frame.addKeyListener(this);
frame.addMouseListener(this);
frame.addMouseMotionListener(this);
frame.setFocusable(true);
}
代码示例来源:origin: com.googlecode.princeton-java-introduction/stdlib
/*************************************************************************
* Event-based interactions.
*************************************************************************/
public void addListener(DrawListener listener) {
// ensure there is a window for listenting to events
show();
listeners.add(listener);
frame.addKeyListener(this);
frame.addMouseListener(this);
frame.addMouseMotionListener(this);
frame.setFocusable(true);
}
代码示例来源:origin: edu.princeton.cs/algs4
/**
* Adds a {@link DrawListener} to listen to keyboard and mouse events.
*
* @param listener the {\tt DrawListener} argument
*/
public void addListener(DrawListener listener) {
// ensure there is a window for listenting to events
show();
listeners.add(listener);
frame.addKeyListener(this);
frame.addMouseListener(this);
frame.addMouseMotionListener(this);
frame.setFocusable(true);
}
代码示例来源:origin: brianway/algorithms-learning
/**
* Adds a {@link DrawListener} to listen to keyboard and mouse events.
*
* @param listener the {\tt DrawListener} argument
*/
public void addListener(DrawListener listener) {
// ensure there is a window for listenting to events
show();
listeners.add(listener);
frame.addKeyListener(this);
frame.addMouseListener(this);
frame.addMouseMotionListener(this);
frame.setFocusable(true);
}
代码示例来源:origin: stackoverflow.com
f.addMouseMotionListener(this);
f.addMouseListener(this);
代码示例来源:origin: org.jppf/jppf-common-node
final long mouseMotionDelay = config.getLong("jppf.screensaver.mouse.motion.delay", 500L);
final long start = System.currentTimeMillis();
frame.addMouseMotionListener(new MouseAdapter() {
@Override
public void mouseMoved(final MouseEvent e) {
内容来源于网络,如有侵权,请联系作者删除!