> Hi Charles,
> Thanks for the advice.
> W.r.t your mail below, and I quote :
>       By further abstracting the Action Listener in this way, you are
> attempting
>       to use an inner class like a subroutine library which won't help you
> in the
>       long run.
>
>       I suggest using the first method.  It will allow you to change your
> encoding
>       algorithm without having to affect the main Codec1 class.
> I understand the 2nd sentence. Can you please
> elaborate on the 1st.
>
> Thanks
> Vasudev
>
> > -----Original Message-----
> > From:       Noble, Charles G. (PS, NE) [SMTP:[EMAIL PROTECTED]]
> > Sent:       Tuesday, October 26, 1999 8:43 PM
> > To: [EMAIL PROTECTED]
> > Subject:    Re: Partly off-topic: Q on inner classes/ActionListener
> >
> > ActionListener is an Abstract class meaning that actionPerformed is
> > intended
> > to be overridden.  The first step is to override actionPerformed in your
> > own
> > classes which should get rid of a couple of errors.
> >
> > The second observation is that you should probably consider changing
> your
> > design.  Making an encode action listener class implies that you are
> > extending the ActionListener abstraction.  What you probably want to do
> is
> >   1. create an EnCode/DecodeButton class which implements
> ActionListener.
> >   2. override actionPerformed with a test like:
> >        if (evt.getSource() instanceof Button) {
> >           Button b =(Button)evt.getSource;
> >           if (b.getLabel() == "Encode") {
> >               abc;
> >               xyz;
> >           }
> >           if (b.getLabel() == "Decode") {
> >               abc;
> >               xyz;
> >           }
> >   3. implement your new EncodeDecodeButton class in your Codec1
> > application.
> >
> > If you really want to use an extra level of abstraction, as your code
> > currently suggests, then you will need to override the code in Codec1 as
> > follows:
> >
> >                 // add Listeners
> >                 encodeBtn.addActionListener(new EncBtnAL() {
> >                   void actionPerformed() { abc; xyz; }
> >                 });
> >                 decodeBtn.addActionListener(new DecBtnAL() {
> >                   void actionPerformed() { abc; xyz; }
> >                 });
> >                 exitBtn.addActionListener(new ExiBtnAL() {
> >                   void actionPerformed() { abc; xyz; }
> >                 });
> >
> > By further abstracting the Action Listener in this way, you are
> attempting
> > to use an inner class like a subroutine library which won't help you in
> > the
> > long run.
> >
> > I suggest using the first method.  It will allow you to change your
> > encoding
> > algorithm without having to affect the main Codec1 class.
> >
> > Charles
> >
> > >
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to