JXErrorDialogDemoPanel.java
资源名称:swingx.zip [点击查看]
上传用户:zhengdagz
上传日期:2014-03-06
资源大小:1956k
文件大小:3k
源码类别:
xml/soap/webservice
开发平台:
Java
- /*
- * JXGlassBoxDemoPanel.java
- *
- * Created on April 18, 2005, 4:20 PM
- */
- package org.jdesktop.demo.swingx;
- import javax.swing.JLabel;
- import org.jdesktop.demo.DemoPanel;
- import org.jdesktop.swingx.JXErrorDialog;
- /**
- * Demonstrates the JXGlassBox component.
- *
- * @author rbair
- */
- public class JXErrorDialogDemoPanel extends DemoPanel {
- /** Creates new form JXGlassBoxDemoPanel */
- public JXErrorDialogDemoPanel() {
- setName("JXErrorDialog Demo");
- initComponents();
- }
- public String getHtmlDescription() {
- return "<html>Click on the error button to generate an Exception. The" +
- "exception will then be displayed in a JXErrorDialog</html>";
- }
- public String getName() {
- return "Error Dialog";
- }
- /** 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.
- */
- // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
- private void initComponents() {
- java.awt.GridBagConstraints gridBagConstraints;
- jXGlassBox1 = new org.jdesktop.swingx.JXGlassBox();
- jLabel1 = new javax.swing.JLabel();
- generateErrorBtn = new javax.swing.JButton();
- jXGlassBox1.setLayout(new java.awt.BorderLayout());
- JLabel lbl = new JLabel("<html><i>Please click to dismiss...</i></html>");
- jXGlassBox1.add(lbl);
- jLabel1.setBackground(new java.awt.Color(255, 255, 255));
- jLabel1.setText("<html><c><i>Click to hide this panel (ie, dismiss)</c></i></html>");
- jLabel1.setOpaque(true);
- jXGlassBox1.add(jLabel1, java.awt.BorderLayout.CENTER);
- setLayout(new java.awt.GridBagLayout());
- generateErrorBtn.setText("Generate Error");
- generateErrorBtn.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- generateErrorBtnActionPerformed(evt);
- }
- });
- gridBagConstraints = new java.awt.GridBagConstraints();
- gridBagConstraints.gridx = 0;
- gridBagConstraints.gridy = 0;
- gridBagConstraints.weightx = 1.0;
- gridBagConstraints.weighty = 1.0;
- gridBagConstraints.insets = new java.awt.Insets(12, 12, 11, 11);
- add(generateErrorBtn, gridBagConstraints);
- }
- // </editor-fold>//GEN-END:initComponents
- private void generateErrorBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateErrorBtnActionPerformed
- try {
- throw new Exception("This is a test exception.");
- } catch (Exception e) {
- JXErrorDialog.showDialog(null, "Application Error", e);
- }
- }//GEN-LAST:event_generateErrorBtnActionPerformed
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JButton generateErrorBtn;
- private javax.swing.JLabel jLabel1;
- private org.jdesktop.swingx.JXGlassBox jXGlassBox1;
- // End of variables declaration//GEN-END:variables
- }