当前位置: 首页>>代码示例>>Java>>正文


Java JXErrorPane类代码示例

本文整理汇总了Java中org.jdesktop.swingx.JXErrorPane的典型用法代码示例。如果您正苦于以下问题:Java JXErrorPane类的具体用法?Java JXErrorPane怎么用?Java JXErrorPane使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JXErrorPane类属于org.jdesktop.swingx包,在下文中一共展示了JXErrorPane类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showExceptionDialog

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
public static void showExceptionDialog(Throwable e) {
    e.printStackTrace();

    if (Build.CURRENT.isRobotTest()) {
        DebugEventQueue.dump();
        History.showHistory();
        Toolkit.getDefaultToolkit().beep();

        playWarningSound();
    }

    Frame parent = getParentForDialogs();
    String basicErrorMessage = "An exception occurred: " + e.getMessage();
    ErrorInfo ii = new ErrorInfo("Program error", basicErrorMessage, null, null, e, Level.SEVERE, null);
    JXErrorPane.showDialog(parent, ii);
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:17,代码来源:Dialogs.java

示例2: interactiveNPEAfterChangeLAF

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
/**
 * Issue #1212-swingx: NullPointerException in BasicErrorPaneUI.initWindow listener
 */
public void interactiveNPEAfterChangeLAF() {
    JComponent pane = new JPanel();
    JButton showErrorPane = new JButton("show error pane");
    pane.add(showErrorPane);
    final JXFrame frame = showInFrame(showErrorPane, "NPE on closing");
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    showErrorPane.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JXErrorPane.showDialog(frame, new ErrorInfo("Title",
                    "Message", "Details", null, null, null, null));
        }
    });
    addStatusMessage(frame, "1. show error, 2. change laf, 3. close frame - NPE");
    show(frame);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:20,代码来源:BasicErrorPaneUIIssues.java

