Java Doc for DraggablePoint.java in  » Science » jcm1-source » edu » hws » jcm » draw » 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 » Science » jcm1 source » edu.hws.jcm.draw 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   edu.hws.jcm.draw.Drawable
      edu.hws.jcm.draw.DraggablePoint

DraggablePoint
public class DraggablePoint extends Drawable implements InputObject,Draggable(Code)
A DraggablePoint can be added to a DisplayCanvas, where it appears as a small disk, square, or cross. (The visual style is a settable property.) This object can be dragged with the mouse, within the limits of the CoordinateRect that contains the DraggablePoint. Either the x- or y-value of the point can be clamped to a specified Value. Typically, the y-value might be given by some function of the x-value. In that case, the point is constrained to move along the graph of the function. Or the x- or y-value can be clamped to a constant to make the point move along a vertical or horizontal line. Two Variables are associated with the DraggablePoint. These Variables represent the x- and y- values of the point. Each Variable implements the Tieable interface, so it can be synchronized with other Tieable values such as a VariableIput or VariableSlider.


Field Summary
final public static  intCROSS
     A style constant that specifies the visual appearance of a DraggablePoint to be a cross.
final public static  intDISK
     A style constant that specifies the visual appearance of a DraggablePoint to be a disk.
final public static  intSQUARE
     A style constant that specifies the visual appearance of a DraggablePoint to be a square.

Constructor Summary
public  DraggablePoint()
     Create a DraggablePoint with default values for style, radius, color.
public  DraggablePoint(int style)
     Create a DraggablePoint with specified visual style.

Method Summary
public  voidcheckInput()
     This method is required by the InputObject interface.
public  voidclampX(Value v)
     Clamp the x-value of the point to v.
public  voidclampX(double x)
     Clamp the x-value of the point to the constant x, so that the point is constrained to a vertical line.
public  voidclampX(Function f)
     Clamp the x-value of the point to the function f, so that the point is constrained to move along the graph of x = f(y).
public  voidclampY(Value v)
     Clamp the y-value of the point to v.
public  voidclampY(double y)
     Clamp the y-value of the point to the constant y, so that the point is constrained to a horizontal line.
public  voidclampY(Function f)
     Clamp the y-value of the point to the function f, so that the point is constrained to move along the graph of y = f(x).
public  voidcontinueDrag(MouseEvent evt)
     Continue a drag operation begun in startDrag().
public  voiddraw(Graphics g, boolean coordsChanged)
     This method, from the Drawable interface, draws the point.
public  voidfinishDrag(MouseEvent evt)
     Finish a drag operation begun in startDrag().
public  ColorgetColor()
     Get the color used for drawing the point.
public  ColorgetGhostColor()
     Get the "ghostColor" of the point.
public  ControllergetOnUserAction(Controller c)
     Get the Controller that is notified when the user drags the point.
public  intgetRadius()
     Get the radius used for drawing the point.
public  intgetStyle()
     Get the visual style of the point, which must be one of the constants DraggablePoint.DISK, DraggablePoint.SQUARE, or DraggablePoint.CROSS.
public  VariablegetXVar()
     Get the variable that represents the current x-value of the point.
public  VariablegetYVar()
     Get the variable that represents the current y-value of the point.
public  voidnotifyControllerOnChange(Controller c)
     Method required by InputObject interface; in this class, it simply calls setOnUserAction(c).
public  voidsetColor(Color c)
     Set the color to be used for drawing the point.
public  voidsetGhostColor(Color c)
     Set the ghoseColor to be used for drawing the point when it location is undefined or is outside the proper limits.
public  voidsetLocation(double x, double y)
     Move the point to (x,y), then "clamp" the value of x or y, if a clamp Value has been set.
public  voidsetOnUserAction(Controller c)
     Set the Controller that is to be notified when the user drags the point.
public  voidsetRadius(int r)
     Set the radius that determines the size of the point when it is drawn.
public  voidsetStyle(int style)
     Set the visual style of the point.
public  booleanstartDrag(MouseEvent evt)
     Check whether a mouse click (as specified in the MouseEvent parameter) is a click on this DraggablePoint.

Field Detail
CROSS
final public static int CROSS(Code)
A style constant that specifies the visual appearance of a DraggablePoint to be a cross.



DISK
final public static int DISK(Code)
A style constant that specifies the visual appearance of a DraggablePoint to be a disk.



SQUARE
final public static int SQUARE(Code)
A style constant that specifies the visual appearance of a DraggablePoint to be a square.




Constructor Detail
DraggablePoint
public DraggablePoint()(Code)
Create a DraggablePoint with default values for style, radius, color. The point appears as a dark gray disk of radius 4.



DraggablePoint
public DraggablePoint(int style)(Code)
Create a DraggablePoint with specified visual style. Radius is 4, color is darkGray, and ghostColor is lightGray.
Parameters:
  style - One of the style constants DraggablePoint.DISK, DraggablePoint.SQUARE, or DraggablePoint.CROSS.




