当前位置: 首页>>代码示例>>Java>>正文


Java MouseEvent.isAltDown方法代码示例

本文整理汇总了Java中java.awt.event.MouseEvent.isAltDown方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.isAltDown方法的具体用法?Java MouseEvent.isAltDown怎么用?Java MouseEvent.isAltDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.event.MouseEvent的用法示例。


在下文中一共展示了MouseEvent.isAltDown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dragBegin

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void dragBegin(DragContext dc) {
  Point3 origin = dc.getPointWorld();
  Vector3 normal = null;
  Axis axis = _frame.getAxis();
  if (axis==Axis.X) {
    normal = new Vector3(1.0,0.0,0.0);
  } else if (axis==Axis.Y) {
    normal = new Vector3(0.0,1.0,0.0);
  } else if (axis==Axis.Z) {
    normal = new Vector3(0.0,0.0,1.0);
  }
  Plane plane = new Plane(origin,normal);
  MouseEvent event = dc.getMouseEvent();
  Matrix44 worldToPixel = dc.getWorldToPixel();
  if (event.isControlDown() || event.isAltDown()) { // Alt/Option for Mac
    _mouseConstrained = new MouseOnPlane(event,origin,plane,worldToPixel);
  } else {
    _mouseConstrained = new MouseOnLine(event,origin,normal,worldToPixel);
  }
  _origin = origin;
  _qa = _frame.getCornerMin();
  _qb = _frame.getCornerMax();
}
 
开发者ID:MinesJTK,项目名称:jtk,代码行数:24,代码来源:AxisAlignedQuad.java

示例2: mouseClicked

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent event)
{
   int xPos = event.getX(); // get x-position of mouse
   int yPos = event.getY(); // get y-position of mouse

   details = String.format("Clicked %d time(s)", 
      event.getClickCount());

   if (event.isMetaDown()) // right mouse button   
      details += " with right mouse button";
   else if (event.isAltDown()) // middle mouse button
      details += " with center mouse button";
   else // left mouse button                       
      details += " with left mouse button";

   statusBar.setText(details); 
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:19,代码来源:MouseDetailsFrame.java

示例3: mousePressed

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e)
{
	if(e.isAltDown())
		System.out.println(mw.gameMap.clearLine(mouse, click));
	else
		click = translateToReal(e.getX(), e.getY());
	
	
}
 
开发者ID:ben-j-c,项目名称:TopDownGame,代码行数:11,代码来源:ClearLineTest.java

