Example usage for javax.swing WindowConstants DISPOSE_ON_CLOSE

List of usage examples for javax.swing WindowConstants DISPOSE_ON_CLOSE

Introduction

In this page you can find the example usage for javax.swing WindowConstants DISPOSE_ON_CLOSE.

Prototype

int DISPOSE_ON_CLOSE

To view the source code for javax.swing WindowConstants DISPOSE_ON_CLOSE.

Click Source Link

Document

The dispose-window default window close operation.

Usage

From source file:dictionary.GUI.GUI_Main.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor./*from   w w w. j a va2 s.c o  m*/
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    frameMean = new javax.swing.JFrame();
    jScrollPane1 = new javax.swing.JScrollPane();
    fieldMean = new javax.swing.JEditorPane();
    buttonEdit = new javax.swing.JButton();
    buttonSave = new javax.swing.JButton();
    buttonDelete = new javax.swing.JButton();
    buttonExit = new javax.swing.JButton();
    frameEntries = new javax.swing.JFrame();
    jScrollPane3 = new javax.swing.JScrollPane();
    listEntries = new javax.swing.JList();
    frameAdd = new javax.swing.JFrame();
    fieldAddWord = new javax.swing.JTextField();
    jScrollPane2 = new javax.swing.JScrollPane();
    fieldAddMean = new javax.swing.JEditorPane();
    buttonAdd2 = new javax.swing.JButton();
    labelWord = new javax.swing.JLabel();
    buttonCloseAdd = new javax.swing.JButton();
    frameSetting = new javax.swing.JFrame();
    panelVoice = new javax.swing.JPanel();
    button1 = new javax.swing.JRadioButton();
    button2 = new javax.swing.JRadioButton();
    buttonCloseSetting = new javax.swing.JButton();
    buttonAboutUs = new javax.swing.JButton();
    buttonGroup1 = new javax.swing.ButtonGroup();
    frameCo = new javax.swing.JFrame();
    jLabel3 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    jLabel7 = new javax.swing.JLabel();
    jLabel8 = new javax.swing.JLabel();
    main = new javax.swing.JPanel();
    comboBoxEV = new javax.swing.JComboBox();
    fieldWord = new javax.swing.JTextField();
    labelDic = new javax.swing.JLabel();
    labelAuthor = new javax.swing.JLabel();
    buttonAdd = new javax.swing.JButton();
    buttonSetting = new javax.swing.JButton();
    traonl = new javax.swing.JButton();
    comboBoxOnl = new javax.swing.JComboBox();
    buttonSpeech = new javax.swing.JButton();
    buttonUndo = new javax.swing.JButton();
    buttonFind = new javax.swing.JButton();

    frameMean.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    frameMean.setTitle("Mean");
    frameMean.setLocation(new java.awt.Point(780, 0));
    frameMean.setName("frameMean"); // NOI18N
    frameMean.setUndecorated(true);
    frameMean.setSize(new java.awt.Dimension(500, 400));

    fieldMean.setEditable(false);
    fieldMean.setBackground(new java.awt.Color(204, 255, 204));
    fieldMean.setContentType("text/html"); // NOI18N
    fieldMean.setAutoscrolls(false);
    fieldMean.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            fieldMeanKeyPressed(evt);
        }
    });
    jScrollPane1.setViewportView(fieldMean);

    buttonEdit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dictionary/images/edit.png"))); // NOI18N
    buttonEdit.setText("Edit");
    buttonEdit.setBorder(null);
    buttonEdit.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonEditActionPerformed(evt);
        }
    });

    buttonSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dictionary/images/save.png"))); // NOI18N
    buttonSave.setText("Save");
    buttonSave.setBorder(null);
    buttonSave.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonSaveActionPerformed(evt);
        }
    });

    buttonDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dictionary/images/delete.png"))); // NOI18N
    buttonDelete.setText("Delete");
    buttonDelete.setBorder(null);
    buttonDelete.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonDeleteActionPerformed(evt);
        }
    });

    buttonExit.setText("Thot");
    buttonExit.setBorder(null);
    buttonExit.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonExitActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout frameMeanLayout = new javax.swing.GroupLayout(frameMean.getContentPane());
    frameMean.getContentPane().setLayout(frameMeanLayout);
    frameMeanLayout
            .setHorizontalGroup(
                    frameMeanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                    frameMeanLayout.createSequentialGroup().addContainerGap()
                                            .addComponent(buttonEdit, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(27, 27, 27)
                                            .addComponent(buttonDelete, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    36, Short.MAX_VALUE)
                                            .addComponent(buttonSave, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18)
                                            .addComponent(buttonExit, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18))
                            .addComponent(jScrollPane1));
    frameMeanLayout.setVerticalGroup(frameMeanLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(frameMeanLayout.createSequentialGroup()
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 348,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(frameMeanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(buttonEdit, javax.swing.GroupLayout.PREFERRED_SIZE, 34,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(buttonDelete, javax.swing.GroupLayout.PREFERRED_SIZE, 34,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(buttonSave, javax.swing.GroupLayout.PREFERRED_SIZE, 34,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(buttonExit, javax.swing.GroupLayout.PREFERRED_SIZE, 34,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    frameEntries.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    frameEntries.setTitle("Entries");
    frameEntries.setAlwaysOnTop(true);
    frameEntries.setAutoRequestFocus(false);
    frameEntries.setLocation(new java.awt.Point(320, 300));
    frameEntries.setName("frameEntries"); // NOI18N
    frameEntries.setUndecorated(true);
    frameEntries.setResizable(false);
    frameEntries.setSize(new java.awt.Dimension(180, 220));

    listEntries.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
    listEntries.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    listEntries.setAutoscrolls(false);
    listEntries.setVerifyInputWhenFocusTarget(false);
    listEntries.setVisibleRowCount(6);
    listEntries.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            listEntriesMouseClicked(evt);
        }
    });
    listEntries.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            listEntriesKeyPressed(evt);
        }
    });
    jScrollPane3.setViewportView(listEntries);

    javax.swing.GroupLayout frameEntriesLayout = new javax.swing.GroupLayout(frameEntries.getContentPane());
    frameEntries.getContentPane().setLayout(frameEntriesLayout);
    frameEntriesLayout.setHorizontalGroup(
            frameEntriesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING,
                    javax.swing.GroupLayout.DEFAULT_SIZE, 454, Short.MAX_VALUE));
    frameEntriesLayout
            .setVerticalGroup(frameEntriesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE));

    frameAdd.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    frameAdd.setTitle("Add Word");
    frameAdd.setLocation(new java.awt.Point(300, 100));
    frameAdd.setUndecorated(true);
    frameAdd.setSize(new java.awt.Dimension(451, 375));
    frameAdd.addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosed(java.awt.event.WindowEvent evt) {
            frameAddWindowClosed(evt);
        }
    });

    fieldAddMean.setBorder(javax.swing.BorderFactory.createTitledBorder(
            javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Mean"));
    jScrollPane2.setViewportView(fieldAddMean);

    buttonAdd2.setText("Add");
    buttonAdd2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonAdd2ActionPerformed(evt);
        }
    });

    labelWord.setText("Word");

    buttonCloseAdd.setText("Close");
    buttonCloseAdd.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonCloseAddActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout frameAddLayout = new javax.swing.GroupLayout(frameAdd.getContentPane());
    frameAdd.getContentPane().setLayout(frameAddLayout);
    frameAddLayout.setHorizontalGroup(frameAddLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, frameAddLayout.createSequentialGroup()
                    .addContainerGap(33, Short.MAX_VALUE)
                    .addGroup(frameAddLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 409,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(frameAddLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(frameAddLayout.createSequentialGroup().addComponent(labelWord)
                                            .addGap(29, 29, 29).addComponent(fieldAddWord,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 341,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(frameAddLayout.createSequentialGroup()
                                            .addComponent(buttonAdd2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    61, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(32, 32, 32).addComponent(buttonCloseAdd,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 69,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGap(22, 22, 22)));
    frameAddLayout.setVerticalGroup(frameAddLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(frameAddLayout.createSequentialGroup().addGap(17, 17, 17)
                    .addGroup(frameAddLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(fieldAddWord, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(labelWord))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 228,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addGroup(frameAddLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(buttonAdd2, javax.swing.GroupLayout.PREFERRED_SIZE, 39,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(buttonCloseAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 39,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap()));

    jScrollPane2.getAccessibleContext().setAccessibleName("");
    jScrollPane2.getAccessibleContext().setAccessibleDescription("");
    jScrollPane2.getAccessibleContext().setAccessibleParent(frameMean);

    frameSetting.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    frameSetting.setTitle("Settings");
    frameSetting.setAlwaysOnTop(true);
    frameSetting.setLocation(new java.awt.Point(200, 100));
    frameSetting.setUndecorated(true);
    frameSetting.setSize(new java.awt.Dimension(400, 200));
    frameSetting.addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosed(java.awt.event.WindowEvent evt) {
            frameSettingWindowClosed(evt);
        }
    });

    panelVoice.setBorder(javax.swing.BorderFactory.createTitledBorder("Voice"));

    buttonGroup1.add(button1);
    button1.setSelected(true);
    button1.setText("Female");
    button1.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            button1ItemStateChanged(evt);
        }
    });

    buttonGroup1.add(button2);
    button2.setText("Male");
    button2.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            button1ItemStateChanged(evt);
        }
    });

    javax.swing.GroupLayout panelVoiceLayout = new javax.swing.GroupLayout(panelVoice);
    panelVoice.setLayout(panelVoiceLayout);
    panelVoiceLayout.setHorizontalGroup(panelVoiceLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelVoiceLayout.createSequentialGroup().addGap(70, 70, 70).addComponent(button1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 110, Short.MAX_VALUE)
                    .addComponent(button2).addGap(82, 82, 82)));
    panelVoiceLayout
            .setVerticalGroup(panelVoiceLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            panelVoiceLayout.createSequentialGroup().addContainerGap(22, Short.MAX_VALUE)
                                    .addGroup(panelVoiceLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(button1).addComponent(button2))
                                    .addGap(36, 36, 36)));

    buttonCloseSetting.setText("Close");
    buttonCloseSetting.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonCloseSettingActionPerformed(evt);
        }
    });

    buttonAboutUs.setText("About Us");
    buttonAboutUs.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    buttonAboutUs.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonAboutUsActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout frameSettingLayout = new javax.swing.GroupLayout(frameSetting.getContentPane());
    frameSetting.getContentPane().setLayout(frameSettingLayout);
    frameSettingLayout.setHorizontalGroup(frameSettingLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                    frameSettingLayout.createSequentialGroup().addContainerGap()
                            .addComponent(panelVoice, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                    frameSettingLayout.createSequentialGroup().addGap(28, 28, 28)
                            .addComponent(buttonAboutUs, javax.swing.GroupLayout.PREFERRED_SIZE, 81,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(buttonCloseSetting).addGap(31, 31, 31)));
    frameSettingLayout.setVerticalGroup(frameSettingLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(frameSettingLayout.createSequentialGroup().addGap(24, 24, 24)
                    .addComponent(panelVoice, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(frameSettingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(buttonAboutUs, javax.swing.GroupLayout.PREFERRED_SIZE, 38,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(buttonCloseSetting, javax.swing.GroupLayout.PREFERRED_SIZE, 38,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(23, Short.MAX_VALUE)));

    frameCo.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    frameCo.setTitle("Author");
    frameCo.setAlwaysOnTop(true);
    frameCo.setLocation(new java.awt.Point(200, 100));
    frameCo.setSize(new java.awt.Dimension(433, 255));
    frameCo.addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosed(java.awt.event.WindowEvent evt) {
            frameCoWindowClosed(evt);
        }
    });

    jLabel3.setBackground(new java.awt.Color(0, 102, 102));
    jLabel3.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
    jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel3.setText("Dictionary version 1.0");

    jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel4.setText("Trn ?c Ton");

    jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel5.setText("Phm Minh ?c");

    jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel6.setText("Nguyn ?nh Phi");
    jLabel6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

    jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel7.setText("Phm Th Thu H?ng");

    jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel8.setText("Trnh Vn Thi");
    jLabel8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

    javax.swing.GroupLayout frameCoLayout = new javax.swing.GroupLayout(frameCo.getContentPane());
    frameCo.getContentPane().setLayout(frameCoLayout);
    frameCoLayout.setHorizontalGroup(frameCoLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                    Short.MAX_VALUE)
            .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING,
                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING,
                    javax.swing.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE)
            .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                    Short.MAX_VALUE)
            .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                    Short.MAX_VALUE)
            .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                    Short.MAX_VALUE));
    frameCoLayout.setVerticalGroup(frameCoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(frameCoLayout.createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel3).addGap(24, 24, 24).addComponent(jLabel4)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(1, 1, 1)
                    .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(1, 1, 1)
                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel7,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(24, 24, 24)));

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Dictionary English VietNam");
    setBackground(new java.awt.Color(255, 51, 0));
    setLocation(new java.awt.Point(200, 100));
    setResizable(false);
    setType(java.awt.Window.Type.POPUP);
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }
    });

    comboBoxEV.setBackground(new java.awt.Color(240, 240, 240));
    comboBoxEV.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
    comboBoxEV.setModel(
            new javax.swing.DefaultComboBoxModel(new String[] { "English-VietNamese", "VietNamese-English" }));
    comboBoxEV.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    comboBoxEV.setFocusable(false);
    comboBoxEV.setRequestFocusEnabled(false);
    comboBoxEV.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            comboBoxEVItemStateChanged(evt);
        }
    });

    fieldWord.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
    fieldWord.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
    fieldWord.setDoubleBuffered(true);
    fieldWord.setDragEnabled(true);
    fieldWord.setFocusCycleRoot(true);
    fieldWord.setFocusTraversalPolicyProvider(true);
    fieldWord.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            fieldWordMouseClicked(evt);
        }
    });
    fieldWord.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            fieldWordKeyPressed(evt);
        }

        public void keyReleased(java.awt.event.KeyEvent evt) {
            fieldWordKeyReleased(evt);
        }
    });

    labelDic.setFont(new java.awt.Font("Times New Roman", 0, 48)); // NOI18N
    labelDic.setForeground(new java.awt.Color(255, 102, 0));
    labelDic.setText("Dictionary");

    labelAuthor.setForeground(new java.awt.Color(255, 102, 0));
    labelAuthor.setText("by HTTPD");

    buttonAdd.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
    buttonAdd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dictionary/images/add.png"))); // NOI18N
    buttonAdd.setText("Add");
    buttonAdd.setBorder(null);
    buttonAdd.setFocusPainted(false);
    buttonAdd.setMargin(new java.awt.Insets(0, 14, 0, 14));
    buttonAdd.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonAddActionPerformed(evt);
        }
    });

    buttonSetting.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
    buttonSetting.setText("Settings");
    buttonSetting.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    buttonSetting.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonSettingActionPerformed(evt);
        }
    });

    traonl.setText("Google Transl");
    traonl.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            traonlActionPerformed(evt);
        }
    });

    comboBoxOnl.setBackground(new java.awt.Color(240, 240, 240));
    comboBoxOnl.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
    comboBoxOnl.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Offline", "Online" }));
    comboBoxOnl.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    comboBoxOnl.setFocusable(false);
    comboBoxOnl.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            comboBoxOnlItemStateChanged(evt);
        }
    });

    buttonSpeech.setForeground(new java.awt.Color(255, 255, 255));
    buttonSpeech.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dictionary/images/speak.png"))); // NOI18N
    buttonSpeech.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonSpeechActionPerformed(evt);
        }
    });

    buttonUndo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dictionary/images/Undo.png"))); // NOI18N
    buttonUndo.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonUndoActionPerformed(evt);
        }
    });

    buttonFind.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dictionary/images/find.png"))); // NOI18N
    buttonFind.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonFindActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout mainLayout = new javax.swing.GroupLayout(main);
    main.setLayout(mainLayout);
    mainLayout.setHorizontalGroup(mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainLayout.createSequentialGroup()
                    .addGroup(mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(buttonSetting, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(buttonAdd, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(traonl, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(fieldWord, javax.swing.GroupLayout.PREFERRED_SIZE, 270,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(mainLayout.createSequentialGroup().addComponent(labelDic)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(labelAuthor))
                                    .addGroup(mainLayout.createSequentialGroup()
                                            .addComponent(comboBoxEV, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    164, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(comboBoxOnl, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    91, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(mainLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(buttonSpeech, javax.swing.GroupLayout.PREFERRED_SIZE, 49,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(buttonFind, javax.swing.GroupLayout.PREFERRED_SIZE, 0,
                                            Short.MAX_VALUE))
                            .addComponent(buttonUndo, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 49,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap()));
    mainLayout.setVerticalGroup(mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainLayout.createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(buttonAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 50,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(buttonSetting, javax.swing.GroupLayout.PREFERRED_SIZE, 49,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                            traonl, javax.swing.GroupLayout.PREFERRED_SIZE, 51,
                            javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainLayout.createSequentialGroup()
                    .addGroup(mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(labelDic).addComponent(labelAuthor))
                    .addGap(0, 33, Short.MAX_VALUE).addGroup(
                            mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(mainLayout.createSequentialGroup().addGroup(mainLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(
                                                    comboBoxEV, javax.swing.GroupLayout.PREFERRED_SIZE, 38,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(comboBoxOnl, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    35, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGap(0, 0, Short.MAX_VALUE))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainLayout
                                            .createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                                            .addGroup(mainLayout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                            mainLayout.createSequentialGroup().addComponent(
                                                                    buttonUndo,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                    .addGap(6, 6, 6)
                                                                    .addComponent(
                                                                            buttonFind,
                                                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                            38,
                                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                    .addPreferredGap(
                                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                                    .addComponent(buttonSpeech,
                                                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                            38,
                                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                    .addGap(5, 5, 5))
                                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                            mainLayout.createSequentialGroup().addComponent(
                                                                    fieldWord,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 76,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                    .addContainerGap()))))));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
            .addComponent(main, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.PREFERRED_SIZE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
            main, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
            javax.swing.GroupLayout.PREFERRED_SIZE));

    pack();
}

From source file:com.plugin.UI.Windows.BiblePeopleSearchResultsDialog.java

/**
 * Initialize.//w  w w.j av  a  2 s  .  c  o  m
 * 
 * @param _term the _term
 * 
 * @throws Exception the exception
 */
private void initialize(String _term) throws Exception {
    ArrayList<String[]> arr = new ArrayList<String[]>();
    for (BiblePerson bp : Global.biblePersons) {
        if (isSoundexCalc(bp.getName().toUpperCase(), _term)) {
            String[] arrin = new String[5];
            arrin[0] = String.valueOf(bp.getName_id());
            arrin[1] = bp.getName();
            arrin[2] = bp.getFather();
            arrin[3] = bp.getMother();
            arrin[4] = bp.getBible_ref();
            arr.add(arrin);
        }
    }
    String[][] arr3 = new String[arr.size()][5];
    for (int i = 0; i < arr.size(); i++)
        arr3[i] = arr.get(i);
    String columns[] = new String[] { "ID", "Name", "Father", "Mother", "Reference" };
    tm = new DefaultTableModel(arr3, columns) {
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };

    table = new JTable(tm);

    table.addMouseListener(new MouseListener() {

        public void mouseClicked(MouseEvent e) {
            int member_id = Integer.parseInt((String) tm.getValueAt(table.getSelectedRow(), 0));
            BibleGenealogy.setSelectMember(member_id);
            if (e.getClickCount() == 2) {
                new BiblePersonDialog(Global._jMainFrame, member_id);
            }
        }

        public void mouseEntered(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        public void mouseExited(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        public void mousePressed(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        public void mouseReleased(MouseEvent e) {
            // TODO Auto-generated method stub

        }
    });

    JScrollPane jsp = new JScrollPane(table);
    jsp.setSize(640, 260);
    this.getContentPane().add(jsp);
    this.pack();
    this.setTitle("Bible People Search Results - " + _term);
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setLocationRelativeTo(null);
    this.setVisible(true);
}

From source file:edu.harvard.mcz.imagecapture.ImageDisplayFrame.java

public ImageDisplayFrame() {
    super();
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    targetSpecimen = null;
    initialize();
}

From source file:com.plugin.UI.Windows.UserSearchResultsDialog.java

/**
 * Initialize./*from w  ww.  j  a v a2  s  .  com*/
 * 
 * @param _term the _term
 * 
 * @throws Exception the exception
 */
private void initialize(String _term) throws Exception {
    ArrayList<String[]> arr = new ArrayList<String[]>();
    for (ChurchMembersData mem : ChurchMemberUtils.getChurchMembers()) {
        if (isSoundex(mem, _term.toUpperCase())) {
            String[] arrin = new String[5];
            arrin[0] = MemberID.getTranslatedID(mem.getMember_id(), mem.getName_english());
            arrin[1] = mem.getName_english() + " (" + mem.getName_otherLang() + ")";
            arrin[2] = mem.getStreet();
            arrin[3] = mem.getSuburb();
            arrin[4] = mem.getState();
            arr.add(arrin);
        }
    }
    String[][] arr3 = new String[arr.size()][5];
    for (int i = 0; i < arr.size(); i++)
        arr3[i] = arr.get(i);
    String columns[] = new String[] { "MemberID", "Name", "Street", "Suburb", "State" };
    tm = new DefaultTableModel(arr3, columns) {
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };

    table = new JTable(tm);

    table.addMouseListener(new MouseListener() {

        public void mouseClicked(MouseEvent e) {
            String member_id = (String) tm.getValueAt(table.getSelectedRow(), 0);
            ChurchMembers.setSelectMember(member_id);
            if (e.getClickCount() == 2) {
                new MemberDialog(Global.DISPLAY_CHURCH_MEMBER, MemberID.getOriginalID(member_id));
            }
        }

        public void mouseEntered(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        public void mouseExited(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        public void mousePressed(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        public void mouseReleased(MouseEvent e) {
            // TODO Auto-generated method stub

        }
    });

    JScrollPane jsp = new JScrollPane(table);
    jsp.setSize(640, 260);
    this.getContentPane().add(jsp);
    this.pack();
    this.setTitle("Church Members Search Results - " + _term);
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setLocationRelativeTo(null);
    this.setVisible(true);
}

From source file:gtu._work.mvn.MavenRepositoryUI.java

private void initGUI() {
    try {/*from  ww  w  .j av a2  s.  co  m*/
        {
        }
        BorderLayout thisLayout = new BorderLayout();
        getContentPane().setLayout(thisLayout);
        this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                scanList = new JList();
                jTabbedPane1.addTab("repository", null, jPanel1, null);
                {
                    scanText = new JTextField();
                    jPanel1.add(scanText, BorderLayout.NORTH);
                }
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel1.add(jScrollPane1, BorderLayout.CENTER);
                    {
                        ListModel scanListModel = new DefaultListModel();
                        jScrollPane1.setViewportView(scanList);
                        scanList.setModel(scanListModel);
                        scanList.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                defaultJListClick(scanList, evt);
                            }
                        });
                    }
                }
            }
            {
                jPanel4 = new JPanel();
                BorderLayout jPanel4Layout = new BorderLayout();
                jPanel4.setLayout(jPanel4Layout);
                jTabbedPane1.addTab("repository only jar", null, jPanel4, null);
                jPanel4.setPreferredSize(new java.awt.Dimension(520, 298));
                {
                    scanText2 = new JTextField();
                    jPanel4.add(scanText2, BorderLayout.NORTH);
                }
                {
                    jScrollPane3 = new JScrollPane();
                    jPanel4.add(jScrollPane3, BorderLayout.CENTER);
                    {
                        scanList2 = new JList();
                        jScrollPane3.setViewportView(scanList2);
                        ListModel scanList2Model = new DefaultListModel();
                        scanList2.setModel(scanList2Model);
                        scanList2.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                defaultJListClick(scanList2, evt);
                            }
                        });
                    }
                }
                {
                }
            }
            {
                jPanel2 = new JPanel();
                BorderLayout jPanel2Layout = new BorderLayout();
                jPanel2.setLayout(jPanel2Layout);
                jTabbedPane1.addTab("jar find", null, jPanel2, null);
                {
                    jarFindText = new JTextField();
                    jPanel2.add(jarFindText, BorderLayout.NORTH);
                }
                {
                    jScrollPane2 = new JScrollPane();
                    jPanel2.add(jScrollPane2, BorderLayout.CENTER);
                    {
                        ListModel jarFindListModel = new DefaultListModel();
                        jarFindList = new JList();
                        jScrollPane2.setViewportView(jarFindList);
                        jarFindList.setModel(jarFindListModel);
                        jarFindList.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                defaultJListClick(jarFindList, evt);
                            }
                        });
                    }
                }
                {
                    jarFindExecute = new JButton();
                    jPanel2.add(jarFindExecute, BorderLayout.SOUTH);
                    jarFindExecute.setText("find");
                    jarFindExecute.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            String searchtext = jarFindText.getText();
                            if (StringUtils.isEmpty(searchtext) || searchtext.length() < 2) {
                                JOptionPaneUtil.newInstance().iconErrorMessage()
                                        .showMessageDialog("", "error");
                                return;
                            }
                            try {
                                DefaultListModel model = new DefaultListModel();
                                jarFindList.setModel(model);

                                searchtext = searchtext.trim();
                                searchtext = searchtext.replace('/', '.');
                                searchtext = searchtext.replace('\\', '.');

                                if (jarfinder == null) {
                                    jarfinder = JarFinder.newInstance();
                                } else {
                                    jarfinder.clear();
                                }

                                jarfinder.pattern(searchtext);

                                DefaultListModel scanModel = (DefaultListModel) scanList.getModel();
                                PomFile pomFile = null;
                                for (int ii = 0; ii < scanModel.getSize(); ii++) {
                                    pomFile = (PomFile) scanModel.getElementAt(ii);
                                    if (pomFile.jarFile == null) {
                                        continue;
                                    }
                                    jarfinder.setDir(pomFile.jarFile);
                                    if (!jarfinder.execute().isEmpty()) {
                                        model.addElement(pomFile);
                                    }
                                    jarfinder.getMap().clear();
                                }
                            } catch (Exception ex) {
                                JOptionPaneUtil.newInstance().iconErrorMessage()
                                        .showMessageDialog(ex.getMessage(), "error");
                                ex.printStackTrace();
                            }
                        }
                    });
                }
            }
            {
                jPanel5 = new JPanel();
                BorderLayout jPanel5Layout = new BorderLayout();
                jTabbedPane1.addTab("detail", null, jPanel5, null);
                jPanel5.setLayout(jPanel5Layout);
                {
                    jScrollPane4 = new JScrollPane();
                    jPanel5.add(jScrollPane4, BorderLayout.CENTER);
                    {
                        TableModel scanTableModel = new DefaultTableModel();
                        scanTable = new JTable();
                        BorderLayout scanTableLayout = new BorderLayout();
                        scanTable.setLayout(scanTableLayout);
                        jScrollPane4.setViewportView(scanTable);
                        scanTable.setModel(scanTableModel);
                        JTableUtil.defaultSetting(scanTable);

                        scanTable.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                tableMouseClicked(scanTable, 0, evt);
                            }
                        });
                    }
                }
            }
            {
                jPanel3 = new JPanel();
                jTabbedPane1.addTab("config", null, jPanel3, null);
                GroupLayout jPanel3Layout = new GroupLayout((JComponent) jPanel3);
                jPanel3.setLayout(jPanel3Layout);
                {
                    copyToDir = new JButton();
                    copyToDir.setText("set copy to dir");
                    copyToDir.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            File file = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog()
                                    .getApproveSelectedFile();
                            if (file == null || !file.exists() || !file.isDirectory()) {
                                JOptionPaneUtil.newInstance().iconErrorMessage()
                                        .showMessageDialog("dir is not correct!, set default desktop", "error");
                                file = FileUtil.DESKTOP_DIR;
                            }
                            copyTo = file;
                            System.out.println("copyTo: " + copyTo);
                        }
                    });
                }
                {
                    resetM2Dir = new JButton();
                    resetM2Dir.setText("set .m2 dir");
                    resetM2Dir.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            File file = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog()
                                    .getApproveSelectedFile();
                            if (file == null || !file.exists() || !file.isDirectory()) {
                                showErrorMsg();
                                repositoryDir = DEFAULT_REPOSITORY_DIR;
                                reloadRepositoryDir();
                                return;
                            }
                            File newRepository = new File(file, "repository");
                            File settings = new File(file, "settings.xml");
                            if (settings.exists() && settings.isFile() && newRepository.exists()
                                    && newRepository.isDirectory()) {
                                repositoryDir = newRepository;
                                reloadRepositoryDir();
                            } else {
                                showErrorMsg();
                            }
                        }

                        void showErrorMsg() {
                            JOptionPaneUtil.newInstance().iconErrorMessage()
                                    .showMessageDialog("dir is not correct!, set default .m2 dir", "error");
                        }
                    });
                }
                {
                    saveCurrentDataBtn = new JButton();
                    saveCurrentDataBtn.setText("save current data");
                    saveCurrentDataBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            File cfgFile = new File(PropertiesUtil.getJarCurrentPath(MavenRepositoryUI.class),
                                    MavenRepositoryUI.class.getSimpleName() + "_" + DateFormatUtil
                                            .format(System.currentTimeMillis(), "yyyyMMdd_HHmmss") + ".cfg");
                            try {
                                ObjectOutputStream writer = new ObjectOutputStream(
                                        new FileOutputStream(cfgFile));
                                writer.writeObject(pomFileList);
                                writer.writeObject(pomFileJarList);
                                writer.writeObject(pomFileMap);
                                writer.flush();
                                writer.close();
                                JOptionPaneUtil.newInstance().iconInformationMessage()
                                        .showMessageDialog("save completed!\n" + cfgFile, "SUCCESS");
                            } catch (Exception ex) {
                                JCommonUtil.handleException(ex);
                                ex.printStackTrace();
                            }
                        }
                    });
                }
                {
                    loadConfigDataBtn = new JButton();
                    loadConfigDataBtn.setText("load config data");
                    loadConfigDataBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            File cfgFile = JFileChooserUtil.newInstance().selectFileOnly()
                                    .addAcceptFile("cfg", ".cfg").showOpenDialog().getApproveSelectedFile();
                            if (cfgFile == null) {
                                JOptionPaneUtil.newInstance().iconErrorMessage()
                                        .showMessageDialog("file is not correct!", "ERROR");
                                return;
                            }
                            try {
                                ObjectInputStream reader = new ObjectInputStream(new FileInputStream(cfgFile));
                                pomFileList = (Set<PomFile>) reader.readObject();
                                pomFileJarList = (Set<PomFile>) reader.readObject();
                                pomFileMap = (Map<DependencyKey, PomFile>) reader.readObject();
                                reader.close();
                                resetUIStatus();
                                JOptionPaneUtil.newInstance().iconInformationMessage()
                                        .showMessageDialog("load completed!\n" + cfgFile, "SUCCESS");
                            } catch (Exception ex) {
                                JCommonUtil.handleException(ex);
                                ex.printStackTrace();
                            }
                        }
                    });

                }
                jPanel3Layout.setHorizontalGroup(jPanel3Layout.createSequentialGroup().addContainerGap(24, 24)
                        .addGroup(jPanel3Layout.createParallelGroup()
                                .addGroup(jPanel3Layout.createSequentialGroup().addComponent(loadConfigDataBtn,
                                        GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel3Layout.createSequentialGroup().addComponent(saveCurrentDataBtn,
                                        GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel3Layout.createSequentialGroup().addComponent(copyToDir,
                                        GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel3Layout.createSequentialGroup().addComponent(resetM2Dir,
                                        GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel3Layout.createSequentialGroup().addComponent(getJButton1(),
                                        GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(281, Short.MAX_VALUE));
                jPanel3Layout.setVerticalGroup(jPanel3Layout.createSequentialGroup().addContainerGap(25, 25)
                        .addComponent(copyToDir, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
                        .addGap(22)
                        .addComponent(resetM2Dir, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
                        .addGap(24)
                        .addComponent(saveCurrentDataBtn, GroupLayout.PREFERRED_SIZE, 31,
                                GroupLayout.PREFERRED_SIZE)
                        .addGap(25)
                        .addComponent(loadConfigDataBtn, GroupLayout.PREFERRED_SIZE, 31,
                                GroupLayout.PREFERRED_SIZE)
                        .addGap(28)
                        .addComponent(getJButton1(), GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(34, Short.MAX_VALUE));
            }
            {
                jPanel6 = new JPanel();
                BorderLayout jPanel6Layout = new BorderLayout();
                jPanel6.setLayout(jPanel6Layout);
                jTabbedPane1.addTab("pom dency", null, jPanel6, null);
                {
                    openPom = new JButton();
                    jPanel6.add(openPom, BorderLayout.NORTH);
                    openPom.setText("open");
                    openPom.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            File file = JFileChooserUtil.newInstance().selectFileAndDirectory()
                                    .showDialog("?pom,pom").getApproveSelectedFile();
                            if (file == null) {
                                JOptionPaneUtil.newInstance().iconErrorMessage()
                                        .showMessageDialog("file is not correct!!", "ERROR");
                                return;
                            }
                            List<File> pomList = new ArrayList<File>();
                            if (file.isFile()
                                    && (file.getName().endsWith(".xml") || file.getName().endsWith(".pom"))) {
                                pomList.add(file);
                            } else {
                                FileUtil.searchFileMatchs(file, "pom.xml", pomList);
                            }
                            Set<PomFile> poms = loadPomList(pomList);
                            resetUIStatus();

                            Map<DependencyKey, PomFile> map = new HashMap<DependencyKey, PomFile>();
                            Set<LoadPomListDependency.DependencyKey> errorSet = new HashSet<LoadPomListDependency.DependencyKey>();
                            for (PomFile p : poms) {
                                openPomFetchDependency(p.pom, map, errorSet);
                            }

                            PomFile pfile = null;
                            DefaultTableModel model = JTableUtil.createModel(true, "groupId", "artifactId",
                                    "jar", "pomFile");
                            for (DependencyKey key : map.keySet()) {
                                pfile = map.get(key);
                                model.addRow(new Object[] { pfile.pom.groupId, pfile.pom.artifactId,
                                        (pfile.jarFile == null ? "" : pfile.jarFile.getName()), pfile });
                            }
                            for (LoadPomListDependency.DependencyKey key : errorSet) {
                                model.addRow(new Object[] { key.groupId, key.artifactId, "ERROR" });
                            }
                            pomDenpendencyTable.setModel(model);
                        }
                    });
                }
                {
                    jScrollPane5 = new JScrollPane();
                    jPanel6.add(jScrollPane5, BorderLayout.CENTER);
                    {
                        TableModel pomDenpendencyTableModel = new DefaultTableModel();
                        pomDenpendencyTable = new JTable();
                        jScrollPane5.setViewportView(pomDenpendencyTable);
                        pomDenpendencyTable.setModel(pomDenpendencyTableModel);
                        pomDenpendencyTable.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                tableMouseClicked(pomDenpendencyTable, 3, evt);
                            }
                        });
                        JTableUtil.defaultSetting(pomDenpendencyTable);
                    }
                }
                {
                    jPanel7 = new JPanel();
                    FlowLayout jPanel7Layout = new FlowLayout();
                    jPanel7Layout.setAlignOnBaseline(true);
                    jPanel6.add(jPanel7, BorderLayout.SOUTH);
                    jPanel7.setLayout(jPanel7Layout);
                    jPanel7.setPreferredSize(new java.awt.Dimension(520, 36));
                    {
                        clipboardListJar = new JButton();
                        jPanel7.add(clipboardListJar);
                        clipboardListJar.setText("jar list to clipboard");
                        clipboardListJar.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                List<File> list = fetchPomDependencyTableJarList();
                                StringBuilder sb = new StringBuilder();
                                for (File f : list) {
                                    sb.append(f + "\n");
                                }
                                ClipboardUtil.getInstance().setContents(sb);
                                JOptionPaneUtil.newInstance().iconInformationMessage()
                                        .showMessageDialog("clipboard set ok!", "SUCCESS");
                            }
                        });
                    }
                    {
                        pomOutputJarDir = new JButton();
                        jPanel7.add(pomOutputJarDir);
                        pomOutputJarDir.setText("set output jar dir");
                        pomOutputJarDir.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                File file = JFileChooserUtil.newInstance().selectDirectoryOnly()
                                        .showDialog("?Jar").getApproveSelectedFile();
                                if (file == null) {
                                    JOptionPaneUtil.newInstance().iconErrorMessage()
                                            .showMessageDialog("dir is not correct!!", "ERROR");
                                    return;
                                }
                                pomOutputJarDir_ = file;
                            }
                        });
                    }
                    {
                        exportListJar = new JButton();
                        jPanel7.add(exportListJar);
                        exportListJar.setText("export list jar");
                        exportListJar.setPreferredSize(new java.awt.Dimension(113, 24));
                        exportListJar.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                List<File> list = fetchPomDependencyTableJarList();
                                if (pomOutputJarDir_ == null || !pomOutputJarDir_.exists()
                                        || !pomOutputJarDir_.isDirectory()) {
                                    JOptionPaneUtil.newInstance().iconErrorMessage()
                                            .showMessageDialog("output dir is not correct!!", "ERROR");
                                    return;
                                }
                                if (JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION == JOptionPaneUtil
                                        .newInstance().confirmButtonYesNo().iconWaringMessage()
                                        .showConfirmDialog("are you sure copy list jar count:(" + list.size()
                                                + ") to\n" + pomOutputJarDir_, "WARN")) {
                                    StringBuilder sb = new StringBuilder();
                                    StringBuilder fsb = new StringBuilder();
                                    sb.append("total : " + list.size() + "\n");
                                    int ok = 0;
                                    int noOk = 0;
                                    for (File f : list) {
                                        try {
                                            FileUtil.copyFile(f, new File(pomOutputJarDir_, f.getName()));
                                            ok++;
                                        } catch (IOException e) {
                                            e.printStackTrace();
                                            noOk++;
                                            fsb.append(f + "\n");
                                        }
                                    }
                                    sb.append("success : " + ok + "\n");
                                    sb.append("failed : " + noOk + "\n");
                                    sb.append("Failed jar :\n");
                                    sb.append(fsb);

                                    JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog(sb,
                                            "COPY RESULT");
                                }

                            }
                        });
                    }
                }
            }
        }
        this.setSize(541, 365);

        reloadRepositoryDir();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:it.geosolutions.imageio.plugins.nitronitf.ImageIOUtils.java

