swing - JAVA putting text in JTextfield -


i'm writing program i'm going info multidimensional array jtextfields, info depend on user inputs in "item2". problem cannot kind of data "thehandler" class jtextfields. try use "settext" tells me cannot change void string. use value in thehandler class "piezas" , use on gui, can't return value piezas gui. not sure here. have array ready, need values on same class write switch can info in jtextfields.

so basically, need "piezas" value thehandler class gui class (or able input text in jtextfields thehandler class).

thnx help!


i'm creating jtextfield this:

jtextfield item1 = new jtextfield(10); 

and here tried set text it:

string setvalue = item1.settext("text"); 

this doesn't work. why?


about edit: full code commented out, not deleted. --mightypork

settext() right choice, used in strange way.

string setvalue = item1.settext("text"); 

settext() has no return value, hence error void.
can't assign void variable.


try instead:

item1.settext("text"); 

or, if want value:

string setvalue = "text"; item1.settext(setvalue); 

or:

string setvalue; item1.settext(setvalue = "text"); 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -