JXErrorDialogDemoPanel.java
上传用户:zhengdagz
上传日期:2014-03-06
资源大小:1956k
文件大小:3k
源码类别:

xml/soap/webservice

开发平台:

Java

  1. /*
  2.  * JXGlassBoxDemoPanel.java
  3.  *
  4.  * Created on April 18, 2005, 4:20 PM
  5.  */
  6. package org.jdesktop.demo.swingx_dev;
  7. import javax.swing.JLabel;
  8. import org.jdesktop.demo.DemoPanel;
  9. import org.jdesktop.swingx.JXErrorDialog;
  10. /**
  11.  * Demonstrates the JXGlassBox component.
  12.  *
  13.  * @author  rbair
  14.  */
  15. public class JXErrorDialogDemoPanel extends DemoPanel {
  16.     
  17.     /** Creates new form JXGlassBoxDemoPanel */
  18.     public JXErrorDialogDemoPanel() {
  19.         setName("JXErrorDialog Demo");
  20.         initComponents();
  21.     }
  22.     public String getHtmlDescription() {
  23.         return "<html>Click on the error button to generate an Exception. The" +
  24.                 "exception will then be displayed in a JXErrorDialog</html>";
  25.     }
  26.     /** This method is called from within the constructor to
  27.      * initialize the form.
  28.      * WARNING: Do NOT modify this code. The content of this method is
  29.      * always regenerated by the Form Editor.
  30.      */
  31.     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
  32.     private void initComponents() {
  33.         java.awt.GridBagConstraints gridBagConstraints;
  34.         jXGlassBox1 = new org.jdesktop.swingx.JXGlassBox();
  35.         jLabel1 = new javax.swing.JLabel();
  36.         generateErrorBtn = new javax.swing.JButton();
  37.         jXGlassBox1.setLayout(new java.awt.BorderLayout());
  38.         JLabel lbl = new JLabel("<html><i>Please click to dismiss...</i></html>");
  39.         jXGlassBox1.add(lbl);
  40.         jLabel1.setBackground(new java.awt.Color(255, 255, 255));
  41.         jLabel1.setText("<html><c><i>Click to hide this panel (ie, dismiss)</c></i></html>");
  42.         jLabel1.setOpaque(true);
  43.         jXGlassBox1.add(jLabel1, java.awt.BorderLayout.CENTER);
  44.         setLayout(new java.awt.GridBagLayout());
  45.         generateErrorBtn.setText("Generate Error");
  46.         generateErrorBtn.addActionListener(new java.awt.event.ActionListener() {
  47.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  48.                 generateErrorBtnActionPerformed(evt);
  49.             }
  50.         });
  51.         gridBagConstraints = new java.awt.GridBagConstraints();
  52.         gridBagConstraints.gridx = 0;
  53.         gridBagConstraints.gridy = 0;
  54.         gridBagConstraints.weightx = 1.0;
  55.         gridBagConstraints.weighty = 1.0;
  56.         gridBagConstraints.insets = new java.awt.Insets(12, 12, 11, 11);
  57.         add(generateErrorBtn, gridBagConstraints);
  58.     }
  59.     // </editor-fold>//GEN-END:initComponents
  60.     private void generateErrorBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateErrorBtnActionPerformed
  61.         try {
  62.             throw new Exception("This is a test exception.");
  63.         } catch (Exception e) {
  64.             JXErrorDialog.showDialog(null, "Application Error", e);
  65.         }
  66.     }//GEN-LAST:event_generateErrorBtnActionPerformed
  67.     
  68.     
  69.     // Variables declaration - do not modify//GEN-BEGIN:variables
  70.     private javax.swing.JButton generateErrorBtn;
  71.     private javax.swing.JLabel jLabel1;
  72.     private org.jdesktop.swingx.JXGlassBox jXGlassBox1;
  73.     // End of variables declaration//GEN-END:variables
  74.     
  75. }