скажем
public class Dirchooser extends JFrame {
protected String dir;
...
private AbstractAction getGetDirAction() {
if (getDirAction == null) {
getDirAction = new AbstractAction("OK", null) {
public void actionPerformed(ActionEvent evt) {
dir = dirPathTextField1.getText();
setVisible(false);}};}
return getDirAction;}}
как я могу обнаружить видимое из Dirchooser и получить строку dir, используя другой класс?
как
public class Run {
public static void main(String[] args) throws IOException {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
inst = new DirChooser();
inst.setLocationRelativeTo(null);
inst.setVisible(true);}});
//if inst is not visible,
//sysout string dir which in inst
}
}