List of usage examples for java.awt.event MouseEvent getComponent
public Component getComponent()
From source file:com.mirth.connect.client.ui.browsers.event.EventBrowser.java
public void initComponentsManual() { this.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { if (evt.isPopupTrigger()) { parent.eventPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY()); }//from w w w. ja v a 2 s. c o m } public void mouseReleased(java.awt.event.MouseEvent evt) { if (evt.isPopupTrigger()) { parent.eventPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY()); } } }); pageSizeField.setDocument(new MirthFieldConstraints(3, false, false, true)); pageNumberField.setDocument(new MirthFieldConstraints(7, false, false, true)); LineBorder lineBorder = new LineBorder(new Color(0, 0, 0)); TitledBorder titledBorder = new TitledBorder("Current Search"); titledBorder.setBorder(lineBorder); lastSearchCriteriaPane.setBorder(titledBorder); lastSearchCriteriaPane.setBackground(Color.white); lastSearchCriteria.setBackground(Color.white); startDatePicker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent arg0) { allDayCheckBox.setEnabled(startDatePicker.getDate() != null || endDatePicker.getDate() != null); startTimePicker.setEnabled(startDatePicker.getDate() != null && !allDayCheckBox.isSelected()); } }); endDatePicker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent arg0) { allDayCheckBox.setEnabled(startDatePicker.getDate() != null || endDatePicker.getDate() != null); endTimePicker.setEnabled(endDatePicker.getDate() != null && !allDayCheckBox.isSelected()); } }); pageNumberField.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent arg0) { if (arg0.getKeyCode() == KeyEvent.VK_ENTER && pageGoButton.isEnabled()) { jumpToPageNumber(); } } }); updateCachedUserMap(); advancedSearchPopup = new EventBrowserAdvancedFilter(parent, "Advanced Search Filter", true, userMapById); advancedSearchPopup.setVisible(false); eventSplitPane.setDividerLocation(0.8); this.addAncestorListener(new AncestorListener() { @Override public void ancestorAdded(AncestorEvent event) { } @Override public void ancestorMoved(AncestorEvent event) { } @Override public void ancestorRemoved(AncestorEvent event) { // Stop waiting for event browser requests when the event browser // is no longer being displayed parent.mirthClient.getServerConnection().abort(getAbortOperations()); // Clear the event cache when leaving the event browser. parent.eventBrowser.clearCache(); } }); }
From source file:org.openehealth.coms.cc.consent_applet.applet.ConsentApplet.java
/** * MouseListener used to select items from the list of Rule descriptions, allows for deletion of Rules * // w w w.j a v a 2 s .c o m * @return */ private MouseListener getRuleListMouseAdapter() { return new MouseListener() { private JList list; public void mousePressed(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { list = ((JList) e.getSource()); list.setSelectedIndex(getRow(e.getPoint())); JPopupMenu menu = new JPopupMenu(); menu.add(new RemoveRule(list)); Point pt = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), list); menu.show(list, pt.x, pt.y); } } private int getRow(Point point) { return list.locationToIndex(point); } public void mouseClicked(MouseEvent arg0) { } public void mouseEntered(MouseEvent arg0) { } public void mouseExited(MouseEvent arg0) { } public void mouseReleased(MouseEvent arg0) { } }; }
From source file:me.mayo.telnetkek.MainPanel.java
public final void setupTablePopup() { this.tblPlayers.addMouseListener(new MouseAdapter() { @Override//from ww w .j a v a 2s . c om public void mouseReleased(final MouseEvent mouseEvent) { final JTable table = MainPanel.this.tblPlayers; final int r = table.rowAtPoint(mouseEvent.getPoint()); if (r >= 0 && r < table.getRowCount()) { table.setRowSelectionInterval(r, r); } else { table.clearSelection(); } final int rowindex = table.getSelectedRow(); if (rowindex < 0) { return; } if ((SwingUtilities.isRightMouseButton(mouseEvent) || mouseEvent.isControlDown()) && mouseEvent.getComponent() instanceof JTable) { final PlayerInfo player = getSelectedPlayer(); if (player != null) { final JPopupMenu popup = new JPopupMenu(player.getName()); final JMenuItem header = new JMenuItem("Apply action to " + player.getName() + ":"); header.setEnabled(false); popup.add(header); popup.addSeparator(); final ActionListener popupAction = (ActionEvent actionEvent) -> { Object _source = actionEvent.getSource(); if (_source instanceof PlayerListPopupItem_Command) { final PlayerListPopupItem_Command source = (PlayerListPopupItem_Command) _source; final String output = source.getCommand().buildOutput(source.getPlayer(), true); MainPanel.this.getConnectionManager().sendDelayedCommand(output, true, 100); } else if (_source instanceof PlayerListPopupItem) { final PlayerListPopupItem source = (PlayerListPopupItem) _source; final PlayerInfo _player = source.getPlayer(); switch (actionEvent.getActionCommand()) { case "Copy IP": { copyToClipboard(_player.getIp()); MainPanel.this.writeToConsole( new ConsoleMessage("Copied IP to clipboard: " + _player.getIp())); break; } case "Copy Name": { copyToClipboard(_player.getName()); MainPanel.this.writeToConsole( new ConsoleMessage("Copied name to clipboard: " + _player.getName())); break; } case "Copy UUID": { copyToClipboard(_player.getUuid()); MainPanel.this.writeToConsole( new ConsoleMessage("Copied UUID to clipboard: " + _player.getUuid())); break; } } } }; TelnetKek.config.getCommands().stream().map( (command) -> new PlayerListPopupItem_Command(command.getName(), player, command)) .map((item) -> { item.addActionListener(popupAction); return item; }).forEach((item) -> { popup.add(item); }); popup.addSeparator(); JMenuItem item; item = new PlayerListPopupItem("Copy Name", player); item.addActionListener(popupAction); popup.add(item); item = new PlayerListPopupItem("Copy IP", player); item.addActionListener(popupAction); popup.add(item); item = new PlayerListPopupItem("Copy UUID", player); item.addActionListener(popupAction); popup.add(item); popup.show(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY()); } } } }); }
From source file:com.devoteam.srit.xmlloader.core.report.derived.DerivedCounter.java
public void addMouseListenerForGraph(JPanel panel) { if (/*this instanceof StatAverage || this instanceof StatFlow*/ true) { panel.addMouseListener(new MouseListener() { java.awt.Color lastColor; public void mouseClicked(MouseEvent e) { }/*from w w w. ja v a 2 s . co m*/ public void mousePressed(MouseEvent e) { JFrameRTStats.instance().getJPanelBottom().removeAll(); JPanel longpanel = generateLongRTStats(); longpanel.setAlignmentX(java.awt.Component.LEFT_ALIGNMENT); longpanel.setAlignmentY(java.awt.Component.TOP_ALIGNMENT); JFrameRTStats.instance().getJPanelBottom().add(longpanel); // We add graphics to jPanelBottom JFrameRTStats.instance().getJPanelBottom().add(getChartPanel()); // We save the StatKey selected ModelTreeRTStats.instance().setStatSelected(id); // We update the panel for display the graph JFrameRTStats.instance().updatePanel(); } public void mouseReleased(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); } public void mouseEntered(MouseEvent e) { lastColor = e.getComponent().getBackground(); e.getComponent().setBackground(ModelTreeRTStats.instance().getColorByString("selectForGraph")); } public void mouseExited(MouseEvent e) { e.getComponent().setBackground(lastColor); } }); } }
From source file:org.rdv.viz.image.ImageViz.java
private void initTiltControls() { tiltControls = new JPanel(); tiltControls.setLayout(new BorderLayout()); JButton tiltUpButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-up.gif")); tiltUpButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { tiltUp();/*ww w . j a v a2 s . c o m*/ } }); tiltUpButton.setBorder(null); tiltControls.add(tiltUpButton, BorderLayout.NORTH); JButton tiltControlButton = new StrechIconButton( DataViewer.getIcon("icons/ptz/robotic_control-tiltbar-medium.gif")); tiltControlButton.setBorder(null); tiltControlButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { JButton button = (JButton) e.getComponent(); int tilt = Math.round(100f * e.getPoint().y / button.getHeight()); tilt(tilt); } }); tiltControls.add(tiltControlButton, BorderLayout.CENTER); JButton tiltDownButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-down.gif")); tiltDownButton.setBorder(null); tiltDownButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { tiltDown(); } }); tiltControls.add(tiltDownButton, BorderLayout.SOUTH); }
From source file:org.rdv.viz.image.ImageViz.java
private void initIrisControls() { irisControls = new JPanel(); irisControls.setLayout(new BorderLayout()); JButton closeIrisButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-close.gif")); closeIrisButton.setBorder(null);//from w w w . j a va 2 s.c o m closeIrisButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { irisClose(); } }); irisControls.add(closeIrisButton, BorderLayout.WEST); JButton irisControlButton = new StrechIconButton( DataViewer.getIcon("icons/ptz/robotic_control-irisbar-medium.gif")); irisControlButton.setBorder(null); irisControlButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { JButton button = (JButton) e.getComponent(); int iris = Math.round(100f * e.getPoint().x / button.getWidth()); iris(iris); } }); irisControls.add(irisControlButton, BorderLayout.CENTER); JPanel irisControlsRight = new JPanel(); irisControlsRight.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); JButton openIrisButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-open.gif")); openIrisButton.setBorder(null); openIrisButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { irisOpen(); } }); irisControlsRight.add(openIrisButton); JButton autoIrisButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-auto.gif")); autoIrisButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { irisAuto(); } }); autoIrisButton.setBorder(null); irisControlsRight.add(autoIrisButton); irisControls.add(irisControlsRight, BorderLayout.EAST); }
From source file:org.rdv.viz.image.ImageViz.java
private void initZoomControls() { zoomControls = new JPanel(); zoomControls.setLayout(new BorderLayout()); JButton zoomOutButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-minus.gif")); zoomOutButton.setBorder(null);/* w w w. j a v a2s. c o m*/ zoomOutButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { zoomOut(); } }); zoomControls.add(zoomOutButton, BorderLayout.WEST); JButton zoomControlButton = new StrechIconButton( DataViewer.getIcon("icons/ptz/robotic_control-zoombar-medium.gif")); zoomControlButton.setBorder(null); zoomControlButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { JButton button = (JButton) e.getComponent(); int zoom = Math.round(100f * e.getPoint().x / button.getWidth()); zoom(zoom); } }); zoomControls.add(zoomControlButton, BorderLayout.CENTER); JPanel topRightControls = new JPanel(); topRightControls.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); JButton zoomInButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-plus.gif")); zoomInButton.setBorder(null); zoomInButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { zoomIn(); } }); topRightControls.add(zoomInButton); JButton topHomeButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-home.gif")); topHomeButton.setBorder(null); topHomeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { home(); } }); topRightControls.add(topHomeButton); zoomControls.add(topRightControls, BorderLayout.EAST); }
From source file:org.rdv.viz.image.ImageViz.java
private void initPanControls() { panControls = new JPanel(); panControls.setLayout(new BorderLayout()); JButton panLeftButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-left.gif")); panLeftButton.setBorder(null);/* w w w . j ava 2 s . c o m*/ panLeftButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { panLeft(); } }); panControls.add(panLeftButton, BorderLayout.WEST); JButton panControlButton = new StrechIconButton( DataViewer.getIcon("icons/ptz/robotic_control-panbar-medium.gif")); panControlButton.setBorder(null); panControlButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { JButton button = (JButton) e.getComponent(); int pan = Math.round(100f * e.getPoint().x / button.getWidth()); pan(pan); } }); panControls.add(panControlButton, BorderLayout.CENTER); JPanel bottomRightControls = new JPanel(); bottomRightControls.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); JButton panRightButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-right.gif")); panRightButton.setBorder(null); panRightButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { panRight(); } }); bottomRightControls.add(panRightButton); JButton bottomHomeButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-home.gif")); bottomHomeButton.setBorder(null); bottomHomeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { home(); } }); bottomRightControls.add(bottomHomeButton); panControls.add(bottomRightControls, BorderLayout.EAST); }
From source file:org.rdv.viz.image.ImageViz.java
private void initFocusControls() { focusControls = new JPanel(); focusControls.setLayout(new BorderLayout()); JButton nearFocusButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-near.gif")); nearFocusButton.setBorder(null);/*from ww w.ja v a 2 s . c om*/ nearFocusButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { focusNear(); } }); focusControls.add(nearFocusButton, BorderLayout.WEST); JButton focusControlButton = new StrechIconButton( DataViewer.getIcon("icons/ptz/robotic_control-focusbar-medium.gif")); focusControlButton.setBorder(null); focusControlButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { JButton button = (JButton) e.getComponent(); int focus = Math.round(100f * e.getPoint().x / button.getWidth()); focus(focus); } }); focusControls.add(focusControlButton, BorderLayout.CENTER); JPanel focusControlsRight = new JPanel(); focusControlsRight.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); JButton farFocusButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-far.gif")); farFocusButton.setBorder(null); farFocusButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { focusFar(); } }); focusControlsRight.add(farFocusButton); JButton autoFocusButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-auto.gif")); autoFocusButton.setBorder(null); autoFocusButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { focusAuto(); } }); focusControlsRight.add(autoFocusButton); focusControls.add(focusControlsRight, BorderLayout.EAST); }
From source file:com.mirth.connect.client.ui.editors.filter.FilterPane.java
/** * Shows the popup menu when the trigger button (right-click) has been pushed. *///from w ww .j a va 2 s. c o m private void checkSelectionAndPopupMenu(java.awt.event.MouseEvent evt) { int row = filterTable.rowAtPoint(new Point(evt.getX(), evt.getY())); if (evt.isPopupTrigger()) { if (row != -1) { filterTable.setRowSelectionInterval(row, row); } filterPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY()); } }