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

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

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

JScrollPane.addMouseListener介绍

暂无

代码示例

代码示例来源:origin: net.java.dev.laf-widget/laf-widget

protected void configureScrollPane() {
  for (MouseListener mouseListener : scrollPane.getMouseListeners()) {
    if (mouseListener instanceof AutoScrollMouseListener) {
      return;
    }
  }
  scrollPane.addMouseListener(new AutoScrollMouseListener(this));
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

/** 
 * Creates panel with table within scroll panel and buttons in the bottom.
 * Also sets the resizing and selection policies of the table to
 * AUTO_RESIZE_OFF and SINGLE_SELECTION respectively.
 */
public static JPanel createTablePanel(final JTable table, JButton[] buttons) {
  JPanel panel = new JPanel();
  panel.setLayout(new BorderLayout(5, 5));
  // Create table with two columns and no rows.
  table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
  JScrollPane scrollPane = new JScrollPane(table);
  scrollPane.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      if(table.isEditing()) {
        table.getCellEditor().stopCellEditing();
      }
    }
  });
  // Panel to add space between table and EAST/WEST borders
  panel.add(scrollPane, BorderLayout.CENTER);
  // Add Add and Remove buttons
  if (buttons != null) {
    panel.add(createButtonPanel(buttons), BorderLayout.SOUTH);
  }
  return panel;
}

代码示例来源:origin: org.geotools/gt-widgets-swing-pending

private void init() {
  guiLabel.setType(JExpressionPane.EXP_TYPE.OTHER);
  guiPriority.setType(JExpressionPane.EXP_TYPE.NUMBER);
  jsp.addMouseListener(new MouseListener() {
    public void mouseClicked(MouseEvent e) {
      int ligne;
      Point p = e.getPoint();
      ligne = tab_demo.rowAtPoint(p);
      if (ligne < tab_demo.getModel().getRowCount() && ligne >= 0) {
        setEdited((TextSymbolizer) tab_demo.getModel().getValueAt(ligne, 0));
      }
    }
    public void mousePressed(MouseEvent e) {
    }
    public void mouseReleased(MouseEvent e) {
    }
    public void mouseEntered(MouseEvent e) {
    }
    public void mouseExited(MouseEvent e) {
    }
  });
}

代码示例来源: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: org.jacorb/jacorb

m_tree_view.addMouseListener(m_handler);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

add (btn);
jta.addMouseListener(this);
jsc.addMouseListener(this);
lbl.addMouseListener(this);
btn.addMouseListener(this);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

add (btn);
jta.addMouseListener(this);
jsc.addMouseListener(this);
lbl.addMouseListener(this);
btn.addMouseListener(this);

代码示例来源:origin: in.jlibs/org-netbeans-swing-outline

/**
 * This method update mouse listener on the scrollPane if it is needed.
 * It also recomputes the model of searchCombo. Both actions are needed after
 * the set of visible columns is changed.
 */
void updateColumnSelectionMouseListener() {
  Container p = getParent();
  if (p instanceof JViewport) {
    Container gp = p.getParent();
    if (gp instanceof JScrollPane) {
      JScrollPane scrollPane = (JScrollPane)gp;
      // Make certain we are the viewPort's view and not, for
      // example, the rowHeaderView of the scrollPane -
      // an implementor of fixed columns might do this.
      JViewport viewport = scrollPane.getViewport();
      if (viewport == null || viewport.getView() != this) {
        return;
      }
      scrollPane.removeMouseListener(columnSelectionMouseListener);
      if (getColumnModel().getColumnCount() == 0) {
        scrollPane.addMouseListener(columnSelectionMouseListener);
      }
    }
  }
  if (searchCombo != null) {
    searchCombo.setModel(getSearchComboModel());
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

jsc.addMouseListener(this);
lbl.addMouseListener(this);
if (!PropUtils.psNoHelpButton) {

代码示例来源: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();
}

代码示例来源:origin: jcbvm/i18n-editor

resourcesScrollPane.setOpaque(false);
resourcesScrollPane.setBorder(null);
resourcesScrollPane.addMouseListener(new ResourcesPaneMouseListener());

代码示例来源:origin: net.sourceforge.jadex/jadex-runtimetools-swing

sktt.addMouseListener(ma);

代码示例来源:origin: org.activecomponents.jadex/jadex-runtimetools-swing

sktt.addMouseListener(ma);

代码示例来源:origin: cytoscape.coreplugins/attribute-browser

tp.addMouseListener(new MouseAdapter() {
  public void mouseClicked(MouseEvent e) {
    getPropertyChangeSupport().firePropertyChange(AttributeBrowser.CLEAR_INTERNAL_SELECTION, null, panelType);

代码示例来源:origin: triplea-game/triplea

tree.setBackground(getBackground());
final JScrollPane scroll = new JScrollPane(tree);
scroll.addMouseListener(mouseFocusListener);
for (final Component comp : scroll.getComponents()) {
 comp.addMouseListener(mouseFocusListener);

代码示例来源:origin: com.googlecode.vfsjfilechooser2/vfsjfilechooser2

scrollpane.addMouseListener(new MouseAdapter()

相关文章

JScrollPane类方法