EDT problem

View: New views
6 Messages — Rating Filter:   Alert me  

EDT problem

by lemmel lemmel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     Hi guys,

I encountered a problem with thread gui, by using both substance (4.3_07final Nairobi) and swingx (0.9.2). I am a bit confused for I'm a new user to java, and a look at your source code doesn't ring a bell about the problem.
So there is the stack :
-------------------------------------------------------------------------------------------------------------
Exception in thread "main" java.lang.IllegalArgumentException: Called outside EDT
        at org.jvnet.substance.utils.LazyResettableHashMap.put(LazyResettableHashMap.java:64)
        at org.jvnet.substance.utils.icon.SubstanceIconFactory.getTreeIcon(SubstanceIconFactory.java:156)
        at org.jvnet.substance.api.SubstanceSkin$30.createValue(SubstanceSkin.java:1643)
        at javax.swing.UIDefaults.getFromHashtable(UIDefaults.java:199)
        at javax.swing.UIDefaults.get(UIDefaults.java:144)
        at javax.swing.MultiUIDefaults.get(MultiUIDefaults.java:44)
        at javax.swing.UIManager.get(UIManager.java:952)
        at javax.swing.plaf.basic.BasicTreeUI.installDefaults(BasicTreeUI.java:698)
        at org.jvnet.substance.SubstanceTreeUI.__org__jvnet__substance__SubstanceTreeUI__installDefaults(SubstanceTreeUI.java:148)
        at org.jvnet.substance.SubstanceTreeUI.installDefaults(SubstanceTreeUI.java)
        at javax.swing.plaf.basic.BasicTreeUI.installUI(BasicTreeUI.java:630)
        at org.jvnet.substance.SubstanceTreeUI.__org__jvnet__substance__SubstanceTreeUI__installUI(SubstanceTreeUI.java)
        at org.jvnet.substance.SubstanceTreeUI.installUI(SubstanceTreeUI.java)
        at javax.swing.JComponent.setUI(JComponent.java:673)
        at javax.swing.JTree.setUI(JTree.java:678)
        at javax.swing.JTree.updateUI(JTree.java:694)
        at org.jdesktop.swingx.JXTreeTable$TreeTableCellRenderer.updateUI(JXTreeTable.java:2280)
        at javax.swing.JTree.(JTree.java:649)
        at org.jdesktop.swingx.JXTree.(JXTree.java:219)
        at org.jdesktop.swingx.JXTreeTable$TreeTableCellRenderer.(JXTreeTable.java:2049)
        at org.jdesktop.swingx.JXTreeTable.(JXTreeTable.java:152)
        at org.jdesktop.swingx.JXTreeTable.(JXTreeTable.java:142)
        at com.isicom.gui.swingx.JXTreeTable.(JXTreeTable.java:19)
        at jicsup.gui.MainWindow.MainWindow.(MainWindow.java:52)
        at jicsup.JicsupApp.showWindow(JicsupApp.java:93)
        at jicsup.JicsupApp.main(JicsupApp.java:239)
-------------------------------------------------------------------------------------------------------------

Have someone an idea about this problem ?

P.S. : I use a java 1.6.0.06, packaged by Debian (a testing with libc at 2.7-10, and kernel 2.6.22-3-686)
_________________________________________________________________
Caroline vient de mettre à jour son profil Messenger ! Connectez-vous !
http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=10&ct=1198837564&rver=4.0.1534.0&wp=MBI&wreply=http:%2F%2Fhome.services.spaces.live.com%2F&lc=1036&id=73625
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: EDT problem

by Oles Hodych :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is the call to showWindow() from the main() on EDT?

There should be something like this:

