🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #8016

Re: passing info???

#8016
From: Randy
Date: Tue, 07 Nov 2000 00:00
51 lines
2043 bytes
well I have an internal frame class that I am implementing an
ActionListener;  I have a method that returns information; the problem that
I am having is the content of the internal frame isn't visible; it's just go
to the method that waits for something to return

for example :

public class example extends JInternalFrame implements
  ActionListener {
    private String value = null;
   public example(){
          super("Example",false,true,false,true);
          Container c = getContentPane();
          c.setLayout(new FlowLayout());
         JButton ok = new JButton("OK");
        ok.addActionListener(this);
        JTextArea name = new JTextArea(20);
       c.add(name);
       c.add(ok);
       show();
  }

  public void actionPerformed(ActionEvent e){
        value = name.getText();
        dispose();
  }

  public String getName(){
      while(value == null);
      return value;
  }
}

from the main JFrame
   ...
   example inter_frame = new example();
   String result = inter_frame.getName();
   ....
"Joi Ellis [TeamB]" <joi@aravox.com> wrote in message
news:8u88r3$2q11@bornews.inprise.com...
> Randy <slyfox65@netzero.net> wrote:
> > how do you pass information back from an actionlistener class to a
JFrame?
>
> Well, in the same way you pass data to any object: by invoking methods on
it.
>
> --
> Joi Ellis (TeamB)
> No direct email, please.
> For best results, post on news server newsgroups.borland.com!
Technical Details
Message-ID: <8u9k5g$gns7@bornews.inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8u86fg$410@bornews.inprise.com> <8u88r3$2q11@bornews.inprise.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,a7b3ebf20753844f
X-Google-Attributes: gid111d45,public
From: "Randy" <slyfox65@netzero.net>
Subject: Re: passing info???
Date: 2000/11/07
Message-ID: <8u9k5g$gns7@bornews.inprise.com>
X-Deja-AN: 690901648
References: <8u86fg$410@bornews.inprise.com> <8u88r3$2q11@bornews.inprise.com>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.swing