This content has been marked as final. Show 8 replies
Is there a class / standard way of adding a status bar to a GUI (JPanel)?Well, typically you would have one status bar for the entire frame. I've never seen a GUI where each panel had one (which isn't to say that you can't do this if you want).
Anyway, the way I do it is pretty straightforward:
1) make all of the panels, tabbedpanes, etc that I need and add them all to a single, content panel, using whatever LayoutManager you want to get the job done for each panel.
2) add the content panel to a scrollpane
3) my frame, using BorderLayout, has 3 parts: a JToolBar, the scrollpane containing the content panel, and a statusbar (which is a JLabel)
4) add the 3 components to the contentPane of my frame:
- the toolbar goes in BorderLayout.NORTH
- the scrollpane goes in BorderLayout.CENTER
- the statusbar goes in BorderLayout.SOUTH
What I was hoping for is a helper class for status bars that are more complex than just a JLabel. Where it can have multiple fields with or without separators and possibly having the field sizes be adjustable by the user (kinda like a split pane).
Or if that class does not exist, which I suspect is true, a place where I could find some guidance about what are good ways to accomplish the above.
The way I did in one of my GUIs is... I had a panel with a label which I made it singleton (this is the StatusBar control). And I had methods like setStatusMessage(), clear() etc. to update the messages from anywhere in the whole application.
Select June, 2000 and you will find an article by Claude Duguay on his JStatuBar component. His status bar allows you to add multiple components with his own custom LayoutManager that allows you to control the sizes of the various cells on the bar. Of course you have to register with the site read the article and download the code.
You ROCK! That's perfect! Thanks.
i am new member of this foum . i dont know how post my question
please help me
i am new member of this foum . i dont know how postPosting a question is simple : write a sentence and add a question mark at the end.