当前位置: 首页>>代码示例>>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;未经允许,请勿转载。