|
Java does not have a built-in StatusBar class in Swing. You need to create your own status bar. The following class creates a simple status bar using JLabel. You can improve it based on your needs:
public class StatusBar extends JLabel {
/** Creates a new instance of StatusBar */
public StatusBar() {
super();
super.setPreferredSize(new Dimension(100, 16));
setMessage("Ready");
}
public void setMessage(String message) {
setText(" "+message);
}
}
|
You can use this status bar in your programs as follows:
statusBar = new StatusBar();
getContentPane().add(statusBar, java.awt.BorderLayout.SOUTH);
|
Note that we added the status bar at the bottom of the frame using BorderLayout.
You can also change the message on the status bar using setMessage method.
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.