start gui and configurator issues
Guybrush Threepwood <[email protected]> Fri, 19 May 2006 12:10:22 +0200
| Newsgroups | gmane.comp.java.jxta.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
first of all I wish I'm in the right mailing list :-)
then, here is my problem: I'm creating a simple chat software using
jxta. I have created the gui using Java Studio 8.
by now I had 2 files: ChatGui.java and ChatPeer.java. so to reflect the
MVC, the gui own a "private ChatPeer hello;" wich is instantiated in
the ChatGui constructor .
Here is a code cut:
*** start code
public class ChatGui extends javax.swing.JFrame {
private ChatPeer hello;
/** Creates new form ChatGui */
public ChatGui() {
hello = new ChatPeer();
initComponents();
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ChatGui().setVisible(true);
}
});
}
*** end of code
well, when I try this I obtain this error:
<FATAL 2006-05-19 11:54:58,363
DefaultConfigurator::getPlatformConfig:219> The JXTA AWT Configuration
Dialog cannot be run from the event dispatch thread. It's modal nature
is fundamentally incompatible with running on the event dispatch thread.
Either change to a different Configurator via
PeerGroupFactory.setConfiguratorClass() or start JXTA from the
application main Thread before starting your GUI via invokeLater().
Java Result: 1
So my solution is to put "hello = new ChatPeer();" in the main, befor
initialising the gui, but for doing this, I have to set ChatPeer hello
as static:
private static ChatPeer hello;
Is this a good solution or ther is another, better way, I can't see??
regards
Segolas
p.s.
Obviously I cannot use myJxta since is a university test ;-)