0

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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Khushwanth
  • 103
  • 7

1 Answers1

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