view
Class MyPoint

java.lang.Object
  extended by java.awt.geom.Point2D
      extended by java.awt.Point
          extended by view.MyPoint
All Implemented Interfaces:
Serializable, Cloneable

public class MyPoint
extends Point

An extension to point allowing construction with a comma-separated string.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Point2D
Point2D.Double, Point2D.Float
 
Field Summary
 
Fields inherited from class java.awt.Point
x, y
 
Constructor Summary
MyPoint()
           
MyPoint(int x, int y)
           
MyPoint(Point p)
           
MyPoint(String desc)
          Constrcuts a new point from a comma-separated string.
 
Method Summary
static Point parsePoint(String desc)
          Parses a point from a String.
 String toString()
          Overrides the string representation.
static String toString(Point p)
          Overrides the string representation.
 
Methods inherited from class java.awt.Point
equals, getLocation, getX, getY, move, setLocation, setLocation, setLocation, translate
 
Methods inherited from class java.awt.geom.Point2D
clone, distance, distance, distance, distanceSq, distanceSq, distanceSq, hashCode, setLocation
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MyPoint

public MyPoint()

MyPoint

public MyPoint(Point p)

MyPoint

public MyPoint(int x,
               int y)

MyPoint

public MyPoint(String desc)
Constrcuts a new point from a comma-separated string. If the string cannot be parsed an IllegalArgumentException is thrown.

Method Detail

parsePoint

public static Point parsePoint(String desc)
Parses a point from a String. Throws an IllegalArgumentException if parsing fails.


toString

public static String toString(Point p)
Overrides the string representation. Here, output is reduced to a simple two-integer string, separated by a comma. The output string is feasable for direct-passing it to the constructor of this class. The static version also works with the original Point class.


toString

public String toString()
Overrides the string representation. Here, output is reduced to a simple two-integer string, separated by a comma. The output string is feasable for direct-passing it to the constructor of this class.

Overrides:
toString in class Point