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;
  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.     public String getName() {
  27.         return "Error Dialog";
  28.     }
  29.     /** This method is called from within the constructor to
  30.      * initialize the form.
  31.      * WARNING: Do NOT modify this code. The content of this method is
  32.      * always regenerated by the Form Editor.
  33.      */
  34.     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
  35.     private void initComponents() {
  36.         java.awt.GridBagConstraints gridBagConstraints;
  37.         jXGlassBox1 = new org.jdesktop.swingx.JXGlassBox();
  38.         jLabel1 = new javax.swing.JLabel();
  39.         generateErrorBtn = new javax.swing.JButton();
  40.         jXGlassBox1.setLayout(new java.awt.BorderLayout());
  41.         JLabel lbl = new JLabel("<html><i>Please click to dismiss...</i></html>");
  42.         jXGlassBox1.add(lbl);
  43.         jLabel1.setBackground(new java.awt.Color(255, 255, 255));
  44.         jLabel1.setText("<html><c><i>Click to hide this panel (ie, dismiss)</c></i></html>");
  45.         jLabel1.setOpaque(true);
  46.         jXGlassBox1.add(jLabel1, java.awt.BorderLayout.CENTER);
  47.         setLayout(new java.awt.GridBagLayout());
  48.         generateErrorBtn.setText("Generate Error");
  49.         generateErrorBtn.addActionListener(new java.awt.event.ActionListener() {
  50.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  51.                 generateErrorBtnActionPerformed(evt);
  52.             }
  53.         });
  54.         gridBagConstraints = new java.awt.GridBagConstraints();
  55.         gridBagConstraints.gridx = 0;
  56.         gridBagConstraints.gridy = 0;
  57.         gridBagConstraints.weightx = 1.0;
  58.         gridBagConstraints.weighty = 1.0;
  59.         gridBagConstraints.insets = new java.awt.Insets(12, 12, 11, 11);
  60.         add(generateErrorBtn, gridBagConstraints);
  61.     }
  62.     // </editor-fold>//GEN-END:initComponents
  63.     private void generateErrorBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateErrorBtnActionPerformed
  64.         try {
  65.             throw new Exception("This is a test exception.");
  66.         } catch (Exception e) {
  67.             JXErrorDialog.showDialog(null, "Application Error", e);
  68.         }
  69.     }//GEN-LAST:event_generateErrorBtnActionPerformed
  70.     
  71.     
  72.     // Variables declaration - do not modify//GEN-BEGIN:variables
  73.     private javax.swing.JButton generateErrorBtn;
  74.     private javax.swing.JLabel jLabel1;
  75.     private org.jdesktop.swingx.JXGlassBox jXGlassBox1;
  76.     // End of variables declaration//GEN-END:variables
  77.     
  78. }