List of usage examples for javax.swing JDialog pack
@SuppressWarnings("deprecation") public void pack()
From source file:com.marginallyclever.makelangelo.MainGUI.java
protected boolean ChooseImageConversionOptions(boolean isDXF) { final JDialog driver = new JDialog(mainframe, translator.get("ConversionOptions"), true); driver.setLayout(new GridBagLayout()); final String[] choices = machineConfiguration.getKnownMachineNames(); final JComboBox<String> machine_choice = new JComboBox<String>(choices); machine_choice.setSelectedIndex(machineConfiguration.getCurrentMachineIndex()); final JSlider input_paper_margin = new JSlider(JSlider.HORIZONTAL, 0, 50, 100 - (int) (machineConfiguration.paper_margin * 100)); input_paper_margin.setMajorTickSpacing(10); input_paper_margin.setMinorTickSpacing(5); input_paper_margin.setPaintTicks(false); input_paper_margin.setPaintLabels(true); //final JCheckBox allow_metrics = new JCheckBox(String.valueOf("I want to add the distance drawn to the // total")); //allow_metrics.setSelected(allowMetrics); final JCheckBox reverse_h = new JCheckBox(translator.get("FlipForGlass")); reverse_h.setSelected(machineConfiguration.reverseForGlass); final JButton cancel = new JButton(translator.get("Cancel")); final JButton save = new JButton(translator.get("Start")); String[] filter_names = new String[image_converters.size()]; Iterator<Filter> fit = image_converters.iterator(); int i = 0;/*from ww w . jav a 2s . c o m*/ while (fit.hasNext()) { Filter f = fit.next(); filter_names[i++] = f.GetName(); } final JComboBox<String> input_draw_style = new JComboBox<String>(filter_names); input_draw_style.setSelectedIndex(GetDrawStyle()); GridBagConstraints c = new GridBagConstraints(); //c.gridwidth=4; c.gridx=0; c.gridy=0; driver.add(allow_metrics,c); int y = 0; c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = y; driver.add(new JLabel(translator.get("MenuLoadMachineConfig")), c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 2; c.gridx = 1; c.gridy = y++; driver.add(machine_choice, c); if (!isDXF) { c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = y; driver.add(new JLabel(translator.get("ConversionStyle")), c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 3; c.gridx = 1; c.gridy = y++; driver.add(input_draw_style, c); } c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = y; driver.add(new JLabel(translator.get("PaperMargin")), c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 3; c.gridx = 1; c.gridy = y++; driver.add(input_paper_margin, c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 1; c.gridx = 1; c.gridy = y++; driver.add(reverse_h, c); c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 2; c.gridy = y; driver.add(save, c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 1; c.gridx = 3; c.gridy = y++; driver.add(cancel, c); startConvertingNow = false; ActionListener driveButtons = new ActionListener() { public void actionPerformed(ActionEvent e) { Object subject = e.getSource(); if (subject == save) { long new_uid = Long.parseLong(choices[machine_choice.getSelectedIndex()]); machineConfiguration.LoadConfig(new_uid); SetDrawStyle(input_draw_style.getSelectedIndex()); machineConfiguration.paper_margin = (100 - input_paper_margin.getValue()) * 0.01; machineConfiguration.reverseForGlass = reverse_h.isSelected(); machineConfiguration.SaveConfig(); // if we aren't connected, don't show the new if (connectionToRobot != null && !connectionToRobot.isRobotConfirmed()) { // Force update of graphics layout. previewPane.updateMachineConfig(); // update window title mainframe.setTitle( translator.get("TitlePrefix") + Long.toString(machineConfiguration.robot_uid) + translator.get("TitleNotConnected")); } startConvertingNow = true; driver.dispose(); } if (subject == cancel) { driver.dispose(); } } }; save.addActionListener(driveButtons); cancel.addActionListener(driveButtons); driver.getRootPane().setDefaultButton(save); driver.pack(); driver.setVisible(true); return startConvertingNow; }
From source file:com.tascape.qa.th.android.driver.App.java
/** * The method starts a GUI to let an user inspect element tree and take screenshot when the user is interacting * with the app-under-test manually. Please make sure to set timeout long enough for manual interaction. * * @param timeoutMinutes timeout in minutes to fail the manual steps * * @throws Exception if case of error/*from w w w . j a va 2s. com*/ */ public void interactManually(int timeoutMinutes) throws Exception { LOG.info("Start manual UI interaction"); long end = System.currentTimeMillis() + timeoutMinutes * 60000L; AtomicBoolean visible = new AtomicBoolean(true); AtomicBoolean pass = new AtomicBoolean(false); String tName = Thread.currentThread().getName() + "m"; SwingUtilities.invokeLater(() -> { JDialog jd = new JDialog((JFrame) null, "Manual Device UI Interaction - " + device.getProductDetail()); jd.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); JPanel jpContent = new JPanel(new BorderLayout()); jd.setContentPane(jpContent); jpContent.setPreferredSize(new Dimension(1088, 828)); jpContent.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel jpInfo = new JPanel(); jpContent.add(jpInfo, BorderLayout.PAGE_START); jpInfo.setLayout(new BorderLayout()); { JButton jb = new JButton("PASS"); jb.setForeground(Color.green.darker()); jb.setFont(jb.getFont().deriveFont(Font.BOLD)); jpInfo.add(jb, BorderLayout.LINE_START); jb.addActionListener(event -> { pass.set(true); jd.dispose(); visible.set(false); }); } { JButton jb = new JButton("FAIL"); jb.setForeground(Color.red); jb.setFont(jb.getFont().deriveFont(Font.BOLD)); jpInfo.add(jb, BorderLayout.LINE_END); jb.addActionListener(event -> { pass.set(false); jd.dispose(); visible.set(false); }); } JLabel jlTimeout = new JLabel("xxx seconds left", SwingConstants.CENTER); jpInfo.add(jlTimeout, BorderLayout.CENTER); jpInfo.add(jlTimeout, BorderLayout.CENTER); new SwingWorker<Long, Long>() { @Override protected Long doInBackground() throws Exception { while (System.currentTimeMillis() < end) { Thread.sleep(1000); long left = (end - System.currentTimeMillis()) / 1000; this.publish(left); } return 0L; } @Override protected void process(List<Long> chunks) { Long l = chunks.get(chunks.size() - 1); jlTimeout.setText(l + " seconds left"); if (l < 850) { jlTimeout.setForeground(Color.red); } } }.execute(); JPanel jpResponse = new JPanel(new BorderLayout()); JPanel jpProgress = new JPanel(new BorderLayout()); jpResponse.add(jpProgress, BorderLayout.PAGE_START); JTextArea jtaJson = new JTextArea(); jtaJson.setEditable(false); jtaJson.setTabSize(4); Font font = jtaJson.getFont(); jtaJson.setFont(new Font("Courier New", font.getStyle(), font.getSize())); JTree jtView = new JTree(); JTabbedPane jtp = new JTabbedPane(); jtp.add("tree", new JScrollPane(jtView)); jtp.add("json", new JScrollPane(jtaJson)); jpResponse.add(jtp, BorderLayout.CENTER); JPanel jpScreen = new JPanel(); jpScreen.setMinimumSize(new Dimension(200, 200)); jpScreen.setLayout(new BoxLayout(jpScreen, BoxLayout.PAGE_AXIS)); JScrollPane jsp1 = new JScrollPane(jpScreen); jpResponse.add(jsp1, BorderLayout.LINE_START); JPanel jpJs = new JPanel(new BorderLayout()); JTextArea jtaJs = new JTextArea(); jpJs.add(new JScrollPane(jtaJs), BorderLayout.CENTER); JSplitPane jSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jpResponse, jpJs); jSplitPane.setResizeWeight(0.88); jpContent.add(jSplitPane, BorderLayout.CENTER); JPanel jpLog = new JPanel(); jpLog.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); jpLog.setLayout(new BoxLayout(jpLog, BoxLayout.LINE_AXIS)); JCheckBox jcbTap = new JCheckBox("Enable Click", null, false); jpLog.add(jcbTap); jpLog.add(Box.createHorizontalStrut(8)); JButton jbLogUi = new JButton("Log Screen"); jpResponse.add(jpLog, BorderLayout.PAGE_END); { jpLog.add(jbLogUi); jbLogUi.addActionListener((ActionEvent event) -> { jtaJson.setText("waiting for screenshot..."); Thread t = new Thread(tName) { @Override public void run() { LOG.debug("\n\n"); try { WindowHierarchy wh = device.loadWindowHierarchy(); jtView.setModel(getModel(wh)); jtaJson.setText(""); jtaJson.append(wh.root.toJson().toString(2)); jtaJson.append("\n"); File png = device.takeDeviceScreenshot(); BufferedImage image = ImageIO.read(png); int w = device.getDisplayWidth(); int h = device.getDisplayHeight(); BufferedImage resizedImg = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = resizedImg.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2.drawImage(image, 0, 0, w, h, null); g2.dispose(); JLabel jLabel = new JLabel(new ImageIcon(resizedImg)); jpScreen.removeAll(); jsp1.setPreferredSize(new Dimension(w + 30, h)); jpScreen.add(jLabel); jLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { LOG.debug("clicked at {},{}", e.getPoint().getX(), e.getPoint().getY()); if (jcbTap.isSelected()) { device.click(e.getPoint().x, e.getPoint().y); device.waitForIdle(); jbLogUi.doClick(); } } }); } catch (Exception ex) { LOG.error("Cannot log screen", ex); jtaJson.append("Cannot log screen"); } jtaJson.append("\n\n\n"); LOG.debug("\n\n"); jd.setSize(jd.getBounds().width + 1, jd.getBounds().height + 1); jd.setSize(jd.getBounds().width - 1, jd.getBounds().height - 1); } }; t.start(); }); } jpLog.add(Box.createHorizontalStrut(38)); { JButton jbLogMsg = new JButton("Log Message"); jpLog.add(jbLogMsg); JTextField jtMsg = new JTextField(10); jpLog.add(jtMsg); jtMsg.addFocusListener(new FocusListener() { @Override public void focusLost(final FocusEvent pE) { } @Override public void focusGained(final FocusEvent pE) { jtMsg.selectAll(); } }); jtMsg.addKeyListener(new KeyAdapter() { @Override public void keyPressed(java.awt.event.KeyEvent e) { if (e.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) { jbLogMsg.doClick(); } } }); jbLogMsg.addActionListener(event -> { Thread t = new Thread(tName) { @Override public void run() { String msg = jtMsg.getText(); if (StringUtils.isNotBlank(msg)) { LOG.info("{}", msg); jtMsg.selectAll(); } } }; t.start(); try { t.join(); } catch (InterruptedException ex) { LOG.error("Cannot take screenshot", ex); } jtMsg.requestFocus(); }); } jpLog.add(Box.createHorizontalStrut(38)); { JButton jbClear = new JButton("Clear"); jpLog.add(jbClear); jbClear.addActionListener(event -> { jtaJson.setText(""); }); } JPanel jpAction = new JPanel(); jpContent.add(jpAction, BorderLayout.PAGE_END); jpAction.setLayout(new BoxLayout(jpAction, BoxLayout.LINE_AXIS)); jpJs.add(jpAction, BorderLayout.PAGE_END); jd.pack(); jd.setVisible(true); jd.setLocationRelativeTo(null); jbLogUi.doClick(); }); while (visible.get()) { if (System.currentTimeMillis() > end) { LOG.error("Manual UI interaction timeout"); break; } Thread.sleep(500); } if (pass.get()) { LOG.info("Manual UI Interaction returns PASS"); } else { Assert.fail("Manual UI Interaction returns FAIL"); } }
From source file:nick.gaImageRecognitionGui.panel.JPanelTraining.java
private void jButtonTrainActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonTrainActionPerformed IApiTrainer trainer = initTrainer(); saveSettings();//from w w w . jav a 2 s .c o m JFrame topFrame = (JFrame) SwingUtilities.getWindowAncestor(this); final JDialog frame = new JDialog(topFrame, false); JPanelTrainingInProgress trainingPanel = new JPanelTrainingInProgress(trainer); frame.getContentPane().add(trainingPanel); frame.pack(); Util.centreWindow(frame); frame.setVisible(true); }
From source file:nick.gaImageRecognitionGui.panel.JPanelTraining.java
private void jButtonSetTrainingRulesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSetTrainingRulesActionPerformed JFrame topFrame = (JFrame) SwingUtilities.getWindowAncestor(this); final JDialog frame = new JDialog(topFrame, true); JPanelSetTrainingRules setTrainingrules = new JPanelSetTrainingRules(trainingRules); frame.getContentPane().add(setTrainingrules); frame.pack(); Util.centreWindow(frame);/*from ww w . j a va 2s. c o m*/ frame.setVisible(true); }
From source file:ome.formats.importer.gui.FileQueueHandler.java
/** * Retrieve the file chooser's selected reader then iterate over * each of our supplied containers filtering out those whose format * do not match those of the selected reader. * /* w ww.ja v a 2 s . co m*/ * @param allContainers List of ImporterContainers */ private void handleFiles(List<ImportContainer> allContainers) { FileFilter selectedFilter = fileChooser.getFileFilter(); IFormatReader selectedReader = null; if (selectedFilter instanceof FormatFileFilter) { log.debug("Selected file filter: " + selectedFilter); selectedReader = ((FormatFileFilter) selectedFilter).getReader(); } List<ImportContainer> containers = new ArrayList<ImportContainer>(); for (ImportContainer ic : allContainers) { if (selectedReader == null) { // The user selected "All supported file types" containers = allContainers; break; } String a = selectedReader.getFormat(); String b = ic.getReader(); if (a.equals(b) || b == null) { containers.add(ic); } else { log.debug(String.format("Skipping %s (%s != %s)", ic.getFile().getAbsoluteFile(), a, b)); } } Boolean spw = spwOrNull(containers); if (containers.size() == 0 && !candidatesFormatException) { final JOptionPane optionPane = new JOptionPane("\nNo importable files found in this selection.", JOptionPane.WARNING_MESSAGE); final JDialog errorDialog = new JDialog(viewer, "No Importable Files Found", true); errorDialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (errorDialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { errorDialog.dispose(); } } }); errorDialog.toFront(); errorDialog.pack(); errorDialog.setLocationRelativeTo(viewer); errorDialog.setVisible(true); } if (candidatesFormatException) { viewer.candidateErrorsCollected(viewer); candidatesFormatException = false; } if (spw == null) { addEnabled(true); containers.clear(); return; // Invalid containers. } if (getOMEROMetadataStoreClient() != null && spw.booleanValue()) { addEnabled(true); SPWDialog dialog = new SPWDialog(config, viewer, "Screen Import", true, getOMEROMetadataStoreClient()); if (dialog.cancelled == true || dialog.screen == null) return; for (ImportContainer ic : containers) { ic.setTarget(dialog.screen); String title = dialog.screen.getName().getValue(); addFileToQueue(ic, title, false, 0); } qTable.centerOnRow(qTable.getQueue().getRowCount() - 1); qTable.importBtn.requestFocus(); } else if (getOMEROMetadataStoreClient() != null) { addEnabled(true); ImportDialog dialog = new ImportDialog(config, viewer, "Image Import", true, getOMEROMetadataStoreClient()); if (dialog.cancelled == true || dialog.dataset == null) return; Double[] pixelSizes = new Double[] { dialog.pixelSizeX, dialog.pixelSizeY, dialog.pixelSizeZ }; Boolean useFullPath = config.useFullPath.get(); if (dialog.useCustomNamingChkBox.isSelected() == false) useFullPath = null; //use the default bio-formats naming for (ImportContainer ic : containers) { ic.setTarget(dialog.dataset); ic.setUserPixels(pixelSizes); ic.setArchive(dialog.archiveImage.isSelected()); String title = ""; if (dialog.project.getId() != null) { ic.setProjectID(dialog.project.getId().getValue()); title = dialog.project.getName().getValue() + " / " + dialog.dataset.getName().getValue(); } else { title = "none / " + dialog.dataset.getName().getValue(); } addFileToQueue(ic, title, useFullPath, config.numOfDirectories.get()); } qTable.centerOnRow(qTable.getQueue().getRowCount() - 1); qTable.importBtn.requestFocus(); } else { addEnabled(true); JOptionPane.showMessageDialog(viewer, "Due to an error the application is unable to \n" + "retrieve an OMEROMetadataStore and cannot continue." + "The most likely cause for this error is that you" + "are not logged in. Please try to login again."); } }
From source file:ome.formats.importer.gui.GuiImporter.java
public void update(IObservable importLibrary, ImportEvent event) { // Keep alive has failed, call logout if (event instanceof ImportEvent.LOGGED_OUT) { logout();//from www . j a va2 s. co m showLogoutMessage(); } if (event instanceof ImportEvent.LOADING_IMAGE) { ImportEvent.LOADING_IMAGE ev = (ImportEvent.LOADING_IMAGE) event; getStatusBar().setProgress(true, -1, "Loading file " + ev.numDone + " of " + ev.total); appendToOutput("> [" + ev.index + "] Loading image \"" + ev.shortName + "\"...\n"); getStatusBar().setStatusIcon("gfx/import_icon_16.png", "Prepping file \"" + ev.shortName); } else if (event instanceof ImportEvent.LOADED_IMAGE) { ImportEvent.LOADED_IMAGE ev = (ImportEvent.LOADED_IMAGE) event; getStatusBar().setProgress(true, -1, "Analyzing file " + ev.numDone + " of " + ev.total); appendToOutput(" Succesfully loaded.\n"); appendToOutput("> [" + ev.index + "] Importing metadata for " + "image \"" + ev.shortName + "\"... "); getStatusBar().setStatusIcon("gfx/import_icon_16.png", "Analyzing the metadata for file \"" + ev.shortName); } else if (event instanceof ImportEvent.BEGIN_SAVE_TO_DB) { ImportEvent.BEGIN_SAVE_TO_DB ev = (ImportEvent.BEGIN_SAVE_TO_DB) event; appendToOutput("> [" + ev.index + "] Saving metadata for " + "image \"" + ev.filename + "\"... "); getStatusBar().setStatusIcon("gfx/import_icon_16.png", "Saving metadata for file \"" + ev.filename); } else if (event instanceof ImportEvent.DATASET_STORED) { ImportEvent.DATASET_STORED ev = (ImportEvent.DATASET_STORED) event; int num = ev.numDone; int tot = ev.total; int pro = num - 1; appendToOutputLn("Successfully stored to " + ev.target.getClass().getSimpleName() + " \"" + ev.filename + "\" with id \"" + ev.target.getId().getValue() + "\"."); appendToOutputLn( "> [" + ev.series + "] Importing pixel data for " + "image \"" + ev.filename + "\"... "); getStatusBar().setProgress(true, 0, "Importing file " + num + " of " + tot); getStatusBar().setProgressValue(pro); getStatusBar().setStatusIcon("gfx/import_icon_16.png", "Importing the pixel data for file \"" + ev.filename); appendToOutput("> Importing plane: "); } else if (event instanceof ImportEvent.DATA_STORED) { ImportEvent.DATA_STORED ev = (ImportEvent.DATA_STORED) event; appendToOutputLn("> Successfully stored with pixels id \"" + ev.pixId + "\"."); appendToOutputLn("> [" + ev.filename + "] Image imported successfully!"); } else if (event instanceof FILE_EXCEPTION) { FILE_EXCEPTION ev = (FILE_EXCEPTION) event; if (IOException.class.isAssignableFrom(ev.exception.getClass())) { final JOptionPane optionPane = new JOptionPane( "The importer cannot retrieve one of your images in a timely manner.\n" + "The file in question is:\n'" + ev.filename + "'\n\n" + "There are a number of reasons you may see this error:\n" + " - The file has been deleted.\n" + " - There was a networking error retrieving a remotely saved file.\n" + " - An archived file has not been fully retrieved from backup.\n\n" + "The importer should now continue with the remainer of your imports.\n", JOptionPane.ERROR_MESSAGE); final JDialog dialog = new JDialog(this, "IO Error"); dialog.setAlwaysOnTop(true); dialog.setContentPane(optionPane); dialog.pack(); dialog.setVisible(true); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { dialog.dispose(); } } }); } } else if (event instanceof EXCEPTION_EVENT) { EXCEPTION_EVENT ev = (EXCEPTION_EVENT) event; log.error("EXCEPTION_EVENT", ev.exception); } else if (event instanceof INTERNAL_EXCEPTION) { INTERNAL_EXCEPTION e = (INTERNAL_EXCEPTION) event; log.error("INTERNAL_EXCEPTION", e.exception); // What else should we do here? Why are EXCEPTION_EVENTs being // handled here? } else if (event instanceof ImportEvent.ERRORS_PENDING) { tPane.setIconAt(4, GuiCommonElements.getImageIcon(ERROR_ICON_ANIM)); errors_pending = true; error_notification = true; } else if (event instanceof ImportEvent.ERRORS_COMPLETE) { tPane.setIconAt(4, GuiCommonElements.getImageIcon(ERROR_ICON)); error_notification = false; } else if (event instanceof ImportEvent.ERRORS_COMPLETE) { tPane.setIconAt(4, GuiCommonElements.getImageIcon(ERROR_ICON)); error_notification = false; } else if (event instanceof ImportEvent.ERRORS_FAILED) { sendingErrorsFailed(this); } else if (event instanceof ImportEvent.IMPORT_QUEUE_DONE && errors_pending == true) { errors_pending = false; importErrorsCollected(this); } }
From source file:ome.formats.importer.gui.GuiImporter.java
/** * Display errors in import dialog //w w w .jav a 2 s . c om * * @param frame - parent frame */ private void importErrorsCollected(Component frame) { final JOptionPane optionPane = new JOptionPane( "\nYour import has produced one or more errors, " + "\nvisit the 'Import Errors' tab for details.", JOptionPane.WARNING_MESSAGE); final JDialog errorDialog = new JDialog(this, "Errors Collected", false); errorDialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (errorDialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { errorDialog.dispose(); } } }); errorDialog.toFront(); errorDialog.pack(); errorDialog.setLocationRelativeTo(frame); errorDialog.setVisible(true); }
From source file:ome.formats.importer.gui.GuiImporter.java
/** * Display errors in candidates dialog/*from ww w. j a v a 2 s. c o m*/ * * @param frame - parent frame */ public void candidateErrorsCollected(Component frame) { errors_pending = false; final JOptionPane optionPane = new JOptionPane( "\nAdding these files to the queue has produced one or more errors and some" + "\n files will not be displayed on the queue. View the 'Import Errors' tab for details.", JOptionPane.WARNING_MESSAGE); final JDialog errorDialog = new JDialog(this, "Errors Collected", true); errorDialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (errorDialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { errorDialog.dispose(); } } }); errorDialog.toFront(); errorDialog.pack(); errorDialog.setLocationRelativeTo(frame); errorDialog.setVisible(true); }
From source file:ome.formats.importer.gui.GuiImporter.java
/** * Display failed sending errors dialog//www . j a v a 2 s .c o m * * @param frame - parent frame */ public void sendingErrorsFailed(Component frame) { final JOptionPane optionPane = new JOptionPane( "\nDue to an error we were not able to send your error messages." + "\nto our feedback server. Please try again.", JOptionPane.WARNING_MESSAGE); final JDialog failedDialog = new JDialog(this, "Feedback Failed!", true); failedDialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (failedDialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { failedDialog.dispose(); } } }); failedDialog.toFront(); failedDialog.pack(); failedDialog.setLocationRelativeTo(frame); failedDialog.setVisible(true); }
From source file:ome.formats.importer.gui.ImportDialog.java
/** * Dialog explaining metadata limitations when changing the main dialog's naming settings * //w w w .j a va2s.c o m * @param frame - parent component */ public void sendNamingWarning(Component frame) { final JOptionPane optionPane = new JOptionPane( "\nNOTE: Some file formats do not include the file name in their metadata, " + "\nand disabling this option may result in files being imported without a " + "\nreference to their file name. For example, 'myfile.lsm [image001]' " + "\nwould show up as 'image001' with this optioned turned off.", JOptionPane.WARNING_MESSAGE); final JDialog warningDialog = new JDialog(this, "Naming Warning!", true); warningDialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (warningDialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { warningDialog.dispose(); } } }); warningDialog.toFront(); warningDialog.pack(); warningDialog.setLocationRelativeTo(frame); warningDialog.setVisible(true); }