List of usage examples for java.awt.event MouseEvent getClickCount
public int getClickCount()
From source file:com.iisigroup.ris.WebFileScanUtilBrowserUI.java
private void initGUI() { final SwingActionUtil swingUtil = (SwingActionUtil) SwingActionUtil.newInstance(this); try {/*from w w w.j a v a 2s. c om*/ BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setTitle("browser source code"); { informationMenu = new JPopupMenu(); setComponentPopupMenu(this, informationMenu); } { ListModel openFileListModel = new DefaultListModel(); openFileList = new JList(); openFileList.setModel(openFileListModel); getContentPane().add(openFileList, BorderLayout.NORTH); openFileList.setPreferredSize(new java.awt.Dimension(663, 281)); openFileList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { swingUtil.invokeAction("openFileList.valueChanged", evt); } }); openFileList.addMouseMotionListener(new MouseMotionAdapter() { public void mouseMoved(MouseEvent evt) { swingUtil.invokeAction("openFileList.mouseMoved", evt); } }); openFileList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { swingUtil.invokeAction("openFileList.keyPressed", evt); } }); } { jPanel1 = new JPanel(); GroupLayout jPanel1Layout = new GroupLayout((JComponent) jPanel1); jPanel1.setLayout(jPanel1Layout); getContentPane().add(jPanel1, BorderLayout.SOUTH); jPanel1.setPreferredSize(new java.awt.Dimension(478, 35)); { openSelected = new JButton(); openSelected.setText("open all"); openSelected.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("openSelected.actionPerformed", evt); } }); } jPanel1Layout.setHorizontalGroup(jPanel1Layout.createSequentialGroup().addContainerGap(178, 178) .addComponent(openSelected, GroupLayout.PREFERRED_SIZE, 126, GroupLayout.PREFERRED_SIZE) .addContainerGap(174, Short.MAX_VALUE)); jPanel1Layout.setVerticalGroup(jPanel1Layout.createSequentialGroup().addGap(7) .addComponent(openSelected, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addGap(0, 6, Short.MAX_VALUE)); } { informationMenu = new JPopupMenu(); } this.setSize(486, 350); this.setLocationRelativeTo(null); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // ?tooltip //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx int initialDelay = ToolTipManager.sharedInstance().getInitialDelay(); ToolTipManager.sharedInstance().setInitialDelay(0); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // ?tooltip //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx swingUtil.addAction("openFileList.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { DefaultListModel model = (DefaultListModel) openFileList.getModel(); int pos = openFileList.getLeadSelectionIndex(); if (pos == -1) { return; } setOpenFileListToolTip(); MouseEvent eeev = (MouseEvent) evt; if (eeev.getClickCount() != 2) { return; } MFile file = (MFile) model.elementAt(pos); openSource(file.file); } }); final JListUtil jlistUtil = JListUtil.newInstance(openFileList); swingUtil.addAction("openFileList.keyPressed", new Action() { public void action(EventObject evt) throws Exception { jlistUtil.defaultJListKeyPressed((KeyEvent) evt); setOpenFileListToolTip(); } }); swingUtil.addAction("openSelected.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { DefaultListModel model = (DefaultListModel) openFileList.getModel(); for (Enumeration<?> enu = model.elements(); enu.hasMoreElements();) { MFile file = (MFile) enu.nextElement(); openSource(file.file); } } }); swingUtil.addAction("openFileList.mouseMoved", new Action() { public void action(EventObject evt) throws Exception { setOpenFileListToolTip(); } }); swingUtil.addAction("openFileList.valueChanged", new Action() { public void action(EventObject evt) throws Exception { System.out.println(evt); setOpenFileListToolTip(); } }); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.plugin.UI.Windows.BiblePeopleSearchResultsDialog.java
/** * Initialize./*from w w w . j a va 2 s . c o m*/ * * @param _term the _term * * @throws Exception the exception */ private void initialize(String _term) throws Exception { ArrayList<String[]> arr = new ArrayList<String[]>(); for (BiblePerson bp : Global.biblePersons) { if (isSoundexCalc(bp.getName().toUpperCase(), _term)) { String[] arrin = new String[5]; arrin[0] = String.valueOf(bp.getName_id()); arrin[1] = bp.getName(); arrin[2] = bp.getFather(); arrin[3] = bp.getMother(); arrin[4] = bp.getBible_ref(); arr.add(arrin); } } String[][] arr3 = new String[arr.size()][5]; for (int i = 0; i < arr.size(); i++) arr3[i] = arr.get(i); String columns[] = new String[] { "ID", "Name", "Father", "Mother", "Reference" }; tm = new DefaultTableModel(arr3, columns) { public boolean isCellEditable(int row, int column) { return false; } }; table = new JTable(tm); table.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { int member_id = Integer.parseInt((String) tm.getValueAt(table.getSelectedRow(), 0)); BibleGenealogy.setSelectMember(member_id); if (e.getClickCount() == 2) { new BiblePersonDialog(Global._jMainFrame, member_id); } } public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub } public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } }); JScrollPane jsp = new JScrollPane(table); jsp.setSize(640, 260); this.getContentPane().add(jsp); this.pack(); this.setTitle("Bible People Search Results - " + _term); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setLocationRelativeTo(null); this.setVisible(true); }
From source file:edu.ku.brc.af.ui.forms.formatters.UIFormatterListEdtDlg.java
/** * /*from ww w .j av a 2 s . co m*/ */ private void hookFormatListMouseListener() { MouseAdapter mAdp = new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int index = formatList.locationToIndex(e.getPoint()); formatList.ensureIndexIsVisible(index); editFormatter((UIFieldFormatter) formatList.getSelectedValue(), false); } } }; formatList.addMouseListener(mAdp); }
From source file:com.plugin.UI.Windows.UserSearchResultsDialog.java
/** * Initialize.//from www . j a va2 s .c om * * @param _term the _term * * @throws Exception the exception */ private void initialize(String _term) throws Exception { ArrayList<String[]> arr = new ArrayList<String[]>(); for (ChurchMembersData mem : ChurchMemberUtils.getChurchMembers()) { if (isSoundex(mem, _term.toUpperCase())) { String[] arrin = new String[5]; arrin[0] = MemberID.getTranslatedID(mem.getMember_id(), mem.getName_english()); arrin[1] = mem.getName_english() + " (" + mem.getName_otherLang() + ")"; arrin[2] = mem.getStreet(); arrin[3] = mem.getSuburb(); arrin[4] = mem.getState(); arr.add(arrin); } } String[][] arr3 = new String[arr.size()][5]; for (int i = 0; i < arr.size(); i++) arr3[i] = arr.get(i); String columns[] = new String[] { "MemberID", "Name", "Street", "Suburb", "State" }; tm = new DefaultTableModel(arr3, columns) { public boolean isCellEditable(int row, int column) { return false; } }; table = new JTable(tm); table.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { String member_id = (String) tm.getValueAt(table.getSelectedRow(), 0); ChurchMembers.setSelectMember(member_id); if (e.getClickCount() == 2) { new MemberDialog(Global.DISPLAY_CHURCH_MEMBER, MemberID.getOriginalID(member_id)); } } public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub } public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } }); JScrollPane jsp = new JScrollPane(table); jsp.setSize(640, 260); this.getContentPane().add(jsp); this.pack(); this.setTitle("Church Members Search Results - " + _term); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setLocationRelativeTo(null); this.setVisible(true); }
From source file:fitmon.WorkoutLog.java
private void removeItem(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_removeItem if (evt.getClickCount() == 1) { JTable target = (JTable) evt.getSource(); int row = target.getSelectedRow(); int column = target.getSelectedColumn(); String selectedwkt = (String) target.getValueAt(row, 0); //int index = selectedwkt.indexOf("--"); // String foodName = selectedFood.substring(0, index); //int calorie = selectedFood.substring(index+2); if (target.getColumnName(target.getSelectedColumn()).equals("Edit")) { DefaultTableModel model = (DefaultTableModel) tab.getModel(); model.removeRow(row);/*ww w . j a v a 2s .c o m*/ for (int i = 0; i < wkt.size(); i++) { if (wkt.get(i).getWorkout().equals(selectedwkt)) //&& wkt.get(i).getCal().equals(calorie)) { wkt.remove(i); break; } } } // do some action if appropriate column } // TODO add your handling code here: }
From source file:org.adempiere.apps.graph.PerformanceIndicator.java
/** * Init Graph Display/*w ww .ja v a 2s .co m*/ * Kinamo (pelgrim) */ private void init() { chartPanel = new ChartPanel(createChart(), //chart false, //boolean properties false, // boolean save false, //boolean print false, //boolean zoom true //boolean tooltips ); chartPanel.setPreferredSize(indicatordimension); chartPanel.addChartMouseListener(new org.jfree.chart.ChartMouseListener() { public void chartMouseClicked(org.jfree.chart.ChartMouseEvent e) { //plot p = (MeterPlot) e.getSource(); MouseEvent me = e.getTrigger(); if (SwingUtilities.isLeftMouseButton(me) && me.getClickCount() > 1) fireActionPerformed(me); if (SwingUtilities.isRightMouseButton(me)) popupMenu.show((Component) me.getSource(), me.getX(), me.getY()); } public void chartMouseMoved(org.jfree.chart.ChartMouseEvent e) { } }); this.add(chartPanel, BorderLayout.NORTH); this.setMinimumSize(paneldimension); this.setMaximumSize(paneldimension); //--------------------------------------------- invalidate(); }
From source file:verdandi.ui.ProjectViewerPanel.java
@Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) { editSelectedProject(); } }
From source file:com.openbravo.pos.epm.JEmployeeFinder.java
private void jListEmployeesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jListEmployeesMouseClicked if (evt.getClickCount() == 2) { selectedEmployee = (EmployeeInfo) jListEmployees.getSelectedValue(); dispose();//from w w w. ja v a2s. c o m } }
From source file:de.wusel.partyplayer.gui.PartyPlayer.java
private Component createSongPanel() { final SongsTableModel model = new SongsTableModel(playerModel, settings, this); table = new JXTable(model) { @Override//w w w . j a v a 2 s .co m public String getToolTipText(MouseEvent event) { int viewRowIndex = rowAtPoint(event.getPoint()); if (viewRowIndex != -1) { int modelIndex = convertRowIndexToModel(viewRowIndex); SongWrapper songFromList = playerModel.getSongFromList(modelIndex); return songFromList.getFileName(); } return super.getToolTipText(event); } }; table.setAutoCreateRowSorter(true); String numberColumnName = getText("table.songs.column.number.label"); table.getColumn(numberColumnName).setMaxWidth(25); table.getColumn(numberColumnName).setResizable(false); TableSortController sorter = (TableSortController) table.getRowSorter(); sorter.setComparator(2, new SongComparator()); table.getColumn(numberColumnName).setCellRenderer(new SubstanceDefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (value != null) label.setText(((SongWrapper) value).getTrackNumber() + ""); return label; } }); table.getColumn(getText("table.songs.column.duration.label")) .setCellRenderer(new SubstanceDefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (value != null) label.setText(Util.getTimeString((Double) value)); return label; } }); table.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { addSongToPlaylist( playerModel.getSongFromList(table.convertRowIndexToModel(table.getSelectedRow()))); } } }); table.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { addSongToPlaylist( playerModel.getSongFromList(table.convertRowIndexToModel(table.getSelectedRow()))); } } }); JScrollPane scrollPane = new JScrollPane(table); table.setFillsViewportHeight(true); return scrollPane; }
From source file:net.sf.mzmine.desktop.impl.projecttree.ProjectTreeMouseHandler.java
public void mouseClicked(MouseEvent e) { if (e.isPopupTrigger()) handlePopupTriggerEvent(e);//from w ww . j a v a 2 s . com if ((e.getClickCount() == 2) && (e.getButton() == MouseEvent.BUTTON1)) handleDoubleClickEvent(e); }