List of usage examples for javax.swing JScrollPane addMouseListener
public synchronized void addMouseListener(MouseListener l)
From source file:com.db2eshop.gui.component.tab.ArticleTab.java
/** * <p>registerMouseListener.</p> * * @param jScrollPane a {@link javax.swing.JScrollPane} object. * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object. *//* ww w . j a va 2s . c o m*/ public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) { jScrollPane.addMouseListener(new BaseMouseListener() { @Override public void mouseClicked(MouseEvent arg0) { if (arg0.getButton() == MouseEvent.BUTTON3) { tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, articleTable); } } }); }
From source file:com.db2eshop.gui.component.tab.ArticleTypeTab.java
/** * <p>registerMouseListener.</p> * * @param jScrollPane a {@link javax.swing.JScrollPane} object. * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object. *//*from ww w .ja v a2 s . c o m*/ public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) { jScrollPane.addMouseListener(new BaseMouseListener() { @Override public void mouseClicked(MouseEvent arg0) { if (arg0.getButton() == MouseEvent.BUTTON3) { tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, articleTypeTable); } } }); }
From source file:com.db2eshop.gui.component.tab.CustomerTab.java
/** * <p>registerMouseListener.</p> * * @param jScrollPane a {@link javax.swing.JScrollPane} object. * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object. *///from w w w. j a va 2 s.co m public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) { jScrollPane.addMouseListener(new BaseMouseListener() { @Override public void mouseClicked(MouseEvent arg0) { if (arg0.getButton() == MouseEvent.BUTTON3) { tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, customerTable); } } }); }
From source file:com.db2eshop.gui.component.tab.EmployeeTab.java
/** * <p>registerMouseListener.</p> * * @param jScrollPane a {@link javax.swing.JScrollPane} object. * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object. *///from ww w . j a va 2 s . co m public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) { jScrollPane.addMouseListener(new BaseMouseListener() { @Override public void mouseClicked(MouseEvent arg0) { if (arg0.getButton() == MouseEvent.BUTTON3) { tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, employeeTable); } } }); }
From source file:com.db2eshop.gui.component.tab.ImportTab.java
/** * <p>registerMouseListener.</p> * * @param jScrollPane a {@link javax.swing.JScrollPane} object. * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object. *///from w w w . j av a 2s. co m public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) { jScrollPane.addMouseListener(new BaseMouseListener() { @Override public void mouseClicked(MouseEvent arg0) { if (arg0.getButton() == MouseEvent.BUTTON3) { tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, importTable); } } }); }
From source file:com.db2eshop.gui.component.tab.SaleTab.java
/** * <p>registerMouseListener.</p> * * @param jScrollPane a {@link javax.swing.JScrollPane} object. * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object. *//*from w w w . j a va2 s . c o m*/ public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) { jScrollPane.addMouseListener(new BaseMouseListener() { @Override public void mouseClicked(MouseEvent arg0) { if (arg0.getButton() == MouseEvent.BUTTON3) { tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, saleTable); } } }); }
From source file:com.db2eshop.gui.component.tab.ShippingTab.java
/** * <p>registerMouseListener.</p> * * @param jScrollPane a {@link javax.swing.JScrollPane} object. * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object. *//*from w w w . j av a2s . c om*/ public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) { jScrollPane.addMouseListener(new BaseMouseListener() { @Override public void mouseClicked(MouseEvent arg0) { if (arg0.getButton() == MouseEvent.BUTTON3) { tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, shippingTable); } } }); }
From source file:com.db2eshop.gui.component.tab.SupplierTab.java
/** * <p>registerMouseListener.</p> * * @param jScrollPane a {@link javax.swing.JScrollPane} object. * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object. *///from w w w .j a va2 s . c o m public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) { jScrollPane.addMouseListener(new BaseMouseListener() { @Override public void mouseClicked(MouseEvent arg0) { if (arg0.getButton() == MouseEvent.BUTTON3) { tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, supplierTable); } } }); }
From source file:statistic.ca.gui.DiagramContainer.java
public void addTable(String title, JScrollPane table, JPanel parent) { JChartPanel jcp = new JChartPanel(); jcp.setPreferredSize(new Dimension((int) ((parent.getWidth() / 2) - 20), 300)); jcp.setMinimumSize(jcp.getPreferredSize()); jcp.setMaximumSize(jcp.getPreferredSize()); jcp.setChart(null);//from www. j av a 2 s . co m jcp.add(table); table.addMouseListener(this.parent.new diagramClick()); addDiagram(title, jcp); }
From source file:com.qspin.qtaste.ui.xmleditor.TestRequirementEditor.java
private void genUI() { getActionMap().put("Save", new SaveAction()); getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK), "Save"); m_TestRequirementTable = new JTable() { @Override/*from w w w . j av a 2 s .c om*/ public String getToolTipText(MouseEvent e) { Point p = e.getPoint(); int rowIndex = rowAtPoint(p); int colIndex = columnAtPoint(p); if (colIndex < 0) { return null; } return convertObjectToToolTip(getValueAt(rowIndex, colIndex)); } // overwrite cell content when typing on a selected cell @Override public Component prepareEditor(TableCellEditor editor, int row, int column) { Component c = super.prepareEditor(editor, row, column); if (c instanceof JTextComponent) { ((JTextField) c).selectAll(); } return c; } // select entire rows when selecting first column (row id) @Override public void columnSelectionChanged(ListSelectionEvent e) { if (e.getFirstIndex() == 0 && e.getValueIsAdjusting()) { setColumnSelectionInterval(1, getColumnCount() - 1); } else { super.columnSelectionChanged(e); } } }; m_TestRequirementTable.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); m_TestRequirementModel = new TestRequirementTableModel(); m_TestRequirementTable.setModel(m_TestRequirementModel); m_TableColumnModelListener = new MyTableColumnModelListener(); m_TestRequirementTable.setSurrendersFocusOnKeystroke(true); m_TestRequirementTable.setColumnSelectionAllowed(true); m_TestRequirementTable.addMouseListener(new TableMouseListener(m_TestRequirementTable)); m_TestRequirementTable.getTableHeader().addMouseListener(new TableMouseListener(m_TestRequirementTable)); m_TestRequirementTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); m_TestRequirementTable.getActionMap().put("Save", new SaveAction()); m_TestRequirementTable.setDefaultEditor(String.class, new TestDataTableCellEditor()); m_TestRequirementTable.setDefaultEditor(Integer.class, new TestDataTableCellEditor()); m_TestRequirementTable.getTableHeader().getInputMap() .put(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK), "Save"); m_TestRequirementTable.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK), "Save"); m_TestRequirementTable.setRowHeight(ROW_HEIGHT); m_TestRequirementTable.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { // if (e.getKeyCode() == KeyEvent.VK_UP) { // check if previous line is empty } if (e.getKeyCode() == KeyEvent.VK_DOWN) { // if current row is the last one if (m_TestRequirementTable.getSelectedRow() == m_TestRequirementTable.getRowCount() - 1) { addNewRow(); } } if ((e.getKeyCode() == KeyEvent.VK_S) && (e.isControlDown())) { save(); } if ((e.getKeyCode() == KeyEvent.VK_C) && (e.isControlDown())) { copySelectionToClipboard(); } if ((e.getKeyCode() == KeyEvent.VK_V) && (e.isControlDown())) { if (m_TestRequirementTable.getSelectedColumn() != 0) { pasteSelectionFromClipboard(); } } } }); tableListener = new TableModelListener() { public void tableChanged(TableModelEvent e) { // build the test data if (e.getType() == TableModelEvent.UPDATE) { if (e.getFirstRow() >= 0) { setModified(true); } } } }; m_TestRequirementModel.addTableModelListener(tableListener); JScrollPane sp = new JScrollPane(m_TestRequirementTable); sp.addMouseListener(new TableMouseListener(null)); add(sp); }