Java Reference
In-Depth Information
speedControl.add(delay);
delay.addActionListener(this);
add(speedControl, BorderLayout.CENTER);
imageControl.add(imagePrompt);
imageControl.add(imageName);
imageName.addActionListener(this);
add(imageControl, BorderLayout.SOUTH);
}
public void actionPerformed(ActionEvent event)
{
if (event.getSource() == delay)
{
//<Return> key pressed at end of entry into
//delay text fi eld, so reset delay…
int pause =
Integer.parseInt(delay.getText());
sequence.setDelay(pause);
delay.setText("");
}
else
{
//<Return> key must have been pressed at end
//of entry into image name text fi eld, so
//change animation…
sequence.setImageName(imageName.getText());
imageName.setText("");
}
}
public void propertyChange(PropertyChangeEvent event)
{
setTitle(sequence.getImageName());
}
}
Figure 10.3 shows the display from the above program just after the image name
has changed from 'juggler' to 'poorpic'.
10.6
Using JavaBeans in JSPs
10.6.1
The Basic Procedure
This is a powerful combination that can be used to add further dynamism to Web
pages. In order to be used by a JSP, a bean must have a default (i.e., no-argument)
Search WWH ::




Custom Search