By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,236 Members | 1,453 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,236 IT Pros & Developers. It's quick & easy.

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

P: 37
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?
Apr 14 '13 #1
Share this Question
Share on Google+
2 Replies

P: 13,264
You can pass variables to other classes through a constructor or as a parameter to a method.
Apr 14 '13 #2

P: 31
Yes, I agree that we can pass variable to a class through constructor and method.
Apr 15 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.