Quandary: why does the method stop in the middle and not refresh the text in the JTextbox?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Quandary: why does the method stop in the middle and not refresh the text in the JTextbox?

kenner

This program displays a question, checks the answer and goes on the next question. The setText for the QBox_1 works fine. The values in text3 and text4 do not get updated. In fact, the trace runs, as you can see, down to the second  check for the EDT and then waits. That's where I was going with this from what I have read: is this a event dispatch thread issue?.


method ShowNextCard(Rand1)
        if Debug_Level > 3 then trace results
        if javax.swing.SwingUtilities.isEventDispatchThread then say "We are running in the EDT, event dispatching thread."
        keystyped = Rexx 0
        keysaccepted = Rexx 0
        I = getNextCardNum(totalQCount, Rand1)
        A_question=question1[I]
        A_answer=answer1[I]
        ans_done[I] = 1
        if javax.swing.SwingUtilities.isEventDispatchThread then say "We are running in the EDT, event dispatching thread."
        QBox_1.setText( A_question)
        InputText.setText("Type your answer here. --> ")
        InputText.setCaretPosition(InputText.GetText.length + 1);
        f = SimpleDateFormat("H:mm:ss" ) -- Formats hours:minutes:seconds
--        text3.setText("Currently: "  f.format(Date()) -
--                                "Elapsed time:" elapsed() "minutes.")
        textForSetting = "Currently: "  f.format(Date()) -
                                "Elapsed time:" elapsed() "minutes."
        text3.setText(textForSetting)
        if (rightTotal + wrongTotal) == 0 then DaScore = 0
                else DaScore = (rightTotal  / (rightTotal + wrongTotal) * 100 %1)
--        text4.setText( -
--                                try_cnt 'of' fcgui.totalQCount 'complete,' (100 * (try_cnt / fcgui.totalQCount) %1) 'of total. \n' -
--                                "Overall percent of correct keystrokes: " DaScore '% \n')
        textForSetting = try_cnt 'of' fcgui.totalQCount 'complete.' (100 * (try_cnt / fcgui.totalQCount) %1) '% \n' -
                                "Overall percent of correct keystrokes: " DaScore '% \n'
        text4.setText(textForSetting)
        InputText.requestFocusinWindow()
        DrawTheCard_Frame.setVisible(1)        


1B <-- this is the answer.
 337 *=*     keysaccepted = keysaccepted + 1
     >p> keysaccepted "1"
 325 *=*   keystyped = keystyped + 1
     >p> keystyped "4"
 326 *=*   key = Rexx e.getKeyChar()                 -- make key of type Rexx for further use
     >v> key "b"
 328 *=*   key = key.upper()
     >v> key "B"
1B <-- this is the answer.
 337 *=*     keysaccepted = keysaccepted + 1
     >p> keysaccepted "2"
 343 *=*     try_cnt = try_cnt + 1
     >p> try_cnt "2"
 352 *=*    wrongTotal = wrongTotal + wrongones
     >p> wrongTotal "2"
 355 *=*       rightTotal = rightTotal + rightones
     >p> rightTotal "6"
 364 *=*    keysaccepted = 0
     >p> keysaccepted "0"
 312 *=*   elapsedTime = (Curr_Time - fcgui.Start_Time) / 60000 %1
     >v> elapsedTime "11"
 313 *=*   elapsedTime = elapsedTime.format(NULL,0)
     >v> elapsedTime "11"
11 Thu Jun 21 11:20:14 EDT 2012
We are running in the EDT, event dispatching thread.
 256 *=*  keystyped = Rexx 0
     >p> keystyped "0"
 257 *=*  keysaccepted = Rexx 0
     >p> keysaccepted "0"
 260 *=*  A_answer=answer1[I]
     >p> A_answer "1C"
 261 *=*  ans_done[I] = 1
     >p> ans_done "1"
We are running in the EDT, event dispatching thread.


Kenneth Klein

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/