Source Code Cross Referenced for PanControl.java in  » Database-Client » prefuse » prefuse » controls » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » prefuse » prefuse.controls 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package prefuse.controls;
002:
003:        import java.awt.Cursor;
004:        import java.awt.event.MouseEvent;
005:
006:        import prefuse.Display;
007:        import prefuse.util.ui.UILib;
008:        import prefuse.visual.VisualItem;
009:
010:        /**
011:         * Pans the display, changing the viewable region of the visualization.
012:         * By default, panning is accomplished by clicking on the background of a
013:         * visualization with the left mouse button and then dragging.
014:         *
015:         * @author <a href="http://jheer.org">jeffrey heer</a>
016:         */
017:        public class PanControl extends ControlAdapter {
018:
019:            private boolean m_panOverItem;
020:            private int m_xDown, m_yDown;
021:            private int m_button;
022:
023:            /**
024:             * Create a new PanControl.
025:             */
026:            public PanControl() {
027:                this (LEFT_MOUSE_BUTTON, false);
028:            }
029:
030:            /**
031:             * Create a new PanControl.
032:             * @param panOverItem if true, the panning control will work even while
033:             * the mouse is over a visual item.
034:             */
035:            public PanControl(boolean panOverItem) {
036:                this (LEFT_MOUSE_BUTTON, panOverItem);
037:            }
038:
039:            /**
040:             * Create a new PanControl.
041:             * @param mouseButton the mouse button that should initiate a pan. One of
042:             * {@link Control#LEFT_MOUSE_BUTTON}, {@link Control#MIDDLE_MOUSE_BUTTON},
043:             * or {@link Control#RIGHT_MOUSE_BUTTON}.
044:             */
045:            public PanControl(int mouseButton) {
046:                this (mouseButton, false);
047:            }
048:
049:            /**
050:             * Create a new PanControl
051:             * @param mouseButton the mouse button that should initiate a pan. One of
052:             * {@link Control#LEFT_MOUSE_BUTTON}, {@link Control#MIDDLE_MOUSE_BUTTON},
053:             * or {@link Control#RIGHT_MOUSE_BUTTON}.
054:             * @param panOverItem if true, the panning control will work even while
055:             * the mouse is over a visual item.
056:             */
057:            public PanControl(int mouseButton, boolean panOverItem) {
058:                m_button = mouseButton;
059:                m_panOverItem = panOverItem;
060:            }
061:
062:            // ------------------------------------------------------------------------
063:
064:            /**
065:             * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
066:             */
067:            public void mousePressed(MouseEvent e) {
068:                if (UILib.isButtonPressed(e, m_button)) {
069:                    e.getComponent().setCursor(
070:                            Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
071:                    m_xDown = e.getX();
072:                    m_yDown = e.getY();
073:                }
074:            }
075:
076:            /**
077:             * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
078:             */
079:            public void mouseDragged(MouseEvent e) {
080:                if (UILib.isButtonPressed(e, m_button)) {
081:                    Display display = (Display) e.getComponent();
082:                    int x = e.getX(), y = e.getY();
083:                    int dx = x - m_xDown, dy = y - m_yDown;
084:                    display.pan(dx, dy);
085:                    m_xDown = x;
086:                    m_yDown = y;
087:                    display.repaint();
088:                }
089:            }
090:
091:            /**
092:             * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
093:             */
094:            public void mouseReleased(MouseEvent e) {
095:                if (UILib.isButtonPressed(e, m_button)) {
096:                    e.getComponent().setCursor(Cursor.getDefaultCursor());
097:                    m_xDown = -1;
098:                    m_yDown = -1;
099:                }
100:            }
101:
102:            /**
103:             * @see prefuse.controls.Control#itemPressed(prefuse.visual.VisualItem, java.awt.event.MouseEvent)
104:             */
105:            public void itemPressed(VisualItem item, MouseEvent e) {
106:                if (m_panOverItem)
107:                    mousePressed(e);
108:            }
109:
110:            /**
111:             * @see prefuse.controls.Control#itemDragged(prefuse.visual.VisualItem, java.awt.event.MouseEvent)
112:             */
113:            public void itemDragged(VisualItem item, MouseEvent e) {
114:                if (m_panOverItem)
115:                    mouseDragged(e);
116:            }
117:
118:            /**
119:             * @see prefuse.controls.Control#itemReleased(prefuse.visual.VisualItem, java.awt.event.MouseEvent)
120:             */
121:            public void itemReleased(VisualItem item, MouseEvent e) {
122:                if (m_panOverItem)
123:                    mouseReleased(e);
124:            }
125:
126:        } // end of class PanControl
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.