Article View: borland.public.jbuilder.java.swing
Article #10007Re: How do I call the method in another JInternalFrame??
From: Paul Furbacher [TeamB]
Date: Thu, 09 Dec 1999 00:00
Date: Thu, 09 Dec 1999 00:00
48 lines
1690 bytes
1690 bytes
ERic wrote:
> [snipped]
You have to provide a way for each object to know about the
other. That means that the Frame which has to access methods
in the other has to have a reference to that other frame:
public class Frame1 extends ... {
public Frame2 frame2;
// constructor with no parameters -- JBuilder needs such a constructor
// for visual designer.
public Frame1() { ... }
// You call this method from the application object, or some other
// object which "knows" about both frames.
public void setFrame2(Frame2 aFrame2) {
this.frame2 = aFrame2;
}
// a method which calls a method in frame2
void doSomething() {
if ( aFrame2.isOK() )
...;
}
} // end of Frame1
public class Frame2 extends ... {
// Zero-parameter constructor.
public Frame2() { ... }
// Provide a "public" method "isOK()" so that other classes can call it.
public boolean isOK() {
// maybe ... you implement it.
return false;
}
// ... more methods.
}
That's it.
Paul Furbacher (TeamB)
Technical Details
Message-ID:
<38507716.D2B3710@bilbo.bio.purdue.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<384B2BF9.E4F5F512@usa.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,90cef02ebe14eb97,start X-Google-Attributes: gid111d45,public From: "Paul Furbacher [TeamB]" <pf@bilbo.bio.purdue.edu> Subject: Re: How do I call the method in another JInternalFrame?? Date: 1999/12/09 Message-ID: <38507716.D2B3710@bilbo.bio.purdue.edu> X-Deja-AN: 558850387 Content-Transfer-Encoding: 7bit References: <384B2BF9.E4F5F512@usa.net> Content-Type: text/plain; charset=us-ascii Organization: Reverse Alchemy, Inc. Mime-Version: 1.0 Reply-To: pf@bilbo.bio.purdue.edu Newsgroups: borland.public.jbuilder.java.swing