|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.geom.Dimension2D
java.awt.Dimension
view.MyDimension
public class MyDimension
Adds a String constructor to Dimension. A dimension object can now also be defined with a string of the format:
200x300
| Field Summary | |
|---|---|
static char |
X
The separator char between width and height, an 'x'. |
| Fields inherited from class java.awt.Dimension |
|---|
height, width |
| Constructor Summary | |
|---|---|
MyDimension()
Constructs an empty dimension. |
|
MyDimension(Dimension dim)
|
|
MyDimension(int w,
int h)
|
|
MyDimension(String xed)
Parses the string with parseDimension(java.lang.String) and calls the
super-constructor with the resulting dimension. |
|
| Method Summary | |
|---|---|
private static String |
getAfter(String arg,
char sep)
Returns the portion of the string after the separator char, excluding it. |
private static String |
getBefore(String arg,
char sep)
Returns the portion of the string before the separator char, excluding it. |
static Dimension |
parseDimension(String xed)
Parses a string by separating it at the central 'x'. |
String |
toString()
|
static String |
toString(Dimension size)
Converts a dimension object to a string that can be parsed into a Dimension object with a call to parseDimension(java.lang.String). |
| Methods inherited from class java.awt.Dimension |
|---|
equals, getHeight, getSize, getWidth, hashCode, setSize, setSize, setSize |
| Methods inherited from class java.awt.geom.Dimension2D |
|---|
clone, setSize |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final char X
| Constructor Detail |
|---|
public MyDimension()
public MyDimension(Dimension dim)
public MyDimension(int w,
int h)
public MyDimension(String xed)
parseDimension(java.lang.String) and calls the
super-constructor with the resulting dimension.
| Method Detail |
|---|
public static final Dimension parseDimension(String xed)
public static String toString(Dimension size)
parseDimension(java.lang.String).
public String toString()
toString in class Dimension
private static String getBefore(String arg,
char sep)
private static String getAfter(String arg,
char sep)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||