View Javadoc
1   /*
2    * Copyright (c) 2005, The JUNG Authors
3    * All rights reserved.
4    *
5    * This software is open-source under the BSD license; see either "license.txt"
6    * or https://github.com/jrtom/jung/blob/master/LICENSE for a description.
7    *
8    * Created on Jul 6, 2005
9    */
10  
11  package edu.uci.ics.jung.visualization.control;
12  
13  import java.awt.event.MouseAdapter;
14  import java.awt.event.MouseEvent;
15  
16  /**
17   * Simple extension of MouseAdapter that supplies modifier
18   * checking
19   * 
20   * @author Tom Nelson 
21   *
22   */
23  public class GraphMouseAdapter extends MouseAdapter {
24  
25      protected int modifiers;
26      
27      public GraphMouseAdapter(int modifiers) {
28          this.modifiers = modifiers;
29      }
30      
31      public int getModifiers() {
32          return modifiers;
33      }
34  
35      public void setModifiers(int modifiers) {
36          this.modifiers = modifiers;
37      }
38      
39      protected boolean checkModifiers(MouseEvent e) {
40          return e.getModifiers() == modifiers;
41      }
42  }