For Programmers: Free Programming Magazines  


Home > Archive > Java Help > May 2006 > Adding a status bar to a window ??









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Adding a status bar to a window ??
Ulf Meinhardt

2006-05-24, 7:07 pm

How do I add a status bar to a window?

When I google for it I found some examples which adds them to a content pane.
But I don't want to add them to a window content. I want to "paste" it
to the whole window frame at the bottom most part of the window.
Just as (nearly) every other window (e.g.Internet Explorer) has.

So when I code e.g.

StatusBar sb = new StatusBar();
contentPane.add(sb);

it is added like a button to a GridBagLayout. But it is not like a statusbar.

Furthermore: How do I write a text (e.g. "Hello") to it?

Ulf

Mark Thomas

2006-05-24, 7:07 pm

Ulf Meinhardt wrote:
> How do I add a status bar to a window?
>
> When I google for it I found some examples which adds them to a content pane.
> But I don't want to add them to a window content. I want to "paste" it
> to the whole window frame at the bottom most part of the window.
> Just as (nearly) every other window (e.g.Internet Explorer) has.
>
> So when I code e.g.
>
> StatusBar sb = new StatusBar();
> contentPane.add(sb);
>
> it is added like a button to a GridBagLayout. But it is not like a statusbar.
>
> Furthermore: How do I write a text (e.g. "Hello") to it?
>
> Ulf
>

contentPane.setLayout(new BorderLayout());
contentPane.add(sb, BorderLayout.SOUTH);

Mark
Thomas Weidenfeller

2006-05-24, 7:07 pm

Ulf Meinhardt wrote:
> How do I add a status bar to a window?
>
> When I google for it I found some examples which adds them to a content pane.


That's the way to do it, with only few variants. E.g. by adding
everything (statusbar and the rest of the contents) to a JPanel and the
JPanel to the content pane.

> But I don't want to add them to a window content.


I guess than you have to implement your own windows. Good luck with that.

> StatusBar sb = new StatusBar();
> contentPane.add(sb);
>
> it is added like a button to a GridBagLayout. But it is not like a statusbar.


Likely you have messed up your layout management. BorderLayout comes
handy when partitioning the space for the contents and status bar.

> Furthermore: How do I write a text (e.g. "Hello") to it?


How should we know? You didn't show us how you implemented StatusBar.

BTW: Why did you cross-post that question to two groups not related to
Java GUI questions, instead of posting it to the GUI group?

/Thomas
--
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS...ng/java/gui/faq
http://www.uni-giessen.de/faq/archi...g.java.gui.faq/
IchBin

2006-05-24, 7:07 pm

Ulf Meinhardt wrote:
> How do I add a status bar to a window?
>
> When I google for it I found some examples which adds them to a content pane.
> But I don't want to add them to a window content. I want to "paste" it
> to the whole window frame at the bottom most part of the window.
> Just as (nearly) every other window (e.g.Internet Explorer) has.
>
> So when I code e.g.
>
> StatusBar sb = new StatusBar();
> contentPane.add(sb);
>
> it is added like a button to a GridBagLayout. But it is not like a statusbar.
>
> Furthermore: How do I write a text (e.g. "Hello") to it?
>
> Ulf
>

I do it this way with JGoodies forms..


frame.getContentPane().add(buildMainPanel(),BorderLayout.CENTER);
frame.getContentPane().add(buildStatusPanel(),BorderLayout.PAGE_END);
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com