TrueZIP 6.8.1

de.schlichtherle.key.passwd.swing
Class BasicFeedback

java.lang.Object
  extended by de.schlichtherle.key.passwd.swing.BasicFeedback
All Implemented Interfaces:
Feedback, Runnable
Direct Known Subclasses:
BasicCreateKeyFeedback, BasicInvalidKeyFeedback, BasicOpenKeyFeedback, BasicUnknownKeyFeedback

public abstract class BasicFeedback
extends Object
implements Feedback

Provides feedback by beeping using the default toolkit. If you would like to play a nice sound for feedback, you need to override the startSound() method.

Warning: Playing a java.applet.AudioClip on J2SE 1.4.2_12 causes a client application not to terminate until System.exit(0) is called explicitly - hence this feature is currently not implemented in this class! This issue is fixed in JSE 1.5.0_07 (and probably earlier versions).

Since:
TrueZIP 6.2
Version:
$Id: BasicFeedback.java,v 1.4 2010/08/20 13:09:40 christian_schlichtherle Exp $
Author:
Christian Schlichtherle

Constructor Summary
BasicFeedback()
           
 
Method Summary
 JPanel getPanel()
          Returns the panel which is used to provide feedback.
 void run()
          Starts the visual/audible feedback.
 void setPanel(JPanel panel)
          Sets the panel which is used to provide feedback.
protected  void startAnimation()
          Starts the visual feedback.
protected  void startSound()
          Starts the audible feedback.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicFeedback

public BasicFeedback()
Method Detail

getPanel

public JPanel getPanel()
Description copied from interface: Feedback
Returns the panel which is used to provide feedback.

Specified by:
getPanel in interface Feedback

setPanel

public void setPanel(JPanel panel)
Description copied from interface: Feedback
Sets the panel which is used to provide feedback.

Specified by:
setPanel in interface Feedback
Parameters:
panel - The CreateKeyPanel to provide feedback.

run

public void run()
Starts the visual/audible feedback. Subclasses should not override this method directly, but override startSound() and/or startAnimation() instead.

The implementation in this class calls startSound() and then startAnimation().

Specified by:
run in interface Feedback
Specified by:
run in interface Runnable

startSound

protected void startSound()
Starts the audible feedback. Subclasses may override this method to play a sound of their liking.


startAnimation

protected void startAnimation()
Starts the visual feedback. Subclasses may override this method to animate the GUI according to their liking. This method is called when the panel is shown in its containing window. It is run on AWT's Event Dispatch Thread, so it must complete fast in order not to block the GUI. If an implementation is going to do animations, the Timer class should be used to schedule timer events for the animation.

The implementation in this class is a no-op.


TrueZIP 6.8.1

Copyright © 2005-2010 Schlichtherle IT Services. All Rights Reserved.