List of usage examples for javax.swing JDialog getMinimumSize
public Dimension getMinimumSize()
From source file:com.haulmont.cuba.desktop.exception.DefaultExceptionHandler.java
@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/*from w w w . j a va 2 s . com*/ 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; }
From source file:com.haulmont.cuba.desktop.sys.DesktopWindowManager.java
@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//from w w w. java 2s . c om 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); }
From source file:util.ui.UiUtilities.java
/** * set the size of a dialog, but never sizes it smaller than the preferred * size/*w ww . j av a 2s . c o m*/ * * @param dialog * dialog to be sized * @param width * wanted width * @param height * wanted height */ public static void setSize(JDialog dialog, int width, int height) { dialog.pack(); Dimension size = dialog.getMinimumSize(); if (width > size.width) { size.width = width; } if (height > size.height) { size.height = height; } dialog.setSize(size); }