This content has been marked as final. Show 14 replies
950420 wrote:Honor Swing's single threaded rule. All Swing constructors and methods should be invoked only on the EDT.
The issue is the error is not coming regularly. But It comes.
Without seeing your code, any answers will be guesses.
please upload your code as well.
I can not put my code due to some constrain., But i would like to know is there any change in code ,that is causing key pressed is not recognized in jdk 1.7. I see this issue not frequently. Pls help me.
950420 wrote:Did you actually read Darryl's response?
Pls help me.
" All Swing constructors and methods should be invoked only on the EDT. ". Is this rule was included in Jdk7 or was existing in previous jdks also.? I am using EDT in my code. One more question i have , is there any change in EDT code in jdk7 such that it will affect any change in response time .
Edited by: 950420 on Sep 10, 2012 2:08 AM
Edited by: 950420 on Sep 10, 2012 2:42 AM
" All Swing constructors and methods should be invoked only on the EDT. ". Is this rule was included in Jdk7 or was existing in previous jdks also.?All JDKs since Swing was included (1.2 IIRC). See the tutorial chapter http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html (a must-read, must-know, and must-apply).
I am using EDT in my code.What does that mean? You previous questions suggests that you didn't know this rule.
950420 wrote:Swing was always single threaded. Some of the methods that were documented to be thread safe up to JDK 6 were in fact never thread safe, and the qualification has been removed in the JDK7 documentation.
Is this rule was included in Jdk7 or was existing in previous jdks also.?
is there any change in EDT code in jdk7 such that it will affect any change in response time .Huh?
thanks for the information. I see Bug ID: 6189501 , also had similar issue , but it was for menubar . Does button.requestFocus() works in jdk7??
Edited by: 950420 on Sep 12, 2012 3:08 AM
Hi I got the error point : getRootPane().setDefaultButton(btn);
from here error starts. any idea anything wrong in this line
Edited by: 950420 on Sep 12, 2012 5:53 AM
I also see some time below error also:
java.lang.Exception: Stack trace
at java.security.AccessController.doPrivileged(Native Method)
Hard to help you further, when there are one or two questions you've been asked above, which you have not answered.
For better help sooner, I recommend you post an SSCCE (http://sscce.org)
I was using EDT. May be i was not 100% sure about the usage of it. as i posted the error place , even that wont help ?
950420 wrote:As you have been told already (twice), the meaning of this sentence is very ambiguous.
I was using EDT. May be i was not 100% sure about the usage of it.
To understand why you should read this chapter of the Swing tutorial (but it's a bit involved): http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html
as i posted the error place , even that wont help ?As you have been already told (twice)... no :)
Your best chance to get further help is, as you have already been told (twice), to provide an SSCCE (http://sscce.org).
The good thing with an SSCCE, is that it will help you isolate the problem to where it really belongs (there is probably only a small part of the code is really involved in the error, and a lot of incidental code that has nothing to do with the error). From there two possibilities:
- you may be able to find out yourself (very self-rewarding, and it will teach you a lot). If you do please post about it anyway, as a courtesy to those who tried to help you.
- you don't find yourself, but you can post the (short but complete) code here for other to reproduce and analyze it.
Either way, if solving the problem is important to you, the effort will pay.
If solving the problem is not that important, then drop the effort - but inform us here, as a courtesy to those who tried to help you.
Edited by: jduprez on Sep 21, 2012 11:59 AM