Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2015 The University of Vermont and State
   * Agricultural College.  All rights reserved.
   *
   * Written by Matthew B. Storer <matthewbstorer@gmail.com>
   *
   * This file is part of CCTS Common.
   *
   * CCTS Common is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * CCTS Common is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with CCTS Common.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
  * Created by JFormDesigner on Tue Sep 16 11:06:30 EDT 2014
  */
 
 package edu.uvm.ccts.common.ui;
 
 
 import javax.swing.*;
 import java.awt.*;

Author(s):
Matthew Storer
 
 public class ConfirmDialog extends JDialog {
     private static final Log log = LogFactory.getLog(ConfirmDialog.class);
 
     private static final String ICON_FILE = "/question_mark.png";
 
     private boolean confirmed = false;
 
     public ConfirmDialog(Frame ownerString message) {
         super(owner);
         initComponents();
         setup(message);
     }
 
     public ConfirmDialog(Dialog ownerString message) {
         super(owner);
         initComponents();
         setup(message);
     }
 
     public boolean isConfirmed() {
         return ;
     }
 
     private void setup(String message) {
         try {
             BufferedImage bimg = ImageIO.read(ResourceUtil.getResourceAsStream());
             ImageIcon icon = new ImageIcon(bimg);
             .setIcon(icon);
 
         } catch (IOException e) {
             .error("caught " + e.getClass().getName() + " loading icon " +  + " - " + e.getMessage(), e);
             .setVisible(false);
         }
 
         .setText("<html>" + message + "</html>");
 
         .grabFocus();
     }
 
     private void noButtonActionPerformed() {
         setVisible(false);
     }
 
     private void yesButtonActionPerformed() {
          = true;
         setVisible(false);
     }
 
     private void initComponents() {
         // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
         // Generated using JFormDesigner non-commercial license
          = new JPanel();
          = new JPanel();
          = new JLabel();
          = new JLabel();
         = new JPanel();
         = new JButton();
         = new JButton();
        //======== this ========
        setTitle("Select a Response");
        setModal(true);
        setMinimumSize(new Dimension(350, 175));
        setResizable(false);
        Container contentPane = getContentPane();
        contentPane.setLayout(new BorderLayout());
        //======== dialogPane ========
        {
            .setBorder(new EmptyBorder(12, 12, 12, 12));
            .setLayout(new BorderLayout());
            //======== contentPanel ========
            {
                //---- lblIcon ----
                .setText("icon");
                .setIcon(null);
                .setPreferredSize(new Dimension(50, 50));
                //---- lblMessage ----
                .setText("text");
                .setVerticalAlignment(.);
                GroupLayout contentPanelLayout = new GroupLayout();
                .setLayout(contentPanelLayout);
                contentPanelLayout.setHorizontalGroup(
                    contentPanelLayout.createParallelGroup()
                        .addGroup(contentPanelLayout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(., 60, .)
                            .addGap(18, 18, 18)
                            .addComponent(., 211, .)
                            .addContainerGap())
                );
                contentPanelLayout.setVerticalGroup(
                    contentPanelLayout.createParallelGroup()
                        .addGroup(contentPanelLayout.createSequentialGroup()
                            .addContainerGap()
                            .addGroup(contentPanelLayout.createParallelGroup()
                                .addComponent(...)
                                .addGroup(contentPanelLayout.createSequentialGroup()
                                    .addComponent(., 60, .)
                                    .addGap(0, 0, .)))
                            .addContainerGap())
                );
            }
            .add(.);
            //======== buttonBar ========
            {
                .setBorder(new EmptyBorder(12, 0, 0, 0));
                .setLayout(new GridBagLayout());
                ((GridBagLayout).getLayout()). = new int[] {0, 85, 80};
                ((GridBagLayout).getLayout()). = new double[] {1.0, 0.0, 0.0};
                //---- noButton ----
                .setText("No");
                .addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        noButtonActionPerformed();
                    }
                });
                .add(new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
                    ..,
                    new Insets(0, 0, 0, 5), 0, 0));
                //---- yesButton ----
                .setText("Yes");
                .addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        yesButtonActionPerformed();
                    }
                });
                .add(new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
                    ..,
                    new Insets(0, 0, 0, 0), 0, 0));
            }
            .add(.);
        }
        contentPane.add(.);
        setSize(355, 180);
        // JFormDesigner - End of component initialization  //GEN-END:initComponents
    }
    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
    // Generated using JFormDesigner non-commercial license
    private JPanel dialogPane;
    private JPanel contentPanel;
    private JLabel lblIcon;
    private JLabel lblMessage;
    private JPanel buttonBar;
    private JButton noButton;
    private JButton yesButton;
    // JFormDesigner - End of variables declaration  //GEN-END:variables
New to GrepCode? Check out our FAQ X