If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

trouble with GUI

Hey guys,
this is the first GUI program I have been trying to write, I have been getting through it all so far, but once my GUI comes up I click on the button and nothing happens, any help is greatly appreciated, thanks in advance.

Re: trouble with GUI

Please post code using the CODE tags (see my sig) to retain formatting so it is readable.

OK... firstly, I seriously recommend that you don't use something like BreezySwing until you've learned how to code a GUI using the standard library, so you know how it all hangs together behind the scenes. See Creating a GUI with Swing.

That said, when your GUI is displayed, both double fields are 0.0, so when you press the button, the button handler code sees it's zero and will just skip the loop - as you have coded it to do.

Also, in that handler, you put the content of 'numberField' into both variables 'answer' and 'extent', ignoring 'iterationField' - are you sure you wanted to do that? I would suggest that 'numberField' is possibly the least informative name you could give to a numeric field, and this has probably contributed to your confusion. Give it a meaningful name - perhaps to do with its label (e.g. 'piField').

Also, you are using a double (floating point) number for the number of iterations - an integer concept. Does it make sense to input a fraction of an iteration?

Also, you should use the Java Naming Convention, or people might not read your code at all. At the very least, class names should begin with uppercase letters and method & variable names should begin with lowercase letters.

Before software can be reusable it first has to be usable...
R. Johnson

Please use &#91;CODE]...your code here...&#91;/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.