문제

I have one JFrame and it has one JTextArea.Now I want set text for this JTextArea to show some infomation.I use MVC with pure entity model.Can I use this function in this JFrame class

 public JTextArea getTxaTicket() {
    return txaTicket;
}

public void setTxaTicket(JTextArea txaTicket) {
    this.txaTicket = txaTicket;
}
도움이 되었습니까?

해결책

I really think you should set and get only the content of the JTextArea. Not the JTextArea it self.

public String getTxaTicket() {
    return txaTicket.getText();
}

public void setTxaTicket(String txaTicket) {
    this.txaTicket.setText(txaTicket);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top