本文整理汇总了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);
}
示例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);
}
示例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();
}
示例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));
}
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}
}
}
示例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");
}
示例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");
}
示例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);
}
示例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;
}
示例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());
}
示例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);
}
}
}
示例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");
}