public static JFrame showImage(BufferedImage image, String title, boolean fitToScreen) {
    JFrame frame = new JFrame(title != null ? title : "");
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    Image im = image;/*www  .  ja v  a  2 s. c o m*/

    if (fitToScreen) {
        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
        int imageHeight = image.getHeight();
        int imageWidth = image.getWidth();
        if (imageHeight > screen.height || imageWidth > screen.width) {
            double hRatio = (imageHeight - screen.height) / screen.height;
            double wRatio = (imageWidth - screen.width) / screen.width;

            int w = -1;
            int h = -1;

            if (hRatio > wRatio)
                h = screen.height;
            else
                w = screen.width;
            im = image.getScaledInstance(w, h, Image.SCALE_DEFAULT);
        }
    }

    JLabel label = new JLabel(new ImageIcon(im));
    frame.getContentPane().add(label, BorderLayout.CENTER);
    frame.pack();
    centerWindow(frame);
    frame.setVisible(true);
    return frame;
}

From source file:gtu._work.ui.DirectoryCompareUI.java

private void initGUI() {
    try {//w  ww  .  j  a  v  a 2 s  .  c  o  m
        BorderLayout thisLayout = new BorderLayout();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(thisLayout);
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                jTabbedPane1.addTab("jPanel1", null, jPanel1, null);
                {
                    jPanel2 = new JPanel();
                    BoxLayout jPanel2Layout = new BoxLayout(jPanel2, javax.swing.BoxLayout.X_AXIS);
                    jPanel2.setLayout(jPanel2Layout);
                    jPanel1.add(jPanel2, BorderLayout.NORTH);
                    jPanel2.setPreferredSize(new java.awt.Dimension(660, 36));
                    {
                        leftDirText = new JTextArea();
                        leftDirText.setPreferredSize(leftDirText.getPreferredSize());
                        leftDirText.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                        JCommonUtil.jTextFieldSetFilePathMouseEvent(leftDirText, true);
                        leftDirText.getDocument()
                                .addDocumentListener(JCommonUtil.getDocumentListener(new HandleDocumentEvent() {
                                    @Override
                                    public void process(DocumentEvent event) {
                                    }
                                }));
                        jPanel2.add(leftDirText);
                        JTextFieldUtil.setupDragDropFilePath(leftDirText, null);
                    }
                    {
                        rightDirText = new JTextArea();
                        rightDirText.setPreferredSize(rightDirText.getPreferredSize());
                        rightDirText.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                        JCommonUtil.jTextFieldSetFilePathMouseEvent(rightDirText, true);
                        rightDirText.getDocument()
                                .addDocumentListener(JCommonUtil.getDocumentListener(new HandleDocumentEvent() {
                                    @Override
                                    public void process(DocumentEvent event) {
                                    }
                                }));
                        jPanel2.add(rightDirText);
                        JTextFieldUtil.setupDragDropFilePath(rightDirText, null);
                    }
                    {
                        executeBtn = new JButton();
                        jPanel2.add(executeBtn);
                        jPanel2.add(getResetBtn());
                        executeBtn.setText("\u958b\u59cb\u6bd4\u5c0d");
                        executeBtn.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                compareStart();
                            }
                        });
                    }
                }
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel1.add(jScrollPane1, BorderLayout.CENTER);
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(660, 362));
                    {
                        dirCompareTable = new JTable();
                        // JTableUtil.defaultSetting(dirCompareTable);
                        JTableUtil.defaultSetting_AutoResize(dirCompareTable);
                        jScrollPane1.setViewportView(dirCompareTable);
                        dirCompareTable.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                dirCompareTableMouseClicked(evt);
                            }
                        });
                        dirCompareTable.setModel(getDefaultTableModel());
                    }
                }
                {
                    jPanel3 = new JPanel();
                    FlowLayout jPanel3Layout = new FlowLayout();
                    jPanel3Layout.setAlignOnBaseline(true);
                    jPanel1.add(jPanel3, BorderLayout.SOUTH);
                    jPanel3.setLayout(jPanel3Layout);
                    jPanel3.setPreferredSize(new java.awt.Dimension(843, 62));
                    {
                        jLabel1 = new JLabel();
                        jPanel3.add(jLabel1);
                        jLabel1.setText("\u526f\u6a94\u540d");
                    }
                    {
                        DefaultComboBoxModel extensionNameComboBoxModel = new DefaultComboBoxModel();
                        extensionNameComboBox = new JComboBox();
                        jPanel3.add(extensionNameComboBox);
                        jPanel3.add(getDiffToolComboBox());
                        jPanel3.add(getJLabel2());
                        jPanel3.add(getSearchText());
                        jPanel3.add(getCompareStyleComboBox());
                        jPanel3.add(getResetQueryBtn());
                        addDiffMergeChkBox();
                        extensionNameComboBox.setModel(extensionNameComboBoxModel);
                        {
                            panel = new JPanel();
                            jTabbedPane1.addTab("New tab", null, panel, null);
                            panel.setLayout(new FormLayout(
                                    new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC,
                                            FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC,
                                            ColumnSpec.decode("default:grow"), },
                                    new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, }));
                            {
                                lblCustomCommand = new JLabel("custom command");
                                panel.add(lblCustomCommand, "2, 2, right, default");
                            }
                            {
                                customCompareText = new JTextField();
                                customCompareText.setText(
                                        "\"C:\\Program Files\\TortoiseGit\\bin\\TortoiseGitMerge.exe\"   /base:\"%s\" /theirs:\"%s\"");
                                panel.add(customCompareText, "4, 2, fill, default");
                                customCompareText.setColumns(10);
                            }
                            {
                                configSaveBtn = new JButton("");
                                configSaveBtn.addActionListener(new ActionListener() {
                                    public void actionPerformed(ActionEvent e) {
                                        try {
                                            boolean configChange = false;
                                            String customCompareUrl = customCompareText.getText();
                                            if (StringUtils.isNotBlank(customCompareUrl)) {
                                                configBean.getConfigProp().setProperty(CUSTOM_COMPARE_URL_KEY,
                                                        customCompareUrl);
                                                configChange = true;
                                            }
                                            if (configChange) {
                                                configBean.store();
                                                JCommonUtil._jOptionPane_showMessageDialog_info(
                                                        "?!");
                                            }
                                        } catch (Exception ex) {
                                            JCommonUtil.handleException(ex);
                                        }
                                    }
                                });
                                panel.add(configSaveBtn, "2, 36");
                            }
                        }
                        extensionNameComboBox.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                totalScanFiles(null);
                            }
                        });
                    }
                }
            }
        }
        pack();
        this.setSize(864, 563);

        JCommonUtil.setJFrameIcon(getOwner(), "images/ico/file_merge.ico");

        initConfigBean();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:fll.subjective.SubjectiveFrame.java

