javax.swing.JScrollPane.addMouseMotionListener()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(160)

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

JScrollPane.addMouseMotionListener介绍

暂无

代码示例

代码示例来源:origin: apache/fop

/**
 * Creates a new PreviewPanel instance.
 * @param foUserAgent the user agent
 * @param renderable the Renderable instance that is used to reload/re-render a document
 *                   after modifications.
 * @param renderer the AWT Renderer instance to paint with
 */
public PreviewPanel(FOUserAgent foUserAgent, Renderable renderable, AWTRenderer renderer) {
  super(new GridLayout(1, 1));
  this.renderable = renderable;
  this.renderer = renderer;
  this.foUserAgent = foUserAgent;
  //Override target resolution for the computer screen
  this.foUserAgent.setTargetResolution(Toolkit.getDefaultToolkit().getScreenResolution());
  gridPanel = new JPanel();
  gridPanel.setLayout(new GridLayout(0, 1)); // rows, cols
  previewArea = new JScrollPane(gridPanel);
  previewArea.getViewport().setBackground(Color.gray);
  previewArea.getVerticalScrollBar().addAdjustmentListener(new PageNumberListener());
  // FIXME should add scroll wheel support here at some point.
  scroller = new ViewportScroller(previewArea.getViewport());
  previewArea.addMouseListener(scroller);
  previewArea.addMouseMotionListener(scroller);
  previewArea.setMinimumSize(new Dimension(50, 50));
  add(previewArea);
}

代码示例来源:origin: com.synaptix/SynaptixSwing

private void initComponents() {
  createComponents();
  scrollPane
      .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  scrollPane
      .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
  MyAdjustmentListener adjustmentListener = new MyAdjustmentListener();
  scrollPane.getHorizontalScrollBar().addAdjustmentListener(
      adjustmentListener);
  scrollPane.getVerticalScrollBar().addAdjustmentListener(
      adjustmentListener);
  MyMouseAdapter mouseAdapter = new MyMouseAdapter();
  scrollPane.addMouseMotionListener(mouseAdapter);
  scrollPane.addMouseWheelListener(mouseAdapter);
  scrollPane.addMouseListener(mouseAdapter);
  Toolkit.getDefaultToolkit().addAWTEventListener(
      new MyAWTEventListener(),
      AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK
          | AWTEvent.MOUSE_WHEEL_EVENT_MASK);
  verifyScrollBars();
}

相关文章

JScrollPane类方法