Parsing or Casting a JtextField? Help requested....

T

Tamer Higazi

Hi!
I have a JTextField which receives at runtime a value. Now this value
has to be inserted with a specialtype (not text) in a database.

In the java chat somebody told me that I have to parse. I know only on
C++ that the conversion a value from one datatype to one other has to be
casted.

Can somebody give me a sample?

I would thank very much for any help coming from your side

kind regards


Tamer Higazi
 
A

Andrew Thompson

I have a JTextField which receives at runtime a value. Now this value
has to be inserted with a specialtype (not text) in a database.

Like special how? (Do not tell us what
it is not, tell us what it is.)

Andrew T.
 
T

Tamer Higazi

From the runtime the values in a JTextField have to be assigned to
variables with the following datatype:

short
byte
int

I don't know how to do that!

For any help

Thank you

Tamer
 
P

Patricia Shanahan

Tamer said:
From the runtime the values in a JTextField have to be assigned to
variables with the following datatype:

short
byte
int

I don't know how to do that!

Short.parseShort(String s)
Byte.parseByte(String s)
Integer.parseInt(String s)

More generally, if you need to do something with e.g. an int and don't
know how to do it, it is always worth scanning the methods in Integer to
see if one helps.

Patricia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top