java - Get return value from new class with gui -
i have class extends jframe make orders. in middle have button opens new window used find article.
what need is: when click btnnewarticle, after searching new article, , confirm in new window, return article code.
click btnnewarticle --> (open new window find article) --> confirm selection -->as return article code.
is possible?
thanks
for me principle has worked:
public class articlesearchdialog extends jdialog { public static articleid execute(frame parent) { articlesearchdialog dialog = new articlesearchdialog(parent, true); dialog.setvisible(true); return dialog.getselectedarticle(); } private articleid getselectedarticle() { return selectedarticle; } private void jbcancelactionperformed(actionevent evt) { selectedarticle = null; setvisible(false); dispose(); } private void jbokactionperformed(actionevent evt) { selectedarticle = ...; //todo setvisible(false); dispose(); } // rest of dialog code. }
then call gets easy:
articleid articleid = articlesearchdialog.execute(this); if (articleid != null) { //todo }
Comments
Post a Comment