java - Retrieve JTextField text value -
i'm trying retrieve text value jtextfield first need cast component object (java.awt.component) jtextfiel...
mi code this
component[] x = this.getcomponents(); for(int = 0; < x.length; i++) { if (x[i] instanceof jtextcomponent) { //retrieve text...something //(jtextfield)x[i].gettext(); } } i'm doing because know controls of mi page in "x" (jlabels , jtextfield) components , that's why i'm making cast jtextfield.
i'm lost here , don't know if right way it. time!
((jtextcomponent) x[i]).gettext(); should work.
(just because x[i] instance of jtextcomponent, doesn't mean it's neccesarily jtextfield though.) jtextcomponent has .gettext() casting jtextcomponent should ok.
Comments
Post a Comment