import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
+import java.util.Timer;
+import java.util.TimerTask;
import javax.swing.Action;
import javax.swing.Box;
/**
* Defines the main window of the application.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
* @version $Id$
*/
/** The status bar. */
private StatusBar statusBar = new StatusBar();
+ /** Timer for clearing the status bar. */
+ private Timer statusBarClearTimer = new Timer("StatusBar Cleaner", true);
+
+ /** Object for status bar clearing ticker event. */
+ private TimerTask statusBarClearTimerTask;
+
+ /** Delay (in seconds) after which to clear status bar. */
+ private int statusBarClearDelay = 5000;
+
/** The content pane. */
private JPanel contentPane = new JPanel(new BorderLayout(12, 12));
/**
* Creates a new main window that redirects all actions to the given swing
* interface.
- *
+ *
* @param swingInterface
* The swing interface to receive all actions
*/
/**
* Sets the text of the status bar.
- *
+ *
* @param text
* The text of the status bar
*/
public void setStatusBarText(String text) {
statusBar.setText(text);
+ synchronized (statusBar) {
+ if (statusBarClearTimerTask != null) {
+ statusBarClearTimerTask.cancel();
+ }
+ statusBarClearTimerTask = new TimerTask() {
+
+ @Override
+ public void run() {
+ statusBar.setText("\u00a0");
+ }
+
+ };
+ statusBarClearTimer.schedule(statusBarClearTimerTask, statusBarClearDelay);
+ }
+ }
+
+ /**
+ * Returns the status bar clear delay (in milliseconds).
+ *
+ * @return The status bar clear delay
+ */
+ public int getStatusBarClearDelay() {
+ return statusBarClearDelay;
+ }
+
+ /**
+ * Sets the status bar clear delay (in milliseconds).
+ *
+ * @param statusBarClearDelay
+ * The status bar clear delay
+ */
+ public void setStatusBarClearDelay(int statusBarClearDelay) {
+ this.statusBarClearDelay = statusBarClearDelay;
}
/**
* Sets whether the advanced mode is activated.
- *
+ *
* @param advancedMode
* <code>true</code> if the advanced mode is activated,
* <code>false</code> if the simple mode is activated
/**
* Returns the currently selected project.
- *
+ *
* @return The currently selected project
*/
public Project getSelectedProject() {
//
// INTERFACE WindowListener
//
-
+
/**
* {@inheritDoc}
*/