I Have created a form and designed it using Swing Components. It is linked to MySQL, so i have few buttons, like Submit (Which When Clicked validates and updates the database). But I also have buttons to view and edit database. When clicked i have worked on Delete Record using JOptionPane (YES_NO_OPTION etc), but when it comes to editing, i want to put Combo boxes and Text Fields etc, which might not be preferred in JOptionPane. Creating a new Window would help, but is there any other easier Default Classes like JOptionPane in which i can use Many components? Also to display Database records?
Asked
Active
Viewed 36 times
0
-
3You can add a JPanel to a JOptionPane. – camickr Oct 11 '16 at 13:26
-
Study the [Oracle Swing tutorial](https://docs.oracle.com/javase/tutorial/uiswing/) to see what options are available for your GUI. – Gilbert Le Blanc Oct 12 '16 at 11:40
-
See this: http://stackoverflow.com/questions/39782984/passing-data-to-new-gui/39786737#39786737 – hamena314 Oct 12 '16 at 13:00
1 Answers
0
I believe what you are looking for are JDialogs, these are the "small" popup windows you are looking for. You may add any swing component you wish to it.
Here is an example of creating one and adding a JTextField to it.
JDialog popup = new JDialog();
//Set window title
popup.setTitle("Example");
//Set window size
popup.setWindowSize(300, 200);
//Force window to stay on top till exit
popup.setModal(true);
//Create and add a JTextField
JTextField input = new JTextField();
popup.add(input);
popup.setVisable(true);

Kyal Bond
- 296
- 1
- 12