Send variable to new application frame


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Send variable to new application frame

  1. #1
    Join Date
    Sep 2002
    Posts
    1

    Question Send variable to new application frame

    Hi!
    Have application with two frames.
    In second frame need value of variable from first frame.
    How do i get it?

  2. #2
    Join Date
    Aug 2002
    Posts
    94
    Hi,

    public class firstframe{
    //some code here
    int n;
    }

    Public class secondframe{
    firstframe fr;

    void somemethod(){
    int m=fr.n;
    }
    }

    Hope this helps.
    Pankaj

  3. #3
    Join Date
    Jul 2002
    Posts
    5
    When you create the second frame, construct it with a pointer to the first frame or the variable needed.

    class SecondFrame extends Frame {

    private Frame firstFrame;

    public SecondFrame(Frame firstFrame) {
    this.firstFrame = firstFrame;
    }

    // or

    private Object varFromFirstFrame;

    public SecondFrame(Object varFromFirstFrame) {
    this.varFromFirstFrame = varFromFirstFrame;
    }

    }

    In FirstFrame create a second frame like this:

    SecondFrame mySecondFrame = new SecondFrame(this);

    // or

    SecondFrame mySecondFrame = new SecondFrame(myVarInFirstFrame);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center