java - How do I receive input from a textbox in a JFrame? -


The following method provides a JFrame, but I need a swing text box inside it to get double value and They can be stored in a variable. The text box should be added to the container

  the public class expands myClass JFrame {container container; Container = getContentPane (); // item label JLabel label text = new jlabel (); ... label text Set text ("item:"); Container.ed (labeltext); // Item Name: Text Box // To create a text box, add it to the container and add value to a variable    

Use a JTextField :

  JTextField field = new JTextField (10); Container.ed (field, border layout south);   

To get the value of the field, repeat .prsd double (field.gettext) ()) .

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -