eventHandler, defining & accessing params (java Swing Netbeans) -


in short: how access param passed gui constructor within eventhandler?

more details: using netbeans , swing write plugin in java. have created jframe gui includes jtextfield. eventhandler jtextfield writes value entered variable. within eventhandler want next call method() uses variable and another, passed gui's constructor.

?? how can gain access variable? netbeans wont let me change auto-generated eventhandler signature include gui variable need. eventhandler code below.

this week 3 of java me apologies if basic question
thank you
b ps thank site, has answered many other questions.

private void jtextfield2actionperformed(java.awt.event.actionevent evt) {  // *** no edit allowed signature (greyed netbeans)                                               system.out.println( "textfield2: " +  jtextfield1.gettext() );     string s = jtextfield2.gettext();     try {         numiter = integer.parseint(s.trim());         testmethod(numiter, parampassedintoguiconstructor);  // ?? how parampassedintoguiconstructor?? <<-- key question     } catch (numberformatexception nfe) {         joptionpane.showmessagedialog(cytoscape.getdesktop(),                 "that's not integer!", "numberformatexception",1);     } } // *** no edit allowed (greyed netbeans)   

i'm not sure understand problem, should able add member variable:

private final integer answer; // variables declaration - not modify ... // end of variables declaration 

initialize in constructor:

public myclass(integer iwantaccesstothis) {     initcomponents();     answer = iwantaccesstothis; } 

access it, ad lib:

private void jtextfield2actionperformed(java.awt.event.actionevent evt) {                                                  ...     system.out.println(this.answer);     ... }                                             

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -