title: Getting user input by JTextField in Java?
body: <p>I am trying to get user inputs from a textbox so I can take the user input to calculate the displacement for a ball.</p>
  
  <p>I  tried this</p>
  
  <pre><code>double initialvelocity = new JTextBox("enter your initial velocity");
  </code></pre>
  
  <p>so I have a variable with data that I can use. I just cant get it to work and this has been a obstacle to my first proper java project.</p>
  
  <p>Could anyone suggest how I can get a variable to store data using <code>JTextField</code> or is there other alternatives?</p>