java - How to return the new value of a public String from a private void JButton? -
i have public string in 1 class , used other classes. value of string can acquired use of jbutton. code seems right still null returned button.
below class containing public string variable , code jbutton:
public class seminar_menu extends javax.swing.jframe { connection conn = null; resultset rs = null; preparedstatement ps = null; // public string mentioned in quesiton public string seminar_choosen; ...... //button code private void jbutton3actionperformed(java.awt.event.actionevent evt) { conduct_seminar consem = new conduct_seminar(); seminar_menu semen = new seminar_menu(); string message = "conduct seminar?"; string title = "conduct"; int reply = joptionpane.showconfirmdialog(null, message, title, joptionpane.yes_no_option); if (reply == joptionpane.yes_option) { seminar_choosen = title_field.gettext(); consem.setvisible(true); semen.setvisible(false); } } ...... } i'm using jframe form way in netbeans. there other way of returning value of seminar_choosen?
public class example { public static class myaction extends abstractaction { string val; public myaction(string val) { this.val = val; } public void actionperformed(actionevent ae) { system.out.println("value: " + val); } } then
jbutton = new jbutton(new example(mystring));
Comments
Post a Comment