|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.autoupdate; import java.awt.Font; import javax.swing.*; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; import org.openide.DialogDescriptor; import org.openide.DialogDisplayer; import org.openide.util.NbBundle; /** * * @author Ales Kemr */ /*was public*/ class ConnectingDialog extends javax.swing.JPanel { static final int CANCEL = 1; static final int SKIP = 2; static final int OK = 0; static boolean canceled = false; static boolean skipped = false; /** Creates new form ConnectingDialog */ private /*was public*/ ConnectingDialog(String ucname) { initComponents(); iconLabel.setText(getBundle("CTL_Connecting_Label") + " " + ucname + "..."); // NOI18N getAccessibleContext().setAccessibleName(getBundle("CTL_Connecting_Title")); getAccessibleContext().setAccessibleDescription(iconLabel.getText()); } /** 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. */ private void initComponents() {//GEN-BEGIN:initComponents iconLabel = new javax.swing.JLabel(); setLayout(new java.awt.BorderLayout()); setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(18, 18, 18, 18))); iconLabel.setFont(iconLabel.getFont().deriveFont(Font.BOLD)); iconLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/autoupdate/resources/gears.gif"))); iconLabel.setLabelFor(this); iconLabel.setText(getBundle("CTL_Connecting_Label")); iconLabel.setIconTextGap(16); add(iconLabel, java.awt.BorderLayout.CENTER); }//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel iconLabel; // End of variables declaration//GEN-END:variables private static DialogDescriptor createDialog(String ucname) { final JButton cancelButton = new JButton(getBundle( "CTL_Connecting_Cancel" ) ); cancelButton.setToolTipText( getBundle( "CTL_Connecting_Cancel_ToolTip" ) ); cancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { canceled = true; } }); final JButton skipButton = new JButton( getBundle("CTL_Connecting_Skip")); skipButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { skipped = true; } }); skipButton.getAccessibleContext().setAccessibleDescription(getBundle("ACS_Connecting_Skip")); DialogDescriptor dd; dd = new DialogDescriptor( new ConnectingDialog(ucname), getBundle( "CTL_Connecting_Title" ), true, // Modal new Object [] { skipButton, cancelButton }, // Option list skipButton, // Default DialogDescriptor.DEFAULT_ALIGN, // Align null, // Help null); dd.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getPropertyName().equals(DialogDescriptor.PROP_VALUE)) { Object option = event.getNewValue(); if (option == DialogDescriptor.CLOSED_OPTION) canceled = true; } } }); dd.setClosingOptions( null ); return dd; } static void closeDialog(java.awt.Dialog dialog) { dialog.dispose(); } static boolean isCanceled() { return canceled; } static boolean isSkipped() { return skipped; } static java.awt.Dialog getDialog(String ucname) { DialogDescriptor dd = createDialog(ucname); canceled = false; skipped = false; java.awt.Dialog dialog = DialogDisplayer.getDefault().createDialog( dd ); return dialog; } private static String getBundle( String key ) { return NbBundle.getMessage( ConnectingDialog.class, key ); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.