protected void configureScrollPane() { for (MouseListener mouseListener : scrollPane.getMouseListeners()) { if (mouseListener instanceof AutoScrollMouseListener) { return; } } scrollPane.addMouseListener(new AutoScrollMouseListener(this)); }
/** * 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; }
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) { } }); }
/** * 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); }
m_tree_view.addMouseListener(m_handler);
add (btn); jta.addMouseListener(this); jsc.addMouseListener(this); lbl.addMouseListener(this); btn.addMouseListener(this);
add (btn); jta.addMouseListener(this); jsc.addMouseListener(this); lbl.addMouseListener(this); btn.addMouseListener(this);
/** * 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()); } }
jsc.addMouseListener(this); lbl.addMouseListener(this); if (!PropUtils.psNoHelpButton) {
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(); }
resourcesScrollPane.setOpaque(false); resourcesScrollPane.setBorder(null); resourcesScrollPane.addMouseListener(new ResourcesPaneMouseListener());
tp.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { getPropertyChangeSupport().firePropertyChange(AttributeBrowser.CLEAR_INTERNAL_SELECTION, null, panelType);
tree.setBackground(getBackground()); final JScrollPane scroll = new JScrollPane(tree); scroll.addMouseListener(mouseFocusListener); for (final Component comp : scroll.getComponents()) { comp.addMouseListener(mouseFocusListener);
scrollpane.addMouseListener(new MouseAdapter()