The Artima Developer Community
Sponsored Link

Java Answers Forum
Passing data in a program with GUI, HOW ?

1 reply on 1 page. Most recent reply: Mar 18, 2002 12:06 AM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
goguest

Posts: 4
Nickname: goguest
Registered: Mar, 2002

Passing data in a program with GUI, HOW ? Posted: Mar 17, 2002 11:22 PM
Reply to this message Reply
Advertisement
I've written a java application consisting of three classes, two of which are coded to construct two different user interfaces for acquiring data from the user while the remaining one consists of the main() function and controls the flow of the entire program.However, due to the property of event-driven programming, I find it very hard to pass data from the two GUI back to the main class for further processing. And my question is, what is the best and efficient way of passing data between classes in a GUI program such as my one, and how ? Appreciate if a simple example could be given ! Thanx.


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Passing data in a program with GUI, HOW ? Posted: Mar 18, 2002 12:06 AM
Reply to this message Reply
Since GUI programs are event-driven, they don't ever provide information back to the main() method. This is true in any GUI environment; for instance, in a traditional old-fashioned Windows application, you'd start out in WinMain(), which would launch the UI and never see any more action until the program exits (I'm overlooking the fact that it could do something silly in the middle of message dispatching, because that would be ...well, silly).

An event-driven system cannot logically interact with a sequential system. The only time a sequential system can use dialogs is when they are modal and it can pop one up, get some info and proceed based on that (for instance, a console app can pop up the occasional modal message box, but it cannot deal with modeless windows). Probably there is something wrong with the way you are going about things, if you think you need to be able to do this. Maybe you can post your code and we can help you to solve your problem in the context of an event-driven program.

Flat View: This topic has 1 reply on 1 page
Topic: How can I get pixel controlling with JAVA? Previous Topic   Next Topic Topic: TicTacToe

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use