Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Null Layout Manager Problems solved! (It's a different kind of Bug...)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Null Layout Manager Problems solved! (It's a different kind of Bug...)



Well, I was able to find out what it was that was causing our Dialogs to crash and it turned out that it wasn't because we were using a Null Layout Manager. I was able to narrow it down pretty well and here's some sample code that will cause a JDialog to crash with a bus error almost every time:

-----------------------------------------------------------------

import java.awt.*;
import javax.swing.*;

public class Dialog1 extends JDialog {

public Dialog1(Frame frame, String title, boolean modal)
{
super(frame, title, modal);
pack();
setSize(400, 400);
setResizable(false);
setLocationRelativeTo(null);
}

}
-----------------------------------------------------------------

For some reason OS X doesn't like this order. Now with our Dialogs we didn't even need to call "pack()" because we are using Null Layout Managers, but we had the pack in there because JBuilder puts it there automatically when using the Visual designers. So our work-around is to just take out the "pack()" call in all of our dialogs, but you can also work-around it if you take "setResizable(false)" out of the constructor (or take it out completely) and call it right before you make the Dialog visible. Anyway it's a really weird bug and I'm filing a bug report on it. I'm happy that I can at least run our App on OS X now and not have it crash every time I open a dialog.

Isn't life great sometimes... I don't get to create the Dialogs, I get to fix the bugs in them! :-)

____________________________________

Dave Thorup
Software Engineer
email@hidden
voice: 801-805-9422

CORDA Technologies, Inc.
http://www.corda.com
Interactive Data-Driven Graphics




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.