I have been messing around for a bit now to get this to work how I intend it to work, but couldn't find anything through Google or API to find the answer I seek, so here I am!
The project I am currently working on is an App for soldier registration (Theme of project), I used JFrame
and JButton
s, but I need to get a dialog box in JFrame
that will intake answers. Something that works like this, but is integrated in JFrame
:
nameField = JOptionPane.showInputDialog(null, "Enter Username(Default is 000000");
Well, by integrated into JFrame, I'm not quite sure what you want the dialog to do, but by simply setting the first parameter in JOptionPane.showInputDialog()
to the parent frame, the input will have the icon of the parent window.
nameField = JOptionPane.showInputDialog(myParentFrame,"Enter Username(Default is 000000");