List of usage examples for javax.swing JOptionPane PLAIN_MESSAGE
int PLAIN_MESSAGE
To view the source code for javax.swing JOptionPane PLAIN_MESSAGE.
Click Source Link
From source file:com.ejie.uda.jsonI18nEditor.Editor.java
public void showMessage(String title, Component component) { showMessageDialog(title, component, JOptionPane.PLAIN_MESSAGE); }
From source file:com.egangotri.transliteratorAsSwing.TransliteratorJFrame.java
public void actionPerformed(ActionEvent e) { String actionCommand = e.getActionCommand(); Log.info("actionCommand: " + actionCommand); if (actionCommand.equals("clear")) { clear();/* w w w . j a v a2 s .co m*/ this.repaint(); } else if (actionCommand.equals("clipboard-1")) { copyToClipBoard("cb1"); } else if (actionCommand.equals("clipboard-2")) { copyToClipBoard("cb2"); } else if (actionCommand.equals("clipboard-3")) { copyToClipBoard("cb3"); } else if (actionCommand.equals("comboBox1")) { inputEncoding = comboBox1.getSelectedItem().toString(); Log.info("inputEncoding: " + inputEncoding); setText(); } else if (actionCommand.equals("comboBox2")) { outputEncoding1 = comboBox2.getSelectedItem().toString(); Log.info("outputEncoding1: " + outputEncoding1); setText(); } else if (actionCommand.equals("comboBox3")) { outputEncoding2 = comboBox3.getSelectedItem().toString(); Log.info("outputEncoding2: " + outputEncoding2); setText(); } else if (actionCommand.equals("open")) { chooseFile(tb1); } else if (actionCommand.equals("convert")) { setText(); } else if (actionCommand.equals("refresh")) { this.repaint(); } else if (actionCommand.equals("about_item")) { String copyright = "Released Under MIT License. eGangotri Digital Preservation Trust\n" + "Pls. Contact egagotritrust@gmail.com for questions and suggestions."; JOptionPane.showMessageDialog(this, copyright, "eGangotri Indic Transliterator", JOptionPane.PLAIN_MESSAGE); } else if (actionCommand.equals("save_1")) { FileIO.saveText(this, tb1, p2); } else if (actionCommand.equals("save_2")) { FileIO.saveText(this, tb2, p2); } else if (actionCommand.equals("save_3")) { FileIO.saveText(this, tb3, p2); } else if (actionCommand.equals("open_1")) { chooseFile(tb1); setText(); } else if (actionCommand.equals("capitalize")) { if (capitalize.isSelected()) { capitalizeIAST = true; tb3.setText(WordUtils.capitalizeFully(tb3.getText())); } else { capitalizeIAST = false; tb3.setText(WordUtils.uncapitalize(tb3.getText())); } } else { CommonActions.performActions(actionCommand); } }
From source file:dbseer.gui.panel.DBSeerSelectableChartPanel.java
@Override public void chartMouseClicked(ChartMouseEvent chartMouseEvent) { ChartEntity entity = chartMouseEvent.getEntity(); MouseEvent mouseEvent = chartMouseEvent.getTrigger(); if (SwingUtilities.isLeftMouseButton(mouseEvent) && entity != null && entity instanceof PieSectionEntity) { java.util.List<String> names = dataset.getTransactionTypeNames(); PieSectionEntity pieSectionEntity = (PieSectionEntity) entity; int idx = pieSectionEntity.getSectionIndex(); String name = (String) JOptionPane.showInputDialog(null, "Enter the name for this transaction type", "Transaction Type", JOptionPane.PLAIN_MESSAGE, null, null, ""); if (name != null) { if (names.contains(name) && !names.get(idx).equals(name) && !name.isEmpty()) { JOptionPane.showMessageDialog(null, "Please enter a different name for the transaction type.\nEach name has to be unique.", "Warning", JOptionPane.WARNING_MESSAGE); } else { PieDataset oldDataset = pieSectionEntity.getDataset(); DefaultPieDataset newDataset = new DefaultPieDataset(); PiePlot plot = (PiePlot) chart.getPlot(); String oldName = (String) oldDataset.getKey(idx); names.set(idx, name);// www . ja v a 2s . c o m dataset.setTransactionTypeName(idx, name); for (int i = 0; i < oldDataset.getItemCount(); ++i) { String key = (String) oldDataset.getKey(i); Number number = oldDataset.getValue(i); if (key.equals(oldName)) { if (name.isEmpty()) newDataset.setValue("Transaction Type " + (i + 1), number); else newDataset.setValue(name, number); } else { newDataset.setValue(key, number); } } Paint[] tempPaint = new Paint[oldDataset.getItemCount()]; for (int i = 0; i < oldDataset.getItemCount(); ++i) { String key = (String) oldDataset.getKey(i); tempPaint[i] = plot.getSectionPaint(key); } ((DefaultPieDataset) oldDataset).clear(); plot.setDataset(newDataset); for (int i = 0; i < newDataset.getItemCount(); ++i) { String key = (String) newDataset.getKey(i); plot.setSectionPaint(key, tempPaint[i]); } } } } }
From source file:com.konifar.material_icon_generator.MaterialDesignIconGenerateDialog.java
@Override protected void doOKAction() { if (model == null) return;//from w w w .j a v a2s. c o m if (!isConfirmed()) return; if (alreadyFileExists()) { final int option = JOptionPane.showConfirmDialog(panelMain, "File already exists, overwrite this ?", "File exists", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, new ImageIcon(getClass().getResource(ICON_WARNING))); if (option == JOptionPane.YES_OPTION) { create(); } } else { create(); } }
From source file:org.rdv.viz.chart.ChartViz.java
/** * Add data from a local file as a series to this chart. This will ask the * user for the file name, and which channels to use. *///from w ww . j av a2s .c o m private void addLocalSeries() { File file = UIUtilities.openFile(); if (file == null || !file.isFile() || !file.exists()) { return; } DataFileReader reader; try { reader = new DataFileReader(file); } catch (IOException e) { JOptionPane.showMessageDialog(getDataComponent(), e.getMessage(), "Problem reading data file", JOptionPane.ERROR_MESSAGE); return; } List<Channel> channels = reader.getChannels(); if (channels.size() < 2) { JOptionPane.showMessageDialog(getDataComponent(), "There must be at least 2 channels in the data file", "Problem with data file", JOptionPane.ERROR_MESSAGE); return; } Channel xChannel; Channel yChannel; if (channels.size() == 2) { xChannel = channels.get(0); yChannel = channels.get(1); } else { xChannel = (Channel) JOptionPane.showInputDialog(getDataComponent(), "Select the x channel:", "Add local channel", JOptionPane.PLAIN_MESSAGE, null, channels.toArray(), null); if (xChannel == null) { return; } yChannel = (Channel) JOptionPane.showInputDialog(getDataComponent(), "Select the y channel:", "Add local channel", JOptionPane.PLAIN_MESSAGE, null, channels.toArray(), null); if (yChannel == null) { return; } } String xChannelName = xChannel.getName(); if (xChannel.getUnit() != null) { xChannelName += " (" + xChannel.getUnit() + ")"; } int xChannelIndex = channels.indexOf(xChannel); String yChannelName = yChannel.getName(); if (yChannel.getUnit() != null) { yChannelName += " (" + yChannel.getUnit() + ")"; } int yChannelIndex = channels.indexOf(yChannel); String seriesName = xChannelName + " vs. " + yChannelName; XYTimeSeries data = new XYTimeSeries(seriesName, FixedMillisecond.class); try { NumericDataSample sample; while ((sample = reader.readSample()) != null) { double timestamp = sample.getTimestamp(); Number[] values = sample.getValues(); FixedMillisecond time = new FixedMillisecond((long) (timestamp * 1000)); XYTimeSeriesDataItem dataItem = new XYTimeSeriesDataItem(time); if (values[xChannelIndex] != null && values[yChannelIndex] != null) { dataItem.setX(values[xChannelIndex]); dataItem.setY(values[yChannelIndex]); } data.add(dataItem, false); } } catch (Exception e) { e.printStackTrace(); return; } Color color = getLeastUsedColor(); colors.put(seriesName, color); ((XYTimeSeriesCollection) dataCollection).addSeries(data); localSeries++; setSeriesColors(); updateTitle(); updateLegend(); }
From source file:gda.gui.mca.McaGUI.java
private SimplePlot getSimplePlot() { if (simplePlot == null) { simplePlot = new SimplePlot(); simplePlot.setYAxisLabel("Values"); simplePlot.setTitle("MCA"); /*//from ww w . j a v a 2s .c o m * do not attempt to get calibration until the analyser is available getEnergyCalibration(); */ simplePlot.setXAxisLabel("Channel Number"); simplePlot.setTrackPointer(true); JPopupMenu menu = simplePlot.getPopupMenu(); JMenuItem item = new JMenuItem("Add Region Of Interest"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "To add a region of interest, please click on region low" + " and region high channels\n" + "in the graph and set the index\n"); regionClickCount = 0; } }); JMenuItem calibitem = new JMenuItem("Calibrate Energy"); /* * Comment out as calibration is to come from the analyser directly menu.add(calibitem); */ calibitem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { // regionClickCount = 0; int[] data = (int[]) analyser.getData(); double[] dData = new double[data.length]; for (int i = 0; i < dData.length; i++) { dData[i] = data[i]; } if (energyCalibrationDialog == null) { energyCalibrationDialog = new McaCalibrationPanel( (EpicsMCARegionOfInterest[]) analyser.getRegionsOfInterest(), dData, mcaName); energyCalibrationDialog.addIObserver(McaGUI.this); } energyCalibrationDialog.setVisible(true); } catch (DeviceException e1) { logger.error("Exception: " + e1.getMessage()); } catch (Exception ex) { JOptionPane.showMessageDialog(null, ex.getMessage()); ex.printStackTrace(); } } }); simplePlot.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { // /////////System.out.println("Mouse clicked " + // me.getX() + " " // /////// + me.getY()); SimpleDataCoordinate coordinates = simplePlot.convertMouseEvent(me); if (simplePlot.getScreenDataArea().contains(me.getX(), me.getY()) && regionClickCount == 0) { regionLow = coordinates.toArray(); regionClickCount++; } else if (simplePlot.getScreenDataArea().contains(me.getX(), me.getY()) && regionClickCount == 1) { regionHigh = coordinates.toArray(); regionClickCount++; if (regionValid(regionLow[0], regionHigh[0])) { final String s = (String) JOptionPane.showInputDialog(null, "Please select the Region Index:\n", "Region Of Interest", JOptionPane.PLAIN_MESSAGE, null, null, String.valueOf(getNextRegion())); Thread t1 = uk.ac.gda.util.ThreadManager.getThread(new Runnable() { @Override public void run() { try { if (s != null) { int rIndex = Integer.parseInt(s); EpicsMCARegionOfInterest[] epc = { new EpicsMCARegionOfInterest() }; epc[0].setRegionLow(regionLow[0]); epc[0].setRegionHigh(regionHigh[0]); epc[0].setRegionIndex(rIndex); epc[0].setRegionName("region " + rIndex); analyser.setRegionsOfInterest(epc); addRegionMarkers(rIndex, regionLow[0], regionHigh[0]); } } catch (DeviceException e) { logger.error("Unable to set the table values"); } } }); t1.start(); } } } }); // TODO note that selectePlot cannot be changed runtime simplePlot.initializeLine(selectedPlot); simplePlot.setLineName(selectedPlot, getSelectedPlotString()); simplePlot.setLineColor(selectedPlot, getSelectedPlotColor()); simplePlot.setLineType(selectedPlot, "LineOnly"); } return simplePlot; }
From source file:components.DialogDemo.java
private JPanel createIconDialogBox() { JButton showItButton = null;/* w ww . j a v a2s . com*/ final int numButtons = 6; JRadioButton[] radioButtons = new JRadioButton[numButtons]; final ButtonGroup group = new ButtonGroup(); final String plainCommand = "plain"; final String infoCommand = "info"; final String questionCommand = "question"; final String errorCommand = "error"; final String warningCommand = "warning"; final String customCommand = "custom"; radioButtons[0] = new JRadioButton("Plain (no icon)"); radioButtons[0].setActionCommand(plainCommand); radioButtons[1] = new JRadioButton("Information icon"); radioButtons[1].setActionCommand(infoCommand); radioButtons[2] = new JRadioButton("Question icon"); radioButtons[2].setActionCommand(questionCommand); radioButtons[3] = new JRadioButton("Error icon"); radioButtons[3].setActionCommand(errorCommand); radioButtons[4] = new JRadioButton("Warning icon"); radioButtons[4].setActionCommand(warningCommand); radioButtons[5] = new JRadioButton("Custom icon"); radioButtons[5].setActionCommand(customCommand); for (int i = 0; i < numButtons; i++) { group.add(radioButtons[i]); } radioButtons[0].setSelected(true); showItButton = new JButton("Show it!"); showItButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String command = group.getSelection().getActionCommand(); //no icon if (command == plainCommand) { JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.", "A plain message", JOptionPane.PLAIN_MESSAGE); //information icon } else if (command == infoCommand) { JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.", "Inane informational dialog", JOptionPane.INFORMATION_MESSAGE); //XXX: It doesn't make sense to make a question with //XXX: only one button. //XXX: See "Yes/No (but not in those words)" for a better solution. //question icon } else if (command == questionCommand) { JOptionPane.showMessageDialog(frame, "You shouldn't use a message dialog " + "(like this)\n" + "for a question, OK?", "Inane question", JOptionPane.QUESTION_MESSAGE); //error icon } else if (command == errorCommand) { JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.", "Inane error", JOptionPane.ERROR_MESSAGE); //warning icon } else if (command == warningCommand) { JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.", "Inane warning", JOptionPane.WARNING_MESSAGE); //custom icon } else if (command == customCommand) { JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.", "Inane custom dialog", JOptionPane.INFORMATION_MESSAGE, icon); } } }); return create2ColPane(iconDesc + ":", radioButtons, showItButton); }
From source file:lu.fisch.moenagade.model.Project.java
public BloxsClass renameWorld(World world) { String name = world.getName(); boolean result; do {//from w w w. j a v a 2s . c o m name = (String) JOptionPane.showInputDialog(frame, "Please enter the world's new name.", "Rename world", JOptionPane.PLAIN_MESSAGE, null, null, name); if (name == null) return null; result = true; // check if name is OK Matcher matcher = Pattern.compile("^[a-zA-Z_$][a-zA-Z_$0-9]*$").matcher(name); boolean found = matcher.find(); if (!found) { result = false; JOptionPane.showMessageDialog(frame, "Please chose a valid name.", "Error", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); } // check if name is unique else if (worlds.containsKey(name)) { result = false; JOptionPane.showMessageDialog(frame, "This name is not unique.", "Error", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); } // check internal name else if (name.trim().equals("World")) { result = false; JOptionPane.showMessageDialog(frame, "The name \"World\" is already internaly\nused and thus not allowed!", "Error", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); } else if (name.charAt(0) != name.toUpperCase().charAt(0)) { result = false; JOptionPane.showMessageDialog(frame, "The name should start with a capital letter.", "Error", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); } else { // send refresh refresh(new Change(null, -1, "rename.world", world.getName(), name)); // switch worlds.remove(world.getName()); worlds.put(name, world); // rename file (if present) File fFrom = new File(directoryName + System.getProperty("file.separator") + "bloxs" + System.getProperty("file.separator") + "worlds" + System.getProperty("file.separator") + world.getName() + ".bloxs"); File fTo = new File(directoryName + System.getProperty("file.separator") + "bloxs" + System.getProperty("file.separator") + "worlds" + System.getProperty("file.separator") + name + ".bloxs"); if (fFrom.exists()) fFrom.renameTo(fTo); // do the rename world.setName(name); return world; } } while (!result); return null; }
From source file:com.konifar.material_icon_generator.MaterialDesignIconGenerateDialog.java
private void create() { if (model.isMdpi()) createIcon(checkBoxMdpi.getText()); if (model.isHdpi()) createIcon(checkBoxHdpi.getText()); if (model.isXhdpi()) createIcon(checkBoxXhdpi.getText()); if (model.isXxhdpi()) createIcon(checkBoxXxhdpi.getText()); if (model.isXxxhdpi()) createIcon(checkBoxXxxhdpi.getText()); JOptionPane.showConfirmDialog(panelMain, "Icon created successfully.", "Material design icon created", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, new ImageIcon(getClass().getResource(ICON_DONE))); }
From source file:net.sf.nmedit.nomad.core.Nomad.java
public void export() { Document doc = getDocumentManager().getSelection(); if (!(doc instanceof Transferable)) return;//from w w w . j a va 2s .c om Transferable transferable = (Transferable) doc; String title = doc.getTitle(); if (title == null) title = "Export"; else title = "Export '" + title + "'"; JComboBox src = new JComboBox(transferable.getTransferDataFlavors()); src.setRenderer(new DefaultListCellRenderer() { /** * */ private static final long serialVersionUID = -4553255745845039428L; public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { String text; if (value instanceof DataFlavor) { DataFlavor flavor = (DataFlavor) value; String mimeType = flavor.getMimeType(); String humanRep = flavor.getHumanPresentableName(); String charset = flavor.getParameter("charset"); if (mimeType == null) text = "?"; else { text = mimeType; int ix = text.indexOf(';'); if (ix >= 0) text = text.substring(0, ix).trim(); } if (charset != null) text += "; charset=" + charset; if (humanRep != null) text += " (" + humanRep + ")"; } else { text = String.valueOf(value); } return super.getListCellRendererComponent(list, text, index, isSelected, cellHasFocus); } }); JComboBox dst = new JComboBox(new Object[] { "File", "Clipboard" }); Object[] msg = { "Source:", doc.getTitle(), "Export as:", src, "Export to:", dst }; Object[] options = { "Ok", "Cancel" }; JOptionPane op = new JOptionPane(msg, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options); JDialog dialog = op.createDialog(getWindow(), title); dialog.setModal(true); dialog.setVisible(true); boolean ok = "Ok".equals(op.getValue()); DataFlavor flavor = (DataFlavor) src.getSelectedItem(); dialog.dispose(); if (!ok) return; if (flavor == null) return; if ("Clipboard".equals(dst.getSelectedItem())) { Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard(); cb.setContents(new SelectedTransfer(flavor, transferable), null); } else { export(transferable, flavor); } }