GUI and switch problem

Discussion in 'Java' started by DERosenblum@gmail.com, Nov 2, 2007.

  1. Guest

    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!
     
    , Nov 2, 2007
    #1
    1. Advertising

  2. Lew Guest

    wrote:
    > ... more details would be useful.


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

    --
    Lew
     
    Lew, Nov 2, 2007
    #2
    1. Advertising

  3. Roedy Green Guest

    On Fri, 02 Nov 2007 07:20:39 -0700, ""
    <> 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.
    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Nov 2, 2007
    #3
  4. Suffocate Guest

    On Nov 3, 12:20 am, "" <>
    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.
     
    Suffocate, Nov 3, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. paul.foreman

    GUI - GUI value passing

    paul.foreman, Oct 22, 2004, in forum: Java
    Replies:
    5
    Views:
    773
    Michael Rauscher
    Oct 25, 2004
  2. Stephen

    Compiler Switch From GUI

    Stephen, Aug 27, 2004, in forum: C++
    Replies:
    1
    Views:
    339
    Victor Bazarov
    Aug 27, 2004
  3. ulysses
    Replies:
    4
    Views:
    787
    Werner Schiendl
    Oct 22, 2003
  4. Hal Fulton

    GUI and non-GUI data

    Hal Fulton, Aug 5, 2004, in forum: Ruby
    Replies:
    1
    Views:
    151
    Austin Ziegler
    Aug 5, 2004
  5. Switch Within A Switch

    , Apr 22, 2006, in forum: Javascript
    Replies:
    7
    Views:
    120
    Lasse Reichstein Nielsen
    Apr 22, 2006
Loading...

Share This Page