main() {
   ... // non GUI related code
  SwingUtilities.invokeLater(new Runnable() {
      public void run() {
         // here goes your GUI invocations including showWindow()
      }
  }
 ... // non GUI related code
}

01es


2008/5/30 lemmel lemmel <lem__mel@...>:

    Hi guys,

I encountered a problem with thread gui, by using both substance (4.3_07final Nairobi) and swingx (0.9.2). I am a bit confused for I'm a new user to java, and a look at your source code doesn't ring a bell about the problem.
So there is the stack :
-------------------------------------------------------------------------------------------------------------
Exception in thread "main" java.lang.IllegalArgumentException: Called outside EDT
       at org.jvnet.substance.utils.LazyResettableHashMap.put(LazyResettableHashMap.java:64)
       at org.jvnet.substance.utils.icon.SubstanceIconFactory.getTreeIcon(SubstanceIconFactory.java:156)
       at org.jvnet.substance.api.SubstanceSkin$30.createValue(SubstanceSkin.java:1643)
       at javax.swing.UIDefaults.getFromHashtable(UIDefaults.java:199)
       at javax.swing.UIDefaults.get(UIDefaults.java:144)
       at javax.swing.MultiUIDefaults.get(MultiUIDefaults.java:44)
       at javax.swing.UIManager.get(UIManager.java:952)
       at javax.swing.plaf.basic.BasicTreeUI.installDefaults(BasicTreeUI.java:698)
       at org.jvnet.substance.SubstanceTreeUI.__org__jvnet__substance__SubstanceTreeUI__installDefaults(SubstanceTreeUI.java:148)
       at org.jvnet.substance.SubstanceTreeUI.installDefaults(SubstanceTreeUI.java)
       at javax.swing.plaf.basic.BasicTreeUI.installUI(BasicTreeUI.java:630)
       at org.jvnet.substance.SubstanceTreeUI.__org__jvnet__substance__SubstanceTreeUI__installUI(SubstanceTreeUI.java)
       at org.jvnet.substance.SubstanceTreeUI.installUI(SubstanceTreeUI.java)
       at javax.swing.JComponent.setUI(JComponent.java:673)
       at javax.swing.JTree.setUI(JTree.java:678)
       at javax.swing.JTree.updateUI(JTree.java:694)
       at org.jdesktop.swingx.JXTreeTable$TreeTableCellRenderer.updateUI(JXTreeTable.java:2280)
       at javax.swing.JTree.(JTree.java:649)
       at org.jdesktop.swingx.JXTree.(JXTree.java:219)
       at org.jdesktop.swingx.JXTreeTable$TreeTableCellRenderer.(JXTreeTable.java:2049)
       at org.jdesktop.swingx.JXTreeTable.(JXTreeTable.java:152)
       at org.jdesktop.swingx.JXTreeTable.(JXTreeTable.java:142)
       at com.isicom.gui.swingx.JXTreeTable.(JXTreeTable.java:19)
       at jicsup.gui.MainWindow.MainWindow.(MainWindow.java:52)
       at jicsup.JicsupApp.showWindow(JicsupApp.java:93)
       at jicsup.JicsupApp.main(JicsupApp.java:239)
-------------------------------------------------------------------------------------------------------------

Have someone an idea about this problem ?

P.S. : I use a java 1.6.0.06, packaged by Debian (a testing with libc at 2.7-10, and kernel 2.6.22-3-686)
_________________________________________________________________
Caroline vient de mettre à jour son profil Messenger ! Connectez-vous !
http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=10&ct=1198837564&rver=4.0.1534.0&wp=MBI&wreply=http:%2F%2Fhome.services.spaces.live.com%2F&lc=1036&id=73625
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



RE: EDT problem

by lemmel lemmel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks a lot :-).
  I forgot that SwingUtilities.invokeLater for I was doing something dirty :
I use Netbeans as a GUI designer, and need to chain several windows before the main window (a Login Windows, a splash), and I didnt find a clean way to do it (some data, need to go through all the windows) and Netbeans create an Application, which didn't allow me to create the main window when I desired, so I performed a :
----------------------
launch(JicsupApp.class, args);
----------------------
which do nothing, and do later (in the main thread) :
-------------------------------------------------
                            mainWindow = new MainWindow(......);
                            mainWindow.getFrame().addWindowListener(new MainFrameListener());
                            getContext().getSessionStorage().restore(mainWindow.getFrame(),"jicsup.xml");
                            mainWindow.finishInitialization();
                            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
                            if (getContext().getLocalStorage().load("jicsup_complement.xml") == null) {
                                mainWindow.getFrame().setLocation(screenSize.width/8, screenSize.height/8);
                                mainWindow.getFrame().setSize(new Dimension(screenSize.width*3/4, screenSize.height*3/4));
                            }
                            mainWindow.getFrame().setVisible(true);
-----------------------------------------------------

I forgot to do the right thing.

Thanks again, you save me a lot of worries :-)

________________________________

> Date: Fri, 30 May 2008 19:26:25 +0300
> From: oles.hodych@...
> To: users@...
> Subject: Re: EDT problem
>
> Is the call to showWindow() from the main() on EDT?
>
> There should be something like this:
>
> main() {
>    ... // non GUI related code
>   SwingUtilities.invokeLater(new Runnable() {
>       public void run() {
>          // here goes your GUI invocations including showWindow()
>       }
>   }
>  ... // non GUI related code
> }
>
> 01es
>

_________________________________________________________________
Caroline vient de mettre à jour son profil Messenger ! Connectez-vous !
http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=10&ct=1198837564&rver=4.0.1534.0&wp=MBI&wreply=http:%2F%2Fhome.services.spaces.live.com%2F&lc=1036&id=73625
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: EDT problem

by Oles Hodych :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No worries.

2008/5/30 lemmel lemmel <lem__mel@...>:

Thanks a lot :-).
 I forgot that SwingUtilities.invokeLater for I was doing something dirty :
