@Ignore @Test public void testShowConfirmDialog(){ LOGGER.info("testShowConfirmDialog"); try{ final String message = new String("Test"); final String title = new String("Test"); CustomDialog.showConfirmDialog(null, true, message, title,JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE); CustomDialog cD = CustomDialog.getInstanceCustomDialog(null, true, message, title, JOptionPane.INFORMATION_MESSAGE, false); assertTrue(checkComponentMessageDialog(cD)); CustomDialog.showConfirmDialog(null, true, message, title,JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); cD = CustomDialog.getInstanceCustomDialog(null, true, message, title, JOptionPane.INFORMATION_MESSAGE, false); assertTrue(checkComponentMessageDialog(cD)); CustomDialog.showConfirmDialog(null, true, message, title,JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); cD = CustomDialog.getInstanceCustomDialog(null, true, message, title, JOptionPane.INFORMATION_MESSAGE, false); assertTrue(checkComponentMessageDialog(cD)); } catch (final java.awt.HeadlessException e) { } }
public static int showConfirmDialog(final Component componentParent, final boolean modal, final String message, final String title, final int typeOption, final int typeMessage){ final CustomDialog customDialog = CustomDialog.getInstanceCustomDialog(componentParent, modal, message, title, typeMessage, false); final GridBagConstraints cons = new GridBagConstraints(); cons.fill = GridBagConstraints.HORIZONTAL; cons.gridy = 0; cons.insets = new Insets(0,0,0,10); if (typeOption == JOptionPane.YES_NO_OPTION) { customDialog.okButton.setText(Messages.getString("CustomDialog.confirmDialog.yes")); customDialog.okButton.setMnemonic(KeyEvent.VK_S); customDialog.noButton = customDialog.getButton(Messages.getString("CustomDialog.confirmDialog.no"), KeyEvent.VK_N); final JPanel noPanel = new JPanel(); noPanel.add(customDialog.noButton); customDialog.buttonsPanel.add(noPanel, cons); customDialog.noButton.addActionListener(customDialog); } else if (typeOption == JOptionPane.YES_NO_CANCEL_OPTION) { customDialog.okButton.setText(Messages.getString("CustomDialog.confirmDialog.yes")); customDialog.okButton.setMnemonic(KeyEvent.VK_S); customDialog.noButton = customDialog.getButton(Messages.getString("CustomDialog.confirmDialog.no"), KeyEvent.VK_N); final JPanel noPanel = new JPanel(); noPanel.add(customDialog.noButton); customDialog.buttonsPanel.add(noPanel, cons); customDialog.noButton.addActionListener(customDialog); cancelButton = customDialog.getButton(cancellText, KeyEvent.VK_C); final JPanel cancelPanel = new JPanel(); cancelPanel.add(cancelButton); customDialog.buttonsPanel.add(cancelPanel, cons); cancelButton.addActionListener(customDialog); } else { cancelButton = customDialog.getButton(cancellText, KeyEvent.VK_C); final JPanel cancelPanel = new JPanel(); cancelPanel.add(cancelButton); customDialog.buttonsPanel.add(cancelPanel, cons); cancelButton.addActionListener(customDialog); } customDialog.infoLabel.setHorizontalAlignment(SwingConstants.CENTER); if (Platform.getOS().equals(Platform.OS.MACOSX)){ customDialog.repaint(); } customDialog.setVisible(true); return customDialog.getAnswer(); }
CustomDialog extends JAccessibilityCustomDialog implements ActionListener { public static int showConfirmDialog(final Component componentParent, final boolean modal, final String message, final String title, final int typeOption, final int typeMessage){ final CustomDialog customDialog = CustomDialog.getInstanceCustomDialog(componentParent, modal, message, title, typeMessage, false); final GridBagConstraints cons = new GridBagConstraints(); cons.fill = GridBagConstraints.HORIZONTAL; cons.gridy = 0; cons.insets = new Insets(0,0,0,10); if (typeOption == JOptionPane.YES_NO_OPTION) { customDialog.okButton.setText(Messages.getString("CustomDialog.confirmDialog.yes")); customDialog.okButton.setMnemonic(KeyEvent.VK_S); customDialog.noButton = customDialog.getButton(Messages.getString("CustomDialog.confirmDialog.no"), KeyEvent.VK_N); final JPanel noPanel = new JPanel(); noPanel.add(customDialog.noButton); customDialog.buttonsPanel.add(noPanel, cons); customDialog.noButton.addActionListener(customDialog); } else if (typeOption == JOptionPane.YES_NO_CANCEL_OPTION) { customDialog.okButton.setText(Messages.getString("CustomDialog.confirmDialog.yes")); customDialog.okButton.setMnemonic(KeyEvent.VK_S); customDialog.noButton = customDialog.getButton(Messages.getString("CustomDialog.confirmDialog.no"), KeyEvent.VK_N); final JPanel noPanel = new JPanel(); noPanel.add(customDialog.noButton); customDialog.buttonsPanel.add(noPanel, cons); customDialog.noButton.addActionListener(customDialog); cancelButton = customDialog.getButton(cancellText, KeyEvent.VK_C); final JPanel cancelPanel = new JPanel(); cancelPanel.add(cancelButton); customDialog.buttonsPanel.add(cancelPanel, cons); cancelButton.addActionListener(customDialog); } else { cancelButton = customDialog.getButton(cancellText, KeyEvent.VK_C); final JPanel cancelPanel = new JPanel(); cancelPanel.add(cancelButton); customDialog.buttonsPanel.add(cancelPanel, cons); cancelButton.addActionListener(customDialog); } customDialog.infoLabel.setHorizontalAlignment(SwingConstants.CENTER); if (Platform.getOS().equals(Platform.OS.MACOSX)){ customDialog.repaint(); } customDialog.setVisible(true); return customDialog.getAnswer(); } }
CustomDialog extends JAccessibilityCustomDialog implements ActionListener { public static int showConfirmDialog(final Component componentParent, final boolean modal, final String message, final String title, final int typeOption, final int typeMessage){ final CustomDialog customDialog = CustomDialog.getInstanceCustomDialog(componentParent, modal, message, title, typeMessage, false); final GridBagConstraints cons = new GridBagConstraints(); cons.fill = GridBagConstraints.HORIZONTAL; cons.gridy = 0; cons.insets = new Insets(0,0,0,10); if (typeOption == JOptionPane.YES_NO_OPTION) { customDialog.okButton.setText(Messages.getString("CustomDialog.confirmDialog.yes")); customDialog.okButton.setMnemonic(KeyEvent.VK_S); customDialog.noButton = customDialog.getButton(Messages.getString("CustomDialog.confirmDialog.no"), KeyEvent.VK_N); final JPanel noPanel = new JPanel(); noPanel.add(customDialog.noButton); customDialog.buttonsPanel.add(noPanel, cons); customDialog.noButton.addActionListener(customDialog); } else if (typeOption == JOptionPane.YES_NO_CANCEL_OPTION) { customDialog.okButton.setText(Messages.getString("CustomDialog.confirmDialog.yes")); customDialog.okButton.setMnemonic(KeyEvent.VK_S); customDialog.noButton = customDialog.getButton(Messages.getString("CustomDialog.confirmDialog.no"), KeyEvent.VK_N); final JPanel noPanel = new JPanel(); noPanel.add(customDialog.noButton); customDialog.buttonsPanel.add(noPanel, cons); customDialog.noButton.addActionListener(customDialog); cancelButton = customDialog.getButton(cancellText, KeyEvent.VK_C); final JPanel cancelPanel = new JPanel(); cancelPanel.add(cancelButton); customDialog.buttonsPanel.add(cancelPanel, cons); cancelButton.addActionListener(customDialog); } else { cancelButton = customDialog.getButton(cancellText, KeyEvent.VK_C); final JPanel cancelPanel = new JPanel(); cancelPanel.add(cancelButton); customDialog.buttonsPanel.add(cancelPanel, cons); cancelButton.addActionListener(customDialog); } customDialog.infoLabel.setHorizontalAlignment(SwingConstants.CENTER); if (Platform.getOS().equals(Platform.OS.MACOSX)){ customDialog.repaint(); } customDialog.setVisible(true); return customDialog.getAnswer(); } private  CustomDialog(final JDialog componentParent, final boolean modal, final String message, final String title, final int typeMessage, final boolean isInputDialog); private  CustomDialog(final Component componentParent, final boolean modal, final String message, final String title, final int typeMessage, final boolean isInputDialog); private  CustomDialog(final JFrame componentParent, final boolean modal, final String message, final String title, final int typeMessage, final boolean isInputDialog); }
CustomDialog extends JAccessibilityCustomDialog implements ActionListener { public static int showConfirmDialog(final Component componentParent, final boolean modal, final String message, final String title, final int typeOption, final int typeMessage){ final CustomDialog customDialog = CustomDialog.getInstanceCustomDialog(componentParent, modal, message, title, typeMessage, false); final GridBagConstraints cons = new GridBagConstraints(); cons.fill = GridBagConstraints.HORIZONTAL; cons.gridy = 0; cons.insets = new Insets(0,0,0,10); if (typeOption == JOptionPane.YES_NO_OPTION) { customDialog.okButton.setText(Messages.getString("CustomDialog.confirmDialog.yes")); customDialog.okButton.setMnemonic(KeyEvent.VK_S); customDialog.noButton = customDialog.getButton(Messages.getString("CustomDialog.confirmDialog.no"), KeyEvent.VK_N); final JPanel noPanel = new JPanel(); noPanel.add(customDialog.noButton); customDialog.buttonsPanel.add(noPanel, cons); customDialog.noButton.addActionListener(customDialog); } else if (typeOption == JOptionPane.YES_NO_CANCEL_OPTION) { customDialog.okButton.setText(Messages.getString("CustomDialog.confirmDialog.yes")); customDialog.okButton.setMnemonic(KeyEvent.VK_S); customDialog.noButton = customDialog.getButton(Messages.getString("CustomDialog.confirmDialog.no"), KeyEvent.VK_N); final JPanel noPanel = new JPanel(); noPanel.add(customDialog.noButton); customDialog.buttonsPanel.add(noPanel, cons); customDialog.noButton.addActionListener(customDialog); cancelButton = customDialog.getButton(cancellText, KeyEvent.VK_C); final JPanel cancelPanel = new JPanel(); cancelPanel.add(cancelButton); customDialog.buttonsPanel.add(cancelPanel, cons); cancelButton.addActionListener(customDialog); } else { cancelButton = customDialog.getButton(cancellText, KeyEvent.VK_C); final JPanel cancelPanel = new JPanel(); cancelPanel.add(cancelButton); customDialog.buttonsPanel.add(cancelPanel, cons); cancelButton.addActionListener(customDialog); } customDialog.infoLabel.setHorizontalAlignment(SwingConstants.CENTER); if (Platform.getOS().equals(Platform.OS.MACOSX)){ customDialog.repaint(); } customDialog.setVisible(true); return customDialog.getAnswer(); } private  CustomDialog(final JDialog componentParent, final boolean modal, final String message, final String title, final int typeMessage, final boolean isInputDialog); private  CustomDialog(final Component componentParent, final boolean modal, final String message, final String title, final int typeMessage, final boolean isInputDialog); private  CustomDialog(final JFrame componentParent, final boolean modal, final String message, final String title, final int typeMessage, final boolean isInputDialog); static void showMessageDialog(final Component componentParent, final boolean modal, final String message, final String title, final int typeMessage); static int showConfirmDialog(final Component componentParent, final boolean modal, final String message, final String title, final int typeOption, final int typeMessage); static String showInputDialog(final Component componentParent, final boolean modal, final String message, final int mnemonic, final String title, final int typeMessage); static Object showInputDialog(final Component componentParent, final boolean modal, final String message, final int mnemonic, final String title, final int typeMessage,
			final Object[] selectionValues, final Object initialSelectionValue); static String showInputDialog(final Component componentParent, final boolean modal, final String message, final int mnemonic, final List<String> list, final String nameListElements, final String title, final int typeMessage); static char[] showInputPasswordDialog(final Component componentParent, final boolean modal, final String charSet, final boolean beep, final String message, final int mnemonic, final String title, final int typeMessage); @Override int getMinimumRelation(); static CustomDialog getInstanceCustomDialog(final Component componentParent, final boolean modal, final String message, final String title, final int typeMessage, final boolean isInputDialog); @Override void actionPerformed(final ActionEvent e); }