/**
 * Create a window to edit subjective scores.
 *//* w w  w  . j  a v  a2s. c  om*/
public SubjectiveFrame() {
    super("Subjective Score Entry");
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    getContentPane().setLayout(new BorderLayout());

    final JPanel topPanel = new JPanel();
    getContentPane().add(topPanel, BorderLayout.NORTH);

    final JButton quitButton = new JButton("Quit");
    topPanel.add(quitButton);
    quitButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent ae) {
            quit();
        }
    });

    final JButton saveButton = new JButton("Save");
    topPanel.add(saveButton);
    saveButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent ae) {
            try {
                save();
            } catch (final IOException ioe) {
                JOptionPane.showMessageDialog(null, "Error writing to data file: " + ioe.getMessage(), "Error",
                        JOptionPane.ERROR_MESSAGE);
            }

        }
    });

    final JButton summaryButton = new JButton("Summary");
    topPanel.add(summaryButton);
    summaryButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent ae) {
            final SummaryDialog dialog = new SummaryDialog(SubjectiveFrame.this);

            dialog.pack();
            dialog.setVisible(true);
        }
    });

    final JButton compareButton = new JButton("Compare Scores");
    topPanel.add(compareButton);
    compareButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent ae) {
            final File compareFile = chooseSubjectiveFile("Choose the file to compare with");
            if (null != compareFile) {
                try {
                    save();
                } catch (final IOException ioe) {
                    JOptionPane.showMessageDialog(null, "Error writing to data file: " + ioe.getMessage(),
                            "Error", JOptionPane.ERROR_MESSAGE);
                }

                try {
                    final Collection<SubjectiveScoreDifference> diffs = SubjectiveUtils
                            .compareSubjectiveFiles(getFile(), compareFile);
                    if (null == diffs) {
                        JOptionPane.showMessageDialog(null,
                                "Challenge descriptors are different, comparison failed", "Error",
                                JOptionPane.ERROR_MESSAGE);

                    } else if (!diffs.isEmpty()) {
                        showDifferencesDialog(diffs);
                    } else {
                        JOptionPane.showMessageDialog(null, "No differences found", "No Differences",
                                JOptionPane.INFORMATION_MESSAGE);

                    }
                } catch (final SAXParseException spe) {
                    final String errorMessage = String.format(
                            "Error parsing file line: %d column: %d%n Message: %s%n This may be caused by using the wrong version of the software attempting to parse a file that is not subjective data.",
                            spe.getLineNumber(), spe.getColumnNumber(), spe.getMessage());
                    LOGGER.error(errorMessage, spe);
                    JOptionPane.showMessageDialog(null, errorMessage, "Error", JOptionPane.ERROR_MESSAGE);
                } catch (final SAXException se) {
                    final String errorMessage = "The subjective scores file was found to be invalid, check that you are parsing a subjective scores file and not something else";
                    LOGGER.error(errorMessage, se);
                    JOptionPane.showMessageDialog(null, errorMessage, "Error", JOptionPane.ERROR_MESSAGE);
                } catch (final IOException e) {
                    LOGGER.error("Error reading compare file", e);
                    JOptionPane.showMessageDialog(null, "Error reading compare file: " + e.getMessage(),
                            "Error", JOptionPane.ERROR_MESSAGE);

                }
            }
        }
    });

    tabbedPane = new JTabbedPane();
    getContentPane().add(tabbedPane, BorderLayout.CENTER);

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(final WindowEvent e) {
            quit();
        }
    });

    pack();
}

