The
StatusView
is the status bar panel at the bottom of the IDE that is used to display a single-line text message. You can specify a color for the message. The IDE uses
red for the foreground color to indicate an error condition.
The StatusView
supports transient messages, such as descriptive text for ActionButton
and ActionMenuItem
. For example, when the user moves the mouse pointer over a JBuilder menu item, descriptive text about the menu item appears on the StatusView
. The descriptive text disappears as the mouse pointer moves away from the menu item. To provide a way to display this temporary text, StatusView
maintains a second internal string that holds this hint text. This second string is substituted for the usual text when it is needed, and the caller must cancel its display when the mouse pointer moves off the menu item. As the hint text is being displayed, the panel border disappears to help distinguish hint text from other status messages.
You can't replace the StatusView
with the OpenTools API. Access the StatusView
only through the Browser
.
Generally you use status messages to indicate the completion of a requested
action. As an action begins, usually you want to clear the StatusView
first by either setting the text string to null or by passing an empty string. Then you report the status of the action as it completes. For example,
Browser.getActiveBrowser().getStatusView().setText(null); try { doSomething(); Browser.getActiveBrowser().getStatusView().setText("Did something successfully"); } catch (Exception ex) { Browser.getActiveBrowser().getStatusView().setText("Did something badly", Color.red); }
JBuilder automatically handles the hint text for the IDE menus and toolbar, but you might like to understand how this feature works. The hint text is set when the mouse pointer enters the menu item or the toolbar button, and then is reset when the mouse pointer moves away. This provides users additonal information about that action before they actually use it. The code might look like this:
jMenuItem1.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { Browser.getActiveBrowser().getStatusView().setHintText("I am a menu item"); } public void mouseExited(MouseEvent e) { Browser.getActiveBrowser().getStatusView().setHintText(null); } });