Hi All

I have a about java. and my question is i have a window open and in that window there is a add button when user click on the add button then a form window opens up and in that form window user can input anything thing want and after they finish they need to click on the "add" button to add all that info. but what i want is when user click "add" button on the form i need to show that info on the first window screen. any help please.

Recommended Answers

All 3 Replies

The second window will have a conwstructor that will take as argument the first window:

public Frame2 (Frame1 f1)

The Frame1 (first window) will have variables that will take value from the second window when you click 'Add'. When you click 'Add' from the second window you will give values to the f1 variables. These variables could be type JTextField so at first they will be blank and then after 'Add' they will display what you get from second window

i m sorry but i still didn't get it.

He is saying that frame2 will need a reference to frame1. Your add button code will need to call methods on frame1 to set the data that you wish to display.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.