Sunday, March 13, 2005

Writing the createStatusBar method

Program

    JPanel createStatusBar() {
        JTextField textField1 = new JTextField("StatusBar");
        textField1.setEditable(false);
        textField1.setBorder(BorderFactory.createLoweredBevelBorder());

        JPanel jPanelStatusBar = new JPanel();
        jPanelStatusBar.setLayout(new BoxLayout(jPanelStatusBar, BoxLayout.X_AXIS));
        jPanelStatusBar.add(textField1);

        return jPanelStatusBar;
    }

Discussion

The StatusBar should be a part of the "Center" in the ContentPane. The StatusBar should not be placed "South" in the Content Pane, because the ToolBar could be moved to the "South" by the user.

No comments: