List of usage examples for javax.swing JDialog JDialog
public JDialog()
From source file:geva.Operator.Operations.UserSelect.java
private void initialiseDialog() { dialog = new JDialog(); dialog.setLayout(new BorderLayout()); if (rectangle != null) dialog.setBounds(rectangle);/* w ww . j a v a 2 s .c o m*/ else dialog.setSize(400, 300); dialog.setModal(true); cmdDone.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doneUsed = true; dialog.setVisible(false); } }); enableDone(false); guiPanel = new JPanel(); dialog.add(new JScrollPane(guiPanel), BorderLayout.CENTER); dialog.add(cmdDone, BorderLayout.SOUTH); }
From source file:coreferenceresolver.gui.MarkupGUI.java
public MarkupGUI() throws IOException { highlightPainters = new ArrayList<>(); for (int i = 0; i < COLORS.length; ++i) { DefaultHighlighter.DefaultHighlightPainter highlightPainter = new DefaultHighlighter.DefaultHighlightPainter( COLORS[i]);/*from ww w . ja v a 2 s.c o m*/ highlightPainters.add(highlightPainter); } defaulPath = FileUtils.readFileToString(new File(".\\src\\coreferenceresolver\\gui\\defaultpath")); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLayout(new BorderLayout()); this.setSize(java.awt.Toolkit.getDefaultToolkit().getScreenSize()); JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); //create menu items JMenuItem importMenuItem = new JMenuItem("Import"); JMenuItem exportMenuItem = new JMenuItem("Export"); fileMenu.add(importMenuItem); fileMenu.add(exportMenuItem); menuBar.add(fileMenu); this.setJMenuBar(menuBar); ScrollablePanel mainPanel = new ScrollablePanel(); mainPanel.setScrollableWidth(ScrollablePanel.ScrollableSizeHint.NONE); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); //IMPORT BUTTON importMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // MarkupGUI.reviewElements.clear(); // MarkupGUI.markupReviews.clear(); JFileChooser markupFileChooser = new JFileChooser(defaulPath); markupFileChooser.setDialogTitle("Choose your markup file"); markupFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); if (markupFileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { final JDialog d = new JDialog(); JPanel p1 = new JPanel(new GridBagLayout()); p1.add(new JLabel("Please Wait..."), new GridBagConstraints()); d.getContentPane().add(p1); d.setSize(100, 100); d.setLocationRelativeTo(null); d.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); d.setModal(true); SwingWorker<?, ?> worker = new SwingWorker<Void, Void>() { protected Void doInBackground() throws IOException, BadLocationException { readMarkupFile(markupFileChooser.getSelectedFile().getAbsolutePath()); for (int i = 0; i < markupReviews.size(); ++i) { mainPanel.add(newReviewPanel(markupReviews.get(i), i)); } return null; } protected void done() { MarkupGUI.this.revalidate(); d.dispose(); } }; worker.execute(); d.setVisible(true); } else { return; } } }); //EXPORT BUTTON: GET NEW VALUE (REF, TYPE) OF NPs exportMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser markupFileChooser = new JFileChooser(defaulPath); markupFileChooser.setDialogTitle("Choose where your markup file saved"); markupFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (markupFileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { final JDialog d = new JDialog(); JPanel p1 = new JPanel(new GridBagLayout()); p1.add(new JLabel("Please Wait..."), new GridBagConstraints()); d.getContentPane().add(p1); d.setSize(100, 100); d.setLocationRelativeTo(null); d.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); d.setModal(true); SwingWorker<?, ?> worker = new SwingWorker<Void, Void>() { protected Void doInBackground() throws IOException { for (Review review : markupReviews) { generateNPsRef(review); } int i = 0; for (ReviewElement reviewElement : reviewElements) { int j = 0; for (Element element : reviewElement.elements) { String newType = element.typeSpinner.getValue().toString(); if (newType.equals("Object")) { markupReviews.get(i).getNounPhrases().get(j).setType(0); } else if (newType.equals("Attribute")) { markupReviews.get(i).getNounPhrases().get(j).setType(3); } else if (newType.equals("Other")) { markupReviews.get(i).getNounPhrases().get(j).setType(1); } else if (newType.equals("Candidate")) { markupReviews.get(i).getNounPhrases().get(j).setType(2); } ++j; } ++i; } initMarkupFile(markupFileChooser.getSelectedFile().getAbsolutePath() + File.separator + "markup.out.txt"); return null; } protected void done() { d.dispose(); try { Desktop.getDesktop() .open(new File(markupFileChooser.getSelectedFile().getAbsolutePath())); } catch (IOException ex) { Logger.getLogger(MarkupGUI.class.getName()).log(Level.SEVERE, null, ex); } } }; worker.execute(); d.setVisible(true); } else { return; } } }); JScrollPane scrollMainPane = new JScrollPane(mainPanel); scrollMainPane.getVerticalScrollBar().setUnitIncrement(16); scrollMainPane.setPreferredSize(new Dimension(this.getWidth(), this.getHeight())); scrollMainPane.setSize(this.getWidth(), this.getHeight()); this.setResizable(false); this.add(scrollMainPane, BorderLayout.CENTER); this.setExtendedState(JFrame.MAXIMIZED_BOTH); this.pack(); }
From source file:com.eviware.soapui.support.SoapUIVersionUpdate.java
public void showNewVersionDownloadDialog() { JPanel versionUpdatePanel = new JPanel(new BorderLayout()); JDialog dialog = new JDialog(); versionUpdatePanel.add(UISupport.buildDescription("New Version of SoapUI is Available", "", null), BorderLayout.NORTH);//from w ww . jav a 2s . c om JEditorPane text = createReleaseNotesPane(); JScrollPane scb = new JScrollPane(text); versionUpdatePanel.add(scb, BorderLayout.CENTER); JPanel toolbar = buildToolbar(dialog); versionUpdatePanel.add(toolbar, BorderLayout.SOUTH); dialog.setTitle("New Version Update"); dialog.setModal(true); dialog.getContentPane().add(versionUpdatePanel); dialog.setSize(new Dimension(500, 640)); UISupport.centerDialog(dialog, SoapUI.getFrame()); dialog.setVisible(true); }
From source file:biomine.bmvis2.pipeline.sources.QueryGraphSource.java
public static QueryGraphSource createFromDialog(Collection<VisualNode> start, String database) { final CrawlSuggestionList sel = new CrawlSuggestionList(); final JDialog dial = new JDialog(); if (database != null) sel.setDatabase(database);//from w w w. jav a 2s .c o m for (VisualNode vn : start) { if (vn.getBMNode() != null) sel.addNode(vn); } dial.setModalityType(ModalityType.APPLICATION_MODAL); final CrawlQuery q = new CrawlQuery(); // Helper class to pass back data from anonymous inner classes to this method class Z { boolean okPressed = false; } final Z z = new Z(); JButton okButton = new JButton(new AbstractAction("OK") { public void actionPerformed(ActionEvent arg0) { dial.setVisible(false); q.addAll(sel.getQueryTerms()); z.okPressed = true; } }); JPanel pane = new JPanel(); pane.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 1; c.fill = c.BOTH; c.gridwidth = 2; c.gridx = 0; c.gridy = 0; pane.add(sel, c); c.weighty = 0; c.gridy++; c.fill = c.HORIZONTAL; c.gridwidth = 1; pane.add(okButton, c); dial.setContentPane(pane); dial.setSize(600, 500); dial.setVisible(true);//this will hopefully block if (z.okPressed) { if (q.size() == 0) { JOptionPane.showMessageDialog(dial, "At least 1 edge must be selected: no queries added"); return null; } return new QueryGraphSource(q, sel.getDatabase()); } return null; }
From source file:GUI.GUI_reporting.java
private void btnLancerStatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLancerStatActionPerformed // TODO add your handling code here: // faire la requete sql et ranger les variables aux bon endroits JDialog reponse = new JDialog(); DefaultPieDataset pieDataset = new DefaultPieDataset(); final DefaultCategoryDataset dataset = new DefaultCategoryDataset(); String text = ""; String Infox = ""; String Infoy = ""; switch (action) {//////////////////:Pie charts////////////////////////////////////// case 1:/*from w w w . j a v a 2 s. c o m*/ //set values pieDataset.setValue("de 700 1100", getEmployeParSalaire(1)); pieDataset.setValue("de 1100 1300", getEmployeParSalaire(2)); pieDataset.setValue("de 1300 1700", getEmployeParSalaire(3)); pieDataset.setValue("Plus de 1700", getEmployeParSalaire(4)); text = "Nombre d'employs par tranche de salaire"; break; case 2: //set values pieDataset.setValue("REA", getEmployeParService(1)); pieDataset.setValue("CHG", getEmployeParService(2)); pieDataset.setValue("CAR", getEmployeParService(3)); text = "Nombre d'employs par service"; break; case 3: //set values pieDataset.setValue("Anesthesiste", getEmployeParSpecialite(1)); pieDataset.setValue("Cardiologue", getEmployeParSpecialite(2)); pieDataset.setValue("Generaliste", getEmployeParSpecialite(3)); pieDataset.setValue("Orthopediste", getEmployeParSpecialite(4)); pieDataset.setValue("Pneumologue", getEmployeParSpecialite(5)); pieDataset.setValue("Radiologue", getEmployeParSpecialite(6)); pieDataset.setValue("Traumatologue", getEmployeParSpecialite(7)); text = "Nombre d'employs par spcialit"; break; case 4: //set values pieDataset.setValue("Jour", getEmployeRotation(1)); pieDataset.setValue("Nuit", getEmployeRotation(2)); text = "Nombre d'employs par rotation"; break; /// diagrammes en barre///////////////////////////// case 5: //dataset.addValue(WIDTH, WIDTH, action); final String REA = "Moyenne pour REA"; final String CHG = "Moyenne pour CHG"; final String CAR = "Moyenne pour CAR"; final String salaire = "salaire"; dataset.addValue(getSalaireParService(1), salaire, REA); dataset.addValue(getSalaireParService(2), salaire, CHG); dataset.addValue(getSalaireParService(3), salaire, CAR); Infox = "service"; Infoy = "salaire"; text = "Salaire moyen par service"; break; case 6: //set values final String malade = "Malade"; final String rea = "REA"; final String chg = "CHG"; final String car = "CAR"; dataset.addValue(getMaladeParService(1), malade, rea); dataset.addValue(getMaladeParService(2), malade, chg); dataset.addValue(getMaladeParService(3), malade, car); Infox = "Service"; Infoy = "Nombre de malades"; text = "Nombre de malade par service"; break; case 7: //set values final String MAAF = "MAAF"; final String MNAM = "MNAM"; final String LMDE = "LMDE"; final String MNH = "MNH"; final String MGEN = "MGEN"; final String MMA = "MMA"; final String CNAMTS = "CNAMTS"; final String CCVRP = "CCVRP"; final String MAS = "MAS"; final String AG2R = "AG2R"; final String MNFTC = "MNFTC"; final String MGSP = "MGSP"; final String salaire0 = "Mutuelle"; Infox = "Mutuelle"; Infoy = "Malades"; text = "Nombre de malades par mutuelle"; // / init dataset.addValue(getMaladeParMutuelle(1), salaire0, MAAF); dataset.addValue(getMaladeParMutuelle(2), salaire0, MNAM); dataset.addValue(getMaladeParMutuelle(3), salaire0, LMDE); dataset.addValue(getMaladeParMutuelle(4), salaire0, MNH); dataset.addValue(getMaladeParMutuelle(5), salaire0, MGEN); dataset.addValue(getMaladeParMutuelle(6), salaire0, MMA); dataset.addValue(getMaladeParMutuelle(7), salaire0, CNAMTS); dataset.addValue(getMaladeParMutuelle(8), salaire0, CCVRP); dataset.addValue(getMaladeParMutuelle(9), salaire0, MAS); dataset.addValue(getMaladeParMutuelle(10), salaire0, AG2R); dataset.addValue(getMaladeParMutuelle(11), salaire0, MNFTC); dataset.addValue(getMaladeParMutuelle(12), salaire0, MGSP); break; case 8: //set values final String malades = "Chambre"; final String reas = "REA"; final String chgs = "CHG"; final String cars = "CAR"; dataset.addValue(getChambreParService(1), malades, reas); dataset.addValue(getChambreParService(2), malades, chgs); dataset.addValue(getChambreParService(3), malades, cars); Infox = "Service"; Infoy = "Nombre de chambre"; text = "Nombre de chambre par service"; break; default: break; } // Piechart if (action > 0 && action < 5) { final JFreeChart pieChart = ChartFactory.createPieChart(text, pieDataset, true, false, false); final ChartPanel cPanel = new ChartPanel(pieChart); reponse.add(cPanel); reponse.pack(); //panelHistogramme.pack(); reponse.setVisible(true); } //Histogramme if (action > 4 && action < 11) { final JFreeChart barChart = ChartFactory.createBarChart(text, Infox, Infoy, dataset, PlotOrientation.VERTICAL, true, true, false); final ChartPanel cPanel = new ChartPanel(barChart); reponse.add(cPanel); reponse.pack(); //panelHistogramme.pack(); reponse.setVisible(true); } /* DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("Valeur1", new Integer(27)); pieDataset.setValue("Valeur2", new Integer(10)); pieDataset.setValue("Valeur3", new Integer(50)); pieDataset.setValue("Valeur4", new Integer(5)); JFreeChart pieChart = ChartFactory.createPieChart("Test camembert",pieDataset, true, true, true); ChartPanel cPanel = new ChartPanel(pieChart); panelHistogramme.add(cPanel); */ }
From source file:es.emergya.ui.plugins.admin.AdminLayers.java
protected SummaryAction getSummaryAction(final CapaInformacion capaInformacion) { SummaryAction action = new SummaryAction(capaInformacion) { private static final long serialVersionUID = -3691171434904452485L; @Override//from w w w . j a va 2s. c om protected JFrame getSummaryDialog() { if (capaInformacion != null) { d = getDialog(capaInformacion, null, "", null, "image/png"); return d; } else { JDialog primera = getJDialog(); primera.setResizable(false); primera.setVisible(true); primera.setAlwaysOnTop(true); } return null; } private JDialog getJDialog() { final JDialog dialog = new JDialog(); dialog.setTitle(i18n.getString("admin.capas.nueva.titleBar")); dialog.setIconImage(getBasicWindow().getIconImage()); dialog.setLayout(new BorderLayout()); JPanel centro = new JPanel(new FlowLayout()); centro.setOpaque(false); JLabel label = new JLabel(i18n.getString("admin.capas.nueva.url")); final JTextField url = new JTextField(50); final JLabel icono = new JLabel(LogicConstants.getIcon("48x48_transparente")); label.setLabelFor(url); centro.add(label); centro.add(url); centro.add(icono); dialog.add(centro, BorderLayout.CENTER); JPanel pie = new JPanel(new FlowLayout(FlowLayout.TRAILING)); pie.setOpaque(false); final JButton siguiente = new JButton(i18n.getString("admin.capas.nueva.boton.siguiente"), LogicConstants.getIcon("button_next")); JButton cancelar = new JButton(i18n.getString("admin.capas.nueva.boton.cancelar"), LogicConstants.getIcon("button_cancel")); final SiguienteActionListener siguienteActionListener = new SiguienteActionListener(url, dialog, icono, siguiente); url.addActionListener(siguienteActionListener); siguiente.addActionListener(siguienteActionListener); cancelar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dialog.dispose(); } }); pie.add(siguiente); pie.add(cancelar); dialog.add(pie, BorderLayout.SOUTH); dialog.getContentPane().setBackground(Color.WHITE); dialog.pack(); dialog.setLocationRelativeTo(null); return dialog; } private JFrame getDialog(final CapaInformacion c, final Capa[] left_items, final String service, final Map<String, Boolean> transparentes, final String png) { if (left_items != null && left_items.length == 0) { JOptionPane.showMessageDialog(AdminLayers.this, i18n.getString("admin.capas.nueva.error.noCapasEnServicio")); } else { final String label_cabecera = i18n.getString("admin.capas.nueva.nombreCapa"); final String label_pie = i18n.getString("admin.capas.nueva.infoAdicional"); final String centered_label = i18n.getString("admin.capas.nueva.origenDatos"); final String left_label = i18n.getString("admin.capas.nueva.subcapasDisponibles"); final String right_label; if (left_items != null) { right_label = i18n.getString("admin.capas.nueva.capasSeleccionadas"); } else { right_label = i18n.getString("admin.capas.ficha.capasSeleccionadas"); } final String tituloVentana, cabecera; if (c.getNombre() == null) { tituloVentana = i18n.getString("admin.capas.nueva.titulo.nuevaCapa"); cabecera = i18n.getString("admin.capas.nueva.cabecera.nuevaCapa"); } else { tituloVentana = i18n.getString("admin.capas.nueva.titulo.ficha"); cabecera = i18n.getString("admin.capas.nueva.cabecera.ficha"); } final Capa[] right_items = c.getCapas().toArray(new Capa[0]); final AdminPanel.SaveOrUpdateAction<CapaInformacion> guardar = layers.new SaveOrUpdateAction<CapaInformacion>( c) { private static final long serialVersionUID = 7447770296943341404L; @Override public void actionPerformed(ActionEvent e) { if (isNew && CapaConsultas.alreadyExists(textfieldCabecera.getText())) { JOptionPane.showMessageDialog(super.frame, i18n.getString("admin.capas.nueva.error.nombreCapaYaExiste")); } else if (textfieldCabecera.getText().isEmpty()) { JOptionPane.showMessageDialog(super.frame, i18n.getString("admin.capas.nueva.error.nombreCapaEnBlanco")); } else if (((DefaultListModel) right.getModel()).size() == 0) { JOptionPane.showMessageDialog(super.frame, i18n.getString("admin.capas.nueva.error.noCapasSeleccionadas")); } else if (cambios) { int i = JOptionPane.showConfirmDialog(super.frame, i18n.getString("admin.capas.nueva.confirmar.guardar.titulo"), i18n.getString("admin.capas.nueva.confirmar.boton.guardar"), JOptionPane.YES_NO_CANCEL_OPTION); if (i == JOptionPane.YES_OPTION) { if (original == null) { original = new CapaInformacion(); } original.setInfoAdicional(textfieldPie.getText()); original.setNombre(textfieldCabecera.getText()); original.setHabilitada(habilitado.isSelected()); original.setOpcional(comboTipoCapa.getSelectedIndex() != 0); boolean transparente = true; HashSet<Capa> capas = new HashSet<Capa>(); List<Capa> capasEnOrdenSeleccionado = new ArrayList<Capa>(); int indice = 0; for (Object c : ((DefaultListModel) right.getModel()).toArray()) { if (c instanceof Capa) { transparente = transparente && (transparentes != null && transparentes.get(((Capa) c).getNombre()) != null && transparentes.get(((Capa) c).getNombre())); capas.add((Capa) c); capasEnOrdenSeleccionado.add((Capa) c); ((Capa) c).setCapaInformacion(original); ((Capa) c).setOrden(indice++); // ((Capa) // c).setNombre(c.toString()); } } original.setCapas(capas); if (original.getId() == null) { String url = nombre.getText(); if (url.indexOf("?") > -1) { if (!url.endsWith("?")) { url += "&"; } } else { url += "?"; } url += "VERSION=" + version + "&REQUEST=GetMap&FORMAT=" + png + "&SERVICE=" + service + "&WIDTH={2}&HEIGHT={3}&BBOX={1}&SRS={0}"; // if (transparente) url += "&TRANSPARENT=TRUE"; url += "&LAYERS="; String estilos = ""; final String coma = "%2C"; if (capasEnOrdenSeleccionado.size() > 0) { for (Capa c : capasEnOrdenSeleccionado) { url += c.getTitulo().replaceAll(" ", "+") + coma; estilos += c.getEstilo() + coma; } estilos = estilos.substring(0, estilos.length() - coma.length()); estilos = estilos.replaceAll(" ", "+"); url = url.substring(0, url.length() - coma.length()); } url += "&STYLES=" + estilos; original.setUrl_visible(original.getUrl()); original.setUrl(url); } CapaInformacionAdmin.saveOrUpdate(original); cambios = false; layers.setTableData(getAll(new CapaInformacion())); closeFrame(); } else if (i == JOptionPane.NO_OPTION) { closeFrame(); } } else { closeFrame(); } } }; JFrame segunda = generateUrlDialog(label_cabecera, label_pie, centered_label, tituloVentana, left_items, right_items, left_label, right_label, guardar, LogicConstants.getIcon("tittleficha_icon_capa"), cabecera, c.getHabilitada(), c.getOpcional(), c.getUrl_visible()); segunda.setResizable(false); if (c != null) { textfieldCabecera.setText(c.getNombre()); textfieldPie.setText(c.getInfoAdicional()); nombre.setText(c.getUrl_visible()); nombre.setEditable(false); if (c.getHabilitada() == null) { c.setHabilitada(false); } habilitado.setSelected(c.getHabilitada()); if (c.isOpcional() != null && c.isOpcional()) { comboTipoCapa.setSelectedIndex(1); } else { comboTipoCapa.setSelectedIndex(0); } } if (c.getId() == null) { habilitado.setSelected(true); comboTipoCapa.setSelectedIndex(1); } habilitado.setEnabled(true); if (c == null || c.getId() == null) { textfieldCabecera.setEditable(true); } else { textfieldCabecera.setEditable(false); } cambios = false; segunda.pack(); segunda.setLocationRelativeTo(null); segunda.setVisible(true); return segunda; } return null; } class SiguienteActionListener implements ActionListener { private final JTextField url; private final JDialog dialog; private final JLabel icono; private final JButton siguiente; public SiguienteActionListener(JTextField url, JDialog dialog, JLabel icono, JButton siguiente) { this.url = url; this.dialog = dialog; this.icono = icono; this.siguiente = siguiente; } @Override public void actionPerformed(ActionEvent e) { final CapaInformacion ci = new CapaInformacion(); ci.setUrl(url.getText()); ci.setCapas(new HashSet<Capa>()); SwingWorker<Object, Object> sw = new SwingWorker<Object, Object>() { private List<Capa> res = new LinkedList<Capa>(); private String service = "WMS"; private String png = null; private Map<String, Boolean> transparentes = new HashMap<String, Boolean>(); private ArrayList<String> errorStack = new ArrayList<String>(); private Boolean goOn = true; @SuppressWarnings(value = "unchecked") @Override protected Object doInBackground() throws Exception { try { final String url2 = ci.getUrl(); WMSClient client = new WMSClient(url2); client.connect(new ICancellable() { @Override public boolean isCanceled() { return false; } @Override public Object getID() { return System.currentTimeMillis(); } }); version = client.getVersion(); for (final String s : client.getLayerNames()) { WMSLayer layer = client.getLayer(s); // this.service = // client.getServiceName(); final Vector allSrs = layer.getAllSrs(); boolean epsg = (allSrs != null) ? allSrs.contains("EPSG:4326") : false; final Vector formats = client.getFormats(); if (formats.contains("image/png")) { png = "image/png"; } else if (formats.contains("IMAGE/PNG")) { png = "IMAGE/PNG"; } else if (formats.contains("png")) { png = "png"; } else if (formats.contains("PNG")) { png = "PNG"; } boolean image = png != null; if (png == null) { png = "IMAGE/PNG"; } if (epsg && image) { boolean hasTransparency = layer.hasTransparency(); this.transparentes.put(s, hasTransparency); Capa capa = new Capa(); capa.setCapaInformacion(ci); if (layer.getStyles().size() > 0) { capa.setEstilo(((WMSStyle) layer.getStyles().get(0)).getName()); } capa.setNombre(layer.getTitle()); capa.setTitulo(s); res.add(capa); if (!hasTransparency) { errorStack.add(i18n.getString(Locale.ROOT, "admin.capas.nueva.error.capaNoTransparente", layer.getTitle())); } } else { String error = ""; // if (opaque) // error += "<li>Es opaca</li>"; if (!image) { error += i18n.getString("admin.capas.nueva.error.formatoPNG"); } if (!epsg) { error += i18n.getString("admin.capas.nueva.error.projeccion"); } final String cadena = i18n.getString(Locale.ROOT, "admin.capas.nueva.error.errorCapa", new Object[] { s, error }); errorStack.add(cadena); } } } catch (final Throwable t) { log.error("Error al parsear el WMS", t); goOn = false; icono.setIcon(LogicConstants.getIcon("48x48_transparente")); JOptionPane.showMessageDialog(dialog, i18n.getString("admin.capas.nueva.error.errorParseoWMS")); siguiente.setEnabled(true); } return null; } @Override protected void done() { super.done(); if (goOn) { dialog.dispose(); ci.setUrl_visible(ci.getUrl()); final JFrame frame = getDialog(ci, res.toArray(new Capa[0]), service, transparentes, png); if (!errorStack.isEmpty()) { String error = "<html>"; for (final String s : errorStack) { error += s + "<br/>"; } error += "</html>"; final String errorString = error; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JOptionPane.showMessageDialog(frame, errorString); } }); } } } }; sw.execute(); icono.setIcon(LogicConstants.getIcon("anim_conectando")); icono.repaint(); siguiente.setEnabled(false); } } }; return action; }
From source file:com.net2plan.gui.GUINet2Plan.java
private void showKeyCombinations() { Component component = container.getComponent(0); if (!(component instanceof IGUIModule)) { ErrorHandling.showErrorDialog("No tool is active", "Unable to show key associations"); return;/*from w w w . ja va2 s. co m*/ } final JDialog dialog = new JDialog(); dialog.setTitle("Key combinations"); SwingUtils.configureCloseDialogOnEscape(dialog); dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); dialog.setSize(new Dimension(500, 300)); dialog.setLocationRelativeTo(null); dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); dialog.setLayout(new MigLayout("fill, insets 0 0 0 0")); final String[] tableHeader = StringUtils.arrayOf("Key combination", "Action"); DefaultTableModel model = new ClassAwareTableModel(); model.setDataVector(new Object[1][tableHeader.length], tableHeader); AdvancedJTable table = new AdvancedJTable(model); JScrollPane scrollPane = new JScrollPane(table); dialog.add(scrollPane, "grow"); RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model); table.setRowSorter(sorter); table.getTableHeader().addMouseListener(new ColumnFitAdapter()); IGUIModule module = (IGUIModule) component; Map<String, KeyStroke> keyCombinations = module.getKeyCombinations(); if (!keyCombinations.isEmpty()) { model.removeRow(0); for (Entry<String, KeyStroke> keyCombination : keyCombinations.entrySet()) { String description = keyCombination.getKey(); KeyStroke keyStroke = keyCombination.getValue(); model.addRow(StringUtils.arrayOf(description, keyStroke.toString().replaceAll(" pressed ", " "))); } } dialog.setVisible(true); }
From source file:gda.gui.mca.McaGUI.java
private void makeTcaControlDialog() { if (tcaControlPanel == null) { tcaControlPanel = new TcaPanel(); tcaDialog = new JDialog(); Object[] options = { "OK" }; Object[] array = { tcaControlPanel }; // Create the JOptionPane. final JOptionPane optionPane = new JOptionPane(array, JOptionPane.PLAIN_MESSAGE, JOptionPane.YES_OPTION, null, options, options[0]); optionPane.addPropertyChangeListener(new PropertyChangeListener() { @Override// w ww .ja v a2 s .c o m public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (isVisible() && (e.getSource() == optionPane) && (JOptionPane.VALUE_PROPERTY.equals(prop) || JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) { Object value = optionPane.getValue(); if (value == JOptionPane.UNINITIALIZED_VALUE) { // ignore reset return; } // Reset the JOptionPane's value. // If you don't do this, then if the user // presses the same button next time, no // property change event will be fired. optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE); if ("OK".equals(value)) { tcaDialog.setVisible(false); } } } }); tcaDialog.setContentPane(optionPane); tcaDialog.pack(); tcaDialog.setTitle("TCA Controls"); tcaDialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); } }
From source file:com.stonelion.zooviewer.ui.JZVNodePanel.java
private JDialog createAddChildDialog() { final JDialog dlg = new JDialog(); dlg.setModal(true);/*from w w w. j a v a 2 s . c om*/ // Content final JPanel content = new JPanel(); content.setLayout(new BorderLayout()); content.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); // child name AlignmentGridPanel pathPanel = new AlignmentGridPanel(); final JTextField childNameText = new JTextField(); final RSyntaxTextArea childDataArea = new RSyntaxTextArea(); final JMenuBar bar = new JMenuBar(); final JMenu menu = new JMenu("Syntax Highlight"); bar.add(menu); setMenuItem(menu, childDataArea, SyntaxConstants.SYNTAX_STYLE_XML); setMenuItem(menu, childDataArea, SyntaxConstants.SYNTAX_STYLE_JAVA); setMenuItem(menu, childDataArea, SyntaxConstants.SYNTAX_STYLE_PROPERTIES_FILE); pathPanel.addLine(new Component[] { new JLabel("Select:"), bar }); pathPanel.addLine(new Component[] { new JLabel("Name: "), childNameText }); pathPanel.addLine(new Component[] { new JLabel("Data: ") }); content.add(pathPanel, BorderLayout.NORTH); content.add(new RTextScrollPane(childDataArea), BorderLayout.CENTER); childDataArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PROPERTIES_FILE); // Buttons. final CButtonPane btnPanel = new CButtonPane(CButtonPane.TAIL); final JButton btnOk = new JButton("Ok"); btnOk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String name = childNameText.getText(); String data = childDataArea.getText(); if ((name == null || name.isEmpty()) || (data == null || data.isEmpty())) { JOptionPane.showMessageDialog(null, "Name or Data is empty", "Error", JOptionPane.ERROR_MESSAGE); return; } childName = name; childText = data; dlg.setVisible(false); dlg.dispose(); } }); final JButton btnCancel = new JButton("Cancel"); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { childName = ""; childText = ""; dlg.setVisible(false); dlg.dispose(); } }); btnPanel.add(btnCancel); btnPanel.add(btnOk); btnPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); Container con = dlg.getContentPane(); con.setLayout(new BorderLayout()); con.add(content, BorderLayout.CENTER); con.add(btnPanel, BorderLayout.SOUTH); return dlg; }
From source file:gda.gui.mca.McaGUI.java
private void makeAdcControlDialog() { if (adcControlPanel == null) { adcControlPanel = new AdcPanel(); adcDialog = new JDialog(); Object[] options = { "OK" }; Object[] array = { adcControlPanel }; // Create the JOptionPane. final JOptionPane optionPane = new JOptionPane(array, JOptionPane.PLAIN_MESSAGE, JOptionPane.YES_OPTION, null, options, options[0]); optionPane.addPropertyChangeListener(new PropertyChangeListener() { @Override/*from ww w .ja v a 2s.co m*/ public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (isVisible() && (e.getSource() == optionPane) && (JOptionPane.VALUE_PROPERTY.equals(prop) || JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) { Object value = optionPane.getValue(); if (value == JOptionPane.UNINITIALIZED_VALUE) { // ignore reset return; } // Reset the JOptionPane's value. // If you don't do this, then if the user // presses the same button next time, no // property change event will be fired. optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE); if ("OK".equals(value)) { adcDialog.setVisible(false); } } } }); adcDialog.setContentPane(optionPane); adcDialog.pack(); adcDialog.setTitle("ADC Controls"); adcDialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); } }