From source file:ar.edu.uns.cs.vyglab.arq.rockar.gui.JFrameControlPanel.java

private void initGUI() {
    try {/*from  w  w w. j  a  v a2 s .c om*/
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        this.setIconImage(new ImageIcon(getClass().getClassLoader()
                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/splash/purple-monkey32.png"))
                        .getImage());
        this.setTitle("Rock.AR v2.0");
        this.addComponentListener(new ComponentAdapter() {
            public void componentResized(ComponentEvent evt) {
                thisComponentResized(evt);
            }
        });
        this.addWindowListener(new WindowAdapter() {
            public void windowClosed(WindowEvent evt) {
                thisWindowClosed(evt);
            }
        });
        {
            jPanelSouth = new JPanel();
            BorderLayout jPanelSouthLayout = new BorderLayout();
            getContentPane().add(jPanelSouth, BorderLayout.SOUTH);
            jPanelSouth.setLayout(jPanelSouthLayout);
            {
                jLabelInformation = new JLabel();
                jPanelSouth.add(jLabelInformation, BorderLayout.CENTER);
                jLabelInformation.setText(DataCenter.langResource.getString("control_information_label"));
                jLabelInformation.setOpaque(true);
                jLabelInformation.setBackground(new java.awt.Color(241, 191, 101));
            }
        }
        {
            jPanelCenter = new JPanel();
            GridLayout jPanelCenterLayout = new GridLayout(1, 1);
            jPanelCenterLayout.setHgap(5);
            jPanelCenterLayout.setVgap(5);
            jPanelCenterLayout.setColumns(1);
            getContentPane().add(jPanelCenter, BorderLayout.CENTER);
            jPanelCenter.setLayout(jPanelCenterLayout);
            {
                jPanelWest = new JPanel();
                BorderLayout jPanelWestLayout = new BorderLayout();
                jPanelCenter.add(jPanelWest);
                jPanelWest.setLayout(jPanelWestLayout);
                jPanelWest.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                {
                    jToolBarMineralTable = new JToolBar();
                    jToolBarMineralTable.setLayout(new FlowLayout(FlowLayout.LEFT));
                    jPanelWest.add(jToolBarMineralTable, BorderLayout.NORTH);
                    jToolBarMineralTable.setFloatable(false);
                    jToolBarMineralTable.setFocusable(false);
                    {
                        jButtonNew = new JButton();
                        jToolBarMineralTable.add(jButtonNew);
                        jButtonNew.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/Actions-tab-new-icon.png")));
                        jButtonNew.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonNewActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jButtonOpen = new JButton();
                        jToolBarMineralTable.add(jButtonOpen);
                        jButtonOpen.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/open.png")));
                        jButtonOpen.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonOpenActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jButtonSave = new JButton();
                        jToolBarMineralTable.add(jButtonSave);
                        jButtonSave.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/save.png")));
                        jButtonSave.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonSaveActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jSeparator1 = new JSeparator();
                        jToolBarMineralTable.add(jSeparator1);
                        jSeparator1.setOrientation(SwingConstants.VERTICAL);
                        jSeparator1.setSize(5, 44);
                        jSeparator1.setPreferredSize(new java.awt.Dimension(5, 44));
                    }
                    {
                        jButtonAdd = new JButton();
                        jToolBarMineralTable.add(jButtonAdd);
                        jButtonAdd.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/add.png")));
                        jButtonAdd.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonAddActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jButtonEdit = new JButton();
                        jToolBarMineralTable.add(jButtonEdit);
                        jButtonEdit.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/modify.png")));
                        jButtonEdit.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonEditActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jButtonRemove = new JButton();
                        jToolBarMineralTable.add(jButtonRemove);
                        jButtonRemove.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/remove.png")));
                        jButtonRemove.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonRemoveActionPerformed(evt);
                            }
                        });
                    }
                }
                {
                    jLabelMineralTableInformation = new JLabel();
                    jPanelWest.add(jLabelMineralTableInformation, BorderLayout.SOUTH);
                    jLabelMineralTableInformation
                            .setText(DataCenter.langResource.getString("total_counted_table"));
                    jLabelMineralTableInformation.setHorizontalAlignment(SwingConstants.LEFT);
                    jLabelMineralTableInformation.setBackground(new java.awt.Color(255, 212, 133));
                    jLabelMineralTableInformation.setOpaque(true);
                }
                {
                    jScrollPaneMineralTable = new JScrollPane();
                    jPanelWest.add(jScrollPaneMineralTable, BorderLayout.CENTER);
                    {
                        jTableMineralsModel = new RockTableModel(
                                new String[] { DataCenter.langResource.getString("keyvalue_table"),
                                        DataCenter.langResource.getString("name_table"),
                                        DataCenter.langResource.getString("color_table"),
                                        DataCenter.langResource.getString("counted_table"),
                                        DataCenter.langResource.getString("area_table") },
                                0);
                        //                     jTableMineralsModel.addRow(new Object[] {
                        //                           0, "x?", Color.gray, 0,
                        //                           "0.00" });
                        jTableMinerals = new JReadOnlyTable();
                        jScrollPaneMineralTable.setViewportView(jTableMinerals);
                        jTableMinerals.setModel(jTableMineralsModel);
                        jTableMinerals.setDefaultRenderer(Color.class, new ColorRenderer(true));
                        TableCellRenderer centerRenderer = new CenterRenderer();
                        TableColumn column = jTableMinerals.getColumnModel().getColumn(0);
                        column.setCellRenderer(centerRenderer);
                        column = jTableMinerals.getColumnModel().getColumn(1);
                        column.setCellRenderer(centerRenderer);
                        column = jTableMinerals.getColumnModel().getColumn(3);
                        column.setCellRenderer(centerRenderer);
                        column = jTableMinerals.getColumnModel().getColumn(4);
                        column.setCellRenderer(centerRenderer);

                    }
                }
            }
            {
                jPanelEast = new JPanel();
                jPanelCenter.add(jPanelEast);
                GridLayout jPanelEastLayout = new GridLayout(2, 1);
                jPanelEastLayout.setHgap(5);
                jPanelEastLayout.setVgap(5);
                jPanelEastLayout.setColumns(1);
                jPanelEast.setLayout(jPanelEastLayout);
                {
                    jPanelTop = new JPanel();
                    BorderLayout jPanelTopLayout = new BorderLayout();
                    jPanelEast.add(jPanelTop);
                    jPanelTop.setLayout(jPanelTopLayout);
                    jPanelTop.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                    {
                        jToolBarStats = new JToolBar();
                        jPanelTop.add(jToolBarStats, BorderLayout.NORTH);
                        jToolBarStats.setFloatable(false);
                        jToolBarStats.setFocusable(false);
                        {
                            jButtonExportStats = new JButton();
                            jButtonExportStats.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent arg0) {
                                    saveChartAsImage();
                                }
                            });
                            //jToolBarStats.add(jButtonExportStats);
                            jButtonExportStats.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                    "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/export-graph.png")));
                        }
                        {
                            jButtonExportExcel = new JButton();
                            //jToolBarStats.add(jButtonExportExcel);
                            //jToolBarMineralTable.add(jButtonExportExcel);
                            jButtonExportExcel.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                    "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/excel-icon.png")));
                            jButtonExportExcel.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent arg0) {
                                    exportToExcel();
                                }
                            });
                        }
                        {
                            jButtonExportAll = new JButton();
                            //jToolBarStats.add(jButtonExportAll);
                            jButtonExportAll.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                    "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/Mimetypes-application-vnd-ms-excel-icon.png")));
                        }
                    }
                    {

                    }
                }
                {
                    jPanelBottom = new JPanel();
                    BorderLayout jPanelBottomLayout = new BorderLayout();
                    jPanelEast.add(jPanelBottom);
                    jPanelBottom.setLayout(jPanelBottomLayout);
                    jPanelBottom.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                    {
                        jToolBarOverview = new JToolBar();
                        jPanelBottom.add(jToolBarOverview, BorderLayout.NORTH);
                        jToolBarOverview.setFloatable(false);
                        jToolBarOverview.setFocusable(false);
                        {
                            jButtonExportOverview = new JButton();
                            jToolBarOverview.add(jButtonExportOverview);
                            jButtonExportOverview.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                    "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/export-graph.png")));
                            jButtonExportOverview.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent arg0) {
                                    exportOverview();
                                }
                            });
                        }
                    }
                    {
                        jPanelOverviewContent = new JPanel();
                        jPanelBottom.add(jPanelOverviewContent, BorderLayout.CENTER);
                        jPanelOverviewContent.setLayout(new GridBagLayout());
                        this.jLabelOverview = new JLabel();
                        jPanelOverviewContent.add(this.jLabelOverview);
                    }
                }
            }
        }
        pack();
        this.setSize(800, 600);
    } catch (Exception e) {
        //add your error handling code here
        e.printStackTrace();
    }
}

From source file:es.mityc.firmaJava.libreria.pkcs7.ValidaTarjeta.java

/**
 * This method initializes this/*w  w  w.  jav  a 2s.  co  m*/
 * 
 */
private void initialize() {
    this.setSize(new Dimension(534, 264));
    this.setResizable(false);
    this.setModal(true);
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setContentPane(getJPanel());
    this.setTitle(I18n.getResource(LIBRERIAXADES_VALIDARTARJETA_TEXTO_5));

    // Centramos la ventana del applet
    //  Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gs = ge.getScreenDevices();

    int screenWidth = 0;
    int screenHeight = 0;
    int longitud = gs.length;
    for (int i = 0; i < longitud; i++) {
        DisplayMode dm = gs[i].getDisplayMode();
        screenWidth = dm.getWidth();
        screenHeight = dm.getHeight();
    }

    this.setLocation((int) (screenWidth / 2) - (int) (539 / 2), (int) (screenHeight / 2) - (int) (497 / 2));
}