In the following example, a
JComponent
is used to generate the network node representation of a
user-defined class named
Workstation
. Business objects of this class are represented in the network
component as a
JButton
with the given label and icon.
object."Workstation" {
class: 'javax.swing.JButton;
icon : @=icon;
label: @name;
foreground: black;
}
object."Workstation":selected {
foreground: red;
}
Subobject#icon {
class: 'javax.swing.ImageIcon';
image: '@|image("workstation.png")';
}
The given class must follow the JavaBeans
pattern; its properties can be customized directly in CSS (icon,
label, foreground).
For information about how to use JavaBeans in CSS and how to use
the
class
property, refer to
Class property.