[kepler-users] Why doesn't "Listen to Actor" work on Kepler 2.2/2.3 for Windows?

Christopher Brooks cxh at eecs.berkeley.edu
Thu Feb 16 09:53:01 PST 2012


All:
It looks like the problem has to do with Java 1.7.  I was able to 
reproduce this on the Mac
with two different early release versions of 1.7.  The bug occurs in 
Ptolemy II, outside of
Kepler.

The bug report is at

http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5574

The fix is to modify ptolemy/actor/gui/TextEditor.java to check if 
_scrollbar is null:

     public Color getBackground() {
         // Under Java 1.7 on the Mac, the _scrollbar is sometimes null.
         // See http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5574
         if (_scrollPane != null) {
             return _scrollPane.getBackground();
          } else {
             return null;
          }
     }

I'm not sure why this is happening, but I suspect the problem is that in 
Java 1.7
setBackground is calling getBackground on subcomponents and the TextEditor
subcomponent is not completely instantiated.

There could be other places where this problem occurs.  I'll switch over 
to Java 1.7 and see
what turned up.  It would be worth running the debugger and verifying 
that we are in the
Swing Event Thread when the problem occurs.

I'll leave it to the Kepler Team to decide how to handle this.  My 
proposal is that I patch the
ptII branch used in the release with the above change.  I'd like to wait 
until a few people have exercised
Kepler under 1.7 before doing so though.   If we patch the ptII tree 
used in Kepler-2.3, then at
least people who are working from the 2.3 tree can get the update.  I'm 
not sure about releasing
a patch release to Kepler, that is up to others.

_Christopher

On 2/15/12 1:34 PM, Daniel Crawl wrote:
>
> Hi Edward and Daren,
>
> "Listen to Actor" is invoked from the context menu on the canvas,
> and the exception is also thrown when double-clicking on the Python
> Actor to edit the script. These are probably run from the Swing
> event thread.
>
> Daren, thanks for verifying this problem occurs with Java 7 but not 6.
> I updated Kepler a few months ago so that it would compile with Java 7.
> However, when I ran it, I didn't exhaustively test all the
> functionality. I'll create bug report so this error is not forgotten.
>
>   --dan
>
>
> On 2/14/12 11:59 PM, Daren Thomas wrote:
>> i resolved this issue temporarily by uninstalling java 7, thus
>> ensuring java 6 is being used. it all works fine now. hope that helps!
>>
>> daren
>>
>> On 15.02.2012, at 00:51, "Edward A. Lee"<eal at eecs.berkeley.edu>  wrote:
>>
>>>
>>> This sort of thing can happen for GUI code that invoked outside
>>> the Swing event thread. How is this being invoked?  If it's just
>>> from the menu, then I presume it is in the Swing event thread...
>>>
>>> Edward
>>>
>>>
>>> On 2/14/12 11:29 AM, Daniel Crawl wrote:
>>>>
>>>> Hi Daren,
>>>>
>>>> I get the same behavior with Windows 7. The error is the same for
>>>> both "Listen to Actor" and editing a Python script:
>>>>
>>>> java.lang.NullPointerException
>>>> at ptolemy.actor.gui.TextEditor.getBackground(TextEditor.java:144)
>>>> at java.awt.Window.setBackground(Unknown Source)
>>>> at java.awt.Frame.setBackground(Unknown Source)
>>>> at ptolemy.gui.Top.access$1001(Top.java:141)
>>>> at ptolemy.gui.Top$SetBackgroundRunnable.run(Top.java:1889)
>>>> at ptolemy.gui.Top.deferIfNecessary(Top.java:247)
>>>> at ptolemy.gui.Top.setBackground(Top.java:501)
>>>> at ptolemy.actor.gui.TextEditor.setBackground(TextEditor.java:238)
>>>> ...
>>>>
>>>> Christopher, do you know what causes this?
>>>>
>>>> Thanks,
>>>>
>>>> --dan
>>>>
>>>>
>>>> On 2/8/12 4:28 AM, Daren Thomas wrote:
>>>>> I can use "Listen to Actor" for Kepler 2.3 on Mac OS X, but not under
>>>>> Windows. When I select the option from the context menu, nothing
>>>>> happens.
>>>>>
>>>>> Also, when I try to edit a script for the Python actor, I get an 
>>>>> error
>>>>> message "Failed to open a dialog to edit the target (null)" - this
>>>>> doesn't bother me ATM, but I guess I should mention it, as it 
>>>>> could be
>>>>> an additional symptom of a wrongly configured system.
>>>>>
>>>>> I installed Kepler 2.3 on Windows with the installer provided on the
>>>>> website. It seems "all" questions in the users list refer to 
>>>>> compiling
>>>>> your own version/environment. Is that the way to go?
>>>>>
>>>>> Regards,
>>>>> Daren Thomas
>>>>> _______________________________________________
>>>>> Kepler-users mailing list
>>>>> Kepler-users at kepler-project.org
>>>>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>>>>>
>>>> _______________________________________________
>>>> Kepler-users mailing list
>>>> Kepler-users at kepler-project.org
>>>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>>> <eal.vcf>
>>
>
> _______________________________________________
> Kepler-users mailing list
> Kepler-users at kepler-project.org
> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users

-- 
Christopher Brooks, PMP                       University of California
CHESS Executive Director                      US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
ph: 510.643.9841                                (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670



More information about the Kepler-users mailing list