List of utility methods to do JDialog
void | resizeDialogToScreen(JDialog dialog) Update the size of the dialog to ensure it will fit on the screen. Rectangle screenBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); final Dimension dialogSize = dialog.getSize(); if (dialogSize.height > screenBounds.height) { dialogSize.height = screenBounds.height; if (dialogSize.width > screenBounds.width) { dialogSize.width = screenBounds.width; dialog.setSize(dialogSize); |
boolean | rptaConfirmDialog(JDialog pJDialog, String pMensaje) rpta Confirm Dialog int rptaDialogo = JOptionPane.showConfirmDialog(pJDialog, pMensaje, "Mensaje del Sistema", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (rptaDialogo == JOptionPane.YES_OPTION) return true; else return false; |
void | runProgressBar(final Runnable runnable, final JDialog dialog) Run progress bar. Thread worker = new Thread() { @Override public void run() { try { runnable.run(); } catch (Throwable e) { e.printStackTrace(); } finally { ... |
void | setActionsMenu(JDialog dialog, MenuElement menu) set Actions Menu MenuElement[] subItems = menu.getSubElements(); for (int i = 0; i < subItems.length; i++) { MenuElement c = subItems[i]; if (c instanceof JMenuItem) { final JMenuItem menuItem = (JMenuItem) c; if (menuItem.getAccelerator() != null) { String key = "hackAction" + counter++; dialog.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) ... |
void | setCursorFree(JDialog dialog) Set cursor to free and enable application input. setCursorFree(dialog.getRootPane().getGlassPane()); |
void | setDirty(JDialog dialog, boolean isDirty) set Dirty setDirty(dialog.getRootPane(), isDirty); |
void | setHelpDialogLoc(JButton odsHelpButton, JDialog helpDialog) set Help Dialog Loc Point buttonPoint = odsHelpButton.getLocationOnScreen(); int dialogWidth = helpDialog.getSize().width; int dialogHeight = helpDialog.getSize().height; int helpDialogX = buttonPoint.x - dialogWidth / 2; if (helpDialogX < 0) { helpDialogX = 0; int helpDialogY = buttonPoint.y - dialogHeight - 10; ... |
void | setSize(JDialog dialog, int width, int height) set the size of a dialog, but never sizes it smaller than the preferred size dialog.pack(); Dimension size = dialog.getMinimumSize(); if (width > size.width) { size.width = width; if (height > size.height) { size.height = height; dialog.setSize(size); |
void | setWinVisible(final JDialog win, final boolean vis) set Win Visible SwingUtilities.invokeLater(new Runnable() { public void run() { win.setVisible(vis); }); |
void | sizeDialog(JDialog dialog, int prefWidth, int prefHeight) Utility method to size a Dialog box correctly. sizeDialog(dialog, prefWidth, prefHeight, false); |