當前位置: 首頁>>代碼示例>>Java>>正文


Java SwingUtilities.isLeftMouseButton方法代碼示例

本文整理匯總了Java中javax.swing.SwingUtilities.isLeftMouseButton方法的典型用法代碼示例。如果您正苦於以下問題:Java SwingUtilities.isLeftMouseButton方法的具體用法?Java SwingUtilities.isLeftMouseButton怎麽用?Java SwingUtilities.isLeftMouseButton使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.SwingUtilities的用法示例。


在下文中一共展示了SwingUtilities.isLeftMouseButton方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processMouseEvent

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
/**
 * Processes a mouse event.
 *
 * @param e the MouseEvent
 */
@Override protected void processMouseEvent(MouseEvent e) {
    super.processMouseEvent(e);
    if (!e.isConsumed()) {
        if (e.isPopupTrigger()) {
            // Show a popup allowing to configure the various options
            showPopup(e.getX(), e.getY());
        }  else if (e.getID() == e.MOUSE_ENTERED) {
            containsMouse = true;
            cachedBorderVaild = false;
            repaint();
        } else if (e.getID() == e.MOUSE_EXITED) {
            containsMouse = false;
            cachedBorderVaild = false;
            repaint();
        }

    } 
    
    if (e.getID() == MouseEvent.MOUSE_CLICKED &&
            SwingUtilities.isLeftMouseButton(e) && 
            e.getClickCount() == 1) {
        // Trigger a gc
        GarbageCollectAction.get(GarbageCollectAction.class).performAction();;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:31,代碼來源:HeapView.java

示例2: mouseClicked

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
@Override
public void mouseClicked(MouseEvent e) {
    try {
        if (SwingUtilities.isLeftMouseButton(e)) {
            JTextPane pane = (JTextPane)e.getSource();
            StyledDocument doc = pane.getStyledDocument();
            Element elem = doc.getCharacterElement(pane.viewToModel(e.getPoint()));
            AttributeSet as = elem.getAttributes();
            Link link = (Link)as.getAttribute(LINK_ATTRIBUTE);
            if (link != null) {
                link.onClick(elem.getDocument().getText(elem.getStartOffset(), elem.getEndOffset() - elem.getStartOffset()));
            }
        }
    } catch(Exception ex) {
        Support.LOG.log(Level.SEVERE, null, ex);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:HyperlinkSupport.java

示例3: mouseReleased

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
public void mouseReleased(MouseEvent e) {
    if (!SwingUtilities.isLeftMouseButton(e)) return;
    chart.updateSelection(true, this);

    if (draggingRow == null && e.getSource() == chart)
        support.indexSelectionChanged(selection.getStartIndex(),
                                      selection.getEndIndex());
    
    updateRowState(e, false);
    updateCursor();

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            selection.setEnabled(true);
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:TimelinePanel.java

示例4: mousePressed

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
@Override
public void mousePressed(MouseEvent e) {
    if (SwingUtilities.isLeftMouseButton(e)) {
        drag = false;
        click.x = e.getX();
        click.y = e.getY();
    }
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:9,代碼來源:SelectionManager.java

示例5: mouseDragged

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
@Override
public void mouseDragged(MouseEvent e) {
    if (SwingUtilities.isLeftMouseButton(e)) {
        drag = true;
        start.x = click.x;
        start.y = click.y;
        if (start.y < 20 || e.getY() < 20) {
            uiController.getFrame().setVisible(false);
        }
        end.x = e.getX();
        end.y = e.getY();
        editor.doCroping();
    }
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:15,代碼來源:Cropper.java

示例6: mouseReleased

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
@Override
public void mouseReleased(MouseEvent e) {
	super.mouseReleased(e);
	if (!SwingUtilities.isLeftMouseButton(e)) {
		return;
	}
	repostEvent(e);
	dispatchComponent = null;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:10,代碼來源:EditableTableHeaderUI.java

示例7: mousePressed

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
@Override
public void mousePressed(MouseEvent e)
{
	if( SwingUtilities.isLeftMouseButton(e) && e.getComponent().isEnabled() )
	{
		spinner = eventToSpinner(e);
		autoRepeatTimer.start();

		focusSpinnerIfNecessary();
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:12,代碼來源:FlatterSpinnerUI.java

示例8: mousePressed

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
@Override
public void mousePressed(MouseEvent e) {
	// this is used to only allow left mouse button zoom / selection
	if (!SwingUtilities.isLeftMouseButton(e)) {
		blockSelectionOrZoom = true;
	} else {
		blockSelectionOrZoom = false;
	}
	super.mousePressed(e);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:11,代碼來源:LinkAndBrushChartPanel.java

示例9: mouseClicked

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
@Override
public void mouseClicked(MouseEvent evt) {
    JTextComponent c = getEditorComponent();
    if (SwingUtilities.isLeftMouseButton(evt)) {
        if (c != null && evt.getClickCount() == 2) {
            pasteContent();
            hide();
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:CompletionLayoutPopup.java

示例10: mouseClicked

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
@Override
public void mouseClicked(MouseEvent e) {
    if (SwingUtilities.isLeftMouseButton(e) && MouseUtils.isDoubleClick(e)) {
        if (!getSelectedNodes().isEmpty()) {
            modeKeeper.storeMode();
        }
    }
    super.mouseClicked(e);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:FileTreeViewImpl.java

示例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);
				}	
			} 
		}
	}
	
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:39,代碼來源:GraphEnvironmentMousePlugin.java

示例12: mouseDragged

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
@Override
public void mouseDragged(MouseEvent e) {
    if (SwingUtilities.isLeftMouseButton(e)) {
        drag = true;
        start.x = click.x;
        start.y = click.y;
        end.x = e.getX();
        end.y = e.getY();
        drawSelection(com.getGraphics());
    }
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:12,代碼來源:SelectionManager.java

示例13: mouseDragged

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
public void mouseDragged(MouseEvent e) {
	mouseX = e.getX();
	mouseY = e.getY();
	if (SwingUtilities.isLeftMouseButton(e)) {
		mouseB = 1;
	}
	if (SwingUtilities.isRightMouseButton(e)) {
		mouseB = 3;
	}

	MouseDraggedEvent event = new MouseDraggedEvent(e.getX(), e.getY(), mouseB);
	try {
		eventListener.onEvent(event);
	} catch (Exception ex) {}
}
 
開發者ID:ritcat14,項目名稱:The-Mysterious-Mind-Of-Jack,代碼行數:16,代碼來源:Mouse.java

示例14: addPoint

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
public void addPoint(int x, int y, MouseEvent me, boolean[][] glider, boolean[][] spaceship, boolean[][] unstOne) 
{
	//This Method is responsible for defining the Boolean Value of a point within the Game of Life Board Array.
	
	SwingUtilities.isLeftMouseButton(me);
	SwingUtilities.isRightMouseButton(me);
	if(MGoL_GUI.isGlider)
	{	
		//if isGlider Boolean is true. The following array will generate at the Point of mouse click. 
		//This Array will print out the Boolean Gun based on the pre-written 9 x 36 array manually written within the Action Events method.
		for(int i=0; i < 9; ++i)     
		{  										
			for(int j=0; j < 36; ++j)
			{
				//Prints out the array at the mouse press point.
				if(glider[i][j]) { point.add(new Point(x+i, y+j)); }
			}		
		}
	}
	else if(MGoL_GUI.isSpaceship)
	{	
		//if isSpaceship Boolean is true. The following array will generate at the Point of mouse click. 
		//This Array will print out the Boolean ship based on the pre-written 5 x 4  array manually written within the Action Events method.
		for(int k=0; k < 4; ++k)
		{
			for(int l=0; l < 5; ++l)
			{
				//Prints out the array at the mouse press point.
				if(spaceship[k][l]) { point.add(new Point(x+k, y+l)); }
			}		
		}
	}
	else if(MGoL_GUI.isUnstOne)
	{
		//if inUnstOne Boolean is true. The following array will generate at the Point of mouse click. 
		//This Array will print out the Boolean Unstable Pattern based on the pre-written array manually written within the Action Events method.
		for(int m=0; m < 10; ++m)
		{
			for(int n=0; n < 12; ++n)
			{
				//Prints out the array at the mouse press point.
				if(unstOne[m][n]) { point.add(new Point(x+n, y+m)); }
			}		
		}
	}
	
	/*
	 * Allow me to explain what happens here, 
	 * the nested for loops perform a recursive action-
	 * to generate a pattern based on the Boolean Array-
	 * Defined for specific pattern selections within the-
	 * GUI Class.
	 */
	
	//If Left Mouse Button is pressed on the mouse.
	//This is the default Point selection.
	else if (SwingUtilities.isLeftMouseButton(me)) { point.add(new Point(x,y)); } //Add Point at Mouse Press 
	
	//This IF STATEMENT is responsible for removing points.
	else if (SwingUtilities.isRightMouseButton(me)) //If Right Mouse Button is pressed on the mouse.
	{
		point.remove(new Point(x,y));//Remove Point at Mouse Press
		++MGoL_GUI.deadCount; //Increase Death Count Statistics.
		--MGoL_GUI.survivorCount; //Increase Survivor Count Statistics
	}	  	
	repaint();
}
 
開發者ID:Mannjamin,項目名稱:Manns-Game-of-Life-Updated-Version,代碼行數:68,代碼來源:MGoL_Backend.java

示例15: isLeftMouseButtonExt

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
private boolean isLeftMouseButtonExt(MouseEvent evt) {
    return (SwingUtilities.isLeftMouseButton(evt)
            && !(evt.isPopupTrigger())
            && (evt.getModifiers() & (InputEvent.META_MASK | InputEvent.ALT_MASK)) == 0);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:BaseCaret.java


注:本文中的javax.swing.SwingUtilities.isLeftMouseButton方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。