java - Random Element as input and get the Value -
i don't know if it's duplicated question cause i've found nothing , didn't know keywords should i've been searching.
i want have class gets element input , shows value of element.
for example:
public void showvalue(object obj){ system.out.println("output: " + obj.getvalue()); }
and then:
nativeselect ns=new nativeselect(); textfield tf=new textfield(); ns.addvalue("name"); ns.select("name"); tf.setvalue("lastname"); showvalue(ns); showvalue(tf);
and have output:
output: name output: lastname
could maybe me or give me idea how should that! i'm new java , started programming after long time.
thanks alot!
you want function can print value of every field. this:
public static void showvalue(field f) { system.out.println("output: "f.getvalue()); //will print via console new notification("output: "+f.getvalue()).show(page.getcurrent()); //will show text box in current page }
as field docs (link), every field has getvalue()
. should take care value types use in fields should have overriden tostring
method doesn't show default tostring
.
Comments
Post a Comment