1 19 20 package org.netbeans.modules.autoupdate; 21 22 import java.awt.Font ; 23 import javax.swing.*; 24 import org.openide.DialogDescriptor; 25 import org.openide.DialogDisplayer; 26 import org.openide.util.NbBundle; 27 28 class IncompleteDialog extends javax.swing.JPanel { 29 30 static final int STOP = 0; 31 static final int CANCEL = 1; 32 33 private static int result = CANCEL; 34 35 private javax.swing.JLabel titleLabel; 36 private javax.swing.JTextArea textArea; 37 private javax.swing.JLabel iconLabel; 38 39 40 public IncompleteDialog() { 41 initComponents(); 42 initAccessibility(); 43 setPreferredSize(new java.awt.Dimension (350,120)); 44 } 45 46 49 private void initComponents() { 50 iconLabel = new javax.swing.JLabel (); 51 titleLabel = new javax.swing.JLabel (); 52 textArea = new javax.swing.JTextArea (); 53 setLayout(new java.awt.GridBagLayout ()); 54 java.awt.GridBagConstraints gridBagConstraints; 55 56 iconLabel.setIcon(javax.swing.UIManager.getIcon("OptionPane.warningIcon")); titleLabel.setFont(ResultsPanel.doDeriveFont(titleLabel.getFont(), Font.BOLD)); 59 titleLabel.setForeground(java.awt.Color.black); 60 titleLabel.setText(getBundle("CTL_Incomplete_titleLabel")); 61 62 textArea.setFont(new Font ("Dialog", Font.PLAIN, textArea.getFont().getSize())); 63 textArea.setBackground(titleLabel.getBackground ()); 64 textArea.setDisabledTextColor(java.awt.Color.black); 65 textArea.setLineWrap(true); 66 textArea.setWrapStyleWord(true); 67 textArea.setEnabled(false); 68 textArea.setText(getBundle("CTL_Incomplete_textLabel")); 69 70 gridBagConstraints = new java.awt.GridBagConstraints (); 71 gridBagConstraints.gridheight = 0; 72 gridBagConstraints.insets = new java.awt.Insets (18, 18, 0, 0); 73 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 74 add(iconLabel, gridBagConstraints); 75 76 gridBagConstraints.gridx = 1; 77 gridBagConstraints.gridy = 0; 78 gridBagConstraints.gridheight = 1; 79 gridBagConstraints.gridwidth = 0; 80 gridBagConstraints.insets = new java.awt.Insets (18, 12, 0, 18); 81 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 82 gridBagConstraints.weighty = 0.0; 83 add(titleLabel, gridBagConstraints); 84 85 gridBagConstraints.gridx = 1; 86 gridBagConstraints.gridy = 1; 87 gridBagConstraints.gridwidth = 0; 88 gridBagConstraints.insets = new java.awt.Insets (0, 12, 0, 18); 89 gridBagConstraints.weightx = 1.0; 90 gridBagConstraints.weighty = 1.0; 91 add(textArea, gridBagConstraints); 92 } 93 94 private void initAccessibility(){ 95 getAccessibleContext().setAccessibleDescription(getBundle( "ACSD_Incomplete_Dlg" ) ); 96 } 97 98 private static DialogDescriptor createDialog() { 99 100 final JButton stopButton = new JButton(getBundle( "CTL_Incomplete_Stop" ) ); 101 final JButton cancelButton = new JButton(getBundle( "CTL_Incomplete_Cancel" ) ); 102 result = CANCEL; 103 104 DialogDescriptor dd; 105 dd = new DialogDescriptor( 106 new IncompleteDialog(), 107 getBundle( "CTL_Incomplete_Title" ), 108 true, new Object [] { 110 stopButton, 111 cancelButton 112 }, stopButton, DialogDescriptor.DEFAULT_ALIGN, null, new java.awt.event.ActionListener () { 117 public void actionPerformed( java.awt.event.ActionEvent evt ) { 118 if ( evt.getSource() == stopButton ) 119 result = STOP; 120 else if ( evt.getSource() == cancelButton ) 121 result = CANCEL; 122 } 123 }); 124 125 dd.setClosingOptions( null ); 126 127 return dd; 128 } 129 130 static int showDialog() { 131 DialogDescriptor dd = createDialog(); 132 java.awt.Dialog dialog = DialogDisplayer.getDefault().createDialog( dd ); 133 dialog.setVisible (true); 134 dialog.dispose(); 135 136 return result; 137 } 138 139 private static String getBundle( String key ) { 140 return NbBundle.getMessage( IncompleteDialog.class, key ); 141 } 142 } 143 | Popular Tags |