本文整理汇总了Java中javax.swing.SwingUtilities.isRightMouseButton方法的典型用法代码示例。如果您正苦于以下问题:Java SwingUtilities.isRightMouseButton方法的具体用法?Java SwingUtilities.isRightMouseButton怎么用?Java SwingUtilities.isRightMouseButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.SwingUtilities
的用法示例。
在下文中一共展示了SwingUtilities.isRightMouseButton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseReleased
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mouseReleased(final MouseEvent e) {
this.setLocation(e);
this.setPressed(false);
final MouseEvent wrappedEvent = this.createEvent(e);
this.mouseListeners.forEach(listener -> listener.mouseReleased(wrappedEvent));
if (SwingUtilities.isLeftMouseButton(e)) {
this.isLeftMouseButtonDown = false;
}
if (SwingUtilities.isRightMouseButton(e)) {
this.isRightMouseButtonDown = false;
}
for (final Consumer<MouseEvent> cons : this.mouseReleasedConsumer) {
cons.accept(wrappedEvent);
}
}
示例2: mousePressed
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void mousePressed(MouseEvent e){
if(!SwingUtilities.isRightMouseButton(e)){
mouseDownCompCoords = e.getPoint();
rightMouseButtonPressed = true;
}
if(SwingUtilities.isRightMouseButton(e)){
if(timestampLow == 0){
timestampLow = (int) new Date().getTime();
}
else if(timestampHigh == 0){
timestampHigh = (int) new Date().getTime();
}
else{
timestampLow = timestampHigh;
timestampHigh = (int) new Date().getTime();
}
if(timestampHigh - timestampLow < 350){
ladderRestExpHour = true;
}
}
}
示例3: mousePressed
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent event) {
JTree tree = (JTree) event.getSource();
int x = event.getX();
int y = event.getY();
int row = tree.getRowForLocation(x, y);
TreePath path = tree.getPathForRow(row);
// if path exists and mouse is clicked exactly once
if (path == null) {
return;
}
CheckNode node = (CheckNode) path.getLastPathComponent();
if ( !SwingUtilities.isRightMouseButton(event)) {
return;
}
Object o = node.getUserObject();
}
示例4: mouseClickedOnItem
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private void mouseClickedOnItem(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e)) {
e.consume();
if (isSelected()) {
Iterator<Category> iterator = evalCats.iterator();
while (iterator.hasNext()) {
Category c = iterator.next();
if (!CommandEvaluator.RECENT.equals(c.getName())) {
iterator.remove();
}
}
evalCats.add(category);
} else {
evalCats.addAll(
ProviderModel.getInstance().getCategories());
evalCats.remove(category);
}
updateCheckBoxes(CategoryCheckBoxMenuItem.this, evalCats);
updateCats(evalCats);
}
}
示例5: mouseClicked
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
JTableHeader header = (JTableHeader) e.getSource();
JTable table = header.getTable();
TableColumnModel columnModel = table.getColumnModel();
int vci = columnModel.getColumnIndexAtX(e.getX());
int mci = table.convertColumnIndexToModel(vci);
if (mci == targetColumnIndex) {
if (SwingUtilities.isLeftMouseButton(e)) {
TableColumn column = columnModel.getColumn(vci);
Object v = column.getHeaderValue();
boolean b = Status.DESELECTED.equals(v);
TableModel m = table.getModel();
for (int i = 0; i < m.getRowCount(); i++) {
m.setValueAt(b, i, mci);
}
column.setHeaderValue(b ? Status.SELECTED : Status.DESELECTED);
} else if (SwingUtilities.isRightMouseButton(e)) {
if (popupMenu != null) {
popupMenu.show(table, e.getX(), 0);
}
}
}
}
示例6: mouseReleased
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mouseReleased(MouseEvent me) {
super.mouseReleased(me);
if (SwingUtilities.isRightMouseButton(me)) {
if (this.movePanelWithRightAction==true) {
this.movePanelWithRightAction = false;
this.getVisViewer().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
} else if (SwingUtilities.isLeftMouseButton(me)) {
if (this.moveNodeWithLeftAction==true) {
this.moveNodeWithLeftAction = false;
this.setNodesMoved2EndPosition();
this.createUndoableMoveAction();
this.nodesMoved.removeAllElements();
}
}
}
示例7: mouseClicked
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
* Call when the mouse has been clicked in the {@link ProcessRendererView}.
*
* @param e
*/
public void mouseClicked(final MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
if (e.getClickCount() == 2) {
if (model.getHoveringOperator() != null) {
if (model.getHoveringOperator() instanceof OperatorChain) {
model.setDisplayedChain((OperatorChain) model.getHoveringOperator());
model.fireDisplayedChainChanged();
RapidMinerGUI.getMainFrame().addViewSwitchToUndo();
}
e.consume();
}
}
} else if (SwingUtilities.isRightMouseButton(e)) {
if (model.getConnectingPortSource() != null) {
cancelConnectionDragging();
connectionDraggingCanceled = true;
e.consume();
}
}
}
示例8: rightClick
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void rightClick(JTable jtable, java.awt.event.MouseEvent evt ){
try {
impostaMenu();
} catch (SQLException ex) {
Logger.getLogger(GuiPrincipale.class.getName()).log(Level.SEVERE, null, ex);
}
if(SwingUtilities.isRightMouseButton(evt)){
int[] coordinate = coordinateMouse(jtable);
jMenuPrincipale.show(this, coordinate[0]+evt.getX(), coordinate[1]+evt.getY());
}
try{
int i = jtable.getSelectedRow();
id = Integer.parseInt(jtable.getValueAt(i, 2).toString());
nomePrenotazione = (String) jtable.getValueAt(i, 0);
}catch(ArrayIndexOutOfBoundsException s){}
}
示例9: mousePressed
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void mousePressed(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e)) {
try {
Robot robot = new java.awt.Robot();
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
} catch (AWTException ex) {
System.out.println(ex);
}
}
maybeShowPopup(e);
}
示例10: mousePressed
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent event) {
JTree tree = (JTree) event.getSource();
int x = event.getX();
int y = event.getY();
int row = tree.getRowForLocation(x, y);
TreePath path = tree.getPathForRow(row);
// if path exists and mouse is clicked exactly once
if (path == null) {
return;
}
CheckNode node = (CheckNode) path.getLastPathComponent();
if ( !SwingUtilities.isRightMouseButton(event)) {
return;
}
Object o = node.getUserObject();
if ( !(o instanceof TreeElement)) {
return;
}
o = ((TreeElement) o).getUserObject();
if (o instanceof RefactoringElement) {
showPopup(((RefactoringElement) o).getLookup().lookupAll(Action.class), tree, x, y);
}
}
示例11: mousePressedOrClicked
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
* Acts on the mouse pressed and mouse clicked action.
* @param me the {@link MouseEvent}
*/
private void mousePressedOrClicked(MouseEvent me) {
// --- Left click ---------------------------------
if(SwingUtilities.isLeftMouseButton(me) || SwingUtilities.isRightMouseButton(me)){
// --- Check if an object was selected --------
Object pickedObject = null;
Point point = me.getPoint();
GraphElementAccessor<GraphNode, GraphEdge> ps = this.getVisViewer().getPickSupport();
GraphNode pickedNode = ps.getVertex(this.getVisViewer().getGraphLayout(), point.getX(), point.getY());
if(pickedNode != null) {
pickedObject = pickedNode;
} else {
GraphEdge pickedEdge = ps.getEdge(this.getVisViewer().getGraphLayout(), point.getX(), point.getY());
if(pickedEdge != null) {
pickedObject = pickedEdge;
}
}
// --- Only when node or edge is clicked -----------
if(pickedObject != null) {
if (me.getClickCount()==2){
// --- Double click ---------
this.basicGraphGUI.handleObjectDoubleClick(pickedObject);
} else {
if(me.isShiftDown()==false) {
// --- Left click -----------
this.basicGraphGUI.handleObjectLeftClick(pickedObject);
}
}
}
}
}
示例12: mouseClicked
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent ev) {
if (SwingUtilities.isRightMouseButton(ev)) {
final int row = last_mouse_point.y / table.get_gate_table_row_height(),
col = last_mouse_point.x / table.get_gate_table_col_width();
for (int first_row = row; first_row >= 0; first_row--) {
final Gate current = table.get_table().get_element(first_row, col);
if (current != null && row - first_row + 1 <= current.get_ports_number()) {
table.get_table().remove_element(first_row, col);
if (table.get_table().get_col_count() > 1 &&
col == table.get_table().get_col_count() - 2 &&
table.get_table().is_col_empty(col)) {
// Delete unnecessary empty columns
for (int current_col = col; current_col >= 0; current_col--)
if (table.get_table().is_col_empty(current_col))
table.get_table().remove_last_col();
else
break;
table.update_size();
}
table.repaint();
break;
}
}
table.repaint();
}
}
示例13: mousePressed
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
setOffsetMarker(e);
drag = false;
click.x = e.getX();
click.y = e.getY();
} else if (SwingUtilities.isRightMouseButton(e) && rcDisArm) {
hideCropper();
}
}
示例14: mousePressed
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
* Overridden to also focus the text component on right mouse clicks.
*
* @param e The mouse event.
*/
@Override
public void mousePressed(MouseEvent e) {
super.mousePressed(e);
if (!e.isConsumed() && SwingUtilities.isRightMouseButton(e)) {
JTextComponent c = getComponent();
if (c!=null && c.isEnabled() && c.isRequestFocusEnabled()) {
c.requestFocusInWindow();
}
}
}
示例15: isToggleEvent
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
*
* @param event
* @return Returns true if the given event should toggle selected cells.
*/
public boolean isToggleEvent(MouseEvent event)
{
// NOTE: IsMetaDown always returns true for right-clicks on the Mac, so
// toggle selection for left mouse buttons requires CMD key to be pressed,
// but toggle for right mouse buttons requires CTRL to be pressed.
return (event != null) ? ((mxUtils.IS_MAC) ? ((SwingUtilities
.isLeftMouseButton(event) && event.isMetaDown()) || (SwingUtilities
.isRightMouseButton(event) && event.isControlDown()))
: event.isControlDown())
: false;
}