I'm having some trouble using getClientproperty() to get a string value
btw, im using java 1.4.2, so no autoboxing

I know how to get int values, and here is an example, which works perfect in my program,

cx = ((Integer) btn.getClientProperty ("cx")).intValue ();

but when i try to get a string value, it wont work

type = ((String) btn.getClientProperty ("type")).StringValue ();

I get error which says
No method named "StringValue" was found in type "java.lang.String".

what am i doing wrong?

No method named "StringValue" was found in type "java.lang.String".

The compiler can not find a method called StringValue for the String class. Where did you see that defined as a method?

What is the type of the value you stored with the key of "type"?

Edited 4 Years Ago by NormR1: n/a

i dont, i was just trying stuff out, i was trying to get the object to a string, idk, do you know what the object type of a string is, becouse i cant find it

have you tried the valueOf(...) method? the String class doesn't have a StringValue() method, which is exactly what your error is telling you.

You just need to cast the Object that's returned. String isn't a primitive so there's no boxing involved
String s = (String) btn.getClientProperty ("myString");

Edited 4 Years Ago by JamesCherrill: n/a

This question has already been answered. Start a new discussion instead.