How to send a variable from one class to another?

hello,
i have "One.as", which is the document class for one.swf.
i also have "two.swf", with "Two.swf" entered as its document
class...
One loads two into it. two is basically a 10 frame movieClip
with a variable at the beginning called "var endFrame:Boolean =
false", then on the last frame it says endFrame = true.
my question: how in the world do I communicate this back to
One.as??? i've tried ENTER_FRAME listeners, declaring the variable
here and there... and many other embarrassingly usuccessful
strategies.
i would just like to load in "three.swf" after two.swf
finishes... but One needs to know that it has indeed finished.
your help would be greatly appreciated. thanks

yarkehsiow,
> David,
> thank you for responding.
Sure thing! :)
> so does what you are saying mean that endFrame is a
property of
> two (the movieClip), or Two (the Class)?
If you've written a property named endFrame for your Two
class, then
yes, Two.endFrame is a property of that class.
Looking back at your original post, I see that you wrote
this:
> One loads two into it. two is basically a 10 frame
movieClip
> with a variable at the beginning called "var
endFrame:Boolean = false",
> then on the last frame it says endFrame = true.
So it sounds like your Two class extends MovieClip. (I'm not
sure
that's true, but that's what it sounds like.) That means your
Two class
supports all the features of the MovieClip class, including a
play() method,
a currentFrame property, and so on. In addition, you've added
new
functionality that amounts to -- by the sound of it -- a
property named
endFrame. If you made your property public (i.e., public var
endFrame),
then it should be accessible by way of an object reference to
your Two
instance.
myTwoInstance.endFrame;
> so can i invoke that method in One.as? do I call it
Two.endFrame (if
> (Two.endFrame == true) {?
Methods are things an object can *do,* such as
gotoAndPlay(). What
you're describing is a property (a characteristic ... in this
case, a
Boolean characteristic). You wouldn't use the expression
Two.endFrame
unless that property was static. Static classes are those
that cannot have
an instance made of them. Think of the Math class. It
contains numerous
static properties in the form of constants, such as Math.PI,
Math.E,
Math.SQRT2, and so on. You can't create an instance of the
Math class -- it
wouldn't make sense to -- so Math is a static class.
On the other hand, you definitely create instances of the
MovieClip
class. Every movie clip symbol is an instance of MovieClip
class, which
means that each instance carries its own unique values for
MovieClip class
members. The MovieClip class defines x and y properties, but
each movie
clip symbol (that is, each instance of the MovieClip class)
configures its
own values of those properties, depending on where each
instance is located
on the Stage.
Assuming your Two class is not static, then somewhere along
the line,
your One class will have to make an instance of it. Somethine
like ...
// inside your One class ...
var myTwo:Two = new Two();
... at which point that myTwo variable because a reference to
that
particular instance of Two. You can invoke Two methods on
that instance.
You can invoke Two properties and events on that instance.
You can invoke
whatever functionality is defined by the Two class on that
myTwo instance.
If Two extends MovieClip, that means you can also invoke any
MovieClip class
member on that myTwo instance.
At some point in your One class, you can refer to that myTwo
instance
later and check if the value of myTwo.endFrame is true or
false.
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design."

Similar Messages

  • How to pass a variable from one class to another class?

    Hi,
    Is it possible to pass a variable from one class to another? For e.g., I need the value of int a for calculation purpose in method doB() but I get an error <identifier> expected. What does the error mean? I know, it's a very, very simple question but once I learn this, I promise to remember it forever. Thank you.
    class A {
      int a;
      int doA() {
          a = a + 1;
          return a;
    class B {
      int b;
      A r = new A();
      r.a;  // error: <identifier> expected. What does that mean ?
      int doB() {
         int c = b/a;  // error: operator / cannot be applied to a
    }Thank you!

    elaine_g wrote:
    I am wondering why does (r.a) give an error outside the method? What's the reason it only works when used inside the (b/r.a) maths function? This is illegal syntax:
    class B {
      int b;
      A r = new A();
      r.a;  //syntax error
    }Why? Class definition restricts what you can define within a class to a few things:
    class X {
        Y y = new Y(); //defining a field -- okay
        public X() { //defining a constructor -- okay
        void f() { //defining a method -- okay
    }... and a few other things, but you can't just write "r.a" there. It also makes no sense -- that expression by itself just accesses a field and does nothing with it -- why bother?
    This is also illegal syntax:
    int doB() {
          A r = new A();
          r.a;  // error: not a statement
    }Again, all "r.a" does on its own is access a field and do nothing with it -- a "noop". Since it has no effect, writing this indicates confusion on the part of the coder, so it classified as a syntax error. There is no reason to write that.

  • Sending a variable from one class to another?

    Dear Java Users - please can you help me out here... I know that what I am asking should be straight forward BUT I just don't understand any of the responses people have put on the web....
    Here is what I am trying to do:
    This piece of code - creates a window with a simple textbox on it to enter a word...
    The button then calls another class file to open a new window...
    All I want to do is to take the word from the text box and print it in the new window....
    The first .java file I have is this:
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class FrontPageGUI extends JFrame implements ActionListener
         //declare all instance variables for THIS per class
              JLabel lblInfoOne;
              JLabel lblButtonPopUp;
              JTextField txtName;
              JButton close;
              JButton popUp;
         public FrontPageGUI()
              //set characteristics of the JFrame object
              super("Title Bar");
              setSize(600,600);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setVisible(true);
              //we need to define a Container to place objects onto the frame - this is inside the JFrame Object Above
              Container ca = getContentPane( );
              ca.setSize(600,600);
              ca.setBackground(Color.white);
              ca.setLayout(null);                
              //define all other objects and set thier characteristics
              lblInfoOne     = new JLabel("Enter a word in the box above to send:");
              lblButtonPopUp = new JLabel("Click Here:");
              txtName          = new JTextField("");
              //create Button components
              close = new JButton("Close");
              popUp = new JButton("Click Me");
              //now add all objects to the container
              //Labels
              addXY(ca,lblInfoOne, 30, 160, 550,45);
              addXY(ca,lblButtonPopUp, 30, 210, 550,45);
              //TextField
              addXY(ca,txtName, 120, 100, 200,30);
              //Buttons
              addButtonXY(ca, popUp, 30, 260, 200, 45);
              addButtonXY(ca, close, 30, 310, 80, 30);
              // add the Container to the Frame     
              setContentPane(ca);          
         void addButtonXY(Container c, JButton cp, int x, int y, int w, int h)
               cp.setBounds(x,y,w,h);
               cp.addActionListener(this);
               c.add(cp);     
         void addXY(Container c, Component cp, int x, int y, int w, int h)
               cp.setBounds(x,y,w,h);
               c.add(cp);
         public void actionPerformed(ActionEvent event)
              if (event.getSource()== popUp)
                   //This is WHERE THE PROBLEM IS...
                   //Here I want to send to contents of the textfield - txtName
                   String temp = txtName.getText();
                   new PopUpGUI(temp);
              if (event.getSource()==close)
                   closeUp();
         void closeUp()
              System.exit(0);
              //dispose();
    //we need a driver program - this is the only time MAIN is used.
    public class FrontPage
         //create an instance of the GUI and showit
         public static void main(String args [])
              new FrontPageGUI();
                   The second .java file I have is this:
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class PopUpGUI extends JFrame implements ActionListener
         //declare all instance variables ie per class
              JLabel headerLabel;
              JLabel sentLabel;          
              JButton close;
         public PopUpGUI(String Sent)
              //set characteristics of the JFrame object
              super("Pop Up Window");
              setSize(320,450);
              setVisible(true);
              //need to define a Container to place objects onto the frame
              Container ca = getContentPane( );
              ca.setSize(320,450);
              ca.setLayout(null);                
              //define all other objects and set characteristics
              headerLabel = new JLabel("New Window!"); //heading label
              sentLabel = new JLabel(Sent);
              close = new JButton("Close");
              //now add all objects to the container
              addXY(ca,headerLabel,10,10,380,80);
              addXY(ca,sentLabel,10,100,380,80);
              addButtonXY(ca, close, 50, 200, 100, 30); //Bottom Left
              // add the Container to the Frame     
              setContentPane(ca);
         //We need these 2 methods - EVERY TIME
         void addButtonXY(Container c, JButton cp, int x, int y, int w, int h)
               cp.setBounds(x,y,w,h);
               cp.addActionListener(this);
               c.add(cp);     
         void addXY(Container c, Component cp, int x, int y, int w, int h)
               cp.setBounds(x,y,w,h);
               c.add(cp);
         //What to do when the click happens
         public void actionPerformed(ActionEvent event)
              if (event.getSource()==close)
                   dispose();
                   //closeUp(); - Doesn't run CLOSEUP this time (i.e. exit program) - instead just DISPOSEs of the window
    //Driver class is in FrontPage.javaThis seems to work... but is it the best way to do it????
    Tony.

    Well,
    Using the constructor is the way to go. Otherwise create a method that takes the string as parameter.

  • Moving Variable from one class to another.

    I need to get a Variable from one class to another how would I do this?

    Well this is a very tipical scehario for every enterprise application. You always create logger classes that generate log files for your application, as that is the only way to track errors in your system when its in the production enviorment.
    Just create a simple class that acts as the Logger, and have a method in it that accepts a variable of the type that you are are trying to pass; most commonly a String; but can be overloaded to accept constom classes. e.g.
    class Logger
      public void log(String message)
        writeToFile("< " + new Date() + " > " + message);
      public void log(CustomClass queueEvent)
        log("queue message was: " + queueEvent.getMessage() + " at: " + queueEven.getEventTime());
    }Hope this makes things clearer
    Regards
    Omer

  • Passing Variables from One Class to Another

    Hello, I am new to Java Programming and I'm currently starting off by trying to build a simple application.
    I need help to pass variables created in one class to another.
    In my source package, I created 2 java classes.
    1. Main.java
    2. InputFileDeclared.java
    InputFileDeclared reads numerical data from an external text file and store them as string variables within the main method while Main converts a text string into a number.
    Hence, I would like to pass these strings variables from the InputFileDeclared class to the Main class so that they can be converted into numbers.
    I hope somebody out there may enlighten me on this.
    Thank you very much in advance!

    Values are passed from method to method, rather than from class to class. In a case such as you describe the code of a method in Main will probably call a method in InputFileDeclared which will return the String you want. The method in Main stores that in a local variable and processes it. It really doesn't matter here which class the method is in.
    You InputFileDeclared object probably contains "state" information in its fields such as the details of the file it's reading and how far it's got, but generally the calling method in Main won't need to know about this state, just the last data read.
    So the sequence in the method in Main will be:
    1) Create an new instance of InputFileDeclared, probably passing it the file path etc..
    2) Repeatedly call a method on that instance to return data values, until the method signals that it's reached the end of file, e.g. by returning a null String.
    3) Probably call a "close()" method on the instance, which you should have written to close the file.

  • How can I pass variables from one project to another using Javascript?

    Hi all, I am trying to do this: let learners take one course and finish a quiz. Then based on their quiz scores, they will be sent to other differenct courses.
    However, I wish keep track on their previous quiz scores as well as many other variables.
    I found this nice widge of upload/download variables by CPguru (http://www.cpguru.com/2011/05/18/save-and-load-data-widget-for-adobe-captivate-4-and-adobe -captivate-5/). However, this widget works by storing variables from one project in local computer and then upload it to another project.
    My targeted learners may not always use the same computer though, so using this widget seems not work.
    All these courses resided in a local-made LMS which I don't have access to their code. Therefore, passing variables to PHP html files seems not work.
    Based on my limited programing knowledge, I assume that using Javascript to pass variables may be the only possible way.
    Can someone instruct me how to do this?
    Thank you very much.

    If you create two MIDlet in a midlet suite, it will display as you mentioned means you can't change the display style.

  • How to access a variable from one program to another (independent)

    Hi,
    My requirement is to use a variable(value) from one program(prog1) to another (prog2). how is it possible.
    Regards
    Arani Bhaskar

    Go for memory id .
    passing on values from one program to another program
    Program1
    EXPORT (variable) TO MEMORY ID 'LOC'.
    Program2
    IMPORT (variable) FROM MEMORY ID 'LOC'.
    LOC is the address , for more press f1 on export in abap editor.

  • How to pass a variable from one scene to another

    I'm making a call from one scene to another via a button, but I have two buttons calling the same scene, each for a different purpose, and I need to pass certain variables tied to each button to that called scene. How can I do this?

    import flash.events.MouseEvent;
    stop();
    var nam:String="test";
    testscene2.addEventListener(MouseEvent.CLICK,fn);
    function fn(e:MouseEvent){
        nam="Raja";
        gotoAndStop(1,"Scene 3");
    testscene1.addEventListener(MouseEvent.CLICK,fn1);
    function fn1(e:MouseEvent){
        nam="Emily";
        gotoAndStop(1,"Scene 2");

  • Using a variable from one class to another

    Hi !
    I've a class called ModFam (file ModFam.java) where I define a variable as
    protected Connection dbconn;
    Inside ModFam constructor I said:
    try
    String url = "jdbc:odbc:baselocal";
    Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
    dbconn = DriverManager.getConnection(url);
    System.err.println("Connection successful");
    } ..... rest of code
    This class define a TabbedPane as follows:
    tabbedPane.addTab("Welcome",null,new Familias(),"Familias");
    As you can see it call a new instance of the Familias class (file Familias.java).
    This constructor will try to connect with the DB to populate a combo box with some data retireved from the DB.
    If I do
    Statement stmt;
    stmt = dbconn.createStatement();
    inside Familias constructor I receive the message
    Familias.java:50: cannot resolve symbol
    symbol : variable dbconn
    location: class fam.Familias
    stmt = dbconn.createStatement();
    at compile time.
    While I can�t use a variable defined as "protected" in one class of my package on another class of the same package ?
    How could I do ?
    Thanks in advance
    <jl>

    Familias doesn't have a reference to ModFam or the Connection.
    So change the constructor in Familias to be
    public class Familias {
      private ModFam modFam;
      public Familias(ModFam m) {
        modFam = m;
    // ... somewhere else in the code
    Statement stmt = modFam.dbconn.createStatement();
    }or
    public class Familias {
      private Connection dbconn;
      public Familias(Connection c) {
        dbconn = c;
    // ... somewhere else in the code
    Statement stmt = dbconn.createStatement();
    }And when you instantiate Familias it should then be
    new Familias(this) // ModFam reference
    or
    new Familias(dbconn)

  • How to send doc files from one system to another using XI

    Hi All,
    I have a requirement to pick the word doc files from one file system and send these word document files to ECC system place in ECC application server.Can we achieve this requirement using XI. If so how we can do this. also let me know can we convert these doc files into proxy and send to ECC?. Please let me know. Thanks.
    Regards,
    Rajesh

    Yes You Can
    XI Converts Unstructured data(That is non -XML)Type- in your case word doc and maps it to Target structure.
    You can either use content conversion
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
    /people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
    /people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
    /people/jeyakumar.muthu2/blog/2005/11/29/file-content-conversion-for-unequal-number-of-columns
    /people/shabarish.vijayakumar/blog/2006/02/27/content-conversion-the-key-field-problem
    /people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter
    You can either built a adaptermodule for the same(U nedd to have Some Java knowledge)
    You can also convert without creating any objects in integration directory link for the same is
    /people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository
    ***********Please Reward Points If find Helpful*********

  • How to send an object from one application to another?

    Hi all,
    I have two applications over the same server. The first application needs to send an object to the other application.
    I try to put the object as a session attribute, but in the moment that the second application tries to get the attribute, the attribute doesn't exist.
    Does anybody now how can pass an object from the one application to the other?

    You can also use JMS

  • How to get array values from one class to another

    Supposing i have:
    - a class for the main()
    - another for the superclass
    And i want to create a subclass that does some function on an array object of the the superclass, how can i do so from this new subclass while keeping the original element values?
    Note: The values in the array are randomly generated integers, and it is this which is causing my mind in failing to comprehend a solution.
    Any ideas?

    If the array is declared as protected or public in the superclass you can directly access it using its identifier. If not, maybe the superclass can expose the array via some getter method.
    If this functionality can be generified (or is generic enough) to apply to all subclasses of the superclass the method should be moved to the superclass to avoid having to reproduce it in all the subclasses.

  • Is there a way to reference a private variable from one class in another?

    My first class starts off by declaring variables like so:
    class tStudent {
      // declare student name, id, grades 1 & 2, and gpa
      private String fname, lname, g1, g2;
      private int id;
      private double gpa;
      // define a constructor for a new student
      tStudent () {fname=lname=g1=g2=null; id=-1; gpa=0.0;}
      // define methods for manipulating the data members.
      // readStudent: reads information for just one student
    public void read (Scanner input) {
          fname = input.next();
          lname = input.next();
          id = input.nextInt();
          g1 = input.next();
          g2 = input.next();
    }And the second class:// tStudentList: for a list of students
    class tStudentList {
      private int nStudents;
      private tStudent[] list;
      // constructor for creating student list
      tStudentList() {
          list = new tStudent[36];
          for (int i=0; i < 36; i++) list=new tStudent();
    // read the individual students into the student list
    public void read(Scanner scan) {
    nStudents=0;
    while (scan.hasNext()) {list[nStudents++].read(scan);}
    // display the list of all students - fname, lname, id, g1, g2 and gpa
    // with an appropriate header so the output matches my sample //output
    public void print() {
    Is there a way to reference the variables in the first class to use in the second? Specifically in the last section of code where I am going to print the list.

    Not without resorting to reflection hackery. If the fields are private (and are supposed to be), then that means "don't allow access to these to outsiders of this class" by design.
    So if you really meant them to be accessible, then don't use private, or provide public accessors for them.

  • Passing a variable from one class to another

    Hello:
    I am new to java programming. I am developing an application in Java
    At a particular JTextField call it jtf3, I am invoking Calendar application by clikcing a jbutton.
    I would like to set text in jtf by obtaining the date clicked by the user. I am storing complete date string in the Calendar application during ActionPerformed event at Calendar Application level.
    I do not know how to pass this string to calling frame as it does not listen to the button event happening at the Calendar Application.
    Much appreciated
    Thanks a lot for your time
    regards

    This is the application from which the I am calling the calendar application.
    The method setDate set the date obtained from calendar class during actionperformed event.
    The actionperfomed event from CalendarClass is pasted below as well.
    Much appreciated
    import javax.swing.JFrame;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;
    import java.awt.*;
    public class TestDrive
    public static void main(String[] args) {
    DatePanelFrame dpf = new DatePanelFrame();
    dpf.addWindowListener(new WindowAdapter( ) {
    public void windowClosing(WindowEvent we) { System.exit(0); }
    dpf.pack();
    dpf.setVisible(true);
    class DatePanelFrame extends JFrame {
    JTextField djtf;
    String dateInput;
    public DatePanelFrame() {
    setTitle("Date Panel");
    setSize(100, 800);
    setLocation(300, 100);
    Container content = getContentPane();
    JPanel datePanel = new JPanel();
    JButton calButton = new JButton(".....");
    datePanel.add(calButton, BorderLayout.SOUTH);
    djtf = new JTextField(" ");
    datePanel.add(djtf, BorderLayout.NORTH);
    content.setLayout(new BorderLayout());
    content.add(datePanel, BorderLayout.CENTER);
    calButton.addActionListener(new ActionListener()
              public void actionPerformed(ActionEvent event)
    JFrame fr = new CalendarClass();
    fr.setSize(400, 400);
    fr.setLocation(600, 100);
    ObjCal oc = new ObjCal();
    fr.setVisible(true);
    public void setDate(String d)
    djtf.setText(d);
    repaint();
    System.out.println(djtf.getText());
    The ActionPerformed event from CalendarClass
    jbtArray.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent event)
    if (event.getActionCommand() != " ")
              daySelected = event.getActionCommand();
              yearSelected = jtfYear.getText();
              int intYearSelected = Integer.valueOf(yearSelected).intValue();
              monthSelected = jtfMonth.getText();
              intDaySelected = Integer.valueOf(daySelected).intValue();
              int intMonthSelected = getMonthNum(monthSelected);
              dateSelected = getDate(intYearSelected, intMonthSelected, intDaySelected);
              TestDrive td = new TestDrive();
              DatePanelFrame dpf = new DatePanelFrame();
              dpf.setDate(dateSelected);

  • Variable from one class to another

    I have a Program that contains a JDesktop Pane, and when the program starts, it creates the "main" window as in JInternal Frame.
    When a certain check box is checked, I call an external class that creates and returns a JInternalFrame. What I need to do is have the external class get a Vector from the main class (I pass it in when i create the object), edit the Vector, then return it to the main class. If i try to create a method in the main class like "returnVector()" or whatever to get the vector back to the main class, I get the error of "Non-static variable cannot be referenced from a non-static context". How can I get around that? The NEXT issue is this: I would like to cause the JInternalFrame that is created from the external class (on the JDesktopPane in the main class) to close itself when a button in it is clicked. I'm guess I'd need a Listener somewhere. Would that listener be in the Main class or in the external one. Does this make sense? Any help would be greatly appreciated.

    Sorry, This might be a bit lengthy, but it works and illustrates my problem. I created it in NetBeans. There are the two classes I'm jusing. The issue is illustrated in the button listener on the 2nd class:
    The First:
    package javaapplication3;
    import java.beans.PropertyVetoException;
    import java.util.Vector;
    import javax.swing.JInternalFrame;
    public class NewJFrame extends javax.swing.JFrame {
        Vector <String> TestVector = new Vector <String> (0); //Vector to move around.
        public NewJFrame() {
            //add some test strings to the Vector
            TestVector.add("String1");
            TestVector.add("String2");
            TestVector.add("String3");
            initComponents();
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
        private void initComponents() {
            jDesktopPane1 = new javax.swing.JDesktopPane();
            jInternalFrame1 = new javax.swing.JInternalFrame();
            jLabel1 = new javax.swing.JLabel();
            jButton1 = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jInternalFrame1.getContentPane().setLayout(new java.awt.FlowLayout());
            jInternalFrame1.setVisible(true);
            jLabel1.setText("This is a VERY simple example");
            jInternalFrame1.getContentPane().add(jLabel1);
            jButton1.setText("Press this");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    ButtonListen(evt);
            jInternalFrame1.getContentPane().add(jButton1);
            jInternalFrame1.setBounds(10, 10, 350, 120);
            jDesktopPane1.add(jInternalFrame1, javax.swing.JLayeredPane.DEFAULT_LAYER);
            org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jDesktopPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
            layout.setVerticalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jDesktopPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
            pack();
        }// </editor-fold>                       
        private void ButtonListen(java.awt.event.ActionEvent evt) {                             
            JInternalFrame newFrame;
            NewJFrame2 roadframe = new NewJFrame2(TestVector);
            newFrame= roadframe.getFrameBack();
            newFrame.setVisible(true);
            jDesktopPane1.add(newFrame);
            try {
                newFrame.setSelected(true);
            } catch (PropertyVetoException ex) {
                ex.printStackTrace();
        //created this in hopes of using it to return the vector from NewJFrame2
        public void returnVector(Vector<String> vectorAgain){
            this.TestVector=vectorAgain;
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new NewJFrame().setVisible(true);
        // Variables declaration - do not modify                    
        private javax.swing.JButton jButton1;
        private javax.swing.JDesktopPane jDesktopPane1;
        private javax.swing.JInternalFrame jInternalFrame1;
        private javax.swing.JLabel jLabel1;
        // End of variables declaration                  
    }The 2nd:
    package javaapplication3;
    import java.util.Vector;
    import javax.swing.DefaultListModel;
    import javax.swing.JInternalFrame;
    public class NewJFrame2 extends javax.swing.JFrame {
        Vector <String> testVector=new Vector<String>(0);
        DefaultListModel model;
        public NewJFrame2(Vector <String> TestVector) {
            this.testVector=TestVector;
            initComponents();
        public JInternalFrame getFrameBack(){
            return jInternalFrame1;
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
        private void initComponents() {
            jInternalFrame1 = new javax.swing.JInternalFrame();
            jLabel1 = new javax.swing.JLabel();
            jLabel2 = new javax.swing.JLabel();
            jScrollPane1 = new javax.swing.JScrollPane();
            model=new DefaultListModel();
            for (int a=0; a<testVector.size();a++){
                model.addElement(testVector.get(a));
            jList1 = jList1=new javax.swing.JList(model);
            jButton1 = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jInternalFrame1.setVisible(true);
            jLabel1.setText("This is the 2nd class I was referencing I passed TestVector from NewFrame. It Contains:");
            jInternalFrame1.getContentPane().add(jLabel1, java.awt.BorderLayout.NORTH);
            jLabel2.setText("Now I want to Edit this list here, and then send it back to NewFrame1. The button will attemp.");
            jInternalFrame1.getContentPane().add(jLabel2, java.awt.BorderLayout.SOUTH);
            jScrollPane1.setViewportView(jList1);
            jInternalFrame1.getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
            jButton1.setText("Return Vector");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    ReturnVectorButtonListener(evt);
            jInternalFrame1.getContentPane().add(jButton1, java.awt.BorderLayout.EAST);
            org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jInternalFrame1)
            layout.setVerticalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jInternalFrame1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            pack();
        }// </editor-fold>
        private void ReturnVectorButtonListener(java.awt.event.ActionEvent evt) {
        NewJFrame.returnVector(testVector);
        // Variables declaration - do not modify
        private javax.swing.JButton jButton1;
        private javax.swing.JInternalFrame jInternalFrame1;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JList jList1;
        private javax.swing.JScrollPane jScrollPane1;
        // End of variables declaration
    }

Maybe you are looking for

  • Error while activating the dictionary table

    i have created a table with the name ZAIL_REC_MAIL_ID in development server, while i was trying to activate it is giving a warning message, and it is not allowing to transport the table into production server. The error is as follows : <b>Name ZAIL_R

  • Restoring Contacts & Calendars 3GS

    I have not been able to restore a single contact, my calendar, my notes, four fifths of my photos despite 4 backups/restores/backups from restore, synching/merging w/google, yahoo, etc! I can see the files on my computer! I've tried seemingly everyth

  • Problem in background session processing

    Hi Experts, I am performing BDC by batch input session method. I acheved BDC by traditional recording method and able to create batch input session in SM35. Whenever I process batch input session in FOREGROUND it processes successfully.But whenever I

  • How can I tell what version of SharePoint Designer 2010 I have?

    I know there have been at least 2 service packs for SharePoint Designer. I know what version I have - 14.0.7128.5000 How can I tell whether the service packs have been applied or not? Thank you.

  • Is Reference Monitor Real Time?

    I never questioned this before but is the reference monitor realtime? The behavior i get is.... frames update when i scrub shows color changes freezes when i plat the SEQ It has always done that but I was wondering it it could play simultaneously wit