You should actually take the result from the option pane: dialogButton = JOptionPane.showConfirmDialog (null, "Are you sure?","WARNING", dialogButton); Otherwise, it remains set to JOptionPane.YES_NO_OPTION. Cleaner would be: if (JOptionPane.showConfirmDialog(null,...
  • April 5, 2022
  • 0 Comments
IT Nursery
You can use custom component instead of a string message, for example: import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; public class TestDialog { public static void main(String args)...
  • April 3, 2022
  • 0 Comments