CustomDialog extends JAccessibilityCustomDialog implements ActionListener { public static int showConfirmDialog(final Component componentParent, final boolean modal, final String message, final String title, final int typeOption, final int typeMessage){ final CustomDialog customDialog = CustomDialog.getInstanceCustomDialog(componentParent, modal, message, title, typeMessage, false); final GridBagConstraints cons = new GridBagConstraints(); cons.fill = GridBagConstraints.HORIZONTAL; cons.gridy = 0; cons.insets = new Insets(0,0,0,10); if (typeOption == JOptionPane.YES_NO_OPTION) { customDialog.okButton.setText(Messages.getString("CustomDialog.confirmDialog.yes")); customDialog.okButton.setMnemonic(KeyEvent.VK_S); customDialog.noButton = customDialog.getButton(Messages.getString("CustomDialog.confirmDialog.no"), KeyEvent.VK_N); final JPanel noPanel = new JPanel(); noPanel.add(customDialog.noButton); customDialog.buttonsPanel.add(noPanel, cons); customDialog.noButton.addActionListener(customDialog); } else if (typeOption == JOptionPane.YES_NO_CANCEL_OPTION) { customDialog.okButton.setText(Messages.getString("CustomDialog.confirmDialog.yes")); customDialog.okButton.setMnemonic(KeyEvent.VK_S); customDialog.noButton = customDialog.getButton(Messages.getString("CustomDialog.confirmDialog.no"), KeyEvent.VK_N); final JPanel noPanel = new JPanel(); noPanel.add(customDialog.noButton); customDialog.buttonsPanel.add(noPanel, cons); customDialog.noButton.addActionListener(customDialog); cancelButton = customDialog.getButton(cancellText, KeyEvent.VK_C); final JPanel cancelPanel = new JPanel(); cancelPanel.add(cancelButton); customDialog.buttonsPanel.add(cancelPanel, cons); cancelButton.addActionListener(customDialog); } else { cancelButton = customDialog.getButton(cancellText, KeyEvent.VK_C); final JPanel cancelPanel = new JPanel(); cancelPanel.add(cancelButton); customDialog.buttonsPanel.add(cancelPanel, cons); cancelButton.addActionListener(customDialog); } customDialog.infoLabel.setHorizontalAlignment(SwingConstants.CENTER); if (Platform.getOS().equals(Platform.OS.MACOSX)){ customDialog.repaint(); } customDialog.setVisible(true); return customDialog.getAnswer(); } private  CustomDialog(final JDialog componentParent, final boolean modal, final String message, final String title, final int typeMessage, final boolean isInputDialog); private  CustomDialog(final Component componentParent, final boolean modal, final String message, final String title, final int typeMessage, final boolean isInputDialog); private  CustomDialog(final JFrame componentParent, final boolean modal, final String message, final String title, final int typeMessage, final boolean isInputDialog); static void showMessageDialog(final Component componentParent, final boolean modal, final String message, final String title, final int typeMessage); static int showConfirmDialog(final Component componentParent, final boolean modal, final String message, final String title, final int typeOption, final int typeMessage); static String showInputDialog(final Component componentParent, final boolean modal, final String message, final int mnemonic, final String title, final int typeMessage); static Object showInputDialog(final Component componentParent, final boolean modal, final String message, final int mnemonic, final String title, final int typeMessage,
			final Object[] selectionValues, final Object initialSelectionValue); static String showInputDialog(final Component componentParent, final boolean modal, final String message, final int mnemonic, final List<String> list, final String nameListElements, final String title, final int typeMessage); static char[] showInputPasswordDialog(final Component componentParent, final boolean modal, final String charSet, final boolean beep, final String message, final int mnemonic, final String title, final int typeMessage); @Override int getMinimumRelation(); static CustomDialog getInstanceCustomDialog(final Component componentParent, final boolean modal, final String message, final String title, final int typeMessage, final boolean isInputDialog); @Override void actionPerformed(final ActionEvent e);  }