Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Frame won't refresh, Part Deux
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Frame won't refresh, Part Deux



As previously discussed, my DiskBrowser sample from JConfig doesn't redraw
on OSX until I minimize the frame.

I constructed a simple test that always works as expected. It consists of a
Frame with a GridLayout containing 6 widgets: 5 descendents of Panel and a
button. Clicking a panel increases the "level", and clicking the button
decreases the "level." When the level is changed, the current level is
painted on the panels. That always works, and doesn't need to be minimized
first as previously described. Note that the Button *always* works, even if
the Panels don't.

When I insert one line into main(), it works with the "bad" behavior (frame
needs to be minimized before panels are redrawn). That one line is....:

Runtime.getRuntime().loadLibrary( "JConfigOSX" );

However, which behavior I get depends on *when* I call loadLibrary. If I
call it before creating and showing the frame, it has the bad behavior.
But, if I call it after creating and showing the frame, it works OK.

Another thing I tried was to load the Example library from Apple's
JNISample instead of loading JConfigOSX. I can load that library either
before or after creating and showing the frame, and I get the good behavior.

I've looked through my code and I can't find any static initialization that
would cause a problem. Perhaps it's an import? 'otool -L' shows that both
libJConfigOSX.jnilib and libExample.jnilib use /usr/lib/libSystem.B.dylib.
Example loads its example dylib. Unlike Example, JConfig uses two
frameworks: Carbon and ApplicationServices.

I don't want to have to start taking the JConfig native code apart until I
find something that works. So, any ideas what might be causing this? Is
there an unstated (or perhaps stated) rule that a jnilib can't load a
system framework before the JVM?

Should I tell my users that they need to load JConfig after doing GUI
stuff, safe in the knowledge that it's not a problem with my library?


At 10:23 AM 6/27/02 -0700, Vladimir Lhotak wrote:
>on 6/26/02 9:45 PM, Chris Kelly at email@hidden wrote:
>
>> I've found that this code works as expected if, after starting my
>> MRJAppBuilder-built application, I minimize and then restore the app. In
>> that case, I can click on the panels, and they get redrawn as expected.
>>
>> If I don't minimize it first, I can click all day and nothing happens. When
>> I click, I'm telling each panel to repaint() itself, but the panel's
>> paint() method is not subsequently called.
>>
>> I note also that when I first open the app, an icon with the name of the
>> generated app ("samizdat") appears in the dock in the section above the
>> section with the trash icon. When I minimize the app, an *additional* icon
>> appears in the same section as the trash icon, named not "samizdat" but
>> "Disk Browser Test" (i.e., the name of the frame, not the app).
>>
>> So, is there some magic code I need to insert to get this thing working as
>> expected on OSX?
>
>In another email you said you're using a bit of native code that might be
>interfering with the desired behavior. It would be a good idea to cook up a
>pure Java test reproducing this problem and submitting a bug report. Calling
>a component's repaint() should result in it's paint() being hit at some (not
>much) later time, there is no OSX-specific magic involved.

-------------------
Send Sun a Message! Vote for JConfig here:

http://www.sys-con.com/java/readerschoice2002/nominationform.cfm

See the 'Best Class Library', 'Best Component', and 'Most Innovative
Product' categories. Thanks!

Get JConfig here: http://www.jconfig.com

Use JConfig to: enumerate the user's hard drives,
launch processes, get the file type of a file,
launch the user's default web browser, and much more.
-------------------
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Frame won't refresh, Part Deux (From: Chris Kelly <email@hidden>)
 >Re: Frame won't refresh, Part Deux (From: Vladimir Lhotak <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.