需要 Start() 等到在另一个类中单击按钮才能继续。请帮忙。
板球比赛
private string occurance;
public void Start()
{
EnterGUI objE = new EnterGUI();
objE.setVisible(true);
String occur = objE.textField.getText();
occurance = occur;
}
进入GUI
public class EnterGUI extends JFrame {
String occurance;
public void setOccurance(String occurance) {
this.occurance = occurance;
}
public String getOccurance() {
return occurance;
}
JButton btnNewButton = new JButton("Save");
btnNewButton.setBounds(120, 5, 86, 43);
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
setOccurance(textField.getText());
}
});
}
}