The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

change of value

Posted by nipin on October 16, 2001 at 11:22 AM

Hi there,

I am not an expert but I have been working on a similar problem.

First of all the JTextField takes a string. So if you have to use
an integer or a float than you have to convert it. For my case
I needed float so i had to conver it.

Try this bro,


String standard = new String("1");
String newInt = new String();
JTextField newText = new JTextField(standard,5); //new textfield will
//have 1 default
newInt = newText.getText(); //newInt has string 1
Float result = new java.lang.Float(1.0); //new Float constructor
result = java.lang.Float.valueOf(result);//conversion of string
// to float




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us