本文整理汇总了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();;
}
}
示例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);
}
}
示例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);
}
});
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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);
}
示例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();
}
}
}
示例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);
}
示例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: 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());
}
}
示例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) {}
}
示例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();
}
示例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);
}