Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

GUI and switch problem

Thread view: 
DERosenblum@gmail.com - 02 Nov 2007 15:20 GMT
In class1 I have a switch statement that switches on int choice and
defaults to choice = 1 when the program is run. In class2, I have
setup a GUI which includes 2 radio buttons. When someone clicks the
2nd radio button I want the variable that gets switched in class1 to
become 2 and restart the application with that value.

I'm having trouble getting Class1 to read-in the value when the radio
button is pushed and then restart. I'm new to programming so more
details would be useful.

Thanks!
Lew - 02 Nov 2007 15:31 GMT
> ... more details would be useful.

Likewise.
<http://www.physci.org/codes/sscce.html>

Signature

Lew

Roedy Green - 02 Nov 2007 19:30 GMT
On Fri, 02 Nov 2007 07:20:39 -0700, "DERosenblum@gmail.com"
<DERosenblum@gmail.com> wrote, quoted or indirectly quoted someone who
said :

> When someone clicks the
>2nd radio button I want the variable that gets switched in class1 to
>become 2 and restart the application with that value.

You want a to write a method of class1 that accepts a boolean.

public setZeugmaState( boolean on )
{
// code to poke the class1 gui the way you want.
// code to invoke the computations based on the change.
}

In your class2 event handler, call setZeugmaState( ... )

Zeugma here stands for the name of the property you seem reluctant to
divulge.

I can't fill in variable names because you did not divulge them.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Suffocate - 03 Nov 2007 10:42 GMT
On Nov 3, 12:20 am, "DERosenb...@gmail.com" <DERosenb...@gmail.com>
wrote:
> In class1 I have a switch statement that switches on int choice and
> defaults to choice = 1 when the program is run. In class2, I have
> setup a GUI which includes 2 radio buttons. When someone clicks the
> 2nd radio button I want the variable that gets switched in class1 to
> become 2 and restart the application with that value.

Depending on exactly how your app is structured, you could create a
Listener for class2, have class1 listen for specific events and pass
back the value that 'choice' should be set to.

/J.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.