need help in identifying what is wrong with my code especially the hypergeomeyric method which when ever i execute it,it display an understandable exception in command prompt.also the poisson method only display the correct result when r=0 but result when r=1 to n.thanks for ever listening hears.
please describe what exceptions you get with which parameters! It would be much easier to help like that.
Anyway, I have run your code, and I got the following exception when trying the Hypergeometric Distribution:
A short inspection told me that NField (and the others as well: nField, rField, etc) are null. Please have a look at the GUI building code. NField is declared as:
It is redefined locally, so no wonder that the NField member in the class is null. Compare this with the field initialization for the Poisson tab:
These errors can be very annoying, but should not be hard to find. The exception above is very clear about what the problem is: a null reference in the actionPerformed method. So you should just find which reference is null. Using an IDE with a debugging option (nearly all of them) can help much, as it can show you which one is the culprit just by moving your mouse over them. [ November 17, 2006: Message edited by: David Nemeskey ]
Joined: Nov 08, 2006
Also, one other suggestion: in the main method, you should call f.setVisible() as the last instruction.
You may remember, that according to the Swing threading model, all modifications to an already visible GUI must be run in the event dispatch thread. This applies to your program from the moment you call f.setVisible(). When I first ran your program, it just displayed an empty frame, as the c.add(cm) "did not make it" to my screen.
Please have a look at the Swing tutorial at Sun. [ November 17, 2006: Message edited by: David Nemeskey ]