Article View: borland.public.jbuilder.java.swing
Article #8976Dialog Data Exchange
From: Jon C. Creyts
Date: Tue, 20 Jun 2000 00:00
Date: Tue, 20 Jun 2000 00:00
37 lines
1810 bytes
1810 bytes
I'm having a puzzling problem with exchanging data between dialog
boxes. I have used the same technique in other code without a hitch,
but for some reason in my current program the transfer variable reverts
to its values in the calling method rather than accepting the changed
values from the spawned dialog. The code looks like this:
//currently in a showDialog method for one Dialog1 box
Dialog2 dlg = new Dialog2(this,"Dialog2", true);
String transferString = new String("GeneratedInDialog1");
if (dlg.showDialog(transferString)) {
System.out.println(transferString);
}
//now in Dialog2 class
public boolean showDialog(String transfer) {
ok = false; //ok is a boolean changed to true if OK button
is pressed
show();
if (ok) {
transfer = transfer.concat(", ModifiedInDialog2");
}
return ok;
}
I would expect the preceding code to print "GeneratedInDialog1,
ModifiedInDialog2" when the OK button is pressed. This is indeed the
value shown in the debugger when in the showDialog method for Dialog2.
But as soon as we go back to Dialog1, it reverts to
"GeneratedinDialog1"! Yikes!!!
Please let me know if you have any insight...I am kinda hopin' to learn
something.
tia,
Jon
Technical Details
Message-ID:
<394FB104.83277EB5@newton.berkeley.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,3e33a8a99f1c0992,start X-Google-Attributes: gid111d45,public From: "Jon C. Creyts" <jcreyts@newton.berkeley.edu> Subject: Dialog Data Exchange Date: 2000/06/20 Message-ID: <394FB104.83277EB5@newton.berkeley.edu> X-Deja-AN: 636887659 Content-Transfer-Encoding: 7bit X-Trace: 20 Jun 2000 10:53:10 -0800, 127.0.0.1 Organization: University of California, Berkeley Content-Type: text/plain; charset=us-ascii MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing