List of usage examples for javax.swing JDialog setMinimumSize
public void setMinimumSize(Dimension minimumSize)
From source file:org.pgptool.gui.ui.keyslist.KeysListView.java
@Override protected JDialog initDialog(Window owner, Object constraints) { JDialog ret = new JDialog(owner, ModalityType.APPLICATION_MODAL); ret.setMinimumSize(new Dimension(spacing(50), spacing(25))); ret.setLayout(new BorderLayout()); ret.setResizable(true);/*w w w .ja va2 s. c om*/ ret.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); ret.setTitle(Messages.get("term.keysList")); ret.add(panelRoot, BorderLayout.CENTER); ret.setJMenuBar(menuBar); initWindowGeometryPersister(ret, "keysList"); return ret; }
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 v a2 s.co m 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:org.pgptool.gui.ui.importkey.KeyImporterView.java
@Override protected JDialog initDialog(Window owner, Object constraints) { JDialog ret = new JDialog(owner, ModalityType.APPLICATION_MODAL); ret.setLayout(new BorderLayout()); ret.setResizable(true);/* w w w . j a va 2s. c o m*/ ret.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); ret.setTitle(Messages.get("action.importKey")); ret.add(pnl, BorderLayout.CENTER); ret.setMinimumSize(new Dimension(spacing(60), spacing(30))); initWindowGeometryPersister(ret, "keyImprt"); return ret; }
From source file:biomine.bmvis2.pipeline.sources.QueryGraphSource.java
@Override public BMGraph getBMGraph() throws GraphOperationException { try {/*ww w.j a v a 2 s . co m*/ if (fetch == null) { fetch = new CrawlerFetch(query, neighborhood, database); } if (ret == null) { final JDialog dial = new JDialog((JFrame) null); dial.setTitle("BMVIS II - Query to database"); dial.setSize(400, 200); dial.setMinimumSize(new Dimension(400, 200)); dial.setResizable(false); final JTextArea text = new JTextArea(); text.setEditable(false); dial.add(text); text.setText("..."); class Z { Exception runExc = null; } final Z z = new Z(); Runnable fetchThread = new Runnable() { public void run() { try { long startTime = System.currentTimeMillis(); while (!fetch.isDone()) { fetch.update(); Thread.sleep(500); long time = System.currentTimeMillis(); long elapsed = time - startTime; if (elapsed > 30000) { throw new GraphOperationException("Timeout while querying " + query); } final String newText = fetch.getState() + ":\n" + fetch.getMessages(); SwingUtilities.invokeLater(new Runnable() { public void run() { text.setText(newText); } }); } SwingUtilities.invokeAndWait(new Runnable() { public void run() { dial.setVisible(false); } }); } catch (Exception e) { z.runExc = e; } } }; new Thread(fetchThread).start(); dial.setModalityType(ModalityType.APPLICATION_MODAL); dial.setVisible(true); ret = fetch.getBMGraph(); if (ret == null) throw new GraphOperationException(fetch.getMessages()); if (z.runExc != null) { if (z.runExc instanceof GraphOperationException) throw (GraphOperationException) z.runExc; else throw new GraphOperationException(z.runExc); } } } catch (IOException e) { throw new GraphOperationException(e); } updateInfo(); return ret; }
From source file:de.codesourcery.jasm16.ide.ui.utils.UIUtils.java
public static void showErrorDialog(Component parent, String title, String textMessage, Throwable cause) { final String stacktrace; if (cause == null) { stacktrace = null;//from www . j a va 2 s. c o m } else { final ByteArrayOutputStream stackTrace = new ByteArrayOutputStream(); cause.printStackTrace(new PrintStream(stackTrace)); stacktrace = new String(stackTrace.toByteArray()); } final JDialog dialog = new JDialog((Window) null, title); dialog.setModal(true); final JTextArea message = createMultiLineLabel(textMessage); final DialogResult[] outcome = { DialogResult.CANCEL }; final JButton okButton = new JButton("Ok"); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { outcome[0] = DialogResult.YES; dialog.dispose(); } }); final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(okButton); final JPanel messagePanel = new JPanel(); messagePanel.setLayout(new GridBagLayout()); GridBagConstraints cnstrs = constraints(0, 0, true, true, GridBagConstraints.BOTH); cnstrs.weightx = 1; cnstrs.weighty = 0.1; cnstrs.gridheight = 1; messagePanel.add(message, cnstrs); if (stacktrace != null) { final JTextArea createMultiLineLabel = new JTextArea(stacktrace); createMultiLineLabel.setBackground(null); createMultiLineLabel.setEditable(false); createMultiLineLabel.setBorder(null); createMultiLineLabel.setLineWrap(false); createMultiLineLabel.setWrapStyleWord(false); final JScrollPane pane = new JScrollPane(createMultiLineLabel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); cnstrs = constraints(0, 1, true, true, GridBagConstraints.BOTH); cnstrs.weightx = 1.0; cnstrs.weighty = 0.9; cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.gridheight = GridBagConstraints.REMAINDER; messagePanel.add(pane, cnstrs); } final JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); cnstrs = constraints(0, 0, true, false, GridBagConstraints.BOTH); cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.gridheight = 1; cnstrs.weighty = 1.0; cnstrs.insets = new Insets(5, 2, 5, 2); // top,left,bottom,right panel.add(messagePanel, cnstrs); cnstrs = constraints(0, 1, true, true, GridBagConstraints.HORIZONTAL); cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.gridheight = 1; cnstrs.weighty = 0; cnstrs.insets = new Insets(0, 2, 10, 2); // top,left,bottom,right panel.add(buttonPanel, cnstrs); dialog.getContentPane().add(panel); dialog.setMinimumSize(new Dimension(600, 400)); dialog.setPreferredSize(new Dimension(600, 400)); dialog.setMaximumSize(new Dimension(600, 400)); dialog.pack(); dialog.setVisible(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 . j a v a2 s .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); }