If you use several user-interface panels together in a wizard for a Java-client
Dataview
, you might want to know the settings that a user has chosen in one panel
before you display a different panel. For example, you might want to know the selected graph
type so you know whether to display one of the axis panels in the wizard.
To listen for changes in a user-interface panel, implement the
java.beans.PropertyChangeListener
interface and add the listener to the panel.
Each panel fires property change events for properties of the panel. For example, to know when
a user has selected a graph category, have your listener listen for a
PropertyChangeEvent
where the property name is TYPE_CHANGED
.
The properties that you can listen for in each panel are described in the javadoc for the panel.
The following code shows an implementation of the propertyChange
method that is
specifies in the PropertyChangeListener
interface. This implementation sets the
GraphType
property of the graph when a user selects a subtype in the Graph Type
panel.
public void propertyChange (PropertyChangeEvent evt) { if (evt.getPropertyName() = (GraphType.SUBTYPE_CHANGED || GraphType.DOUBLE_CLICK)) { // m_graph is the graph with which the GraphType panel was constructed // m_typePanel is the GraphType panel Type type = m_typePanel.getCurrentType(); Subtype subtype = m_typePanel.getCurrentSubtype(); GraphTypeAndSubtype typeAndSubtype = new GraphTypeAndSubtype(type, subtype); m_graph.getGraphTypeConverter().setTypeAndSubtype(typeAndSubtype); } }