示例4: mouseReleased

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseReleased(MouseEvent evt) {
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("EditorCaret.mouseReleased: " + logMouseEvent(evt) + ", state=" + mouseState + '\n'); // NOI18N
    }

    int offset = mouse2Offset(evt);
    switch (mouseState) {
        case DRAG_SELECTION_POSSIBLE:
            setDot(offset);
            adjustRectangularSelectionMouseX(evt.getX(), evt.getY()); // also fires state change
            break;

        case CHAR_SELECTION:
            if (evt.isAltDown() && evt.isShiftDown()) {
                moveDot(offset);
            } else {
                moveDot(offset); // Will do setDot() if no selection
                adjustRectangularSelectionMouseX(evt.getX(), evt.getY()); // also fires state change
            }
            break;
    }
    // Set DEFAULT state; after next mouse press the state may change
    // to another state according to particular click count
    mouseState = MouseState.DEFAULT;
    component.setDragEnabled(true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:EditorCaret.java

示例5: mousePressed

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
protected void mousePressed(MouseEvent me) {
    if (me.getButton() == MouseEvent.BUTTON1 && me.getClickCount() == 1 && !me.isAltDown() && !me.isMetaDown()
            && !me.isAltGraphDown() && !me.isControlDown()) {
        mouseButton1Pressed(me);
    } else {
        recorder.recordClick2(this, me, true);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:9,代码来源:RComponent.java

示例6: mouseReleased

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseReleased(MouseEvent e) {
	Point point = e.getPoint();
	
	Point2D newPoint = new Point2D.Double(0, 0);
	mouseTransform.transform(point, newPoint); 
	
	// only listen to the right button
	if (e.getButton() == MouseEvent.BUTTON3 || e.isAltDown()) {
		//System.out.println("User right clicked at " + point.x + ", " + point.y);
		lastMouseClick = new Position(newPoint.getX(), newPoint.getY());
	}
}
 
开发者ID:amymcgovern,项目名称:spacesettlers,代码行数:14,代码来源:HumanTeamClient.java

示例7: mousePressed

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
    if (!isMyEvent(e)) {
        return;
    }
    getJGraph().requestFocus();
    stopEditing(getJGraph());
    // determine the drag mode (although dragging does not yet start)
    DragMode newDragMode;
    JCell<G> jVertex = getJVertexAt(e.getPoint());
    JCell<G> jEdge = getJEdgeAt(e.getPoint());
    if (getJGraphMode() == PAN_MODE && e.getButton() == BUTTON1) {
        newDragMode = PAN;
    } else if (jVertex != null || jEdge != null) {
        // either start adding an edge, or move 
        if (getJGraphMode() == EDIT_MODE && e.getButton() == BUTTON1
            && !ADD_EDGE_BY_CLICK) {
            if (jEdge != null) {
                newDragMode = MOVE;
            } else if (getJGraph().isCellSelected(jVertex)) {
                newDragMode = EDGE;
            } else if (e.isAltDown()) {
                newDragMode = EDGE;
            } else {
                newDragMode = MOVE;
            }
        } else {
            newDragMode = MOVE;
        }
    } else {
        newDragMode = SELECT;
    }
    this.dragMode = newDragMode;
    this.dragStart = e;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:36,代码来源:JGraphUI.java

示例8: mouseClicked

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent me) {
    if (me.isAltDown()) {
        if (table.rowAtPoint(me.getPoint()) != -1 && getTestCase(table) != null) {
            TestStep step = getTestCase(table).getTestSteps().get(table.rowAtPoint(me.getPoint()));
            if (isDataBaseQueryStep(step) && table.columnAtPoint(me.getPoint()) == Input.getIndex()) {
                new SQLTextArea(null, step, getInputs());
            }
        }
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:12,代码来源:TestCaseAutoSuggest.java

示例9: isShift

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private boolean isShift(MouseEvent e) {
    if (e.isShiftDown() && !e.isControlDown() && !e.isAltDown()) {
        return true;
    } else {
        return false;
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:8,代码来源:EvolutionaryThrottleController.java

示例10: mouseDragged

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
    if (e.isAltDown() && startLocation != null) {
        isInDragOperation = true;
        JTable t = (JTable) e.getSource();
        int selRow = t.rowAtPoint(e.getPoint());
        int selColumn = t.columnAtPoint(e.getPoint());
        if (selRow != -1 && selColumn != -1) {
            rowsRColumns.add(new Integer[]{selRow, selColumn});
        }
    } else {
        isInDragOperation = false;
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:15,代码来源:TableCellDrag.java

示例11: isControl

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private boolean isControl(MouseEvent e) {
    if (!e.isShiftDown() && e.isControlDown() && !e.isAltDown()) {
        return true;
    } else {
        return false;
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:8,代码来源:HumanVsComputerThrottleController.java

示例12: mouseDragged

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
    if (currentProfile == null) {
        return;
    }
    int idx = -1;
    if ((idx = getIndex(e)) == -1) {
        return;
    }
    if (idx != lastEditIdx) {
        if (e.isAltDown() && e.isShiftDown()) {
            // brake point
            currentProfile.editClearBrake(idx);
            currentProfile.log();
            editState = EditState.None;
            glCanvas.repaint();
        } else if (e.isAltDown() && !e.isShiftDown()) {
            // brake point
            currentProfile.editSetBrake(idx);
            currentProfile.log();
            editState = EditState.None;
            glCanvas.repaint();
        } else if (isShift(e)) {
            currentProfile.editIncreaseThrottle(idx);
            currentProfile.log();
            editState = EditState.Increae;
            glCanvas.repaint();
        } else if (isControl(e)) {
            currentProfile.editDecreaseThrottle(idx);
            currentProfile.log();
            editState = EditState.Decrease;
            glCanvas.repaint();
        } else {
            editState = EditState.None;
        }
    }
    lastEditIdx = idx;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:39,代码来源:HumanVsComputerThrottleController.java

示例13: mouseDragged

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseDragged(MouseEvent evt) {
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("EditorCaret.mouseDragged: " + logMouseEvent(evt) + ", state=" + mouseState + '\n'); //NOI18N
    }

    if (isLeftMouseButtonExt(evt)) {
        JTextComponent c = component;
        int offset = mouse2Offset(evt);
        int dot = getDot();
        int mark = getMark();
        LineDocument lineDoc = LineDocumentUtils.asRequired(c.getDocument(), LineDocument.class);
        
        try {
            switch (mouseState) {
                case DEFAULT:
                case DRAG_SELECTION:
                    break;

                case DRAG_SELECTION_POSSIBLE:
                    mouseState = MouseState.DRAG_SELECTION;
                    break;

                case CHAR_SELECTION:
                    if (evt.isAltDown() && evt.isShiftDown()) {
                        moveDot(offset);
                    } else {
                        moveDot(offset);
                        adjustRectangularSelectionMouseX(evt.getX(), evt.getY());
                    }
                    break; // Use the offset under mouse pointer

                case WORD_SELECTION:
                    // Increase selection if at least in the middle of a word.
                    // It depends whether selection direction is from lower offsets upward or back.
                    if (offset >= mark) { // Selection extends forward.
                        offset = LineDocumentUtils.getWordEnd(lineDoc, offset);
                    } else { // Selection extends backward.
                        offset = LineDocumentUtils.getWordStart(lineDoc, offset);
                    }
                    selectEnsureMinSelection(mark, dot, offset);
                    break;

                case LINE_SELECTION:
                    if (offset >= mark) { // Selection extends forward
                        offset = Math.min(LineDocumentUtils.getLineEnd(lineDoc, offset) + 1, c.getDocument().getLength());
                    } else { // Selection extends backward
                        offset = LineDocumentUtils.getLineStart(lineDoc, offset);
                    }
                    selectEnsureMinSelection(mark, dot, offset);
                    break;

                default:
                    throw new AssertionError("Invalid state " + mouseState); // NOI18N
            }
        } catch (BadLocationException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:61,代码来源:EditorCaret.java

示例14: onlyShift

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private static boolean onlyShift(MouseEvent e) {
    return e.isShiftDown() && !(e.isAltDown() || e.isAltGraphDown() ||
                                e.isControlDown() || e.isMetaDown());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:ProfilerTableContainer.java

示例15: isForceMarqueeEvent

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
 * Note: This is not used during drag and drop operations due to limitations of the underlying
 * API. To enable this for move operations set dragEnabled to false.
 * 
 * @param event
 * @return Returns true if the given event is constrained.
 */
public boolean isForceMarqueeEvent(MouseEvent event) {
  return (event != null) ? event.isAltDown() : false;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:11,代码来源:mxGraphComponent.java


注:本文中的java.awt.event.MouseEvent.isAltDown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。