~ubuntu-branches/ubuntu/natty/libswingx-java/natty

« back to all changes in this revision

Viewing changes to src/test/org/jdesktop/swingx/plaf/basic/BasicErrorPaneUIIssues.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2010-07-26 12:11:27 UTC
  • mfrom: (4.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100726121127-k0d3b21nhja0dn93
Tags: 1:1.6.1-1
* New upstream release.
* Switch to 3.0 (quilt) format.
* Bump Standards-Version to 3.9.1: no changes needed.
* Drop Depends on JRE: not requested anymore by new Java Policy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Id$
 
3
 *
 
4
 * Copyright 2009 Sun Microsystems, Inc., 4150 Network Circle,
 
5
 * Santa Clara, California 95054, U.S.A. All rights reserved.
 
6
 *
 
7
 * This library is free software; you can redistribute it and/or
 
8
 * modify it under the terms of the GNU Lesser General Public
 
9
 * License as published by the Free Software Foundation; either
 
10
 * version 2.1 of the License, or (at your option) any later version.
 
11
 * 
 
12
 * This library is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
 * Lesser General Public License for more details.
 
16
 * 
 
17
 * You should have received a copy of the GNU Lesser General Public
 
18
 * License along with this library; if not, write to the Free Software
 
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
20
 *
 
21
 */
 
22
package org.jdesktop.swingx.plaf.basic;
 
23
 
 
24
import java.awt.event.ActionEvent;
 
25
import java.awt.event.ActionListener;
 
26
 
 
27
import javax.swing.JButton;
 
28
import javax.swing.JComponent;
 
29
import javax.swing.JFrame;
 
30
import javax.swing.JPanel;
 
31
 
 
32
import org.jdesktop.swingx.InteractiveTestCase;
 
33
import org.jdesktop.swingx.JXErrorPane;
 
34
import org.jdesktop.swingx.JXFrame;
 
35
import org.jdesktop.swingx.JXTable;
 
36
import org.jdesktop.swingx.error.ErrorInfo;
 
37
 
 
38
/**
 
39
 * 
 
40
 * @author Jeanette Winzenburg
 
41
 */
 
42
public class BasicErrorPaneUIIssues extends InteractiveTestCase {
 
43
 
 
44
    public static void main(String[] args) {
 
45
        BasicErrorPaneUIIssues test = new BasicErrorPaneUIIssues();
 
46
        try {
 
47
            test.runInteractiveTests();
 
48
        } catch (Exception e) {
 
49
            e.printStackTrace();
 
50
        }
 
51
    }
 
52
    /**
 
53
     * first frame - 
 
54
     */
 
55
    public void interactiveDummy() {
 
56
        showWithScrollingInFrame(new JXTable(20, 6), "just a dummy - #1212 is virulent only if not app exited");
 
57
    }
 
58
    /**
 
59
     * Issue #1212-swingx: NullPointerException in BasicErrorPaneUI.initWindow listener
 
60
     */
 
61
    public void interactiveNPEAfterChangeLAF() {
 
62
        JComponent pane = new JPanel();
 
63
        JButton showErrorPane = new JButton("show error pane");
 
64
        pane.add(showErrorPane);
 
65
        final JXFrame frame = showInFrame(showErrorPane, "NPE on closing");
 
66
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
 
67
        showErrorPane.addActionListener(new ActionListener() {
 
68
            @Override
 
69
            public void actionPerformed(ActionEvent e) {
 
70
                JXErrorPane.showDialog(frame, new ErrorInfo("Title",
 
71
                        "Message", "Details", null, null, null, null));
 
72
            }
 
73
        });
 
74
        addStatusMessage(frame, "1. show error, 2. change laf, 3. close frame - NPE");
 
75
        show(frame);
 
76
    }
 
77
}