List of usage examples for javax.swing JOptionPane showInputDialog
public static String showInputDialog(Component parentComponent, Object message) throws HeadlessException
parentComponent
. From source file:my.honeypotadmin.AppMain.java
private void AddUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddUserActionPerformed int dialogResult = JOptionPane.showConfirmDialog(this, "Are you sure you woud like to add a user to the system?", "Add User", JOptionPane.YES_NO_OPTION); if (dialogResult == 0) { String newUser = JOptionPane.showInputDialog("Please enter PMKeys for new user.", ""); String newGivenName = JOptionPane.showInputDialog("Please enter First name for new user.", ""); String newSurname = JOptionPane.showInputDialog("Please enter Surname for new user.", ""); sql.SQLUpdate("INSERT INTO Users VALUES ('" + newUser + "','" + newGivenName + "','" + newSurname + "','0','0','')"); SQLSetup();//from www . j av a 2 s .c o m newUser = newGivenName = newSurname = null; } }
From source file:com.peterbochs.PeterBochsDebugger.java
private void runBochsButtonActionPerformed(ActionEvent evt) { if (runBochsButton.getEventSource() != null) { if (runBochsButton.getEventSource() == jRunBochsAndSkipBreakpointMenuItem) { customCommandQueue.clear();//ww w . j a va 2s . co m commandReceiver.shouldShow = false; String s = JOptionPane.showInputDialog(this, "How many time of breakpoint you want to skip?"); if (s == null) { return; } skipBreakpointTime = Integer.parseInt(s); runBochsMenuItemActionPerformed(null); } else if (runBochsButton.getEventSource() == jRunCustomCommandMenuItem) { CustomCommandDialog d = new CustomCommandDialog(this); d.setVisible(true); customCommandQueue.clear(); if (d.ok) { for (int z = 0; z < (Integer) d.jRepeatSpinner.getValue(); z++) { if (!d.jComboBox1.getSelectedItem().toString().equals("")) { for (int x = 0; x < (Integer) d.jSpinner1.getValue(); x++) { customCommandQueue .add(new CustomCommand(d.jComboBox1.getSelectedItem().toString())); } } if (!d.jComboBox2.getSelectedItem().toString().equals("")) { for (int x = 0; x < (Integer) d.jSpinner2.getValue(); x++) { customCommandQueue .add(new CustomCommand(d.jComboBox2.getSelectedItem().toString())); } } if (!d.jComboBox3.getSelectedItem().toString().equals("")) { for (int x = 0; x < (Integer) d.jSpinner3.getValue(); x++) { customCommandQueue .add(new CustomCommand(d.jComboBox3.getSelectedItem().toString())); } } if (!d.jComboBox4.getSelectedItem().toString().equals("")) { for (int x = 0; x < (Integer) d.jSpinner4.getValue(); x++) { customCommandQueue .add(new CustomCommand(d.jComboBox4.getSelectedItem().toString())); } } if (!d.jComboBox5.getSelectedItem().toString().equals("")) { for (int x = 0; x < (Integer) d.jSpinner5.getValue(); x++) { customCommandQueue .add(new CustomCommand(d.jComboBox5.getSelectedItem().toString())); } } if (!d.jComboBox6.getSelectedItem().toString().equals("")) { for (int x = 0; x < (Integer) d.jSpinner6.getValue(); x++) { customCommandQueue .add(new CustomCommand(d.jComboBox6.getSelectedItem().toString())); } } } skipBreakpointTime = 0; commandReceiver.shouldShow = false; runBochsMenuItemActionPerformed(null); } } } else { customCommandQueue.clear(); commandReceiver.shouldShow = false; if (runBochsButton.getText().equals(MyLanguage.getString("Run_bochs"))) { runBochsMenuItemActionPerformed(null); } else { pauseBochsMenuItemActionPerformed(null); } } }
From source file:cfa.vo.sed.science.stacker.SedStackerFrame.java
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed String newName = JOptionPane.showInputDialog(stackPanel, "New Stack ID:"); List<String> names = new ArrayList(); for (SedStack stack : stacks) { names.add(stack.getName());//from ww w . j av a 2 s . c o m } if (names.contains(newName)) { NarrowOptionPane.showMessageDialog(rootFrame, "This Stack ID already exists. Please use a unique ID.", "Rename error", NarrowOptionPane.ERROR_MESSAGE); } else { SedStack stack = getSelectedStack(); stack.setName(newName); setSelectedStack(stack); jList1.setSelectedValue(stack, true); } }
From source file:com.peterbochs.PeterBochsDebugger.java
private void stepBochsButtonActionPerformed(ActionEvent evt) { if (stepBochsButton.getEventSource() != null) { untilThread = new StepThread(stepBochsButton.getEventSource()); if (stepBochsButton.getEventSource() == jStepNMenuItem) { String s = JOptionPane.showInputDialog(this, "Please input the instruction count?"); if (s == null) { return; }/*w w w .ja va 2 s. co m*/ untilThread.instructionCount = Integer.parseInt(s); } else if (stepBochsButton.getEventSource() == jStepUntilIPBigChangeMenuItem) { String s = JOptionPane.showInputDialog("Please input the instruction count?"); if (s == null) { return; } untilThread.ipDelta = CommonLib.string2long(s); } CardLayout cl = (CardLayout) (jMainPanel.getLayout()); cl.show(jMainPanel, "Running Label 2"); new Thread(untilThread, "Step until thread").start(); } else { sendCommand("s"); WebServiceUtil.log("peter-bochs", "step", null, null, null); updateBochsStatus(true); } }
From source file:cfa.vo.sed.science.stacker.SedStackerFrame.java
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed String newRedshift = JOptionPane.showInputDialog(sedsTable, "New observed redshift: "); //TODO: check for bad z values. // Check for invalid redshift values if (newRedshift != null && newRedshift.length() > 0) { if (!isNumeric(newRedshift) || Double.parseDouble(newRedshift) < 0) { NarrowOptionPane.showMessageDialog(null, "Invalid redshift values", "WARNING", NarrowOptionPane.WARNING_MESSAGE); try { this.setSelected(true); } catch (PropertyVetoException ex) { Logger.getLogger(SedStackerFrame.class.getName()).log(Level.SEVERE, null, ex); }/*from ww w.jav a2 s .co m*/ return; } int i = sedsTable.getSelectedRow(); selectedStack.getSeds().get(i).addAttachment(SedStackerAttachments.REDSHIFT, newRedshift); selectedStack.getSeds().get(i).addAttachment(SedStackerAttachments.ORIG_REDSHIFT, newRedshift); selectedStack.getOrigSeds().get(i).addAttachment(SedStackerAttachments.REDSHIFT, newRedshift); selectedStack.getOrigSeds().get(i).addAttachment(SedStackerAttachments.ORIG_REDSHIFT, newRedshift); sedsTable.setModel(new StackTableModel(selectedStack)); } }
From source file:ffx.ui.MainPanel.java
/** * <p>//from ww w. j ava 2s .c o m * Setter for the field <code>port</code>.</p> */ public void setPort() { String s = new String("" + port); s = JOptionPane.showInputDialog("Enter a port number", s); if (s == null) { return; } int temp; try { temp = Integer.parseInt(s); } catch (NumberFormatException e) { return; } port = temp; socketAddress = new InetSocketAddress(address, port); }
From source file:ffx.ui.MainPanel.java
/** * <p>/* w ww . jav a 2s. c om*/ * setRemoteJobAddress</p> */ public void setRemoteJobAddress() { if (address == null) { try { address = InetAddress.getLocalHost(); } catch (Exception e) { try { address = InetAddress.getByName(null); } catch (Exception ex) { return; } } } String s = new String("" + address.getHostAddress()); s = JOptionPane.showInputDialog("Enter an IP Address (XXX.XXX.XXX.XXX)", s); if (s == null) { return; } InetAddress newAddress; InetSocketAddress newSocketAddress; try { newAddress = InetAddress.getByName(s); newSocketAddress = new InetSocketAddress(newAddress, port); } catch (NumberFormatException e) { return; } catch (Exception e) { return; } address = newAddress; socketAddress = newSocketAddress; }
From source file:fi.hoski.remote.ui.Admin.java
private Reservation reservate(EventType eventType, Event event) { // search a member String[] columns = Member.MODEL.getProperties(); String lastName = JOptionPane.showInputDialog(panel, TextUtil.getText(Member.SUKUNIMI) + "?"); if (lastName == null) { return null; }/*w w w. j a va 2 s .co m*/ lastName = Utils.convertName(lastName); List<AnyDataObject> memberList = null; memberList = dss.retrieve(Member.KIND, Member.SUKUNIMI, lastName, columns); DataObjectChooser<AnyDataObject> ec = new DataObjectChooser<AnyDataObject>(Member.MODEL, memberList, TextUtil.getText(eventType.name()), "CHOOSE"); ec.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); List<AnyDataObject> selected = ec.choose(); if (selected != null && selected.size() >= 1) { try { return reservate(eventType, selected.get(0), event); } catch (ParseException ex) { Logger.getLogger(Admin.class.getName()).log(Level.SEVERE, null, ex); } } else { JOptionPane.showMessageDialog(frame, TextUtil.getText("NO SELECTION"), TextUtil.getText("MESSAGE"), JOptionPane.INFORMATION_MESSAGE); } return null; }
From source file:ffx.ui.MainPanel.java
/** * <p>//from www.j a v a2 s. c om * skip</p> */ public void skip() { Trajectory trajectory = getTrajectory(); if (trajectory == null) { return; } String skip = new String("" + trajectory.getSkip()); skip = JOptionPane.showInputDialog("Enter the Number of Frames to Skip", skip); try { int f = Integer.parseInt(skip); trajectory.setSkip(f); } catch (NumberFormatException e) { return; } }
From source file:ffx.ui.MainPanel.java
/** * <p>/* ww w .j a v a2 s . co m*/ * speed</p> */ public void speed() { Trajectory trajectory = getTrajectory(); if (trajectory == null) { return; } String rate = new String("" + trajectory.getRate()); rate = JOptionPane.showInputDialog("Enter the Frame Rate (1-100)", rate); try { int f = Integer.parseInt(rate); trajectory.setRate(f); } catch (NumberFormatException e) { return; } }