java - How to return to the class from a jframe in netbeans -


i'm new netbeans. below scenario :

i have created normal java file in i'm calling jframe. jframe have textbox , submit button. want after calling jframe java file, jframe opens up. after typing text in textbox, when click on submit button should return java file (to line after called jframe) text typed. so, can use text in java file further.

but happening when call jframe below command, jframe opens , after rest of code in java file gets executed. java not waiting jframe return data.

new frame1(new javax.swing.jframe(), false).setvisible(true); 

and below code in jframe. don't know how return , use in java file

private void jbutton1actionperformed(java.awt.event.actionevent evt) {                                              string s1 = jtextfield1.gettext();     arga[0] = s1; } 

so, please let me know how can ?

thanks in advance

make 2 methods,

first 1 main method create frame.

second 1 things when jframe done work.


and case

string s1 = jtextfield1.gettext(); arga[0] = s1; 

just write

arga[0] = jtextfield1.gettext(); 

make arga instance variable can call without return things.

or

private void jbutton1actionperformed(java.awt.event.actionevent evt) private string jbutton1actionperformed(java.awt.event.actionevent evt) {     return yourstringhere; } 

by way, use netbeans, coding via gui design mode more easier learn.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -