ShapeLabel
class that extends
JLabel
and overrides its paint()
method so that, instead of
rendering text, it renders the shape.
Create a ShapeRenderer
that extends
the ShapeLabel
class and also
implements the ListCellRenderer
interface.
ShapeLabel
object can be printed at its current
position and size (i.e., it does not need to be translated or
scaled) using a
PrinterJob
object on page 0. You may assume that it will
fit on a single page.
<play> <title>All's Well That Ends Well</title> <personae> <persona>KING OF FRANCE</persona> <persona>DUKE OF FLORENCE</persona> <persona>BERTRAM, Count of Rousillon.</persona> <persona>LAFEU, an old lord.</persona> </personae> </play>
Write an application (that includes a class that extends
DefaultHandler
and a driver) that can
use a SAXParser
to list all of the persona in a
play (of the kind in the previous question).
import java.lang.reflect.*; public class ObjectFactory { /** * Uses reflection to create an Object of a given class * * @param className The name of the class (e.g., String) * @return An instance of the given class */ public Object createObject(String className) { } }
Copyright 2022