Java Code Examples for java.awt.event.MouseEvent.isPopupTrigger()

The following are Jave code examples for showing how to use isPopupTrigger() of the java.awt.event.MouseEvent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Wilmersdorf_SER316   File: HTMLEditor.java   View Source Code Vote up 6 votes
private void maybeShowPopup(MouseEvent e) {
	if (e.isPopupTrigger()) {
		JPopupMenu popupMenu = new JPopupMenu();
		popupMenu.setFocusable(false);

		popupMenu.add(jMenuItemUndo);
		popupMenu.add(jMenuItemRedo);
		popupMenu.addSeparator();
		popupMenu.add(jMenuItemCut);
		popupMenu.add(jMenuItemCopy);
		popupMenu.add(jMenuItemPaste);
		popupMenu.addSeparator();
		if (jMenuItemInsCell.getAction().isEnabled()) {
			popupMenu.add(jMenuItemInsCell);
			jMenuItemInsCell.setEnabled(true);
			popupMenu.add(jMenuItemInsRow);
			jMenuItemInsRow.setEnabled(true);
			popupMenu.addSeparator();
		}
		popupMenu.add(jMenuItemProp);
		popupMenu.show(e.getComponent(), e.getX(), e.getY());

	}
}
 
Example 2
Project: parabuild-ci   File: ChartPanel.java   View Source Code Vote up 6 votes
/**
 * Handles a 'mouse pressed' event.
 * <P>
 * This event is the popup trigger on Unix/Linux.  For Windows, the popup
 * trigger is the 'mouse released' event.
 *
 * @param e  The mouse event.
 */
public void mousePressed(MouseEvent e) {

    if (this.zoomRectangle == null) {

        this.zoomPoint = RefineryUtilities.getPointInRectangle(
            e.getX(), e.getY(), getScaledDataArea()
        );
        LOGGER.debug("In mousePressed()");
        LOGGER.debug("getScaledDataArea() = " + getScaledDataArea());
        LOGGER.debug("this.zoomPoint = " + this.zoomPoint);

        // check for popup trigger...
        if (e.isPopupTrigger()) {
            if (this.popup != null) {
                displayPopupMenu(e.getX(), e.getY());
            }
        }
    }

}
 
Example 3
Project: rapidminer   File: ExtendedMouseClickedAdapter.java   View Source Code Vote up 5 votes
@Override
public void mouseClicked(MouseEvent e) {
	if (e.isPopupTrigger()) {
		showContextMenu(e.getPoint());
	} else {
		click(e);
	}
	armed = null;
}
 
Example 4
Project: geomapapp   File: MGGData.java   View Source Code Vote up 5 votes
public void tryPopUp(MouseEvent evt){
	String osName = System.getProperty("os.name");
	if ( !evt.isControlDown() ) {
		if ( osName.startsWith("Mac OS") && evt.isShiftDown() ) {
			pm.show(evt.getComponent(), evt.getX(), evt.getY() );
		}
		else if ( evt.isPopupTrigger() ) {
			pm.show(evt.getComponent(), evt.getX(), evt.getY());
		}
	}
}
 
Example 5
Project: FinalSpeed   File: TextComponentPopupMenu.java   View Source Code Vote up 5 votes
public void mouseReleased(MouseEvent e) {
	if (e.isPopupTrigger() && e.getSource() instanceof JTextField) {
		JTextField textfield = (JTextField) e.getSource();
		if (Boolean.TRUE.equals(textfield
				.getClientProperty("DisablePopupMenu"))) {
			return;
		}
		textfield.requestFocusInWindow();
		show(textfield, e.getX(), e.getY());
	}
}
 
Example 6
Project: incubator-netbeans   File: LineNumbersActionsBar.java   View Source Code Vote up 5 votes
public void mouseClicked(MouseEvent e) {
    if (!e.isPopupTrigger()) {
        HotSpot spot = getHotspotAt(e.getPoint());
        if (spot != null) {
            performAction(spot);
        }
    }
}
 
Example 7
Project: gate-core   File: LuceneDataStoreSearchGUI.java   View Source Code Vote up 5 votes
@Override
public void mousePressed(MouseEvent e) {
  if(e.isPopupTrigger()) {
    createPopup(e);
    mousePopup.show(e.getComponent(), e.getX(), e.getY());
  }
}
 
Example 8
Project: JavaGraph   File: RuleTree.java   View Source Code Vote up 5 votes
private void maybeShowPopup(MouseEvent evt) {
    if (evt.isPopupTrigger()) {
        TreePath selectedPath = getPathForLocation(evt.getX(), evt.getY());
        TreeNode selectedNode =
            selectedPath == null ? null : (TreeNode) selectedPath.getLastPathComponent();
        RuleTree.this.requestFocus();
        createPopupMenu(selectedNode).show(evt.getComponent(), evt.getX(), evt.getY());
    }
}
 
Example 9
Project: incubator-netbeans   File: ComponentDetailsProvider.java   View Source Code Vote up 4 votes
public void mousePressed(final MouseEvent e) {
    if (e.isPopupTrigger()) showPopup(e);
}
 
Example 10
Project: SER316-Aachen   File: NotesControlPanel.java   View Source Code Vote up 4 votes
private void maybeShowPopup(MouseEvent e) {
    if (e.isPopupTrigger()) {
        notesPPMenu.show(e.getComponent(), e.getX(), e.getY());
    }
}
 
