Article View: borland.public.jbuilder.java.swing
Article #7536Re: Best way to show pop-up window?
From: Torsten Welches
Date: Wed, 17 Jan 2001 12:11
Date: Wed, 17 Jan 2001 12:11
129 lines
5171 bytes
5171 bytes
Andy,
apparently you do some db stuff inside your jbInit which is
causing the problem. Do you share a DataSet between login dialog
and main window? If so just do what the exceptions says:
"Close the DataSet first" before reusing it inside jbInit.
If not you might want to repost to borland.public.jbuilder.database.
It is not a Swing problem for sure.
Good luck,
Torsten
"Andy Lau" <alau@idsfinance.com> wrote:
>Hello all,
> I need some help to solve some dialog problem. thanks.
>
> Basically I created a Login Dialog (modal dialog) box to validate
>username and
>password, and then pass the username/password to it's 'owner' frame for
>database connection.
>I have tried the DBPasswordPrompter and it works , however, I want to add
>more features so I
>created my own dialog box.
>
>The main application has something like this:
>
> public Application1() {
> Frame1 frame = new Frame1();
> Dialog_Login dialog = new Dialog_Login(frame,"try",true); // a
>modal dialog
> dialog.show();
> frame.setUser( dialog.getUser());
> frame.setPassword(dialog.getPassoword());
> frame.loadframe();
> if (packFrame) {
> frame.pack();
> }
> else {
> frame.validate();
> }
>
> Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
> Dimension frameSize = frame.getSize();
> if (frameSize.height > screenSize.height) {
> frameSize.height = screenSize.height;
> }
> if (frameSize.width > screenSize.width) {
> frameSize.width = screenSize.width;
> }
> frame.setLocation((screenSize.width - frameSize.width) / 2,
>(screenSize.height - frameSize.height) / 2);
> frame.setVisible(true);
> }
>
>And the main frame has something like:
>
> public Frame1() {
> enableEvents(AWTEvent.WINDOW_EVENT_MASK);
> try {
> // jbInit();
> }
> catch(Exception e) {
> e.printStackTrace();
> }
> }
>
> public void loadframe() {
> try {
> jbInit(); // I want to load the frame myself instead, instead at the
>constructor.
> }
> catch(Exception e) {
> e.printStackTrace();
> }
> }
>
>The Dialog has something like:
>
> public Dialog_Login(Frame frame, String title, boolean modal) {
> super(frame, title, modal);
> try {
> jbInit();
> pack();
> }
> catch(Exception ex) {
> ex.printStackTrace();
> }
> }
>
>Problem I face:
> 1) after the dialog exit ( or rather hide() ) , then the parent 'frame'
>will show up.
> However , it gave me some errors like :
>
>See com.borland.dx.dataset.DataSetException error code: BASE+39
>com.borland.dx.dataset.DataSetException: Operation cannot be performed on an
>open DataSet. Close the DataSet first.
> at com.borland.dx.dataset.DataSetException.c(Unknown Source)
> at com.borland.dx.dataset.DataSetException.y(Unknown Source)
> at com.borland.dx.dataset.StorageDataSet.s(Unknown Source)
> at com.borland.dx.dataset.StorageDataSet.ac(Unknown Source)
> at com.borland.dx.dataset.StorageDataSet.setColumns(Unknown Source)
> at com.ids.spectrum.Frame1.jbInit(Frame1.java:3421)
> at com.ids.spectrum.Frame1.loadframe(Frame1.java:761)
> at com.ids.spectrum.Application1.<init>(Application1.java:39)
> at com.ids.spectrum.Application1.main(Application1.java:69)
>
>
>I am sure the main frame works as it was able to run properly if I disable
>the dialog box.
>As far as I know, when you say dialog.show() , the 'owner' frame will not
>execute until
> dialog.hide() which causes dialog.show() to return.
>This mean that the application is running sequencially , and I am just
>wondering
> why will the Dialog box interfer with it's owner frame ????
>The dialog box and it's owner frame both have their jbinit() method. They
>are executed in a sequential manner.
>Also, all my Database connection properties are initilased within the
>jbinit() method of the 'owner' frame.
>
>
>Your comment/help is greatly appreciated.
>
>
>Andy.
Technical Details
Message-ID:
<3a658c08_1@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!bornews.borland.com!dnews!207.105.83.65References:
<3a6377a0_2@dnews> <MPG.14cdb2b271adba45989e9c@forums.borland.com> <3a6576f8_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,267d9c3d9ca6f479 X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2001-01-17 04:14:07 PST From: "Torsten Welches" <torsten.welches@who.cares.netcologne.de> Sender: "Torsten Welches" <torsten.welches@who.cares.netcologne.de> Reply-To: "Torsten Welches" <torsten.welches@who.cares.netcologne.de> Subject: Re: Best way to show pop-up window? Newsgroups: borland.public.jbuilder.java.swing X-User-Info: 193.158.55.74 193.158.55.74 References: <3a6377a0_2@dnews> <MPG.14cdb2b271adba45989e9c@forums.borland.com> <3a6576f8_2@dnews> NNTP-Posting-Host: 207.105.83.65 Message-ID: <3a658c08_1@dnews> Date: 17 Jan 2001 04:11:52 -0800 X-Trace: 17 Jan 2001 04:11:52 -0800, 207.105.83.65 Lines: 130 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!bornews.borland.com!dnews!207.105.83.65