need your support here. i tried everything i could, to get this work. but no success.
I have JFrame, which contains some menus on menu bar, one such menu is "Settings" which contains "Configuration" as JMenuItem, When clicking on that, i want to show a JDialog/JOptionPane/JFrame, where user can actually enter some values in text fields and click on "OK", these values will be used by JFrame accordingly.
Now the problem is:
1. If i am using JOptionPane's showInputDialog() method, then i am not able to set its Title Bar Icon (by default, it doesn't comes with any icon on its title bar as JFrame does.).
2. If i am using JOptionPane's showInputDialog() method, I am not able to put a JPanel inside it which contains properly formatted input fields.
3. If i am using JFrame, so that i can put any JPanel and any user input stuff, then , it comes with minimize and maximize buttons on top-right, which i dont want, since i am intension is to use it as a dialog for just getting input from the user.
4. secondly, if i use JFrame, then the new Jframe which comes up, can loose focus , when user clicks on main JFrame which contains Jmenu, i dont want user to actually able to access that main JFrame, untill he has provided any input which i am asking for (2-3 input fields) or unless he has explicitly clicked on "Close" button of that JFrame which is acting as a dialog. I am not getting any way to do it.
can someone please help.
-------------------------------<br />you can't move ahead, unless you try for it.
Originally posted by Akhil Jain: 2. If i am using JOptionPane's showInputDialog() method, I am not able to put a JPanel inside it which contains properly formatted input fields.
Use showConfirmDialog instead, with your JPanel as the second parameter (message) and JOptionPane.OK_CANCEL_OPTION as option type. Then check if the return value equals JOptionPane.OK_OPTION to see whether the user pressed OK, then get the values from the panel.