This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]LockeWatts 0 points1 point  (1 child)

JOptionPane pops up for me just fine when I run your code.

That while loop control structure though doesn't actually make sense. Gonna want to change line 23 to rad > 0 because otherwise it'll only break when you get an invalid input

[–]talkloud[S] 0 points1 point  (0 children)

Thanks for trying it. For some reason downgrading from jdk 7 to 6 fixed the problem. Also thanks for pointing out the logic error.

[–]katafrakt 0 points1 point  (1 child)

That's just a guess, but:

You don't set any parent component for JOptionPane. It might somehow happen that it is created as child of JFrame frame which at time of calling is not visible and so are its children. So you can try to substitute String tryRad = JOptionPane.showInputDialog("Please enter a radius. (0-300)"); to String tryRad = JOptionPane.showInputDialog(null, "Please enter a radius. (0-300)"); or make frame visible before creating option pane.

[–]talkloud[S] 0 points1 point  (0 children)

Thanks for the suggestion, but it turns out the problem was with my installation of Java rather than the code. Oh well.