查询结果的ActionEvent - Java

时间:2016-01-11 10:25:04

标签: java actionlistener actionevent

我想知道在一个扩展到windowPane的弹出窗口中执行的查询的结果。

这是打开窗口的班级:

private void processBtnChangeRateAction(ActionEvent e) {
        AccountChangeRate win = new AccountChangeRate(clientRef, lblClientRate.getText(),a , app);
        win.setModal(true);
        win.setListener(new ActionListener() {
            private static final long serialVersionUID = 1L;

            public void actionPerformed(ActionEvent e) {
                WindowMessage win = new WindowMessage("Saved");
                getApplication().addWindow(win);
            }
        });
        getApplication().addWindow(win);
}

这是窗口类:

public AccountChangeRate(String clientRef, String old_rate, Account a, Application app) {
    super();
    this.clientRef = clientRef;
    this.old_rate = old_rate;
    this.a = a;
    initComponents();

}

private void processBtnSaveAction(ActionEvent e) {

    String msg = "Saved";
    app = getApplication();
    List<Product> list = bc.getProducts(a, app);
    try{
        if(rate.getText() == "N/A" || rate.getText() == ""){
            msg = "Please enter a Rate before saving.";
        }else{
            bc.editProduct(a.getHandle().getAccountNumber(), list.get(0).getName(), rate.getText(), startDate.getText(), app);
        }
    } catch (RateNotFoundException_Exception e1) {
        // TODO Auto-generated catch block
        msg = "The Rate you entered does not exist in the database.";
        e1.printStackTrace();
    }
    if(!msg.equals("Saved")){
        // HERE I Would like to sent a event that says that there was an issue.
    }else{
        l.actionPerformed(e);
        getParent().remove(this);
    }
}

我该如何处理?有什么建议吗?

0 个答案:

没有答案