> I have a Main Frame and a Log Frame.
> On May 27, 10:01 pm, cokofree...@gmail.com wrote:
> ...
[quoted text clipped - 7 lines]
> Andrew T.
> PhySci.org
Well, I'm not exactly sure why...Because it seemed the easier method?
The idea is that the Log Frame will be receiving constant log
information from a wide selection of classes, but I would be wanting
to do constant actions in the Main Frame and so don't want it locking
up while it outputs the messages.
Andrew Thompson - 27 May 2008 14:06 GMT
On May 27, 10:36 pm, cokofree...@gmail.com wrote:
> > On May 27, 10:01 pm, cokofree...@gmail.com wrote:
> > ...
[quoted text clipped - 3 lines]
> > Why? Or rather, why not put the relevant
> > components from both, into a single frame?
(Please trim sigs from replies.)
> Well, I'm not exactly sure why...Because it seemed the easier method?
Uh-huhh. It seems, even from your question, that
this approach might have it's pitfalls.
> The idea is that the Log Frame will be receiving constant log
> information from a wide selection of classes, but I would be wanting
> to do constant actions in the Main Frame and so don't want it locking
> up while it outputs the messages.
Multi-threading should solve that (and is
the best solution to it).
As far as putting all the components into a
single frame, you might look to using a JSplitPane,
which can be anything from 'half and half' of the
content area devoted to the groups of components,
or the user (or application) reassigning space to
one or the other as needs dictate.
OTOH there are a number of other possible layouts
that might better suit these collection of
components.
But I suggest you abandon the 'twin frames'
approach, it seems like a non optimal strategy,
to me.
--
Andrew T.
PhySci.org
Daniel Pitts - 27 May 2008 16:24 GMT
>> On May 27, 10:01 pm, cokofree...@gmail.com wrote:
>> ...
[quoted text clipped - 12 lines]
> to do constant actions in the Main Frame and so don't want it locking
> up while it outputs the messages.
You're approach doesn't solve your goal! All parts of your code that
interact with the GUI *must* do so on the Event Dispatch Thread. If
your Log Frame is blocking the EDT, your Main Frame will be blocked anyway.
Andrew is right, it would be better to put them into the same frame.
You might look into JDesktopPane and JInternalFrame if you want to keep
the windows separate, but tied together.
As for the logging window itself, if you expect a large amount of
"traffic", you might consider decoupling the "logging" aspect from the
"rendering the log" aspect. Actually, you probably should do that
anyway. For example, you should probably log to a buffer and/or file
and/or database, and have the Log window read from that
file/database/buffer every so often (using a Swing Timer). Half a
second might be often enough, you can make it configurable by the user
though. If that isn't frequent enough, then the chances are that more
information is scrolling by than what a human can interpret anyway :-)
Hope this helps,
Daniel.

Signature
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>