Re: Closing one window and opening another
- From: "VisionSet" <spam@xxxxxxxxxxxx>
- Date: Wed, 30 Aug 2006 20:53:04 GMT
<zilvar@xxxxxxxxx> wrote in message
news:1156965574.470737.50440@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Using Netbeans 5.0, I'm trying to teach myself some Java more
complicated than System.out.println("Hello World.");
I'd like some help figuring out the best way to build a login-style
screen. It seems that I could create a main class and the two forms.
My main could call LoginScreen, which listens for a button press, hides
itself on command ... and this is where I get iffy. I doubt action
listeners can return a value, so I think I need to implement a personal
'yo, successful login' event and wrap that around login in a try/catch
block, which would catch the event and ask the 2nd window to show
itself.
Is that a reasonable implementation of the idea, and if not, some
pointers to whatever I'm missing would be much appreciated. :)
I've done this with a CardLayout presenting the login screen first.
The Login component is a separate class to which I can add a listener for
successful login. This keeps the login screen responsible for displaying
bad login information. You only need a regular ActionListener.
Of course you should have model classes that decouple presentation from
logic and that do the actual validation... If this is anymore than a toy
app.
Oh and remember exception handling is for exceptional conditions.
--
Mike W
.
- References:
- Closing one window and opening another
- From: zilvar@xxxxxxxxx
- Closing one window and opening another
- Prev by Date: Re: robot gui approach
- Next by Date: Re: Closing one window and opening another
- Previous by thread: Re: Closing one window and opening another
- Next by thread: Re: Closing one window and opening another
- Index(es):