I use Netbeans as a GUI designer, and need to chain several windows before the main window (a Login Windows, a splash), and I didnt find a clean way to do it (some data, need to go through all the windows) and Netbeans create an Application, which didn't allow me to create the main window when I desired, so I performed a :
----------------------
launch(JicsupApp.class, args);
----------------------
which do nothing, and do later (in the main thread) :
-------------------------------------------------
                           mainWindow = new MainWindow(......);
                           mainWindow.getFrame().addWindowListener(new MainFrameListener());
                           getContext().getSessionStorage().restore(mainWindow.getFrame(),"jicsup.xml");
                           mainWindow.finishInitialization();
                           Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
                           if (getContext().getLocalStorage().load("jicsup_complement.xml") == null) {
                               mainWindow.getFrame().setLocation(screenSize.width/8, screenSize.height/8);
                               mainWindow.getFrame().setSize(new Dimension(screenSize.width*3/4, screenSize.height*3/4));
                           }
                           mainWindow.getFrame().setVisible(true);
-----------------------------------------------------

I forgot to do the right thing.

Thanks again, you save me a lot of worries :-)

________________________________
> Date: Fri, 30 May 2008 19:26:25 +0300
> From: oles.hodych@...
> To: users@...
> Subject: Re: EDT problem
>
> Is the call to showWindow() from the main() on EDT?
>
> There should be something like this:
>
> main() {
>    ... // non GUI related code
>   SwingUtilities.invokeLater(new Runnable() {
>       public void run() {
>          // here goes your GUI invocations including showWindow()
>       }
>   }
>  ... // non GUI related code
> }
>
> 01es
>

_________________________________________________________________
Caroline vient de mettre à jour son profil Messenger ! Connectez-vous !
http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=10&ct=1198837564&rver=4.0.1534.0&wp=MBI&wreply=http:%2F%2Fhome.services.spaces.live.com%2F&lc=1036&id=73625
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Parent Message unknown Re: EDT problem

by Kirill Grouchnikov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi,

In general, Substance is much less forgiving for EDT violations (which is a good thing). There are a number of utilities to check your code for EDT violations - take a look at the SwingHelper project [1] and [2].

Thanks
Kirill

[1] https://swinghelper.dev.java.net/
[2] http://weblogs.java.net/blog/alexfromsun/archive/2006/02/debugging_swing.html

----- Original Message ----
From: lemmel lemmel <lem__mel@...>
To: users@...
Sent: Friday, May 30, 2008 10:03:58 AM
Subject: RE: EDT problem


Thanks a lot :-).
  I forgot that SwingUtilities.invokeLater for I was doing something dirty :
I use Netbeans as a GUI designer, and need to chain several windows before the main window (a Login Windows, a splash), and I didnt find a clean way to do it (some data, need to go through all the windows) and Netbeans create an Application, which didn't allow me to create the main window when I desired, so I performed a :
----------------------
launch(JicsupApp.class, args);
----------------------
which do nothing, and do later (in the main thread) :
-------------------------------------------------
                            mainWindow = new MainWindow(......);
                            mainWindow.getFrame().addWindowListener(new MainFrameListener());
                            getContext().getSessionStorage().restore(mainWindow.getFrame(),"jicsup.xml");
                            mainWindow.finishInitialization();
                            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
                            if (getContext().getLocalStorage().load("jicsup_complement.xml") == null) {
                                mainWindow.getFrame().setLocation(screenSize.width/8, screenSize.height/8);
                                mainWindow.getFrame().setSize(new Dimension(screenSize.width*3/4, screenSize.height*3/4));
                            }
                            mainWindow.getFrame().setVisible(true);
-----------------------------------------------------

I forgot to do the right thing.

Thanks again, you save me a lot of worries :-)

________________________________

> Date: Fri, 30 May 2008 19:26:25 +0300
> From: oles.hodych@...
> To: users@...
> Subject: Re: EDT problem
>
> Is the call to showWindow() from the main() on EDT?
>
> There should be something like this:
>
> main() {
>    ... // non GUI related code
>  SwingUtilities.invokeLater(new Runnable() {
>      public void run() {
>          // here goes your GUI invocations including showWindow()
>      }
>  }
>  ... // non GUI related code
> }
>
> 01es
>

_________________________________________________________________
Caroline vient de mettre à jour son profil Messenger ! Connectez-vous !
http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=10&ct=1198837564&rver=4.0.1534.0&wp=MBI&wreply=http:%2F%2Fhome.services.spaces.live.com%2F&lc=1036&id=73625
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: EDT problem

by lemmel lemmel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> In general, Substance is much less forgiving for EDT violations (which is a good thing). There are a number of utilities to check your code for EDT violations - take a look at the SwingHelper project [1] and [2].
> [1] https://swinghelper.dev.java.net/
> [2] http://weblogs.java.net/blog/alexfromsun/archive/2006/02/debugging_swing.html
Thanks for the tip.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

LightInTheBox - Buy quality products at wholesale price