On Tue, 26 Jun 2012 15:49:29 -0700, bilsch <
bils...@gmail.com> wrote,
quoted or indirectly quoted someone who said :
>A stripped down version of my program is in the 2 files copied below.
>It is a simple calculator like in Windows accessories. The example only
>does addition and subtraction but it doesn't work. A number is
>accumulated in the textbox and when '+' button is clicked the displayed
>string is converted to double, the displayed string remains until the
>first digit of the next number is entered then the first number is
>cleared and the second number begins. When '=' is clicked the second
>displayed string (number) is converted to double and added to the first
>double number. The operation is controlled by 'opFlag' and 'addFlag'
>settings. The problem apparently is that the 'if' statements that set
>the flags are not being executed. I tried NetBeans debugger to watch
>the values but I don't know how to use the debugger well enough. I'm
>hoping someone here can tell me what I'm doing wrong so I can move on.
>Your comments will be appreciated. TIA Bill S.
I have not studied your program, but it sounds from your general
complaint like the problem might be you don't understand that nothing
gets painted until after an event handler returns. You may not
appreciate why event handlers cannot dither in the least. They have
to do i tiny bit of work and return, or else they will gum up the
entire JVM which an only process one Swing event at a time.
I suggest some background reading on events. e.g.
http://mindprod.com/jgloss/event11.html
--
Roedy Green Canadian Mind Products
http://mindprod.com
When you get stuck trying to solve a computer program:
1. Go into the kitchen and make coffee.
2. If that fails, go for a walk.
3. If that fails, take a nap.
Why? To avoid being swamped with details, to see the big picture,
to allow in some random noise to kick you out of your thinking rut.