• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JStatusBar ?

 
James Du
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I find through the java docments and cant find such a thing like JStatusBar.
How do you implement the Status Bar? simply add a common JPane at the bottom of the JFrame to do the job?
Thanks in advance
James Du
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For my Server I have a "Status Bar" and all it is is a JLabel in the South portion of a BorderLayout.
Mark
 
Alex Gregory
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouldn't adding a JLabel in the South make the Label too big usually? After all, shouldn't the bar just be 1 line?
Also, Mark you mentioned your server had a status bar, so what kind of information did you display on the server side?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the status bar was only one line. South gets its preferred height and if the lable is only long enough for one line then it will be just one line.
It would state startup steps, and mostly "waiting for client request", when a client sent a request it would say "Servicing a client"
To be honest most of those messages displayed way to quickly for most people to see them change, but it was still nice to have. Not necessary at all for the specs though.
Mark
 
Rajesh So
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
I have a Model class which is dedicated for handling TableModels and the ComboModels. It uses a another class for communicating to the server. As the results are returned from the server, the appropriate model is altered.
The models are already owned by some GUIComponents in a class called View. The class Control marries the Model and the View.
The GUI Components of class View that currently use the Models are JTable and the JComboBox. Now I thought of adding a JLabel to tell the status/Exceptions (in a user understandable way) and errors. It would be good if I have a Label Model. Unfortunately, there is not one.
Please suggest me how I could maintain the conssitency of class Model and the class View, so that Jlabel can also be made to behave like JTable and JComboBox.
Thanks in advance,
Rajesh
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Rajesh"-
First I have to do the bartendering thingee. So please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it
here.
Thanks!
Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, so now to your question. Sometimes MVC might be overkill for a particular solution. Now this is a subjective decision.
Now for a JLabel the only "Data" that can be held in this label is the text to display. Now this isn't very complicated, so a MVC answer, in my opinion is not worth the effort.
However, you can have a utility method in this class that will assign a value to the JTable. The only value for this is the ability to change the implementation of this method inside the method and once. Whereas, if you use a JLabel.setText() method everywhere, and you no longer are going to use a JLabel, then you will have to change this code everywhere else.
Just a 2 cents quick reply. I hope it helps.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic