java.awt.Container.addMouseMotionListener()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中java.awt.Container.addMouseMotionListener()方法的一些代码示例,展示了Container.addMouseMotionListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Container.addMouseMotionListener()方法的具体详情如下:
包路径:java.awt.Container
类名称:Container
方法名:addMouseMotionListener

Container.addMouseMotionListener介绍

暂无

代码示例

代码示例来源:origin: magefree/mage

public static void main(String[] args) {
    final JFrame frame = new JFrame();
    frame.setLayout(new BorderLayout());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    final Arrow arrow = new Arrow();
    frame.add(arrow, BorderLayout.CENTER);
    frame.setSize(640, 480);
    frame.setResizable(false);
    frame.setVisible(true);
    frame.getContentPane().addMouseMotionListener(new MouseMotionListener() {
      @Override
      public void mouseMoved(MouseEvent e) {
        arrow.setArrowLocation(320, 240, e.getX(), e.getY());
      }

      @Override
      public void mouseDragged(MouseEvent e) {
      }
    });
  }
}

代码示例来源:origin: edu.ucar/grib

/**
 * Adds the specified mouse motion listener to receive mouse motion events
 * from this component. It is actually added to the image area only and
 * not to the scrollbar areas.
 *
 * @param l the mouse motion listener
 * */
public synchronized void addMouseMotionListener(MouseMotionListener l) {
  super.addMouseMotionListener(l);
  imgDisplay.addMouseMotionListener(l);
}

代码示例来源:origin: edu.ucar/jj2000

/**
 * Adds the specified mouse motion listener to receive mouse motion events
 * from this component. It is actually added to the image area only and
 * not to the scrollbar areas.
 *
 * @param l the mouse motion listener
 * */
public synchronized void addMouseMotionListener(MouseMotionListener l) {
  super.addMouseMotionListener(l);
  imgDisplay.addMouseMotionListener(l);
}

代码示例来源:origin: cpesch/RouteConverter

public JPopupMenu createPopupMenu() {
  // cannot use table.setComponentPopupMenu(popupMenu); since it does ensure a selection
  MouseListener mouseListener = new MouseListener();
  table.addMouseListener(mouseListener);
  table.getParent().addMouseListener(mouseListener);
  table.getParent().addMouseMotionListener(new MouseMotionListener());
  table.registerKeyboardAction(new FrameAction() {
    public void run() {
      ensureSelection(lastMouseEvent, 1);
      showPopup(lastMouseEvent);
    }
  }, getKeyStroke(VK_CONTEXT_MENU, 0), WHEN_IN_FOCUSED_WINDOW);
  this.popupMenu = doCreatePopupMenu();
  return popupMenu;
}

代码示例来源:origin: org.microemu/microemu-javase-swing

scaledDisplayFrame.getContentPane().addMouseMotionListener(new MouseMotionListener() {
  private MouseMotionListener receiver = ((SwingDisplayComponent) emulatorContext
      .getDisplayComponent()).getMouseMotionListener();

代码示例来源:origin: org.openimaj/image-local-features

/**
   * Create an interactive display of matches between two images.
   *
   * @param <T> Pixel type
   * @param <I> Image type
   * @param im1 first image
   * @param im2 second image
   * @param matches matched features between images
   * @param col the colour to draw in
   */
  public static <T, I extends Image<T,I>> void displayMouseOverMatches(I im1, I im2,List<Pair<Keypoint>> matches, T col) {
    int newwidth = im1.getWidth() + im2.getWidth();
    int newheight = Math.max(im1.getHeight(), im2.getHeight());

    I out = im1.newInstance(newwidth, newheight);
    ImageRenderer<T, I> renderer = out.createRenderer();
    renderer.drawImage(im1, 0, 0);
    renderer.drawImage(im2, im1.getWidth(), 0);

    JFrame frame = DisplayUtilities.display(out);
    MouseOverFeatureListener<T, I> mofl = new MouseOverFeatureListener<T,I>(im1, im2, frame, matches, col);
    frame.addKeyListener(mofl);
    frame.getContentPane().addMouseMotionListener(mofl);
  }
}

代码示例来源:origin: openimaj/openimaj

/**
   * Create an interactive display of matches between two images.
   *
   * @param <T> Pixel type
   * @param <I> Image type
   * @param im1 first image
   * @param im2 second image
   * @param matches matched features between images
   * @param col the colour to draw in
   */
  public static <T, I extends Image<T,I>> void displayMouseOverMatches(I im1, I im2,List<Pair<Keypoint>> matches, T col) {
    int newwidth = im1.getWidth() + im2.getWidth();
    int newheight = Math.max(im1.getHeight(), im2.getHeight());

    I out = im1.newInstance(newwidth, newheight);
    ImageRenderer<T, I> renderer = out.createRenderer();
    renderer.drawImage(im1, 0, 0);
    renderer.drawImage(im2, im1.getWidth(), 0);

    JFrame frame = DisplayUtilities.display(out);
    MouseOverFeatureListener<T, I> mofl = new MouseOverFeatureListener<T,I>(im1, im2, frame, matches, col);
    frame.addKeyListener(mofl);
    frame.getContentPane().addMouseMotionListener(mofl);
  }
}

代码示例来源:origin: org.opentcs.thirdparty.dockingframes/docking-frames-core

parent.addMouseMotionListener( listener );
parent.addComponentListener( listener );

代码示例来源:origin: xyz.cofe/docking-frames-core

parent.addMouseMotionListener( listener );
parent.addComponentListener( listener );

代码示例来源:origin: openimaj/openimaj

this.mouseFrame.getContentPane().addMouseMotionListener(this);

代码示例来源:origin: org.openimaj/demos

this.mouseFrame.getContentPane().addMouseMotionListener(this);

相关文章

微信公众号

最新文章

更多

Container类方法