-2

I have a question, im making a application where you can first select a name from a jList in a jFrame. After you've selected a name and pressed the proceed button, a second jFrame pops up.

On this jFrame there are a couple of textfield which i want to automatically fill up with information about the selected name selected in the first jFrame. And this information which is automatically filled in is different depending on the chosen name.

I already have the first jFrame with 4 names in a arraylist but now im stuck on the second part where the chosen name is transfered to the second frame along with the extra information which must be done automatically

I hope someone can help me, i would really appreciate it.

THank you.

Reimeus
  • 158,255
  • 15
  • 216
  • 276
DOGGY G
  • 15
  • 4

2 Answers2

0

Well, heres how I would do it:

Exit the current jframe

Pass the data in the arrayList to a function that creates a new JFrame

Fill the new JFrame

Community
  • 1
  • 1
Bobb Dizzles
  • 533
  • 3
  • 12
0

Creating a a Swing application with multiple JFrames can be problematic.

A better and simpler approach would be to use CardLayout and to have panels within a single frame. Your ArrayList could be a member variable in the main JFrame class and could be easily be updated with data as you progress.

See: How to Use CardLayout

Community
  • 1
  • 1
Reimeus
  • 158,255
  • 15
  • 216
  • 276