01: package tide.editor;
02:
03: import javax.swing.border.EmptyBorder;
04: import java.util.*;
05: import javax.swing.*;
06:
07: /** TODO. Shows tips and short information about what just happens.
08: * (example: missing import causing no completion..)
09: */
10: public final class StatusBar extends JTextField {
11: // short history (not persistent)
12: List<String> statusHistory = new ArrayList<String>();
13:
14: public StatusBar() {
15: super ();
16: setText("This is the status bar, showing some information about what just happens");
17: setBorder(new EmptyBorder(2, 2, 2, 2));
18: setEditable(false);
19: setVisible(false);
20: }
21:
22: public void setStatusText(String line) {
23: if (line == null || line.length() == 0) {
24: setVisible(false);
25: return;
26: }
27:
28: if (!this .isVisible())
29: setVisible(true);
30:
31: setText(line);
32: statusHistory.add(line);
33: if (statusHistory.size() > 30) {
34: statusHistory.remove(0);
35: }
36: }
37:
38: }
|