List of usage examples for javax.swing JDialog pack
@SuppressWarnings("deprecation") public void pack()
From source file:org.pgptool.gui.ui.tools.DialogViewBaseCustom.java
protected void initWindowGeometryPersister(JDialog dialog, String key) { windowGeometryPersister = new WindowGeometryPersisterImpl(dialog, key, uiGeom, scheduledExecutorService); if (dialog.isResizable()) { if (!windowGeometryPersister.restoreSize()) { dialog.pack(); }/* ww w . ja v a2 s .co m*/ } // if (!windowGeometryPersister.restoreLocation()) { UiUtils.centerWindow(dialog); // } }
From source file:org.nekorp.workflow.desktop.view.resource.imp.DamageCaptureDetailDialogFactory.java
@Override public JDialog createDialog(Frame frame, boolean modal) { JDialog dialog = new JDialog(mainFrame, true); dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); dialog.setTitle("Descripcin del Dao"); view.setParentWindow(dialog);// w w w .j a v a2 s. c om view.iniciaVista(); dialog.add(view); dialog.validate(); dialog.pack(); dialog.setLocationRelativeTo(mainFrame); return dialog; }
From source file:org.nekorp.workflow.desktop.view.resource.imp.WizardDialogFactory.java
@Override public JDialog createDialog(Frame frame, boolean modal) { JDialog dialog = new JDialog(mainFrame, true); dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); dialog.setTitle("Nuevo Servicio"); wizard.setParentWindow(dialog);// www . j a va2 s . c om wizard.iniciaVista(); dialog.add(wizard); dialog.validate(); dialog.pack(); dialog.setLocationRelativeTo(mainFrame); return dialog; }
From source file:org.nekorp.workflow.desktop.view.resource.imp.ParametrosReporteGlobalDialogFactory.java
@Override public JDialog createDialog(Frame frame, boolean modal) { JDialog dialog = new JDialog(mainFrame, true); dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); dialog.setTitle("Reporte Global"); datePickView.setParent(dialog);//www . j av a 2 s . co m datePickView.iniciaVista(); dialog.add(datePickView); dialog.validate(); dialog.pack(); dialog.setLocationRelativeTo(mainFrame); return dialog; }
From source file:org.cytoscape.dyn.internal.graphMetrics.GraphMetricsResultsPanel.java
/** * //from w ww . j a v a2 s . co m */ public void enlargeChart() { chartPanelForDialog = new ChartPanel(this.timeSeries); JDialog dialog = new JDialog(cyActivator.getCySwingAppication().getJFrame(), "Dynamic Graph Metrics", false); dialog.getContentPane().add(chartPanelForDialog); dialog.pack(); dialog.setLocationRelativeTo(cyActivator.getCySwingAppication().getJFrame()); dialog.setVisible(true); }
From source file:org.nekorp.workflow.desktop.view.resource.imp.HistorialServicioDialogFactory.java
@Override public JDialog createDialog(Frame frame, boolean modal) { HistorialServiciosJTableModel model = new HistorialServiciosJTableModel(); model.setDatos(historialController.getHistorial()); JDialog dialog = new JDialog(mainFrame, true); dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); dialog.setTitle("Historial Servicio"); historialView.setParent(dialog);/* ww w . j a v a 2s . c o m*/ historialView.iniciaVista(); historialView.setHistoricoModel(model); dialog.add(historialView); dialog.validate(); dialog.pack(); dialog.setLocationRelativeTo(mainFrame); return dialog; }
From source file:net.sf.jabref.util.Util.java
/** * Automatically add links for this set of entries, based on the globally stored list of external file types. The * entries are modified, and corresponding UndoEdit elements added to the NamedCompound given as argument. * Furthermore, all entries which are modified are added to the Set of entries given as an argument. * <p>//from ww w .jav a 2s .c o m * The entries' bibtex keys must have been set - entries lacking key are ignored. The operation is done in a new * thread, which is returned for the caller to wait for if needed. * * @param entries A collection of BibEntry objects to find links for. * @param ce A NamedCompound to add UndoEdit elements to. * @param changedEntries MODIFIED, optional. A Set of BibEntry objects to which all modified entries is added. * This is used for status output and debugging * @param singleTableModel UGLY HACK. The table model to insert links into. Already existing links are not * duplicated or removed. This parameter has to be null if entries.count() != 1. The hack has been * introduced as a bibtexentry does not (yet) support the function getListTableModel() and the * FileListEntryEditor editor holds an instance of that table model and does not reconstruct it after the * search has succeeded. * @param metaData The MetaData providing the relevant file directory, if any. * @param callback An ActionListener that is notified (on the event dispatch thread) when the search is finished. * The ActionEvent has id=0 if no new links were added, and id=1 if one or more links were added. This * parameter can be null, which means that no callback will be notified. * @param diag An instantiated modal JDialog which will be used to display the progress of the autosetting. This * parameter can be null, which means that no progress update will be shown. * @return the thread performing the autosetting */ public static Runnable autoSetLinks(final Collection<BibEntry> entries, final NamedCompound ce, final Set<BibEntry> changedEntries, final FileListTableModel singleTableModel, final MetaData metaData, final ActionListener callback, final JDialog diag) { final Collection<ExternalFileType> types = ExternalFileTypes.getInstance().getExternalFileTypeSelection(); if (diag != null) { final JProgressBar prog = new JProgressBar(JProgressBar.HORIZONTAL, 0, types.size() - 1); final JLabel label = new JLabel(Localization.lang("Searching for files")); prog.setIndeterminate(true); prog.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); diag.setTitle(Localization.lang("Autosetting links")); diag.getContentPane().add(prog, BorderLayout.CENTER); diag.getContentPane().add(label, BorderLayout.SOUTH); diag.pack(); diag.setLocationRelativeTo(diag.getParent()); } Runnable r = new Runnable() { @Override public void run() { // determine directories to search in List<File> dirs = new ArrayList<>(); List<String> dirsS = metaData.getFileDirectory(Globals.FILE_FIELD); for (String dirs1 : dirsS) { dirs.add(new File(dirs1)); } // determine extensions Collection<String> extensions = new ArrayList<>(); for (final ExternalFileType type : types) { extensions.add(type.getExtension()); } // Run the search operation: Map<BibEntry, List<File>> result; if (Globals.prefs.getBoolean(JabRefPreferences.AUTOLINK_USE_REG_EXP_SEARCH_KEY)) { String regExp = Globals.prefs.get(JabRefPreferences.REG_EXP_SEARCH_EXPRESSION_KEY); result = RegExpFileSearch.findFilesForSet(entries, extensions, dirs, regExp); } else { result = FileUtil.findAssociatedFiles(entries, extensions, dirs); } boolean foundAny = false; // Iterate over the entries: for (Entry<BibEntry, List<File>> entryFilePair : result.entrySet()) { FileListTableModel tableModel; String oldVal = entryFilePair.getKey().getField(Globals.FILE_FIELD); if (singleTableModel == null) { tableModel = new FileListTableModel(); if (oldVal != null) { tableModel.setContent(oldVal); } } else { assert entries.size() == 1; tableModel = singleTableModel; } List<File> files = entryFilePair.getValue(); for (File f : files) { f = FileUtil.shortenFileName(f, dirsS); boolean alreadyHas = false; //System.out.println("File: "+f.getPath()); for (int j = 0; j < tableModel.getRowCount(); j++) { FileListEntry existingEntry = tableModel.getEntry(j); //System.out.println("Comp: "+existingEntry.getLink()); if (new File(existingEntry.link).equals(f)) { alreadyHas = true; break; } } if (!alreadyHas) { foundAny = true; ExternalFileType type; Optional<String> extension = FileUtil.getFileExtension(f); if (extension.isPresent()) { type = ExternalFileTypes.getInstance().getExternalFileTypeByExt(extension.get()); } else { type = new UnknownExternalFileType(""); } FileListEntry flEntry = new FileListEntry(f.getName(), f.getPath(), type); tableModel.addEntry(tableModel.getRowCount(), flEntry); String newVal = tableModel.getStringRepresentation(); if (newVal.isEmpty()) { newVal = null; } if (ce != null) { // store undo information UndoableFieldChange change = new UndoableFieldChange(entryFilePair.getKey(), Globals.FILE_FIELD, oldVal, newVal); ce.addEdit(change); } // hack: if table model is given, do NOT modify entry if (singleTableModel == null) { entryFilePair.getKey().setField(Globals.FILE_FIELD, newVal); } if (changedEntries != null) { changedEntries.add(entryFilePair.getKey()); } } } } // handle callbacks and dialog // FIXME: The ID signals if action was successful :/ final int id = foundAny ? 1 : 0; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (diag != null) { diag.dispose(); } if (callback != null) { callback.actionPerformed(new ActionEvent(this, id, "")); } } }); } }; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { // show dialog which will be hidden when the task is done if (diag != null) { diag.setVisible(true); } } }); return r; }
From source file:net.automatalib.visualization.jung.JungGraphVisualizationProvider.java
@Override public <N, E> void visualize(Graph<N, E> graph, GraphDOTHelper<N, ? super E> helper, boolean modal, Map<String, String> options) { DirectedGraph<NodeVisualization, EdgeVisualization> visGraph = createVisualizationGraph(graph, helper); Layout<NodeVisualization, EdgeVisualization> layout = new KKLayout<>(visGraph); VisualizationViewer<NodeVisualization, EdgeVisualization> vv = new VisualizationViewer<>(layout); setupRenderContext(vv.getRenderContext()); vv.setGraphMouse(mouse);//from ww w. jav a2 s .c o m final JDialog frame = new JDialog((Dialog) null, "Visualization", modal); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.getContentPane().add(vv); frame.pack(); frame.setVisible(true); }
From source file:org.nekorp.workflow.desktop.view.resource.imp.ServicioPreviewDialogFactory.java
@Override public JDialog createDialog(Frame frame, boolean modal) { JDialog dialog = new JDialog(mainFrame, true); dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); dialog.setTitle("Consulta Servicio " + " Nmero: " + viewServicioModel.getId()); servicioPreview.setParent(dialog);/* w ww . jav a2 s. c o m*/ servicioPreview.iniciaVista(); servicioPreview.setEditableStatus(false); dialog.add(servicioPreview); dialog.validate(); dialog.pack(); dialog.setLocationRelativeTo(mainFrame); return dialog; }
From source file:esmska.gui.AboutFrame.java
private void licenseButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_licenseButtonActionPerformed //show licence try {/*w w w . j a v a2 s . c o m*/ logger.fine("Showing license..."); String license = IOUtils.toString(getClass().getResourceAsStream(RES + "license.txt"), "UTF-8"); final String agpl = IOUtils.toString(getClass().getResourceAsStream(RES + "gnu-agpl.txt"), "UTF-8"); license = MiscUtils.escapeHtml(license); license = license.replaceAll("GNU Affero General Public License", "<a href=\"agpl\">GNU Affero General Public License</a>"); final JTextPane tp = new JTextPane(); tp.setContentType("text/html; charset=UTF-8"); tp.setText("<html><pre>" + license + "</pre></html>"); tp.setEditable(false); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); tp.setPreferredSize(new Dimension((int) d.getWidth() / 2, (int) d.getHeight() / 2)); //reasonable size tp.setCaretPosition(0); //make links clickable tp.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(final HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { logger.fine("Showing GNU AGPL..."); tp.setText(null); tp.setContentType("text/plain"); tp.setText(agpl); tp.setCaretPosition(0); } } }); String option = l10n.getString("AboutFrame.Acknowledge"); JOptionPane op = new JOptionPane(new JScrollPane(tp), JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[] { option }, option); JDialog dialog = op.createDialog(this, l10n.getString("AboutFrame.License")); dialog.setResizable(true); dialog.pack(); dialog.setVisible(true); } catch (IOException ex) { logger.log(Level.WARNING, "Could not show license", ex); } }