Example 11
Project: Wilmersdorf_SER316   File: ProjectsPanel.java   View Source Code Vote up 4 votes
private void maybeShowPopup(MouseEvent e) {
	if (e.isPopupTrigger()) {
		projectsPPMenu.show(e.getComponent(), e.getX(), e.getY());
	}
}
 
Example 12
Project: incubator-netbeans   File: BaseCaret.java   View Source Code Vote up 4 votes
private boolean isLeftMouseButtonExt(MouseEvent evt) {
    return (SwingUtilities.isLeftMouseButton(evt)
            && !(evt.isPopupTrigger())
            && (evt.getModifiers() & (InputEvent.META_MASK | InputEvent.ALT_MASK)) == 0);
}
 
Example 13
Project: SER316-Dresden   File: JTreeTable.java   View Source Code Vote up 4 votes
/**
 * Overridden to return false, and if the event is a mouse event it is
 * forwarded to the tree.
 * <p>
 * The behavior for this is debatable, and should really be offered as a
 * property. By returning false, all keyboard actions are implemented in
 * terms of the table. By returning true, the tree would get a chance to
 * do something with the keyboard events. For the most part this is ok.
 * But for certain keys, such as left/right, the tree will
 * expand/collapse where as the table focus should really move to a
 * different column. Page up/down should also be implemented in terms of
 * the table. By returning false this also has the added benefit that
 * clicking outside of the bounds of the tree node, but still in the
 * tree column will select the row, whereas if this returned true that
 * wouldn't be the case.
 * <p>
 * By returning false we are also enforcing the policy that the tree
 * will never be editable (at least by a key sequence).
 */
public boolean isCellEditable(EventObject e) {
	if (e instanceof MouseEvent) {
		for (int counter = getColumnCount() - 1; counter >= 0; counter--) {
			if (getColumnClass(counter) == TreeTableModel.class) {
				MouseEvent me = (MouseEvent) e;
				MouseEvent newME = new MouseEvent(tree, me.getID(), me
						.getWhen(), me.getModifiers(), me.getX()
						- getCellRect(0, counter, true).x, me.getY(),
						me.getClickCount(), me.isPopupTrigger());
				tree.dispatchEvent(newME);
				break;
			}
		}
	}
	return false;
}
 
Example 14
Project: Wilmersdorf_SER316   File: JTreeTable.java   View Source Code Vote up 4 votes
/**
 * Overridden to return false, and if the event is a mouse event it is
 * forwarded to the tree.
 * <p>
 * The behavior for this is debatable, and should really be offered as a
 * property. By returning false, all keyboard actions are implemented in
 * terms of the table. By returning true, the tree would get a chance to
 * do something with the keyboard events. For the most part this is ok.
 * But for certain keys, such as left/right, the tree will
 * expand/collapse where as the table focus should really move to a
 * different column. Page up/down should also be implemented in terms of
 * the table. By returning false this also has the added benefit that
 * clicking outside of the bounds of the tree node, but still in the
 * tree column will select the row, whereas if this returned true that
 * wouldn't be the case.
 * <p>
 * By returning false we are also enforcing the policy that the tree
 * will never be editable (at least by a key sequence).
 */
public boolean isCellEditable(EventObject e) {
	if (e instanceof MouseEvent) {
		for (int counter = getColumnCount() - 1; counter >= 0; counter--) {
			if (getColumnClass(counter) == TreeTableModel.class) {
				MouseEvent me = (MouseEvent) e;
				MouseEvent newME = new MouseEvent(tree, me.getID(), me
						.getWhen(), me.getModifiers(), me.getX()
						- getCellRect(0, counter, true).x, me.getY(),
						me.getClickCount(), me.isPopupTrigger());
				tree.dispatchEvent(newME);
				break;
			}
		}
	}
	return false;
}
 
Example 15
Project: Reinickendorf_SER316   File: ProjectsPanel.java   View Source Code Vote up 4 votes
private void maybeShowPopup(MouseEvent e) {
	if (e.isPopupTrigger()) {
		projectsPPMenu.show(e.getComponent(), e.getX(), e.getY());
	}
}
 
Example 16
Project: rapidminer   File: TextFieldUI.java   View Source Code Vote up 4 votes
private void evaluateClick(MouseEvent e) {
	if (e.isPopupTrigger()) {
		showPopup(e.getPoint());
	}
}
 
Example 17
Project: Dahlem_SER316   File: ProjectsPanel.java   View Source Code Vote up 4 votes
private void maybeShowPopup(MouseEvent e) {
	if (e.isPopupTrigger()) {
		projectsPPMenu.show(e.getComponent(), e.getX(), e.getY());				
	}
}
 
Example 18
Project: incubator-netbeans   File: InstancesListControllerUI.java   View Source Code Vote up 4 votes
public void mousePressed(final MouseEvent e) {
    final int row = instancesListTable.rowAtPoint(e.getPoint());
    updateSelection(row);
    if (row != -1 && e.isPopupTrigger())
        showTablePopup(e.getComponent(), e.getX(), e.getY());
}
 
Example 19
Project: incubator-netbeans   File: ImageDetailProvider.java   View Source Code Vote up 4 votes
public void mouseReleased(MouseEvent e) {
    if (e.isPopupTrigger()) {
        showPopup(e);
    }
}
 
Example 20
Project: incubator-netbeans   File: ReferencesBrowserControllerUI.java   View Source Code Vote up 4 votes
public void mousePressed(final MouseEvent e) {
    final int row = fieldsListTable.rowAtPoint(e.getPoint());
    updateSelection(row);
    if (e.isPopupTrigger()) showPopupMenu(row, e.getX(), e.getY());
}