|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.gui.ComponentFactory
ComponentFactory has 3 static methods that create
gui or graphical objects from more general objects.
makeComponent that constructs a Component
from an ObjectmakeIcon that constructs an Icon
from an ObjectmakePaintable that constructs a Paintable
from an Object
The first two methods both make certain specific attempts to convert a
general Object into the desired type. If these attempts
fail then the methods use the makePaintable method to try
to convert the Object into a Paintable. If
that attempt succeeds then the Paintable is placed
into a PaintableComponent. On the other hand, if this
final attempt fails then null is returned.
As of 2.6.0, makePaintable returns a
MultiLineTextPaintable if it is given a String.
| Constructor Summary | |
ComponentFactory()
|
|
| Method Summary | |
static Component |
makeComponent(Object o)
Returns a Component associated with the given
object. |
static Icon |
makeIcon(Object o)
Returns an Icon associated with the given
object. |
static Paintable |
makePaintable(Object o)
Returns a Paintable associated with the given
object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ComponentFactory()
| Method Detail |
public static Component makeComponent(Object o)
Returns a Component associated with the given
object.
The table below shows more about how makeComponent works.
| Argument | Return | ||
Component |
The same Component |
||
String |
Annotation |
||
Icon |
Annotation |
||
Action |
JButton |
||
Paint |
PaintSwatch |
||
|
PaintableComponent |
||
| otherwise | null |
o - the object to make into a Componentpublic static Icon makeIcon(Object o)
Returns an Icon associated with the given
object.
The table below shows more about how makeIcon works.
| Argument | Return | ||
Icon |
The same Icon |
||
Paint |
PaintSwatch |
||
|
PaintableComponent |
||
| otherwise | null |
o - the object to make into an Iconpublic static Paintable makePaintable(Object o)
Returns a Paintable associated with the given
object.
The table below shows more about how makePaintable works.
| Argument | Return |
Paintable |
The same Paintable |
Shape |
ShapePaintable |
PathList |
ShapePaintable |
Image |
ImagePaintable |
ImageIcon |
ImagePaintable |
String |
MultiLineTextPaintable |
Point2D |
PointPaintable |
Object[] |
PaintableSequence |
| otherwise | null |
o - the object to make into a Paintable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||