Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #1347

Re: Disposing of Objects?

From Davej <galt_57@hotmail.com>
Newsgroups comp.lang.java.help
Subject Re: Disposing of Objects?
Date 2011-11-15 12:15 -0800
Organization http://groups.google.com
Message-ID <86fef440-0898-4ff1-90f2-ba076f524818@j10g2000vbe.googlegroups.com> (permalink)
References <752b3c45-6455-4f52-8cf8-d2ba7714b51f@p16g2000yqd.googlegroups.com> <j9tv9q$dvi$1@dont-email.me> <14847360.425.1321373842152.JavaMail.geo-discussion-forums@prgt40> <a6100ea3-c1bd-450e-9750-1277fc00c8bd@w1g2000vba.googlegroups.com> <EWxwq.27362$Us1.15966@newsfe16.iad>

Show all headers | View raw


On Nov 15, 12:10 pm, Daniel Pitts wrote:
> On 11/15/11 9:56 AM, Davej wrote:
> > On Nov 15, 10:17 am, Lew  wrote:
> >> [...]
>
> >> What do you mean by "reinstantiating"?
>
> > I have q declared as a global inside the main class...
>
> > public class MortgageView extends FrameView {
> >    Mortgage q;//globals
>
> > ....then inside the button event handler I execute...
>
> > q = new Mortgage(amt, term, int);//creates table
>
> > ....if the button is pressed again the statement is executed again. I
> > would call this "reinstantiation."
>
> You may call q global and call that reinstantiation, but you'd be wrong
> on both counts.
>
> However, to a better point, you should not be using "new Mortgage"
> inside MortgageView at all! Mortgage should be instantiated by your
> controller, and passed to the view.  Mortgage is your model.
>
> If you have a button that says "New Mortgage", then the handler (which
> is in the controller) should call new Mortgage() and pass it to all
> views which care about it.
>
> HTH,
> Daniel.

Ok, maybe I need an introduction to the controller. You create a new
desktop application in Netbeans and all you have is the view class.
Button events are handled in routines inside this view class. Thanks.

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Disposing of Objects? Davej <galt_57@hotmail.com> - 2011-11-15 06:59 -0800
  Re: Disposing of Objects? markspace <-@.> - 2011-11-15 07:08 -0800
    Re: Disposing of Objects? Lew <lewbloch@gmail.com> - 2011-11-15 08:17 -0800
      Re: Disposing of Objects? Davej <galt_57@hotmail.com> - 2011-11-15 09:56 -0800
        Re: Disposing of Objects? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-15 10:10 -0800
          Re: Disposing of Objects? Davej <galt_57@hotmail.com> - 2011-11-15 12:15 -0800
            Re: Disposing of Objects? markspace <-@.> - 2011-11-15 12:51 -0800
        Re: Disposing of Objects? Lew <lewbloch@gmail.com> - 2011-11-15 13:00 -0800
        Re: Disposing of Objects? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-15 21:59 -0500
          Re: Disposing of Objects? markspace <-@.> - 2011-11-15 19:13 -0800
            Re: Disposing of Objects? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-15 22:32 -0500
  Re: Disposing of Objects? Davej <galt_57@hotmail.com> - 2011-11-15 08:08 -0800
    Re: Disposing of Objects? markspace <-@.> - 2011-11-15 08:32 -0800
    Re: Disposing of Objects? Lew <lewbloch@gmail.com> - 2011-11-15 12:57 -0800
  Re: Disposing of Objects? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-16 06:23 -0800

csiph-web