1 /* 2 * Copyright 2006 Schlichtherle IT Services 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package de.schlichtherle.key.passwd.swing; 18 19 import javax.swing.JPanel; 20 21 /** 22 * Provides visual and/or audible feedback to the user when prompting 23 * for a key in its {@link #run} method. 24 * <p> 25 * Note that the {@link #run} method of this class is called when the panel 26 * is just showing. This implies that the panel is fully initialized and 27 * the implementation of this interface is not expected to do anything in 28 * particular. 29 * 30 * @author Christian Schlichtherle 31 * @version @version@ 32 * @since TrueZIP 6.2 33 */ 34 public interface Feedback extends Runnable { 35 36 /** 37 * Returns the panel which is used to provide feedback. 38 */ 39 JPanel getPanel(); 40 41 /** 42 * Sets the panel which is used to provide feedback. 43 * 44 * @param panel The <code>CreateKeyPanel</code> to provide feedback. 45 */ 46 void setPanel(JPanel panel); 47 48 /** 49 * Starts the visual/audible feedback. 50 * This method is called when the panel is shown in its containing window. 51 * It is run on AWT's Event Dispatch Thread, so it must complete fast 52 * in order not to block the GUI. 53 * If an implementation is going to do animations, the 54 * {@link javax.swing.Timer} class should be used to schedule timer events 55 * for the animation. 56 */ 57 void run(); 58 } 59