TrueZIP 6.8

de.schlichtherle.key.passwd.swing
Class BasicInvalidKeyFeedback

java.lang.Object
  extended by de.schlichtherle.key.passwd.swing.BasicFeedback
      extended by de.schlichtherle.key.passwd.swing.BasicInvalidKeyFeedback
All Implemented Interfaces:
Feedback, Runnable
Direct Known Subclasses:
BasicInvalidCreateKeyFeedback, BasicInvalidOpenKeyFeedback, HurlingWindowFeedback

public abstract class BasicInvalidKeyFeedback
extends BasicFeedback

Provides feedback by beeping using the default toolkit and disabling the default button in the root pane for three seconds when prompting for a key and the last input was invalid.

Note that the root pane is normally the root pane of an enclosing JOptionPane which has the OK button set as its default button. This is to inhibit the use of a GUI robot for exhaustive password searching.

If you would like to play a nice sound for feedback, you need to override the BasicFeedback.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.4
Version:
$Id: BasicInvalidKeyFeedback.java,v 1.4 2010/08/20 13:09:40 christian_schlichtherle Exp $
Author:
Christian Schlichtherle

Constructor Summary
BasicInvalidKeyFeedback()
           
 
Method Summary
 int getDelay()
          Returns the delay for reenabling the default button in the root pane.
 void setDelay(int delay)
          Sets the delay for reenabling the default button in the root pane.
protected  void startAnimation()
          Starts the visual feedback.
 
Methods inherited from class de.schlichtherle.key.passwd.swing.BasicFeedback
getPanel, run, setPanel, startSound
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicInvalidKeyFeedback

public BasicInvalidKeyFeedback()
Method Detail

getDelay

public int getDelay()
Returns the delay for reenabling the default button in the root pane.

Returns:
The delay in milliseconds. Defaults to KeyProvider.MIN_KEY_RETRY_DELAY.

setDelay

public void setDelay(int delay)
Sets the delay for reenabling the default button in the root pane.

Parameters:
delay - The delay in milliseconds.

startAnimation

protected void startAnimation()
Description copied from class: BasicFeedback
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.

Overrides:
startAnimation in class BasicFeedback

TrueZIP 6.8

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