Java Reference
In-Depth Information
theLabel
.
setText
(
text
);
}
/** Set the font used in both subcomponents. */
public
public
void
void
setFont
(
Font f
) {
// This class' constructors call to super() can trigger
// calls to setFont() (from Swing.LookAndFeel.installColorsAndFont),
// before we create our components, so work around this.
iif
(
theLabel
!=
null
null
)
theLabel
.
setFont
(
f
);
iif
(
theTextField
!=
null
null
)
theTextField
.
setFont
(
f
);
}
/** Adds the ActionListener to receive action events from the textfield */
public
public
void
void
addActionListener
(
ActionListener l
) {
theTextField
.
addActionListener
(
l
);
}
/** Remove an ActionListener from the textfield. */
public
public
void
void
removeActionListener
(
ActionListener l
) {
theTextField
.
removeActionListener
(
l
);
}
}
Once it's compiled, it's ready to be pickled into a
JAR
. JavaBeans people really talk like that!
Pickling Your Bean into a JAR
Problem
You need to package your bean for deployment.
Solution
“Pickle your bean into a JAR” (i.e., create a JAR archive containing it and a manifest file).
Discussion
Although most containers now use reflection to access POJO bean properties, you may wish
to package your Java bean into a self-contained JAR file for separate distribution. In addition