Solved

How to get the Value ?

Posted on 2002-03-07
4
193 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 50 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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

705 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