볼드표시 되어있는 부분에서 출력이 안되는데 이상하네요.
문법적으로 오류가 없는거 같은데............. 고수분들 헬프점여!
class Panel1 extends Panel implements ActionListener {
private GridLayout gl = new GridLayout(2, 2);
private Label filename_lb = new Label(" Input file name");
private TextField filename_tf = new TextField();
private Label word_lb = new Label(" Input word");
private TextField word_tf = new TextField();
private Panel2 p2;
public Panel1() {
this.setLayout(gl);
this.add(filename_lb);
this.add(filename_tf);
this.add(word_lb);
this.add(word_tf);
}
public Panel1(Panel2 p) {
this.p2 = p;
}
public void actionPerformed(ActionEvent e) {
// System.out.println("hello"+p1.getFilename_tf().getText());
if (e.getSource() == p2.bt) {
try {
System.out.println("go");
search();
} catch (IOException ie) {
}
} else {
System.out.println("no");
}
}
public void search() throws IOException {
System.out.println(filename_tf.getText()); <------------ 여기서 아무 출력도 나오지 않습니다.
System.out.println(word_tf.getText());
}
}
class Panel2 extends Panel {
private FlowLayout fl = new FlowLayout(FlowLayout.RIGHT);
Button bt = new Button("Search");
public Panel2() {
this.setLayout(fl);
this.add(bt);
bt.addActionListener(new Panel1(this));
}
}