🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #18778

String Conversions

#18778
From: Julio Rincon
Date: Mon, 27 Apr 1998 00:00
34 lines
1707 bytes
I'm trying to do simple calculations on a frame and I'm having many
problems.  To simplify I have setup two FieldControl components  on a
Frame (fieldOne and fieldTwo) and I am trying to do the following:

  1) pull the string from fieldOne
  2) convert it to integer to do some calculations
  3) convert the new value back to string
  4) set the textfield of fieldTwo to new string value

I setup an event with the following code that would execute if the
value of fieldOne changed, the calculations are omitted since they're
not the cause of the problem:

  String test = fieldOne.getText();
  int itest = Integer.parseInt(test);
  String stest = Integer.toString(itest);
  fieldTwo.setText(stest);

This works if I type integers into fieldOne but it doesn't work if I
type in currency amounts (e.g. 55.55).  When I type in currency
amounts nothing happens, not even an error message.

If I link fieldOne to a table field in a database I get an error
message: EventDispatchThread.java:63.

I have tried converting the text from fieldOne to a float number, but
not have much luck since I can't figure out the correct syntax from
the Float class (valueOf).  I have been trying to figure this out for
a couple of hours and am quite confused.

Any help would be appreciated!

Julio.
Technical Details
Message-ID: <3544318b.861070400@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,896ae2f6a10aacdf,start
X-Google-Attributes: gidf74b3,public
From: julioCR@aol.com (Julio Rincon)
Subject: String Conversions
Date: 1998/04/27
Message-ID: <3544318b.861070400@forums.borland.com>
X-Deja-AN: 347997327
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language