Set a string variable equal to a JTextField entry

Like the title says, how could I go about setting a string variable equal to a JTextField entry

Ah, I remember you.
http://forum.java.sun.com/thread.jspa?threadID=5267710
You've been told to read the API before.
At least you should show some effort. In your post state, I read the API and I tried this method or that method but it didn't work because of so and so. Otherwise, you may appear lazy, and that just won't do.
Edited by: petes1234 on Feb 24, 2008 7:38 AM

Similar Messages

  • Make a String variable equal to a Taglib value

    Hi,
    I'm using XMLTextReader to parse an XML file. During this I need to test to see if an attribute name of an Element is equal to "domain". I can't seem to work out how to insert the taglib value into my code, and I am starting to think it's not possible to do it the way I would like to. The general idea is this:
    <sax:XMLTextReader xmlData="/home/thomaswebb/SMSToolRenderers/web/surveys/button.xml">
    <sax:ifNameEquals name="survey"><b></sax:ifNameEquals>
    <sax:Attributes>
    <%
    if ("domain".equalsIgnoreCase(<sax:getAttributeName/>)) {
    %><sax:getAttributeValue/><%
    //if (domain.length() == 0)
    //domain =
    %>
    </sax:Attributes>
    <sax:ifNameEquals name="price"></b></sax:ifNameEquals>
    </sax:XMLTextReader>
    Any help would be much apprecieted,
    Thomas

    Ah, I remember you.
    http://forum.java.sun.com/thread.jspa?threadID=5267710
    You've been told to read the API before.
    At least you should show some effort. In your post state, I read the API and I tried this method or that method but it didn't work because of so and so. Otherwise, you may appear lazy, and that just won't do.
    Edited by: petes1234 on Feb 24, 2008 7:38 AM

  • Setting Prompt Directory path using a string variable?

    So when you define a Prompt you get the form P[promptname.wav] and all is good.  What we want to do is have that prompt name be retrieved from a prompt directory which is defined by a string.   So assume all your prompts have the same numbers like 1001.wav but the actual file is customized based on things like Sales/1001.wav and Marketing/1001.wav   and you want to have a StringValue DirectoryName set the Directory to Sales or Marketing.   The Script does not seem to support setting P["DirectoryName"/1001.wav] where Directory Name is a string variable.    Is there a solution to this other than changing the entire prompt to a string type and dropping the P[] data type entirely?   

    I am working with a similar issue.   It is simple enought to set the Prompt Directory but when it is a variable it seems to have different results.  The attached simple script is used to demonstrate Sam's recommendation.  The XML document is embedded in the script variable, so you dont need to create it.   So the script reaches into the XML document and pulls up the variable strDirectoryName and then adds "/" to it and then sets the strPromptDirectory.   I have done it three ways:  Hard coded, string value for prompt' and prompt data type resolved from string.  As you single step through the script you will find that all values populate appropriately, but only the hard coded play prompt actually plays the prompt.  The other two assemblies fail.  (Clearly it assumes the prompt 10001.wav is in the directory Generic/ if you want to try it).    Written in  Version 8.5 editor.  

  • Set "url" in HTTPService using String variable

    Hi,
    How can I set "url" in HTTPService using String variable (see below). I've tried different formats of string & variable concatenations.
    privtate var myurl:String = "http://localhost/";
        <mx:HTTPService id="post_submit_service"
            url="{myurl+'test.php'}"
            method="POST"
            resultFormat="text"
          result="result_handler(event)"
          fault="fault_handler(event)">
            <mx:request xmlns="">
          </mx:request>
        </mx:HTTPService>
    Thanks,
    ASM

    try following:
    url="{myurl}test.php"

  • DIADEM STRING VARIABLE SET

    I am using the DIADEM STRING VARIABLE SET.vi in LV8.6.1 to set the T3 variable in DD11.1.
    the string is being truncated 
    For example I sent 1527 characters
    ------start ------
    Custom_Count=0&Plot_Size=Letter&Plot_Orientation=Landscape&Plot_Count=1&Plot1_Style=S Parameter&Plot1_UseTestSetup=1&Plot1_Run_Mode=Most Recent&Plot1_Run_Field=Step_Tag&Plot1_Run_Field_Value=&Plot1_LineType=0&Plot1_X_Unit=MHz&Plot1_X_Min=500&Plot1_X_Max=800&Plot1_AxisType=Split&Plot1_Auto_X=1&Plot1_Auto_Y=1&Plot1_Y_Format=Delay&Plot1_Scale=10&Plot1_Reference=0&Plot1_Position=5&Plot1_Curve1_Parameter=S11&Plot1_Curve1_LimitOn=1&Plot1_Curve1_LimitFill=0&Plot1_Curve1_Label=LABEL&Plot1_Curve1_Autoscale=1&Plot1_Curve1_Scale=2.5&Plot1_Curve1_Reference=-50&Plot1_Curve1_Position=0&Plot1_Curve1_Format=Log Mag&Plot1_Marker1=1000&Plot1_Marker4=Limit Maximum&Plot1_Marker2=Trace Maximum&Plot1_Marker3=Trace Minimum&Plot1_Marker5=Limit Minimum&Plot1_Curve2_Parameter=S21&Plot1_Curve2_LimitOn=1&Plot1_Curve2_LimitFill=0&Plot1_Curve2_Label=&Plot1_Curve2_Autoscale=1&Plot1_Curve2_Scale=10&Plot1_Curve2_Reference=0&Plot1_Curve2_Position=5&Plot1_Curve2_Format=Phase&Template_dHeight=8.500000&Template_dWidth=11.000000&Plot1_run_id=&preview=1&report_path=C:\DEVELOPMENT\SPARTAN\www\temp\preview_preview_99452782.png&data_path=C:\DEVELOPMENT\SPARTAN\data\tdm&test_status=&ReportFooter_txt=&serial_number=
    ------ end ------
    but received only 1192 characters in Diadem
    ------start ------
    Custom_Count=0&Plot_Size=Letter&Plot_Orientation=Landscape&Plot_Count=1&Plot1_Style=S Parameter&Plot1_UseTestSetup=1&Plot1_Run_Mode=Most Recent&Plot1_Run_Field=Step_Tag&Plot1_Run_Field_Value=&Plot1_LineType=0&Plot1_X_Unit=MHz&Plot1_X_Min=500&Plot1_X_Max=800&Plot1_AxisType=Split&Plot1_Auto_X=1&Plot1_Auto_Y=1&Plot1_Y_Format=Delay&Plot1_Scale=10&Plot1_Reference=0&Plot1_Position=5&Plot1_Curve1_Parameter=S11&Plot1_Curve1_LimitOn=1&Plot1_Curve1_LimitFill=0&Plot1_Curve1_Label=LABEL&Plot1_Curve1_Autoscale=1&Plot1_Curve1_Scale=2.5&Plot1_Curve1_Reference=-50&Plot1_Curve1_Position=0&Plot1_Curve1_Format=Log Mag&Plot1_Marker1=1000&Plot1_Marker4=Limit Maximum&Plot1_Marker2=Trace Maximum&Plot1_Marker3=Trace Minimum&Plot1_Marker5=Limit Minimum&Plot1_Curve2_Parameter=S21&Plot1_Curve2_LimitOn=1&Plot1_Curve2_LimitFill=0&Plot1_Curve2_Label=&Plot1_Curve2_Autoscale=1&Plot1_Curve2_Scale=10&Plot1_Curve2_Reference=0&Plot1_Curve2_Position=5&Plot1_Curve2_Format=Phase&Template_dHeight=8.500000&Template_dWidth=11.000000&Plot1_run_id=&pr
    ------ end ------
    jim

    Hi Jim,
    The problem here is that DIAdem's ActiveX servers still use the old autosequence syntax, where strings constants can be created with the apostrophe ( ' ) character instead of the more usual double-quote ( ") character.  So if I were to send a command from LabVIEW to DIAdem to assign the string "hello" to the variable "T1", it would look like this:
    T1:= 'hello'
    So I agree with you that the ( ' ) character termination is DIAdem's fault, but it would be more a designed behavior than a bug.  It was also possible in an autosequence to use the normal ( " ) character to specify a string constant, like this:
    T1:= "hello"
    Actually, when I try to use the "CmdExecuteSync" method I am able to sidestep the ( ' ) character termination problem, whereas the "TextVarSet" method reproduces it.  I'd recommend using the VI equivalent of "CmdExecuteSync":
    Set ToCommand = CreateObject("DIAdem.ToCommand")Call ToCommand.CmdExecuteSync("T1:= 'hello'")Call ToCommand.CmdExecuteSync("T1:= ""he'llo""")'Call ToCommand.TextVarSet("T1", """hello""")
    'Call ToCommand.TextVarSet("T1", """he'llo""")Call ToCommand.TextVarGet("T1", TextVar)Set ToCommand = Nothing MsgBox TextVar 
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • How to swap two string variables without using a 3rd variable?

    How to swap two string variables without using a 3rd variable?
    ex.
    A = "aa"
    B = "bb"
    Result required
    A = "bb"
    B = "aa"
    Thanks

    How to swap two string variables without using a 3rd
    variable?
    Something like this.
    Append A with B (so A equals "aabb")
    Set B equal to a substring of A starting with the first character and ending at A's length minus B's length. (So B equals "aa")
    Set A equal to a substring of A starting from B's length and ending at the end of A. (So A equals "bb")

  • How to compare numbers in a string variable?

    I have a powershell script that is grabbing the output of a website and storing it into a string variable. What I would like to do is check a line in the output which contains two numbers - the number of emails sent out of the total number of emails.
    I have not come up with a way to do this that works. I was thinking of maybe using a regex, but there are other numbers I don't care about that keep getting caught.
    Here is a sample of what is contained in the string variable:
    Email ID: 46862270 : Succeded. Time Taken: 00:00:00.0924511
    Email ID: 46862272 : Succeded. Time Taken: 00:00:00.0493887
    -- Sent 250 of 250 emails successfully. Total Dispatch Time: 00:00:08.1406995
    --State Written to DB. Time Taken for DB Write: 00:00:00.4611053
    Here is another sample:
    Email ID: 46865840 : Succeded. Time Taken: 00:00:00.9333887
    -- Sent 17 of 17 emails successfully. Total Dispatch Time: 00:00:01.2416905
    --State Written to DB. Time Taken for DB Write: 00:00:00.0402957
    So if I have the above contained in a variable called $httpResponse how can I find only the line that starts with -- Sent
    and then subtract the first number from the second number?
    So for example if I have this:
    Email ID: 46865840 : Succeded. Time Taken: 00:00:00.9333887
    -- Sent 207 of 217 emails successfully. Total Dispatch Time: 00:00:01.2416905
    --State Written to DB. Time Taken for DB Write: 00:00:00.0402957
    I would want the check to return 10. Is this even possible?
    Any help is appreciated!

    Sure.
    $String = @'
    Email ID: 46865840 : Succeded. Time Taken: 00:00:00.9333887
    -- Sent 207 of 217 emails successfully. Total Dispatch Time: 00:00:01.2416905
    --State Written to DB. Time Taken for DB Write: 00:00:00.0402957
    if ( $string -match 'Sent (\d+) of (\d+) emails .+' )
    { $FailedEmailCount = [int]$matches[2] - $matches[1] }
    $FailedEmailCount
    10
    Each set of parens will designate a capture group, and those can be referenced from $Matches after a successful -match.
    Just remember that they will all be strings, and to do a math operation you have to cast at least the one on the LH side to a numeric type first.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • HELP ME i need to pass String variables from one Frame to another

    I need help with some code.
    i need to pass a set of string values from one frame to another.
    from the mainscreen i need to pass what type of seats the user has requested this is done by radio buttons. i need this information to then be passed onto the next frame called Mydialog1 and placed in a textbox with label st. it dosn't comple and i don't know why
    this is getting me depressed. I need some serious help with this
    can anybody get this to work??
    here is the code
    Mainscreen1 code
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class mainscreen1 extends Applet implements ItemListener,
    ActionListener
    private Image layout1;
    private int frame;
    private int xpos,ypos,xdir,ydir;
    public TextField tn, tt1, tt2, total;
    public int value, ticketnum, sum, nr_seats, ctot;
    public Label title, seat, need, payable;
    public Button b1, b2, b3;
    Mydialog1 d;
    String stype, c1, sr;
    public void init()
         setBackground(Color.pink);
    setSize (600, 460);
    setLayout(null);
    //Mydialog1.mehod(sr);
    title=new Label("The Almeida Theater booking system");
         title.setBounds(100,0,400,30);
         title.setFont(new Font("Verdana", Font.PLAIN,24));
         add(title);
    seat=new Label("Please choose a seating location:");
         seat.setBounds(300,40,190,20);
         seat.setFont(new Font("Verdana", Font.BOLD,12));
         add(seat);
    payable=new Label("Total Payable:�");
         payable.setBounds(300,390,100,20);
         payable.setFont(new Font("Verdana", Font.BOLD,12));
         add(payable);
         need=new Label("Please enter the number of seats needed:");
         need.setBounds(300,180,245,20);
         need.setFont(new Font("Verdana", Font.BOLD,12));
         add(need);
         CheckboxGroup sr = new CheckboxGroup();
         Checkbox Stalls = new Checkbox("Stalls", true, sr);
         Stalls.setBounds(490,40,60,25);
         add(Stalls);
         Stalls.addItemListener(this);
         Checkbox Balcony = new Checkbox("Balcony", false, sr);
         Balcony.setBounds(490,65,65,25);
         add(Balcony);
         Balcony.addItemListener(this);
         Checkbox Concessions = new Checkbox("Concessions", false,
    sr);
         Concessions.setBounds(490,90,94,25);
         add(Concessions);
         Concessions.addItemListener(this);
    Button b1=new Button("Quote");
         b1.setBounds(20,395,80,30);
         add(b1);
         b1.addActionListener( this );
         Button b2=new Button("Confirm booking");
         b2.setBounds(110,395,100,30);
         add(b2);
         b2.addActionListener( this );
         Button b3=new Button("Clear");
         b3.setBounds(480,410,100,30);
         add(b3);
         b3.addActionListener( this );
         tt1=new TextField(60);
         tt1.setBounds(300,250,270,20);
    add(tt1);
         tt1.setEditable (false);
         tt1.addActionListener(this);
         tt2=new TextField(60);
         tt2.setBounds(300,300,150,20);
         add(tt2);
         tt2.setEditable (false);
         tt2.addActionListener(this);
         tn=new TextField(3);
         tn.setBounds(545,180,30,20);
         add(tn);
         tn.addActionListener(this);
         total=new TextField(5);
         total.setBounds(400,390,45,20);
         add(total);
         total.setEditable (false);
         total.addActionListener(this);
         xpos = getSize().width/-1400;
         ypos = getSize().height/12;
         layout1 = getImage(getDocumentBase(),"layout1.gif");
         repaint();
    public void itemStateChanged(ItemEvent e)
         String c1 = (String) e.getItem();
         if (c1 == "Stalls")
              value = 20;
         else if (c1 == "Balcony")
              value = 15;
         else
              value = 10;
         tt1.setText("You have chosen to sit in the " + c1 + "
    area");
         tt2.setText("Each seat will cost: �" + value);
         repaint();
    public void clearValue()
              //cb.setSelectiob
              total.setText("");
              tt1.setText("");
              tt2.setText("");
              tn.setText("");
    public void actionPerformed ( ActionEvent e )
    if( e.getActionCommand() == "Quote" )
         int nr_seats = Integer.parseInt(tn.getText());
         total.setText("" +nr_seats*value);
    else if( e.getActionCommand() == "Confirm booking")
         int nr_seats = Integer.parseInt(tn.getText());
         int ctot = Integer.parseInt(total.getText());
         //String stype = String.parseString(c1.getText());
         total.setText("" +nr_seats*value);   
         d = new Mydialog1();      
         d.set_text(nr_seats);
         d.set_texts(ctot);
         stype = sr.getSelectedItem();
    else if ( e.getActionCommand() == "Clear")
         clearValue();
              ticketnum = Integer.parseInt(tn.getText());
              repaint();
         public void paint(Graphics g)
              g.setColor(Color.black);
              g.drawString ("You have chosen:" + ticketnum +"
    seats", 300, 365);
              g.drawImage(layout1,xpos,ypos,null);
    Mydialog1 code
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Mydialog1 extends Frame implements ItemListener,
    ActionListener
    public Label title, custd, custd1, custfn, custad, custsn, custpc,
    custph, custem, custem1, need;
    public Button b1, b2, b3;
    public TextField cfnt, csnt, cdt,cdt2,cdt3,cdt4, tf, tt, st,
    cpct, cph, cem;
    public int value, nr_seats, ctot;
    creditcard cc;
    String stype, c;
    public Mydialog1() //constructor
         init();
    public void init()
         custer(String c)
         stype = c;
         setBackground(Color.yellow);
    setSize (500, 500);
    setLayout(null);
         setLocation(320,140);
         setVisible(true);
         //Mydialog1(Frame f);
    title=new Label("The Almeida Theater booking system");
         title.setBounds(70,20,400,30);
         title.setFont(new Font("Verdana", Font.PLAIN,24));
         add(title);
         CheckboxGroup ct = new CheckboxGroup();
         Checkbox Mr = new Checkbox("Mr", true, ct);
         Mr.setBounds(5,190,36,25);
         add(Mr);
         Mr.addItemListener(this);
         Checkbox Mrs = new Checkbox("Mrs", false, ct);
         Mrs.setBounds(50,190,42,25);
         add(Mrs);
         Mrs.addItemListener(this);
         Checkbox Miss = new Checkbox("Miss", false, ct);
         Miss.setBounds(95,190,45,25);
         add(Miss);
         Miss.addItemListener(this);
    custd=new Label("If above booking details are correct please
    fill in your deatils below");
         custd.setBounds(5,140,400,30);
         add(custd);
         custd1=new Label("If they are incorrect please click on
    close and re-book seats.");
         custd1.setBounds(5,160,400,30);
         add(custd1);
         custfn=new Label("*ForeName:");
         custfn.setBounds(5,220,60,20);
         add(custfn);
         cfnt=new TextField(60);
         cfnt.setBounds(70,220,150,20);
    add(cfnt);
         custsn=new Label("*SurName:");
         custsn.setBounds(230,220,60,20);
         add(custsn);
         csnt=new TextField(60);
         csnt.setBounds(300,220,150,20);
    add(csnt);
         custad=new Label("*Address:");
         custad.setBounds(5,250,55,20);
         add(custad);
         cdt=new TextField(60);
         cdt.setBounds(70,250,180,20);
    add(cdt);
         cdt2=new TextField(60);
         cdt2.setBounds(70,270,180,20);
    add(cdt2);
         cdt3=new TextField(60);
         cdt3.setBounds(70,290,180,20);
    add(cdt3);
         cdt4=new TextField(60);
         cdt4.setBounds(70,310,180,20);
    add(cdt4);
         custpc=new Label("*Postcode:");
         custpc.setBounds(5,330,60,20);
         add(custpc);
         cpct=new TextField(60);
         cpct.setBounds(70,330,180,20);
    add(cpct);
         custph=new Label("*Telephone:");
         custph.setBounds(5,360,65,20);
         add(custph);
         cph=new TextField(60);
         cph.setBounds(70,360,180,20);
    add(cph);
         custem=new Label("E-mail:");
         custem.setBounds(5,390,65,20);
         add(custem);
         cem=new TextField(60);
         cem.setBounds(70,390,180,20);
    add(cem);
         custem1=new Label("eg: [email protected]");
         custem1.setBounds(250,390,150,20);
         add(custem);
         need=new Label("* = required field.");
         need.setBounds(350,400,150,20);
         add(need);
         //seat number being pased into this textbox
         tf = new TextField();
    tf.setBounds(5, 80, 160,20);
         tf.setEditable (false);
    add(tf);
         //seat number being pased into this textbox
         tt = new TextField();
    tt.setBounds(5, 100, 160,20);
         tt.setEditable (false);
    add(tt);
         //seat number being pased into this textbox
         st = new TextField(stype);
    st.setBounds(5, 120, 230,20);
         st.setEditable (false);
    add(st);
         setVisible(true);
         Button b1=new Button("Close");
         b1.setBounds(20,440,80,30);
         add(b1);
         b1.addActionListener( this );
         Button b2=new Button("Proced with booking");
         b2.setBounds(110,440,150,30);
         add(b2);
         b2.addActionListener( this );
         Button b3=new Button("Clear");
         b3.setBounds(350,440,100,30);
         add(b3);
         b3.addActionListener( this );
    public void itemStateChanged(ItemEvent e)
         String c2 = (String) e.getItem();
         if (c2 == "Mr")
              value = 20;
         else if (c2 == "Mrs")
              value = 15;
         else
              value = 10;
    public void clearValuea()
              //cb.setSelectiob
              cem.setText("");
              cph.setText("");
              cdt.setText("");
              cdt2.setText("");
              cdt3.setText("");
              cdt4.setText("");
              cfnt.setText("");
              csnt.setText("");
              cpct.setText("");
              cph.setText("");
              cem.setText("");
    public void actionPerformed( ActionEvent e )
    if( e.getActionCommand() == "Close" )
    this.dispose();
    else if( e.getActionCommand() == "Proced with booking")
    cc = new creditcard();
    else if( e.getActionCommand() == "Clear")
    clearValuea();
         public void set_text (int nr_seats)
         tf.setText (" You have booked " + nr_seats + " seat/s");
         public void set_texts (int ctot)
         tt.setText (" The total is � " + ctot);
         public void SetTextField(String c1)
         st.setText(c1);
    creditcard
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class creditcard extends Frame implements ActionListener
         public Label title, ccd1, ccfn;
         public Button b1, b2;
         public TextField cnt, cdt, ccfnt;
         public String cfnt;
    public creditcard() //constructor
         init();
    public void init()
         setBackground(Color.green);
    setSize (500, 500);
    setLayout(null);
         setLocation(320,140);
         setVisible(true);
         //Mydialog1(Frame f);
    title=new Label("The Almeida Theater booking system");
         title.setBounds(70,20,400,30);
         title.setFont(new Font("Verdana", Font.PLAIN,24));
         add(title);
         ccd1=new Label("If billing address is different please edit below information.");
         ccd1.setBounds(5,50,400,20);
         ccd1.setFont(new Font("Verdana", Font.BOLD,12));
         add(ccd1);
         ccfn=new Label("*ForeName:");
         ccfn.setBounds(5,220,60,20);
         add(ccfn);
         ccfnt=new TextField(60);
         ccfnt.setBounds(70,220,150,20);
    add(ccfnt);
         Button b1=new Button("Close");
         b1.setBounds(20,440,80,30);
         add(b1);
         b1.addActionListener( this );
         Button b2=new Button("Proced with booking");
         b2.setBounds(110,440,150,30);
         add(b2);
         b2.addActionListener( this );
    public void actionPerformed( ActionEvent e )
    if( e.getActionCommand() == "Close" )
    this.dispose();
    else if( e.getActionCommand() == "Proced with booking")
    setBackground(Color.red);

    Here's the new mainscreen1.java file...
    public class mainscreen1 extends Applet implements ItemListener,
    ActionListener
      private Image layout1;
      private int frame;
      private int xpos,ypos,xdir,ydir;
      public TextField tn, tt1, tt2, total;
      public int value, ticketnum, sum, nr_seats, ctot;
      public Label title, seat, need, payable;
      public Button b1, b2, b3;
      Mydialog1 d;
      CheckboxGroup checkGroup; // heres the new global CheckboxGroup variable.
      String stype, c1, dialogString; // new name for the string too...
      public void init()
        setBackground(Color.pink);
        setSize(600, 460);
        setLayout(null);
        //dialogString = "Hi";
        //Mydialog1.mehod(dialogString);
        title=new Label("The Almeida Theater booking system");
        title.setBounds(100,0,400,30);
        title.setFont(new Font("Verdana", Font.PLAIN,24));
        add(title);
        seat=new Label("Please choose a seating location:");
        seat.setBounds(300,40,190,20);
        seat.setFont(new Font("Verdana", Font.BOLD,12));
        add(seat);
        payable=new Label("Total Payable:�");
        payable.setBounds(300,390,100,20);
        payable.setFont(new Font("Verdana", Font.BOLD,12));
        add(payable);
        need=new Label("Please enter the number of seats needed:");
        need.setBounds(300,180,245,20);
        need.setFont(new Font("Verdana", Font.BOLD,12));
        add(need);
        checkGroup = new CheckboxGroup(); // instantiate the global CheckboxGroup
        Checkbox Stalls = new Checkbox("Stalls", true, checkGroup); // add to the CheckboxGroup
        Stalls.setBounds(490,40,60,25);
        add(Stalls);
        Stalls.addItemListener(this);
        Checkbox Balcony = new Checkbox("Balcony", false, checkGroup);
        Balcony.setBounds(490,65,65,25);
        add(Balcony);
        Balcony.addItemListener(this);
        Checkbox Concessions = new Checkbox("Concessions", false, checkGroup);
        Concessions.setBounds(490,90,94,25);
        add(Concessions);
        Concessions.addItemListener(this);
        Button b1=new Button("Quote");
        b1.setBounds(20,395,80,30);
        add(b1);
        b1.addActionListener( this );
        Button b2=new Button("Confirm booking");
        b2.setBounds(110,395,100,30);
        add(b2);
        b2.addActionListener( this );
        Button b3=new Button("Clear");
        b3.setBounds(480,410,100,30);
        add(b3);
        b3.addActionListener( this );
        tt1=new TextField(60);
        tt1.setBounds(300,250,270,20);
        add(tt1);
        tt1.setEditable(false);
        tt1.addActionListener(this);
        tt2=new TextField(60);
        tt2.setBounds(300,300,150,20);
        add(tt2);
        tt2.setEditable(false);
        tt2.addActionListener(this);
        tn=new TextField(3);
        tn.setBounds(545,180,30,20);
        add(tn);
        tn.addActionListener(this);
        total=new TextField(5);
        total.setBounds(400,390,45,20);
        add(total);
        total.setEditable(false);
        total.addActionListener(this);
        xpos = getSize().width/-1400;
        ypos = getSize().height/12;
        layout1 = getImage(getDocumentBase(),"layout1.gif");
        repaint();
      public void itemStateChanged(ItemEvent e) {
        String c1 = (String) e.getItem();
        if (c1 == "Stalls") {
          value = 20;
        else if (c1 == "Balcony") {
          value = 15;
        else {
          value = 10;
        tt1.setText("You have chosen to sit in the " + c1 + " area");
        tt2.setText("Each seat will cost: �" + value);
        repaint();
      public void clearValue() {
        //cb.setSelectiob
        total.setText("");
        tt1.setText("");
        tt2.setText("");
        tn.setText("");
      public void actionPerformed( ActionEvent e ) {
        if( e.getActionCommand() == "Quote" ) {
          int nr_seats = Integer.parseInt(tn.getText());
          total.setText("" +nr_seats*value);
        else if( e.getActionCommand() == "Confirm booking") {
          int nr_seats = Integer.parseInt(tn.getText());
          int ctot = Integer.parseInt(total.getText());
          total.setText("" +nr_seats*value);
          d = new Mydialog1();
          d.set_text(nr_seats);
          d.set_texts(ctot);
          // You can do your checkbox selection data transfer here like this...
          // I used d.SetTextField because you had that defined in the Mydialog1 class.
          Checkbox chkBx = checkGroup.getSelectedCheckbox();
          d.SetTextField(chkBx.getLabel());
        else if ( e.getActionCommand() == "Clear") {
          clearValue();
        ticketnum = Integer.parseInt(tn.getText());
        repaint();
      public void paint(Graphics g)
        g.setColor(Color.black);
        g.drawString("You have chosen:" + ticketnum +" seats", 300, 365);
        g.drawImage(layout1,xpos,ypos,null);
    }

  • How to load a text file (ASCII) into a TS string variable?

    I need to load a ASCII file into a TS string variable for subsequent processing. I tried the SecuenceBuilder DLL (in the examples directory) but it seems that this DLL has a bug. Some text files are not loaded properly. I have also tried the kernel32 functions (openfile, createfile, readfile ... ) handling them as a C program, but with no success. The property loader feature of TS is not the suitable solution for me, because I would have to modify all my text files to include some specific fields (step name, variables, starmarker ...). Doy you know an alternative procedure to load text files or any DLL that implements what I look for ? Any help would be grateful. Cesar ([email protected])

    Hi Cesar,
    I don't know if you have found a solution, but attached is a DLL built in VC that will read the text out of a file into a TestStand variable. The attached sequence file \SequenceFile1.seq contains a step type that is set to call the DLL responsible for reading the file. It reads the file specified under Step.FilePath and stores the data in Step.ReadData. Please let me know if this works for you. I have attached the source as well.
    Regards,
    Bob
    Attachments:
    ReadFile.zip ‏3628 KB

  • Looking for a better way to determine string variable from multiple options

    Hi,
    I trying to figure out a better way to determine a string variable from multiple options.
    Say i have five pictures each with a different filename: img1 - img5...these file names could be named anything really but for this example i will keep them as img1, img2, img3, img4 and img5.
    I want to display a messagebox with the string depending on what a certain variable is.
    So for example, we have the number X, if X = 1 then i want the messagebox to show "img1" as the message
    Essentially the way I have been doing it so far is:
    Private Sub WhichImage()
    Dim ImageName As String = ""
    Dim i as integer
    If i = 0 Then
    ImageName = "img1"
    End If
    If i = 1 Then
    ImageName = "img2"
    End If
    If i = 2 Then
    ImageName = "img3"
    End If
    If i = 3 Then
    ImageName = "img4"
    End If
    If i = 4 Then
    ImageName = "img5"
    End If
    MessageBox.show(imagename, "Name of image", MsgBox.Style.OkOnly, MsgBoxResult.Ok)
    end
    Up until now, this has been fine, but what if I have 50 images, do I have to do this for all 50 images? or is there an easier way like putting the image names into a text file and have it read from the file depending on what the variable i equals? If so,
    how do I go about this? Does each image name go on a separate line? can it just be separated by a comma instead? or is there a better way?
    Please note that i know that i have declared "i" above in my code and not intialised it with anything, in reality "i" comes from somewhere else in the program so please ignore that part, it is not what I am concerned with.
    Thanks
    Mersec

    Does each image name go on a separate line? can it just be separated by a comma instead? or is there a better way?
    Arrays are useful for this.
    Dim imagenames() As String = {"img1", "img2", "img3", "img4", "img5"}
    Dim imagename As String = imagenames(i)
    MessageBox.Show(imagename, "Name of image")
    Any sort of collection will do instead of an array, and may be simpler to manage. There are many other options - the most suitable one probably depends on where the names originally come from.  For instance, if you are getting them from a folder
    using the FileSystem.GetFiles method, then they are already in a collection.
    If the files names never change then you may as well include them in the program code, using something like the code above.  If they can change, then you could use a text file, but that means you need a file update routine.  If that is required
    then the way you store the names will dictate how you access them.

  • Create Report Layout (Apex 3.2) - How can I set the substitution variables?

    Hi,
    I created a "Report Query" under "Shared Components". I now want to work on the corresponding "report layout". I created a "Generic Columns (XSL-FO)". I read the following in the documentation:
    The following are valid substitution strings:
    #PAGE_HEADER#
    #PAGE_HEADERFONT_COLOR#
    #PAGE_HEADER_FONT_FAMILY#
    #PAGE_HEADER_FONT_SIZE#
    #PAGE_HEADER_FONT_WEIGHT#
    #PAGE_FOOTER#
    #PAGE_FOOTER_FONT_COLOR#
    #PAGE_FOOTER_FONT_FAMILY#
    #PAGE_FOOTER_FONT_SIZE#
    #PAGE_FOOTER_FONT_WEIGHT#
    #PAGE_WIDTH#
    #PAGE_HEIGHT#
    #HEADER_BG_COLOR#
    #HEADER_FONT_COLOR#
    #HEADER_FONT_FAMILY#
    #HEADER_FONT_SIZE#
    #HEADER_FONT_WEIGHT#
    #BODY_BG_COLOR#
    #BODY_FONT_COLOR#
    #BODY_FONT_FAMILY#
    #BODY_FONT_SIZE#
    #BODY_FONT_WEIGHT#
    #BORDER_WIDTH#
    Where can I set the values for these substitution variables in my "Report Layout"? Could someone give an example? I can't seem to find documentation on this.
    Thanks!
    Francois

    Thanks for the tip however I'm not trying to do this through the print tab, I'm calling the report using the following get_print_document in pl/sql code:
    l_report_blob := apex_util.get_print_document(
    p_application_id => l_application_id,
    p_report_layout_name => l_report,
    p_report_query_name => l_report,
    p_report_layout_type => l_output_format,
    p_document_format => l_output_format,
    p_print_server => null);
    Where could I set these substitution variables ? I'm simply calling a report query and layout created under Shared Components.
    Thanks
    Francois

  • Problem with String variable

    I am new to Java Programming.
    I have a line of code that works and does what is supposed to.
    faceData.getProfile("Lisa").removeFriend("Curtis");
    If I assign the strings to variables such as-
    String name = "Lisa";
    String fName = "Curtis";
    and then plug those into the same line of code, it does not work
    faceData.getProfile(name).removeFriend(fName);
    What could be causing the problem?
    I even added some lines to print out what is stored in the variables to verify that they are what they should be, but for some reason the variables do not work while putting the strings in quotes does. Any ideas?

    I guarantee that something about your assertions are incorrect. Those variables are either not equal to the values you claim, or something else is going on. But it's not a problem with string variables versus string constants.
    Edit: My best guess in lack of a real example from you, is that the strings in question have non-printable characters in them, such as trailing spaces or line feeds.

  • EnterProjectStage - reading GUID from a string variable within Workflow created in Visual Studio 2012.

    Hi,
    I am creating a Project Server Workflow (site workflow) using Visual Studio 2012.
    If i set the "EnterProjectStage" activity with a GUID within quotes the workflow works
    (as suggested in the MSDN blog (http://blogs.msdn.com/b/project_programmability/archive/2012/11/07/creating-project-workflows-using-visual-studio-2012.aspx).
    However, the GUID of stages will change from environment to environmet (QA, Stage, PROD). So, I tried setting the GUID in a string variable (which i am populating dynamically) and assigned the string variable to the "EnterProjectStage"
    activity. However, this dynamic assignment of stage id to "EnterProjectStage" does not work and after deployment the workflow dumps with the following error:
    ===============================================
    Exception Starting Workflow: Sequence contains no elements. Trace: at System.Linq.Enumerable.First[TSource](IEnumerable`1 source) at Microsoft.Office.Project.Server.BusinessLayer.Workflow.<FillWorkflowStatusTableFromXaml>b__47(XElement
    e) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Linq.Enumerable.<DistinctIterator>d__81`1.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1
    source) at Microsoft.Office.Project.Server.BusinessLayer.Workflow.FillWorkflowStatusTableFromXaml(String xaml, WorkflowDataSet& ds, Guid projUid) at Microsoft.Office.Project.Server.BusinessLayer.Workflow.StartWorkflow(Guid projectGuid, Guid enterpriseProjectTypeUid,
    Boolean isNewProject, Guid previousEntepriseProjectTypeUid, Boolean skipStage, Guid stageToSkipTo):
    WorkflowExceptionStartingWorkflow (35115). Details: id='35115' name='WorkflowExceptionStartingWorkflow'
    uid='b31d825e-1d00-e411-9466-005056b11412'. 
    ===============================================
    Is there a way the "EnterProjectStage" can be made dynamic so that it reads from a variable.
    Thanks,
    Amitava.

    Arthur,
    Thank you for your reply.  But at this point, one of my points of confusion is what software I have available to me.  I wish I had a useful central help desk to call up and just say, "Hey, load me up with all of the professional version(s) of Visual
    Studio.  But I do not know what we have license to.  And I kind of need to know what the options are, so that I can ask a specific question of our vast buracracy.
    For now, I have downloaded only free versions of Visual Studio client software.  Since my company does have servers running Microsoft SQL Server, I am going to assume that we have proper licensing for those servers.  But does that server license
    allow me to get any professional versions of the PC client software for the various Visual Studio(s) 2012?
    And if I get a professional version of Visual Studio 2012, does that do away with the three different flavors that I have right now?  I have 2012 versions of SQL Server Management Studio, Visual Studio Express, and Visual Studio Shell (Integrated).
    Your feedback is much appreciated.
    Thanks!

  • Regular Expressions and String variables

    Hi,
    I am attempting to implement a system for searching text files for regular expression matches (similar to something like TextPad, etc.).
    Looking at the regular expression API, it appears that you can only match using string variables. I just wanted to make sure this is true. Some of these files might be large and I feel uneasy about loading them into ginormous Strings. Is this the only way to do it? Can I make a String as big as I want?
    Thanks,
    -Mike

    Newlines are only a problem if you're reading the
    text line-by-line and applying the regexp to each
    line. It wouldn't catch expressions that span
    lines.
    @sabre150: your note re: CharSequence -- so what
    you're suggesting is to implement a CharSequence that
    wraps the file contents, and then use the regexps on
    the whole thing? I like the idea but it seems like
    it would only be easy to implement if the file uses a
    fixed-width character set. Or am I missing
    something...?You are correct for the most basic implementation. It is very easy to create a char sequence for fixed width character sets using RandomAccessFile. Once you go to character sets such as UTF-8 then more effort is required.
    While ever the regex is moving forward thought the CharSequence one char at a time there is no problem because one can wrap a Reader but once it backtracks then one needs random access and one will need to have a buffer. I have used a ring buffer for this which seems to work OK but of course this will not allow the regex to move to any point in the CharSequence.
    'uncle_alice' is the regex king round here so listen to him.
    :-( I should read further ahead next time!
    Message was edited by:
    sabre150
    Message was edited by:
    sabre150

  • Replacement string variable in data form

    Hi everybody,
    in Planning 11.1.2, is it possible to set a replacement variable, with type String, and then use it in a data form to let the user inserting a string value (i.e "actual")?
    I need to reuse the value inserted in a business rule. I think to use the @MEMBER to refrence it to the corresponding dimension member.
    For example:
    If I define a string variable named SCENARIO and the user insert in the data form "actual", can i reference it in a cross-dimension:
    Account1->Peiod1->Fy12 -> @MEMBER(SCENARIO)
    does this cross-dimension return the value corresponding to Account1->Period1->FY12->Actual?
    Thank All
    Maurizio

    Why you just don't use RPT with type Member ?
    Users chose member name from the LOV (no chance for mistake) and run your rule

Maybe you are looking for

  • Can I plug mic directly into computer to record on GB?

    Hi, I'm having trouble getting audio out after recording with my Duet Apogee interface. Is it necessary to use an interface with GB or can I just go direct with the mic? Thanks in advance for any input. Happy Sunday! Kate

  • Query Embed In JAVA returns NULL

    Hi All, I have embed a query in the JAVA to retrieve the data from the back end and I use Oracle for back end. What I'm trying to do is in my query has been shown below. The issue here is that result set returns the NULL. But fine when I change the q

  • Error with XCode

    Hey there, I just got the following error message in XCode: Uncaught Exception: * -[XCActionManager buildAndGo:]: unrecognized selector sent to instance 0x2883bf0 Stack Backtrace: The stack backtrace has been logged to the console. I think is is rela

  • Iphoto library consolidation

    Hi there, I started using iphoto taking my photos from an external hard disk (usb 2.0), after some year later and I dont know why, my photos stored in imac hard disk (in iphoto libray). Due there are a huge quantitiy of photos, more than 30.000, I de

  • Photoshop Cs3 saving problem

    Good Day! I've just installed Adobe photoshop Cs3 Extended and everytime i save my work, it crashes. The window is still there yet i can't click on anything even the menu bar. And the worst part of it is that it didn't save my work. It also doesn't c