Java Doc for MouseSelectionTracker.java in  » GIS » GeoTools-2.4.1 » org » geotools » gui » swing » 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 » GIS » GeoTools 2.4.1 » org.geotools.gui.swing 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.swing.event.MouseInputAdapter
   org.geotools.gui.swing.MouseSelectionTracker

MouseSelectionTracker
abstract class MouseSelectionTracker extends MouseInputAdapter (Code)
Controller which allows the user to select a region of a component. The user must click on a point in the component, then drag the mouse pointer whilst keeping the button pressed. During the dragging, the shape which is drawn will normally be a rectangle. Other shapes could always be used such as, for example, an ellipse. To use this class, it is necessary to create a derived class which defines the following methods: This controller should then be registered with one, and only one, component using the following syntax:
Component  component=...
 MouseSelectionTracker control=...
 component.addMouseListener(control);
 

since:
   2.0
version:
   $Id: MouseSelectionTracker.java 22482 2006-10-31 02:58:00Z desruisseaux $
author:
   Martin Desruisseaux



Constructor Summary
public  MouseSelectionTracker()
     Constructs an object which will allow rectangular regions to be selected using the mouse.

Method Summary
protected  ShapegetModel(MouseEvent event)
     Returns the geometric shape to use for marking the boundaries of a region.
public  ShapegetSelectedArea(AffineTransform transform)
     Returns the geometric shape surrounding the last region to be selected by the user.
public  voidmouseDragged(MouseEvent event)
     Informs this controller that the mouse has been dragged.
public  voidmouseMoved(MouseEvent event)
     Informs this controller that the mouse has been moved but not as a result of the user selecting a region.
public  voidmousePressed(MouseEvent event)
     Informs this controller that the mouse button has been pressed.
public  voidmouseReleased(MouseEvent event)
     Informs this controller that the mouse button has been released.
abstract protected  voidselectionPerformed(int ox, int oy, int px, int py)
     Method which is automatically called after the user selects a region with the mouse.
public  voidsetXORColors(Color a, Color b)
     Specifies the colours to be used for drawing the outline of a box when the user selects a region.


Constructor Detail
MouseSelectionTracker
public MouseSelectionTracker()(Code)
Constructs an object which will allow rectangular regions to be selected using the mouse.




Method Detail
getModel
protected Shape getModel(MouseEvent event)(Code)
Returns the geometric shape to use for marking the boundaries of a region. This shape is normally a rectangle but could also be an ellipse, an arrow or even other shapes. The coordinates of the returned shape will not be taken into account. In fact, these coordinates will regularly be discarded. Only the class of the returned shape will count (for example, java.awt.geom.Ellipse2D vs java.awt.geom.Rectangle2D ) and their parameters which are not linked to their position (for example, the rounding of a rectangle's corners).

The shape returned will normally be from a class derived from RectangularShape , but could also be from the Line2D class. Any other class risks throwing a ClassCastException when executed. The default implementation always returns an object Rectangle .
Parameters:
  event - Mouse coordinate when the button is pressed. This information can be used bythe derived classes which like to be informed of the position of the mouse beforechosing a geometric shape. Shape from the class {link RectangularShape} or {link Line2D}, or null to indicate that we do not want to make a selection.




getSelectedArea
public Shape getSelectedArea(AffineTransform transform) throws NoninvertibleTransformException(Code)
Returns the geometric shape surrounding the last region to be selected by the user. An optional affine transform can be specified to convert the region selected by the user into logical coordinates. The class of the shape returned depends on the model returned by MouseSelectionTracker.getModel :
  • If the model is null (which means that this MouseSelectionTracker object only draws a line between points), the object returned will belong to the Line2D class.
  • If the model is not null, the object returned can be from the same class (most often java.awt.geom.Rectangle2D ). There could always be situations where the object returned is from another class, for example if the affine transform carries out a rotation.

Parameters:
  transform - Affine transform which converts logical coordinates into pixel coordinates.It is usually an affine transform which is used in a paint(...) method todraw shapes expressed in logical coordinates. A geometric shape enclosing the last region to be selected by the user, or null if no selection has yet been made.
throws:
  NoninvertibleTransformException - If the affine transform can't be inverted.



mouseDragged
public void mouseDragged(MouseEvent event)(Code)
Informs this controller that the mouse has been dragged. The default implementation uses this to move a corner of the rectangle used to select the region. The other corner remains fixed at the point where the mouse was at the moment its button was pressed..



mouseMoved
public void mouseMoved(MouseEvent event)(Code)
Informs this controller that the mouse has been moved but not as a result of the user selecting a region. The default implementation signals to the source component that this is no longer interested in being informed about mouse movements.



mousePressed
public void mousePressed(MouseEvent event) throws ClassCastException(Code)
Informs this controller that the mouse button has been pressed. The default implementation retains the mouse coordinate (which will become one of the corners of the future rectangle to be drawn) and prepares this to observe the mouse movements.
throws:
  ClassCastException - if MouseSelectionTracker.getModel doesn't return a shapefrom the class {link RectangularShape} or {link Line2D}.



mouseReleased
public void mouseReleased(MouseEvent event)(Code)
Informs this controller that the mouse button has been released. The default implementation calls MouseSelectionTracker.selectionPerformed with the bounds of the selected region as parameters.



selectionPerformed
abstract protected void selectionPerformed(int ox, int oy, int px, int py)(Code)
Method which is automatically called after the user selects a region with the mouse. All coordinates passed in as parameters are expressed in pixels.
Parameters:
  ox - x coordinate of the mouse when the user pressed the mouse button.
Parameters:
  oy - y coordinate of the mouse when the user pressed the mouse button.
Parameters:
  px - x coordinate of the mouse when the user released the mouse button.
Parameters:
  py - y coordinate of the mouse when the user released the mouse button.



setXORColors
public void setXORColors(Color a, Color b)(Code)
Specifies the colours to be used for drawing the outline of a box when the user selects a region. All a colours will be replaced by b colours and vice versa.




www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.