Method Detail
checkInput
public void checkInput()(Code)
This method is required by the InputObject interface. In this case, it just applies the clamping Values if any are specified.



clampX
public void clampX(Value v)(Code)
Clamp the x-value of the point to v. That is, if v is not null, then whenever the location of the point changes, its x-value is modified to v.getVal(). Note that if v is non-null then any clamp Value specified for y will be cleared since x and y cannot both be clamped.



clampX
public void clampX(double x)(Code)
Clamp the x-value of the point to the constant x, so that the point is constrained to a vertical line.



clampX
public void clampX(Function f)(Code)
Clamp the x-value of the point to the function f, so that the point is constrained to move along the graph of x = f(y). f must be a function of one variable.



clampY
public void clampY(Value v)(Code)
Clamp the y-value of the point to v. That is, if v is not null, then whenever the location of the point changes, its y-value is modified to v.getVal(). Note that if v is non-null then any clamp Value specified for x will be cleared since x and y cannot both be clamped.



clampY
public void clampY(double y)(Code)
Clamp the y-value of the point to the constant y, so that the point is constrained to a horizontal line.



clampY
public void clampY(Function f)(Code)
Clamp the y-value of the point to the function f, so that the point is constrained to move along the graph of y = f(x). f must be a function of one variable.



continueDrag
public void continueDrag(MouseEvent evt)(Code)
Continue a drag operation begun in startDrag(). This is not meant to be called directly.



draw
public void draw(Graphics g, boolean coordsChanged)(Code)
This method, from the Drawable interface, draws the point. It is not usually called directly.



finishDrag
public void finishDrag(MouseEvent evt)(Code)
Finish a drag operation begun in startDrag(). This is not meant to be called directly.



getColor
public Color getColor()(Code)
Get the color used for drawing the point.



getGhostColor
public Color getGhostColor()(Code)
Get the "ghostColor" of the point. This color is used for drawing the point when its x-value or y-value is undefined or outside the range of values on the CoordinateRect that contains the point. (This can happen because of clamping of values. It can also happen if the limits on the CoordinateRect are changed.)



getOnUserAction
public Controller getOnUserAction(Controller c)(Code)
Get the Controller that is notified when the user drags the point. A null value means that no notification is done.



getRadius
public int getRadius()(Code)
Get the radius used for drawing the point. The point's height and width are given by two times the radius.



getStyle
public int getStyle()(Code)
Get the visual style of the point, which must be one of the constants DraggablePoint.DISK, DraggablePoint.SQUARE, or DraggablePoint.CROSS.



getXVar
public Variable getXVar()(Code)
Get the variable that represents the current x-value of the point. (Note that this variable can be type-cast to type Tieable.)



getYVar
public Variable getYVar()(Code)
Get the variable that represents the current y-value of the point. (Note that this variable can be type-cast to type Tieable.)



notifyControllerOnChange
public void notifyControllerOnChange(Controller c)(Code)
Method required by InputObject interface; in this class, it simply calls setOnUserAction(c). This is meant to be called by JCMPanel.gatherInputs().



setColor
public void setColor(Color c)(Code)
Set the color to be used for drawing the point. If the specified Color value is null, then nothing is done.



setGhostColor
public void setGhostColor(Color c)(Code)
Set the ghoseColor to be used for drawing the point when it location is undefined or is outside the proper limits. If the specified Color value is null, then nothing is done.



setLocation
public void setLocation(double x, double y)(Code)
Move the point to (x,y), then "clamp" the value of x or y, if a clamp Value has been set.



setOnUserAction
public void setOnUserAction(Controller c)(Code)
Set the Controller that is to be notified when the user drags the point. (The compute() method of the Controller is called.) If the Controller value is null, then no notification is done.



setRadius
public void setRadius(int r)(Code)
Set the radius that determines the size of the point when it is drawn. The point's height and width are given by two times the radius.



setStyle
public void setStyle(int style)(Code)
Set the visual style of the point. The style should be one of the constants DraggablePoint.DISK, DraggablePoint.SQUARE, or DraggablePoint.CROSS. If it is not, then nothing is done.



startDrag
public boolean startDrag(MouseEvent evt)(Code)
Check whether a mouse click (as specified in the MouseEvent parameter) is a click on this DraggablePoint. If so, return true, and start a drag operation. It is expected that the continueDrag() and finishDrag() will be called to complete the drag operation. This is only meant to be called from the checkDraggables() method in class CoordinateRect.



Fields inherited from edu.hws.jcm.draw.Drawable
protected DisplayCanvas canvas(Code)(Java Doc)
protected CoordinateRect coords(Code)(Java Doc)

Methods inherited from edu.hws.jcm.draw.Drawable
abstract public void draw(Graphics g, boolean coordsChanged)(Code)(Java Doc)
public boolean getVisible()(Code)(Java Doc)
public void needsRedraw()(Code)(Java Doc)
protected void setOwnerData(DisplayCanvas canvas, CoordinateRect coords)(Code)(Java Doc)
public void setVisible(boolean show)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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