Article View: borland.public.jbuilder.java.swing
Article #7519Re: Best way to show pop-up window?
From: John McGrath TeamB
Date: Tue, 16 Jan 2001 07:41
Date: Tue, 16 Jan 2001 07:41
39 lines
2534 bytes
2534 bytes
On Mon, 15 Jan 2001 17:23:02 -0500, Steve Swett wrote:
[snip]
> What is the best way to do something like that? I'm pretty new
> with Java, so I don't know whether I should be looking at a dialog,
> option pane, or a card layout solution. (or something else)
I assume what you mean by a CardLayout would be to switch the card on
the frame to show the other information. Although that would not be
hard to do, I would avoid that approach because I think the interface
would be somewhat confusing to the user. Opening a dialog is more
typical in that sort of a situation, so the user would understand it
more readily.
The difference between the dialog and option pane approaches are in the
implementation, and they should achieve essentially the same thing.
The JOptionPane class provides convenient methods for placing the
buttons and showing your object in a dialog.
If JOptionPane does what you want it to do, then it is probably the
better approach, since it is a little easier. But if you want to do
things that JOptionPane does not handle, then you will find yourself
fighting it, and you would be better off using a JDialog.
One example where JOptionPane does not work very well is if you need to
validate some input and if it is invalid, display an error dialog and
then allow the user to correct the problem. The problem there is that
the JOptionPane showXxxxDialog() methods close the dialog before they
give control back to the caller. In these cases, a JDialog works much
better.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<MPG.14cdb2b271adba45989e9c@forums.borland.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.maxwell.syr.edu!nntp1.njy.teleglobe.net!teleglobe.net!surfnet.nl!naxos.belnet.be!news.belnet.be!bornews.borland.com!not-for-mailReferences:
<3a6377a0_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-15 23:42:06 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.maxwell.syr.edu!nntp1.njy.teleglobe.net!teleglobe.net!surfnet.nl!naxos.belnet.be!news.belnet.be!bornews.borland.com!not-for-mail From: John McGrath [TeamB] <ng-b@JPMcGrath.net> Newsgroups: borland.public.jbuilder.java.swing Subject: Re: Best way to show pop-up window? Date: Tue, 16 Jan 2001 02:41:19 -0500 Organization: Another Netscape Collabra Server User Lines: 39 Message-ID: <MPG.14cdb2b271adba45989e9c@forums.borland.com> References: <3a6377a0_2@dnews> NNTP-Posting-Host: dslcv1-60.fast.net X-Newsreader: MicroPlanet Gravity v2.30