Java Swing: Get text value from JOptionPane -


I would like to create a new window that is used in POS systems. The user input is for the amount of the customer and the window has to display the exchange amount. I'm new with the JOHNptionPan feature (I am using JAVAFX and this is different).

This is my code:

  public static zero main (string [] argv throws exception {string newline = System.getProperty ("line.separator"); Int cost = 100; Int zodiac = integer PRIIENT (JOPEPANGANG.GATE TEXT) ()) / This is wrong! It needs to come from the user input box in the same window. Jeffre Frame = New Gefram (); String message = "Enter amount of money" + Newline + "Money is money:" + zodiac-cost; String text = optionpane.shownputdialog (frame, message); If (text == faucet) {// the user has clicked then canceled}  

Is there any suggestions?

Use InputDialog for user input received

  public stable Zero main (string [] argv throws exceptions {// JFrame frame = new JFrame (); //frame.setVisible(true); Int cost = 100; JLab L = New JLABEL ("exchange currency is"); Jpnil p = new zpinal (new grid layout (1, 2, 10, 10)); P.setPreferredSize (new dimension (400, 50)); JTextField T = New JTextField ("Enter the amount of money"); T.addKeyListener (new java.awt.event.KeyAdapter () {public void keyReleased (java.awt.event.KeyEvent evt) {{int amount = Integer.parseInt (t.getText ()); l.setText ("exchange The money is: \ n "+ (zodiac-cost));} hold (exception before) {// ex.printStackTrace ();}}}); P.add (t); P.add (l); Int options = joppenpen. Shows Confirming Dialeg (tap, p, "joppenpen example:", joppenpain.ocancel_option, joppenpane.plin_message); If (option == 0) {System.out.println ("right clicked"); } Else {System.out.println ("click cancel"); }}  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -