List of usage examples for javax.swing JOptionPane showInputDialog
public static String showInputDialog(Object message) throws HeadlessException
From source file:com.floreantpos.ui.views.payment.SettleTicketDialog.java
public void submitMyKalaDiscount() { if (ticket.hasProperty(LOYALTY_ID)) { POSMessageDialog.showError(Application.getPosWindow(), Messages.getString("SettleTicketDialog.18")); //$NON-NLS-1$ return;//from w w w. ja v a 2 s .com } try { String loyaltyid = JOptionPane.showInputDialog(Messages.getString("SettleTicketDialog.19")); //$NON-NLS-1$ if (StringUtils.isEmpty(loyaltyid)) { return; } ticket.addProperty(LOYALTY_ID, loyaltyid); String transactionURL = buildLoyaltyApiURL(ticket, loyaltyid); String string = IOUtils.toString(new URL(transactionURL).openStream()); JsonReader reader = Json.createReader(new StringReader(string)); JsonObject object = reader.readObject(); JsonArray jsonArray = (JsonArray) object.get("discounts"); //$NON-NLS-1$ for (int i = 0; i < jsonArray.size(); i++) { JsonObject jsonObject = (JsonObject) jsonArray.get(i); addCoupon(ticket, jsonObject); } updateModel(); OrderController.saveOrder(ticket); POSMessageDialog.showMessage(Application.getPosWindow(), Messages.getString("SettleTicketDialog.21")); //$NON-NLS-1$ paymentView.updateView(); } catch (Exception e) { POSMessageDialog.showError(Application.getPosWindow(), Messages.getString("SettleTicketDialog.22"), e); //$NON-NLS-1$ } }
From source file:com.mycompany.zad1.MainWindow.java
private void averegeilterButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_averegeilterButtonActionPerformed AverageFilter medianfIlter = new AverageFilter(); consloleOut();// w w w .j a v a2 s . c o m int maskSize = Integer.parseInt(JOptionPane.showInputDialog("Input maskSize")); try { imageBuff = medianfIlter.computeImage(imageBuff, maskSize); } catch (Exception ex) { Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); } imageMoiffayLabel.setIcon(new ImageIcon(imageBuff.getImage())); consloleOut(); }
From source file:org.samjoey.gui.GraphicalViewer.java
private void jMenu_GameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu_GameActionPerformed String inputValue = JOptionPane.showInputDialog("Please input a value (Integers only):"); try {/*from w ww. j ava 2s. c o m*/ setViewer(Integer.parseInt(inputValue), 0); } catch (Exception e) { } }
From source file:org.samjoey.gui.GraphicalViewer.java
private void jMenu_PlyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu_PlyActionPerformed String inputValue = JOptionPane.showInputDialog("Please input a value (Integers only):"); try {// w w w .ja v a 2 s . c o m setViewer(currentGame, Integer.parseInt(inputValue)); } catch (Exception e) { } }
From source file:au.com.jwatmuff.eventmanager.gui.main.MainWindow.java
private void manualAddPeerMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manualAddPeerMenuItemActionPerformed String hostname = JOptionPane .showInputDialog("Enter an IP Address, Host or Computer Name on which EventManager is running."); if (!StringUtils.isBlank(hostname)) { try {//from w w w . j a va 2s . co m setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); InetAddress.getByName(hostname); GUIUtils.displayMessage(null, "The computer '" + hostname + "' was successfully added.\nIf EventManager is able to connect to this computer, it will appear under the chat user list shortly", "Computer added"); manuallyAddHost(hostname); } catch (UnknownHostException e) { GUIUtils.displayError(null, "EventManager was unable to identify any computer named '" + hostname + "' (Unknown host)"); } finally { setCursor(Cursor.getDefaultCursor()); } } }
From source file:org.samjoey.gui.GraphicalViewer.java
private void Graphs_MenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Graphs_MenuItemActionPerformed String inputValue = JOptionPane.showInputDialog("Please input a values separated by commas:"); try {/*from ww w . ja v a 2 s . co m*/ String[] vals = inputValue.split(","); LinkedList<Game> getFor = new LinkedList<>(); for (String str : vals) { getFor.add(games.get(Integer.parseInt(str))); } for (String s : getFor.get(0).getVarData().keySet()) { this.Variable_Chooser.addItem(s); } graphs = GraphUtility.getGraphs(getFor); } catch (Exception e) { try { String[] vals = inputValue.split(", "); LinkedList<Game> getFor = new LinkedList<>(); for (String str : vals) { getFor.add(games.get(Integer.parseInt(str))); } for (String s : getFor.get(0).getVarData().keySet()) { this.Variable_Chooser.addItem(s); } graphs = GraphUtility.getGraphs(getFor); } catch (Exception ee) { } } }
From source file:com.mycompany.zad1.MainWindow.java
private void histogramModifyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_histogramModifyButtonActionPerformed String[] inputText = JOptionPane.showInputDialog("Input gMin and alpha").split(";"); if (inputText.length == 2) { Rayleigh rayleigh = new Rayleigh(Integer.parseInt(inputText[0]), Integer.parseInt(inputText[1])); imageBuff = rayleigh.compute(imageBuff); //MyPulpa pulpa = new MyPulpa(Integer.parseInt(inputText[0]), Integer.parseInt(inputText[1])); //imageBuff = pulpa.h1(imageBuff); imageMoiffayLabel.setIcon(new ImageIcon(imageBuff.getImage())); CalculateHistogram histogram = new CalculateHistogram(); imageBuff = histogram.calculateHistogram(imageBuff); HistogramPlot plot = new HistogramPlot(); JFreeChart chart;/*from w w w . j av a2 s .c o m*/ if (imageBuff.getColorDepth() == 24) chart = plot.plotColorChart(imageBuff.getHistogram()); else chart = plot.plotGrayChart(imageBuff.getHistogram().get(0)); ChartFrame chartFrame = new ChartFrame(); chartFrame.initChart(chart); chartFrame.setVisible(true); } }
From source file:com.mycompany.zad1.MainWindow.java
private void imageMoiffayLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_imageMoiffayLabelMouseClicked if (regionGrowing) { int treschold = Integer.parseInt(JOptionPane.showInputDialog("Treschold value")); RegionGrowing growing = new RegionGrowing(); ArrayList<int[]> mask = growing.findRegion(imageBuff, evt.getX(), evt.getY(), treschold); ImageUtlis utlis = new ImageUtlis(); utlis.repaintImage(imageBuff, colors[currentColor], mask); SupportFrame frame = new SupportFrame(); frame.initRegionMask(imageOrginal.getWidth(), imageOrginal.getHeight(), mask); frame.setVisible(true);// w w w .j a v a 2 s . c om imageMoiffayLabel.setIcon(new ImageIcon(imageBuff.getImage())); currentColor++; if (currentColor == colors.length) { regionGrowingButton.setEnabled(false); regionGrowing = false; currentColor = 0; } } }
From source file:com.mycompany.zad1.MainWindow.java
private void fourierFiltersButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fourierFiltersButtonActionPerformed String[] buttonsLabels = { "Low pass", "High pass", "Band pass", "Band stop", "Edge detection" }; Filters filters = new Filters(); boolean flag = false; double level = 0; int result = JOptionPane.showOptionDialog(null, "Choose Filter", "Choose filter", JOptionPane.INFORMATION_MESSAGE, 0, null, buttonsLabels, buttonsLabels[0]); switch (result) { case 0:// w w w. j a v a 2s . com level = Double.parseDouble(JOptionPane.showInputDialog("D")); filters.lowPassFilter(imageBuff, level); flag = true; break; case 1: level = Double.parseDouble(JOptionPane.showInputDialog("D")); filters.HigPassFilter(imageBuff, level); flag = true; break; case 2: filters.bandPassFilter(imageBuff, 0.2, 0.6); flag = true; break; case 3: filters.bandStopFilter(imageBuff, 0.2, 0.6); flag = true; break; case 4: filters.edgeDetetcion(imageBuff, 0.2, 0.6, 30, 90); flag = true; break; } if (flag) { SupportFrame spectrumFrame = new SupportFrame(); spectrumFrame.initFurier(imageBuff.getFourierMatrix(), false); Fourier fourier = new Fourier(); imageBuff = fourier.fft(imageBuff, true); imageMoiffayLabel.setIcon(new ImageIcon(imageBuff.getImage())); spectrumFrame.setVisible(true); } }
From source file:at.tuwien.ifs.somtoolbox.apps.viewer.MapPNode.java
/** * Adds a manual label to the map. Pops up a Dialog asking for the text. The created label has the size 10x number * of units in width./* www . j ava 2s . co m*/ */ public void createLabel() { // maybe move this code somewhere else... not 100% appropriate in this class. String txt = JOptionPane.showInputDialog("Enter label text:"); PNode bigLabel; // TODO: Fontsize: not nice to have it hard coded here... maybe something // like a maxFontSize for the cluster labels and make it depending on that value bigLabel = LabelPNodeGenerator.newLabel(txt, this.units.length * 10); manualLabels.addChild(bigLabel); // bigLabel.moveToFront(); }