GUI help


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: GUI help

  1. #1
    Join Date
    Oct 2004
    Posts
    1

    Exclamation GUI help

    I am creating a payroll GUI for school, i need to know how to get text from a jtextfield ( that is numbers ) and be able to use that data for calculations and display it on another window

  2. #2
    Join Date
    Oct 2004
    Location
    Roseville, CA
    Posts
    3
    You need to parse the string coming from JTextField. The easiest way is to wrap it in a conversion to a numeric type. For instance, if you want the result from JTextField to be a double, use the following code:

    JTextField field = new JTextField();
    .
    .
    .
    double value = Double.parseDouble(field.getText());

    If you don't want a double, you can typecast the entire expression into another format, such as an integer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center