Article View: borland.public.jbuilder.java.language
Article #8105Re: Accessing methods of other existing frame
From: ainur
Date: Wed, 18 Apr 2001 14:44
Date: Wed, 18 Apr 2001 14:44
51 lines
2144 bytes
2144 bytes
You could make all the methodes from the on-screen frame static, bu that is
a dumb (Visual Basic) way of doing things to my oppinion.
What about passing the onscreen frame as a parameter in the construction of
the second screen like:
public class OnScreen extends JFrame {
Onscreen() {
..code..
}
public void aMethode() {
...code..
}
public void callScecondScreen() {
ScecondScreen screen = new ScecondScreen(this);
// with the this-keyword the whole class is passed as parameter to
the second frame
}
}
public class SecondScreen extends JFrame {
SecondScreen(JFrame firstFrame) {
// call the methode in the Onscreen class, wich is now, in this
class, named firstFrame
firstFrame.aMethode();
}
}
Hope this works for you. Let me now if you, or anybody else, finds something
better
"Ken Kwok" <kamkuikwok@hotmail.com> schreef in bericht
news:3adbc418_2@dnews...
> Dear all:
>
> Can anyone tell me how a frame can access public methods of another
existing
> (already shown on screen) frame?
>
> Thanks,
> Ken
>
>
Technical Details
Message-ID:
<987604929.8402.0.pluto.c3adee5c@news.demon.nl>Path:
arc1-ca.pugleaf.net!supernews.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!194.176.220.130!newsfeed.icl.net!dispose.news.demon.net!news.demon.nl!demon!ainur.demon.nl!not-for-mailReferences:
<3adbc418_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,bd5fce8d57c77f0d X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-04-18 07:47:05 PST Path: arc1-ca.pugleaf.net!supernews.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!194.176.220.130!newsfeed.icl.net!dispose.news.demon.net!news.demon.nl!demon!ainur.demon.nl!not-for-mail From: <ainur> Newsgroups: borland.public.jbuilder.java.language Subject: Re: Accessing methods of other existing frame Date: Wed, 18 Apr 2001 16:44:36 +0200 Message-ID: <987604929.8402.0.pluto.c3adee5c@news.demon.nl> References: <3adbc418_2@dnews> NNTP-Posting-Host: ainur.demon.nl X-NNTP-Posting-Host: ainur.demon.nl:195.173.238.92 X-Trace: news.demon.nl 987604929 pluto:8402 NO-IDENT ainur.demon.nl:195.173.238.92 X-Complaints-To: abuse@nl.demon.net X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Lines: 53