List of usage examples for java.awt.event MouseEvent getClickCount
public int getClickCount()
From source file:org.drools.mas.SimpleClient.java
private void factsjTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_factsjTableMouseClicked if (evt.getClickCount() > 1) { int i = factsjTable.getSelectedRow(); Object fact = factTableModel.getFacts().get(i); this.openFactEditorPanelForEdition(fact); }/*w ww . j a va2 s.c o m*/ }
From source file:com.hexidec.ekit.component.RelativeImageView.java
/** On double-click, open image properties dialog. *//* w w w . j a v a 2s . c o m*/ public void mouseClicked(MouseEvent me) { if (me.getClickCount() == 2) { //$ IMPLEMENT } }
From source file:org.eclipse.jubula.rc.swing.listener.RecordActions.java
/** * creates CAP for Click in Component/*w w w . j a va 2 s . c om*/ * @param id IComponentIdentifier * @param me MouseEvent * @param source Component */ protected void clickInComponent(IComponentIdentifier id, MouseEvent me, Component source) { int clickcount = me.getClickCount(); if (clickcount < 1) { clickcount = 1; } String clCount = (new Integer(clickcount).toString()); String mbutton = (new Integer(me.getButton()).toString()); Action a = m_recordHelper.compSysToAction(id, "CompSystem.ClickDirect"); //$NON-NLS-1$ Rectangle bounds = me.getComponent().getBounds(); int percentX = (int) (me.getX() / bounds.getWidth() * 100); String percentXString = new Integer(percentX).toString(); int percentY = (int) (me.getY() / bounds.getHeight() * 100); String percentYString = new Integer(percentY).toString(); String units = Constants.REC_UNITS; List parValues = new LinkedList(); parValues.add(clCount); parValues.add(mbutton); parValues.add(percentXString); parValues.add(units); parValues.add(percentYString); parValues.add(units); String logName = createLogicalName(source, id); createCAP(a, id, parValues, logName); }
From source file:edu.ku.brc.specify.plugins.PartialDateUI.java
@Override public void setParent(final FormViewObj parent) { this.parent = parent; JLabel lbl = parent.getLabelFor(this); if (lbl != null && StringUtils.isNotEmpty(dateFieldName)) { DBTableInfo tblInfo = DBTableIdMgr.getInstance().getByClassName(parent.getView().getClassName()); if (tblInfo != null) { final DBFieldInfo fi = tblInfo.getFieldByName(dateFieldName); if (fi != null) { title = fi.getTitle();//from w w w . j a va 2 s . c o m isRequired = fi.isRequired(); if (uivs[0] instanceof ValFormattedTextFieldSingle) { ((ValFormattedTextFieldSingle) uivs[0]).setRequired(isRequired); } else { for (UIValidatable uiv : uivs) { ((ValFormattedTextField) uiv).setRequired(isRequired); } } if (StringUtils.isNotEmpty(fi.getTitle())) { lbl.setText(fi.getTitle() + ":"); if (isRequired) { lbl.setFont(lbl.getFont().deriveFont(Font.BOLD)); } } if (lbl != null) { lbl.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); if (e.getClickCount() == 2) { JOptionPane.showMessageDialog(UIRegistry.getMostRecentWindow(), "<html>" + fi.getDescription(), UIRegistry.getResourceString("FormViewObj.UNOTES"), JOptionPane.INFORMATION_MESSAGE); } } }); } } else { log.error("PartialDateUI - Couldn't find date field [" + dateFieldName + "] in data obj View: " + parent.getView().getName()); } } } }
From source file:be.nbb.demetra.dfm.output.simulation.RealTimePerspGraphView.java
/** * Creates new form FixedHorizonsGraphView *///from w ww. j a v a 2 s . c o m public RealTimePerspGraphView(DfmDocument doc) { initComponents(); demetraUI = DemetraUI.getDefault(); formatter = demetraUI.getDataFormat().numberFormatter(); defaultColorSchemeSupport = new SwingColorSchemeSupport() { @Override public ColorScheme getColorScheme() { return demetraUI.getColorScheme(); } }; this.graphs_ = new LinkedHashMap<>(); trueDataRenderer = new XYLineAndShapeRenderer(true, false); trueDataRenderer.setAutoPopulateSeriesPaint(false); trueDataRenderer.setBasePaint(defaultColorSchemeSupport.getLineColor(KnownColor.RED)); forecastsRenderer = new XYLineAndShapeRenderer(true, false); forecastsRenderer.setAutoPopulateSeriesPaint(false); forecastsRenderer.setAutoPopulateSeriesShape(false); forecastsRenderer.setBaseShape(new Ellipse2D.Double(-2, -2, 4, 4)); forecastsRenderer.setBasePaint(defaultColorSchemeSupport.getLineColor(KnownColor.BLUE)); forecastsRenderer.setBaseShapesFilled(false); arimaRenderer = new XYLineAndShapeRenderer(true, false); arimaRenderer.setAutoPopulateSeriesPaint(false); arimaRenderer.setAutoPopulateSeriesShape(false); arimaRenderer.setBaseShape(new Ellipse2D.Double(-2, -2, 4, 4)); arimaRenderer.setBasePaint(defaultColorSchemeSupport.getLineColor(KnownColor.GREEN)); arimaRenderer.setBaseShapesFilled(false); mainChart = createChart(); detailChart = createChart(); this.dfmSimulation = Optional.absent(); chartPanel = new JChartPanel(null); chartPanel.setPopupMenu(buildMenu().getPopupMenu()); chartPanel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { indexSelected = -1; if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { double x = chartPanel.getChartX(e.getX()); Graphs g = null; for (Bornes b : graphs_.keySet()) { indexSelected++; if (x >= b.min_ && x <= b.max_) { g = graphs_.get(b); break; } } if (g == null) { return; } showDetail(g); } } }); comboBox.setRenderer(new ComboBoxRenderer()); comboBox.addItemListener((ItemEvent e) -> { filterPanel = null; updateChart(); }); addPropertyChangeListener((PropertyChangeEvent evt) -> { switch (evt.getPropertyName()) { case DFM_SIMULATION_PROPERTY: updateComboBox(); updateChart(); break; } }); updateComboBox(); updateChart(); demetraUI.addPropertyChangeListener((PropertyChangeEvent evt) -> { switch (evt.getPropertyName()) { case DemetraUI.DATA_FORMAT_PROPERTY: onDataFormatChanged(); break; case DemetraUI.COLOR_SCHEME_NAME_PROPERTY: onColorSchemeChanged(); break; } }); add(chartPanel, BorderLayout.CENTER); }
From source file:org.domainmath.gui.FileTreePanel.java
/** * Creates new form FileTreePanel//from w ww. j a v a 2 s . c o m * @param frame */ public FileTreePanel(MainFrame frame) { initComponents(); this.frame = frame; fileTree.setEditable(true); addPopupMenuToFileTree(); ToolTipManager.sharedInstance().registerComponent(fileTree); // handle right click event on File Tree. fileTree.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (e.getClickCount() == 2) { TreePath path = fileTree.getPathForLocation(e.getX(), e.getY()); Rectangle pathBounds = fileTree.getUI().getPathBounds(fileTree, path); if (pathBounds != null && pathBounds.contains(e.getX(), e.getY())) { File file = (File) fileTree.getLastSelectedPathComponent(); selectFile(file); } } } }); keyDeleteItem = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0); keyRenameItem = KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0); keyOpenItem = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0); keyRefreshItem = KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0); }
From source file:net.sf.mzmine.modules.visualization.tic.TICPlot.java
@Override public void mouseClicked(final MouseEvent event) { // Let the parent handle the event (selection etc.) super.mouseClicked(event); // Request focus to receive key events. requestFocus();//from www. j av a 2 s. c om // If user double-clicked left button, place a request to open a spectrum. if (event.getButton() == MouseEvent.BUTTON1 && event.getClickCount() == 2) { showSpectrumRequest = true; } }
From source file:fll.subjective.SubjectiveFrame.java
/** * Show differences.//from w w w .j a v a 2s. c o m */ private void showDifferencesDialog(final Collection<SubjectiveScoreDifference> diffs) { final SubjectiveDiffTableModel model = new SubjectiveDiffTableModel(diffs); final JTable table = new JTable(model); table.setGridColor(Color.BLACK); table.addMouseListener(new MouseAdapter() { public void mouseClicked(final MouseEvent e) { if (e.getClickCount() == 2) { final JTable target = (JTable) e.getSource(); final int row = target.getSelectedRow(); final SubjectiveScoreDifference diff = model.getDiffForRow(row); // find correct table final String category = diff.getCategory(); final JTable scoreTable = getTableForTitle(category); final int tabIndex = getTabIndexForCategory(category); getTabbedPane().setSelectedIndex(tabIndex); // get correct row and column final SubjectiveTableModel model = (SubjectiveTableModel) scoreTable.getModel(); final int scoreRow = model.getRowForTeamAndJudge(diff.getTeamNumber(), diff.getJudge()); final int scoreCol = model.getColForSubcategory(diff.getSubcategory()); if (scoreRow == -1 || scoreCol == -1) { throw new FLLRuntimeException( "Internal error: Cannot find correct row and column for score difference: " + diff); } scoreTable.changeSelection(scoreRow, scoreCol, false, false); } } }); final JDialog dialog = new JDialog(this, false); final Container cpane = dialog.getContentPane(); cpane.setLayout(new BorderLayout()); final JScrollPane tableScroller = new JScrollPane(table); cpane.add(tableScroller, BorderLayout.CENTER); dialog.pack(); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setVisible(true); }
From source file:pcgen.gui.sources.SourceSelectionDialog.java
/** * User has clicked/double clicked on the source list * If double click send to load//w w w . j a va 2s .c o m * * @param evt The event to be processed */ private void sourceListMouseClicked(MouseEvent evt) { if (sourceList.getSelectedIndex() >= 0) { if (evt.getClickCount() == 2) { loadButtonAction(); } } }
From source file:com.haulmont.cuba.desktop.gui.components.DesktopTree.java
@Override public void setItemClickAction(Action action) { if (this.doubleClickAction != action) { if (action != null) { if (itemClickListener == null) { itemClickListener = new MouseAdapter() { @Override//from w ww . j av a 2s. co m public void mouseClicked(MouseEvent e) { if (isEditable()) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2 && doubleClickAction != null) { int rowForLocation = impl.getRowForLocation(e.getX(), e.getY()); TreePath pathForLocation = impl.getPathForRow(rowForLocation); if (pathForLocation != null) { impl.setSelectionPath(pathForLocation); doubleClickAction.actionPerform(DesktopTree.this); } } } } }; impl.addMouseListener(itemClickListener); impl.setToggleClickCount(0); } } else { impl.removeMouseListener(itemClickListener); impl.setToggleClickCount(2); itemClickListener = null; } this.doubleClickAction = action; } }