But who wants secondary windows opening in front of their app?Damon McNeill wrote:. . . you can do anything you like in a new window.
Damon McNeill wrote:Dialog box is limited to a simple choice like "OK", "RETRY", "CANCEL", but you can do anything you like in a new window.
Tim Rawley wrote:How can I have my JDialog windows change the settings in my speedMathData Class?
Would it be bad form to just leave the JDialog open but not visible when the OK button is clicked and use something like options.getNumberOfProblems()?
Tim Rawley wrote:it's smd.setNumberOfProbs(val);
also Eclipse said I need to add null to compile --- SMOptions dialog = new SMOptions(null);
Tim Rawley wrote:if I have public SMOptions(speedMathData smd) {
then SMOptions dialog = new SMOptions() shows constructor SMOptions() is undefined,
when I pick add argument to match SMOptions(speedDataMath) eclipse sets it to null.
Your long comments make those lines too long to read easily, but that is only a minor problem.Tim Rawley wrote:. . .
Somebody please hit me for not noticing the logic error in that line. I am not certain there is an error, but the variable names suggest it. Please tell us what sort of result you expect from that method if you pass (10, 10) as arguments.Tim Rawley wrote:. . .. . .
That's a pleasureThanks again for the help.
Tim Rawley wrote:I still feel that I'm missing something fundamental as far passing info back to the parent object from the child object.
I might need component listener, or call back method?
By the way I don't understand why you're using language which implies a parent/child relationship between two objects. Sometimes there's a relationship between two objects as a result of their design, but that doesn't imply that there are special ways for transferring data between them. They're just two objects.
I know it is late to comment about that, but I doubt whether you should use those two statements togetherTim Rawley wrote:. . . I borrowed it from the net, it seems to work correctly. . . .
Dangerous combination. You need to work out what you want to do, and then work out what you are actually doing. What would that formula do if both variables had the value 10, as I asked yesterday? You need to know that sort of thing before you can program random numbers confidently. I do not like doing arithmetic with Math#random, because there are much better ways to get random numbers.Tim Rawley wrote:. . . They both seem to work fine. I'm not sure why. . . .
Start by reading the documentation for Math#random(), then work out what you will get if you multiply by 10, then work out what you will get if you cast that to an int. Also compare the precedences of multiplication and cast, for example here. The reason you are not getting repeated values from 1, 1000 is probably because you have a larger range; if you printed 10,000 numbers you would have at least 9*** repeated numbers.Tim Rawley wrote:. . . So I'm not really sure what is happening there. . . .
Don't get me started about those stupid light bulbs. |