?
Solved

How to get the Value ?

Posted on 2002-03-07
4
Medium Priority
?
197 Views
Last Modified: 2010-03-31
Hi

I have a JPopupMenu.When I right click on the Menu
I am loading a wizard screen

basically I am loading a new JFrame

which has a Jbutton "finish" and many JTextFields

Now when the user presses "finish"
I have to get the values entered in the JTextField
in the main class which loaded the Wizard

I dont have the reference of the textfields in the main class.

How do I do this?

please help



0
Comment
Question by:sanjay_thakur
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 4

Author Comment

by:sanjay_thakur
ID: 6847935
The problem is when the user presses the finish button
Then I have to read the values of all the Textfields
in some data structure (say a hashmap)and send it to the
mainframe who invoked the wizard

But I dont have any reference of the finish button in the main frame
So when the user presses the finish button in the wizard screen how do I
send this event to the main frame

 public void gui_VolumeMenu()
    {
       //here I am loading the new frame
       WizardFrame  frame = new VolumeWizard1();
       
        /**I need to do this when the user presses the    
        finish button in the new Frame ?????**/
        Iterator i = data.iterator();
        while(i.hasNext())
        {
          System.out.println("next" + i.next());
        }
       

}


0
 
LVL 9

Accepted Solution

by:
Ovi earned 150 total points
ID: 6849893
The main class can register itself as listener to the wizard ? If yes you could generate a event when the finish button was pressed, and put in that event your hashmap with results.

If not, you could implement a class (maybe static) for notification let's say Dispatcher, to which your main class listen for notification. When you push the finish button, you will notify the Dispatcher that you have some results and pass'it to it. The Dispatcher then notify the main class (or all listeners for that kind of event) and send the data. You can extend further this pattern in forcing each class which want's notification of some kind to implement a general interface, register that interface to the Dispatcher, and put the Dispatcher to directly set the data using the interface methods.
0
 
LVL 4

Author Comment

by:sanjay_thakur
ID: 6850990
Hi could you please post some source code/links
for the second option

It would be really helpful

Thanka a ton
0
 
LVL 4

Author Comment

by:sanjay_thakur
ID: 6942498
I follwed the guidelines and implemented it

Thanks a ton

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month12 days, 23 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question