Can I pass String[] values to array in another frame?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Corwin Moyne
    New Member
    • Feb 2012
    • 37

    Can I pass String[] values to array in another frame?

    I have been given some already complete classes by my lecturer and the idea is that I build a GUI. The project is based on an Employee class.

    Among other things, I would like to add a new Employee to the array of Employees already created for me by my lecturer. The problem I have is in the way my lecturer has set the project up: I run an EmployeeTester class, and after selecting an Employee to view from a combobox, a new frame opens up called EmployeeFrame showing the Employee details. From here I have successfully created a JButton (Add Employee) which opens a JDialog to take in values of a new Employee and pass them back to EmployeeFrame where I can create a new Employee. The problem I have is that the original array of employees is back in EmployeeTester and this is where I need to add the new Employee. Is it possible to pass these details back another frame so that I can add my new Employee to the array? Can I implement some kind of listener on EmployeeTester that detects when a value has changed on EmployeeFrame?
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    You can pass variables to other classes through a constructor or as a parameter to a method.

    Comment

    • VanessaMeacham
      New Member
      • Sep 2012
      • 31

      #3
      Yes, I agree that we can pass variable to a class through constructor and method.

      Comment

      Working...