X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fgui%2FMainWindow.java;h=4b447f7481a67a22fce280d94c8cfc003f112569;hb=fa2475af2c06ae03a4338a3fc1e327dc1970faf4;hp=4eb7ab71d319e11b0b3914d2b7a5e7f0213105de;hpb=ebd531bc775036dd66a7e20abebbcb480af35491;p=jSite2.git
diff --git a/src/net/pterodactylus/jsite/gui/MainWindow.java b/src/net/pterodactylus/jsite/gui/MainWindow.java
index 4eb7ab7..4b447f7 100644
--- a/src/net/pterodactylus/jsite/gui/MainWindow.java
+++ b/src/net/pterodactylus/jsite/gui/MainWindow.java
@@ -25,6 +25,8 @@ import java.awt.Dimension;
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;
@@ -50,7 +52,7 @@ import net.pterodactylus.util.swing.SwingUtils;
/**
* Defines the main window of the application.
- *
+ *
* @author David âBombeâ Roden <bombe@freenetproject.org>
* @version $Id$
*/
@@ -62,6 +64,15 @@ public class MainWindow extends JFrame implements WindowListener, I18nable {
/** 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));
@@ -98,7 +109,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable {
/**
* Creates a new main window that redirects all actions to the given swing
* interface.
- *
+ *
* @param swingInterface
* The swing interface to receive all actions
*/
@@ -119,17 +130,50 @@ public class MainWindow extends JFrame implements WindowListener, I18nable {
/**
* 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
* true
if the advanced mode is activated,
* false
if the simple mode is activated
@@ -151,7 +195,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable {
/**
* Returns the currently selected project.
- *
+ *
* @return The currently selected project
*/
public Project getSelectedProject() {
@@ -333,7 +377,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable {
//
// INTERFACE WindowListener
//
-
+
/**
* {@inheritDoc}
*/