1 19 20 package org.netbeans.modules.autoupdate; 21 22 23 import org.openide.DialogDescriptor; 24 import org.openide.DialogDisplayer; 25 import org.openide.NotifyDescriptor; 26 import org.openide.util.NbBundle; 27 28 31 class FinishDialog extends javax.swing.JPanel { 32 33 34 private static FinishDialog finishPanel; 35 36 private static DialogDescriptor dialogDescriptor = null; 37 38 private static java.awt.Dialog dialog = null; 39 40 private static boolean restart = true; 41 42 static final long serialVersionUID =-4861236822808181670L; 43 44 public FinishDialog() { 45 initComponents (); 46 47 initAccessibility(); 48 } 49 50 55 private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; 57 58 buttonGroup1 = new javax.swing.ButtonGroup (); 59 commentTextArea = new javax.swing.JTextArea (); 60 restartRadioButton = new javax.swing.JRadioButton (); 61 laterRadioButton = new javax.swing.JRadioButton (); 62 63 setLayout(new java.awt.GridBagLayout ()); 64 65 commentTextArea.setBackground(restartRadioButton.getBackground()); 66 commentTextArea.setColumns(50); 67 commentTextArea.setEditable(false); 68 commentTextArea.setLineWrap(true); 69 commentTextArea.setRows(6); 70 commentTextArea.setText(getBundle("LBL_Finish_Comment")); 71 commentTextArea.setWrapStyleWord(true); 72 commentTextArea.setDisabledTextColor(java.awt.Color.black); 73 commentTextArea.setEnabled(false); 74 gridBagConstraints = new java.awt.GridBagConstraints (); 75 gridBagConstraints.gridx = 0; 76 gridBagConstraints.gridy = 0; 77 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 78 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 79 gridBagConstraints.insets = new java.awt.Insets (12, 12, 12, 12); 80 gridBagConstraints.weightx = 1.0; 81 add(commentTextArea, gridBagConstraints); 82 83 restartRadioButton.setMnemonic(getBundle("CTL_Finish_Restart_Mnemonic").charAt(0)); 84 restartRadioButton.setSelected(true); 85 restartRadioButton.setText(getBundle("CTL_Finish_Restart")); 86 buttonGroup1.add(restartRadioButton); 87 restartRadioButton.addActionListener(new java.awt.event.ActionListener () { 88 public void actionPerformed(java.awt.event.ActionEvent evt) { 89 restartRadioButtonActionPerformed(evt); 90 } 91 }); 92 93 gridBagConstraints = new java.awt.GridBagConstraints (); 94 gridBagConstraints.gridx = 0; 95 gridBagConstraints.gridy = 1; 96 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 97 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 98 gridBagConstraints.insets = new java.awt.Insets (0, 24, 3, 0); 99 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 100 add(restartRadioButton, gridBagConstraints); 101 102 laterRadioButton.setMnemonic(getBundle("CTL_Finish_Later_Mnemonic").charAt(0)); 103 laterRadioButton.setText(getBundle("CTL_Finish_Later")); 104 buttonGroup1.add(laterRadioButton); 105 laterRadioButton.addActionListener(new java.awt.event.ActionListener () { 106 public void actionPerformed(java.awt.event.ActionEvent evt) { 107 laterRadioButtonActionPerformed(evt); 108 } 109 }); 110 111 gridBagConstraints = new java.awt.GridBagConstraints (); 112 gridBagConstraints.gridx = 0; 113 gridBagConstraints.gridy = 2; 114 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 115 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 116 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 117 gridBagConstraints.insets = new java.awt.Insets (0, 24, 0, 0); 118 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 119 gridBagConstraints.weighty = 1.0; 120 add(laterRadioButton, gridBagConstraints); 121 122 } 124 private void laterRadioButtonActionPerformed(java.awt.event.ActionEvent evt) { restart = false; 126 } 128 private void restartRadioButtonActionPerformed(java.awt.event.ActionEvent evt) { restart = true; 130 } 132 private void initAccessibility(){ 133 getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/autoupdate/Bundle").getString("LBL_Finish_Comment")); 134 getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/autoupdate/Bundle").getString("CTL_Finish_Title")); 135 commentTextArea.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/autoupdate/Bundle").getString("ACSD_Comment_Text")); 136 commentTextArea.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/autoupdate/Bundle").getString("ACSN_Comment_Text")); 137 restartRadioButton.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/autoupdate/Bundle").getString("ACS_Finish_Restart")); 138 laterRadioButton.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/autoupdate/Bundle").getString("ACS_Finish_Later")); 139 } 140 141 private javax.swing.ButtonGroup buttonGroup1; 143 private javax.swing.JTextArea commentTextArea; 144 private javax.swing.JRadioButton laterRadioButton; 145 private javax.swing.JRadioButton restartRadioButton; 146 148 static boolean showDialog() { 149 if ( dialogDescriptor == null ) { 150 createDialog(); 151 } 152 153 return DialogDisplayer.getDefault().notify( dialogDescriptor ).equals( NotifyDescriptor.OK_OPTION ); 154 } 155 156 static boolean isRestart() { 157 return restart; 158 } 159 160 private static void createDialog() { 161 finishPanel = new FinishDialog(); 162 163 dialogDescriptor = new DialogDescriptor( 164 finishPanel, 165 getBundle( "CTL_Finish_Title" )); 166 } 167 168 private static String getBundle( String key ) { 169 return NbBundle.getMessage( FinishDialog.class, key ); 170 } 171 } 172 | Popular Tags |