Default implementation of status line in NetBeans * displays the text in status line and clears it after a while. * Also there is no guarantee how long the text will be displayed as - * it can be replaced with new call to this method at any time. + * it can be replaced with new call to this method at any time.
+ *Note: The text may not show in the status line at all if some + * other text with higher importance is currently showing in the status line.
* @param text the text to be shown + * @see #setStatusText(String,int) */ public abstract void setStatusText(String text); + + /** + *Show text in the status line. importance
argument
+ * indicates that the text should stay in the status line until it is replaced
+ * with new text by calling setStatusText(String,int)
again with
+ * the same or higher importance value.
The text will be removed from status line when this method's return value is
+ * garbage-collected or excplicitly by calling Message.clear(int)
.
+ * @param text The text to be shown until some other text with the same or higher
+ * importance is passed into the status line.
+ * @param importance Positive integer defining the 'Importance' of the message
+ * to be displayed, the higher number the higher importance.
+ * @return Handle associated with given status line text. The text will be removed
+ * from status line either after calling clear(int)
on this handle or when
+ * the Message
object is garbage-collected.
+ * @throws IllegalArgumentException If importance <= 0
+ */
+ public Message setStatusText(String text, int importance) {
+ setStatusText(text);
+ return new Message();
+ }
/** Add a listener for when the text changes.
* @param l a listener
@@ -103,6 +145,22 @@
* @param l a listener
*/
public abstract void removeChangeListener(ChangeListener l);
+
+ /**
+ * Handle for 'important' status line messages. The message will be removed
+ * from status line when this object is garbage-collected.
+ *
+ * @see #setStatusText(String,int)
+ */
+ public static class Message {
+ /**
+ * Removes this message from status line after timeInMillis
+ * milliseconds.
+ * @param timeInMillis
+ */
+ public void clear(int timeInMillis) {
+ }
+ }
/**
* Trivial default impl for standalone usage.