Skip to main content


2 replies [Last post]
Joined: 2011-03-29


The error pane is not working for me.

I first tryed
showInternalFrame(java.lang.Throwable e)
inside an internal frame. Nothing happens...

Then I tryed
showFrame(java.lang.Throwable e)
inside the internal frame. A new frame opens but with bugs.
The close or whatever buttons got no text.
I only see two little round buttons... don't know what they mean.

Reading the Javadoc didn't help much.

Some strange code I found for ErrorInfo.
copied from the javadoc

String message = "An error occured on ${} version ${os.version}";
    //auto creates the state map, populated with all System properties.
    //Sandboxed apps can't read System properties.
    ErrorInfo info = new ErrorInfo("Error", exception);
    message = info.substituteVariables(message);

    //prints out: "An error occured on Mac OS X version 10.4.7" on some systems;

The strange this here is, that the method
substituteVariables is not listet in the method section ...

Any Ideas?



Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-06-08

That doesn't appear to be the latest version of the ErrorInfo JavaDoc. I am not having any trouble bringing up a frame with the exception contents.

Can you post a small demo? Also, what OS and version of Java are you using?


Joined: 2011-03-29

Hi Karl,

Sorry for the late reply...

Now I got a little demo, where you (maybe) can see what I mean.
I use WindowsXP SP3 with different Java Versions. The problem occured
with Java 1.6

Here ist the demo:
First the main-class

import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import tester.ui.MainFrame;

* @author OhneAngabe
public class Tester {

    private static void setLookAndFeel() {
        try {
            UIManager.setLookAndFeel( "" );
            //UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
            //UIManager.setLookAndFeel( "" );
        } catch (ClassNotFoundException cnfe) {
        } catch (InstantiationException ie) {
        } catch (IllegalAccessException iae) {
        } catch (UnsupportedLookAndFeelException uslfe) {

     * @param args the command line arguments
    public static void main( String[] args ) {


        SwingUtilities.invokeLater( new Runnable() {

            public void run() {
                new MainFrame( "Test" );
        } );

and the the ui-class ( )

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Level;
import javax.swing.JComponent;
import org.jdesktop.swingx.JXButton;
import org.jdesktop.swingx.JXErrorPane;
import org.jdesktop.swingx.JXFrame;
import org.jdesktop.swingx.error.ErrorInfo;

* @author OhneAngabe
public class MainFrame extends JXFrame implements ActionListener {
    private JXButton showErrorPaneB;
    public MainFrame( final String title ) {
        super( title, true );
        setVisible( true );
    private void createMainFrame() {
        setSize( 200, 200 );
        setLocationRelativeTo( null );
        setLayout( new BorderLayout() );
        showErrorPaneB = new JXButton( "Help" );
        showErrorPaneB.addActionListener( this );
        add( showErrorPaneB, BorderLayout.CENTER );

    public static void showErrorDialog( final JComponent parentComponent,
            final String headerText, final String basicInfoText,
            final String detailedInfoText, final String cat,
            final Throwable reason )  {
        JXErrorPane errorPane = new JXErrorPane();

        ErrorInfo ei = new ErrorInfo( headerText, basicInfoText,
                detailedInfoText, cat, reason, Level.WARNING, null );

        errorPane.setErrorInfo( ei );

        JXErrorPane.showDialog( parentComponent, errorPane );
    public void actionPerformed( ActionEvent ae ) {
        if( ae.getSource() ==  showErrorPaneB ) {
            showErrorDialog( null, "Warning", "Some Error", "", "Cat 1", new NullPointerException() );