示例3: showErrorMessage

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
public static void showErrorMessage(final String shortMessage, final String detailedMessage,
        final Throwable exception) {
    final Throwable presentedException = ErrorUtils.unwrapForPresentation(exception);
    if (exception == null) {
        showErrorMessage(shortMessage, detailedMessage);
        return;
    }

    final String finalDetailedMessage = detailedMessage == null ? "" : detailedMessage;
    final String finalShortMessage = shortMessage == null ? "" : shortMessage;

    final ErrorInfo info = new ErrorInfo(finalShortMessage, finalDetailedMessage, null, "error", presentedException,
            ErrorLevel.SEVERE, null);
    final JXErrorPane errorPane = new JXErrorPane();
    errorPane.setErrorInfo(info);

    final JDialog dialog = JXErrorPane.createDialog(null, errorPane);

    centerOnScreen(dialog);
    JXErrorPane.setDefaultLocale(Locale.ENGLISH);
    dialog.setLocale(Locale.ENGLISH);
    dialog.setModal(true);
    dialog.setTitle(finalShortMessage);
    dialog.setVisible(true);
    dialog.toFront();
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:27,代码来源:WidgetUtils.java

示例4: openLink

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
private void openLink(String link) {
    Exception error = null;
    if (Desktop.isDesktopSupported()) {
        try {
            Desktop.getDesktop().browse(new URI(link));
        } catch (IOException | URISyntaxException ex) {
            error = ex;
        }
    } else {
        error = new BrowserException();
    }
    if (error != null) {
        JXErrorPane.showDialog(null, new ErrorInfo("Open link error",
            "Can not open link", null, "Error", error,
            java.util.logging.Level.SEVERE, null));
    }
}
 
开发者ID:nemolovich,项目名称:MinecraftRcon,代码行数:18,代码来源:MainFrame.java

示例5: showErrorDialog

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
public static void showErrorDialog(Component parent, ErrorInfo errorInfo)
{

    if (parent == null)
    {
        if (org.springframework.richclient.application.Application.isLoaded())
        {
            ApplicationWindow activeWindow = org.springframework.richclient.application.Application
                    .instance().getActiveWindow();
            if (activeWindow != null)
                parent = activeWindow.getControl();
        }
    }

    JXErrorPane pane = new JXErrorPane();
    pane.setErrorInfo(errorInfo);
    pane.setErrorReporter(new JdicEmailNotifierErrorReporter());

    JXErrorPane.showDialog(parent, pane);
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:21,代码来源:RcpSupport.java

示例6: onEvent

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
/**
 *
 * @param topic
 * @param data
 */
public void onEvent(String topic, Exception data) {

    String msg = randomHaiku();
    String details = formatStackTraceForDialogs(data, false);

    /*
     * Create an error pane to display the error stuff
     */
    JXErrorPane errorPane = new JXErrorPane();
    Icon errorIcon = randomImage();
    ErrorInfo errorInfo = new ErrorInfo("VARS - Fatal Error", msg, details, null, data, ErrorLevel.FATAL, null);

    errorPane.setIcon(errorIcon);
    errorPane.setErrorInfo(errorInfo);
    errorPane.setErrorReporter(new EmailErrorReporter(errorPane));
    JXErrorPane.showDialog(null, errorPane);

}
 
开发者ID:hohonuuli,项目名称:vars,代码行数:24,代码来源:FatalExceptionSubscriber.java

示例7: JXInternalErrorFrame

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
public JXInternalErrorFrame(JXErrorPane p) {
    setTitle(p.getErrorInfo().getTitle());

    setLayout(new BorderLayout());
    add(p, BorderLayout.CENTER);
    final Action closeAction = new AbstractAction() {
        public void actionPerformed(ActionEvent evt) {
            setVisible(false);
            dispose();
        }
    };
    closeButton.addActionListener(closeAction);
    addComponentListener(new ComponentAdapter() {
        @Override
        public void componentHidden(ComponentEvent e) {
            //remove the action listener
            closeButton.removeActionListener(closeAction);
            exitIfFatal();
        }
    });

    getRootPane().setDefaultButton(closeButton);
    setResizable(false);
    setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
    KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    getRootPane().registerKeyboardAction(closeAction, ks, JComponent.WHEN_IN_FOCUSED_WINDOW);
    //setPreferredSize(calculatePreferredDialogSize());
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:29,代码来源:BasicErrorPaneUI.java

示例8: exitIfFatal

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
private void exitIfFatal() {
    ErrorInfo info = pane.getErrorInfo();
    // FYI: info can be null
    if ((info != null) && (info.getErrorLevel() == ErrorLevel.FATAL)) {
        Action fatalAction = pane.getActionMap().get(JXErrorPane.FATAL_ACTION_KEY);
        if (fatalAction == null) {
            System.exit(1);
        } else {
            ActionEvent ae = new ActionEvent(closeButton, -1, "fatal");
            fatalAction.actionPerformed(ae);
        }
    }
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:14,代码来源:BasicErrorPaneUI.java

示例9: addBasicDefaults

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
    super.addBasicDefaults(addon, defaults);

    defaults.add(JXErrorPane.uiClassID, "org.jdesktop.swingx.plaf.basic.BasicErrorPaneUI");

    UIManagerExt.addResourceBundle(
            "org.jdesktop.swingx.plaf.basic.resources.ErrorPane");
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:13,代码来源:ErrorPaneAddon.java

示例10: addMacDefaults

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected void addMacDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
    super.addMacDefaults(addon, defaults);

    defaults.add(JXErrorPane.uiClassID, "org.jdesktop.swingx.plaf.macosx.MacOSXErrorPaneUI");

    UIManagerExt.addResourceBundle(
            "org.jdesktop.swingx.plaf.macosx.resources.ErrorPane");
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:12,代码来源:ErrorPaneAddon.java

示例11: showExceptionDialog

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
@Override
public void showExceptionDialog(Throwable throwable, @Nullable String caption, @Nullable String message) {
    Preconditions.checkNotNullArgument(throwable);

    JXErrorPane errorPane = new JXErrorPaneExt();
    errorPane.setErrorInfo(createErrorInfo(caption, message, throwable));

    final TopLevelFrame mainFrame = App.getInstance().getMainFrame();

    JDialog dialog = JXErrorPane.createDialog(mainFrame, errorPane);
    dialog.setMinimumSize(new Dimension(600, (int) dialog.getMinimumSize().getHeight()));

    final DialogWindow lastDialogWindow = getLastDialogWindow();
    dialog.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosed(WindowEvent e) {
            if (lastDialogWindow != null) {
                lastDialogWindow.enableWindow();
            } else {
                mainFrame.activate();
            }
        }
    });
    dialog.setModal(false);

    if (lastDialogWindow != null) {
        lastDialogWindow.disableWindow(null);
    } else {
        mainFrame.deactivate(null);
    }

    dialog.setVisible(true);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:34,代码来源:DesktopWindowManager.java

示例12: handle

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
@Override
public boolean handle(Thread thread, Throwable exception) {
    JXErrorPane errorPane = new JXErrorPaneExt();

    errorPane.setErrorInfo(createErrorInfo(exception));
    JDialog dialog = JXErrorPane.createDialog(App.getInstance().getMainFrame(), errorPane);
    dialog.setMinimumSize(new Dimension(600, (int) dialog.getMinimumSize().getHeight()));

    final DialogWindow lastDialogWindow = getLastDialogWindow();
    dialog.addWindowListener(
            new WindowAdapter() {
                @Override
                public void windowClosed(WindowEvent e) {
                    if (lastDialogWindow != null)
                        lastDialogWindow.enableWindow();
                    else
                        App.getInstance().getMainFrame().activate();
                }
            }
    );
    dialog.setModal(false);

    if (lastDialogWindow != null)
        lastDialogWindow.disableWindow(null);
    else
        App.getInstance().getMainFrame().deactivate(null);

    dialog.setVisible(true);
    return true;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:31,代码来源:DefaultExceptionHandler.java

示例13: JXInternalErrorFrame

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
public JXInternalErrorFrame(JXErrorPane p) {
    setTitle(p.getErrorInfo().getTitle());

    setLayout(new BorderLayout());
    add(p, BorderLayout.CENTER);
    final Action closeAction = new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            setVisible(false);
            dispose();
        }
    };
    closeButton.addActionListener(closeAction);
    addComponentListener(new ComponentAdapter() {
        @Override
        public void componentHidden(ComponentEvent e) {
            //remove the action listener
            closeButton.removeActionListener(closeAction);
            exitIfFatal();
        }
    });

    getRootPane().setDefaultButton(closeButton);
    setResizable(false);
    setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
    KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    getRootPane().registerKeyboardAction(closeAction, ks, JComponent.WHEN_IN_FOCUSED_WINDOW);
    //setPreferredSize(calculatePreferredDialogSize());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:30,代码来源:BasicErrorPaneUI.java

示例14: exitIfFatal

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
private void exitIfFatal() {
    ErrorInfo info = pane.getErrorInfo();
    // FYI: info can be null
    if (info != null && info.getErrorLevel() == ErrorLevel.FATAL) {
        Action fatalAction = pane.getActionMap().get(JXErrorPane.FATAL_ACTION_KEY);
        if (fatalAction == null) {
            System.exit(1);
        } else {
            ActionEvent ae = new ActionEvent(closeButton, -1, "fatal");
            fatalAction.actionPerformed(ae);
        }
    }
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:14,代码来源:BasicErrorPaneUI.java

示例15: addBasicDefaults

import org.jdesktop.swingx.JXErrorPane; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
    super.addBasicDefaults(addon, defaults);
    
    defaults.add(JXErrorPane.uiClassID, "org.jdesktop.swingx.plaf.basic.BasicErrorPaneUI");
    
    UIManagerExt.addResourceBundle(
        "org.jdesktop.swingx.plaf.basic.resources.ErrorPane");
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:13,代码来源:ErrorPaneAddon.java


注:本文中的org.jdesktop.swingx.JXErrorPane类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。