1 2 3 4 5 6 7 8 9 10 11 12 | public interface ClientStateChangeable { /** * To get all changeable components in the GUI object. * @return Collection contains Component objects. */ Collection getChageableComponents(); /** * To save data to server. */ void saveChangeToServer(); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | public class AClientGUI extends JPanel implements ClientStateChangeable{ //… private ClientState state = null; public DesignStep1View(ClientState state){ //… this.state = state; this.state.setComponents(this); } private void okButton_actionPerformed(ActionEvent e){ state.action(this); //save data } public Collection getChageableComponents() { Collection dataComponents = new ArrayList(); dataComponents.add(jComboBoxESEPattern); //… return dataComponents; } public void saveChangeToServer() { //… } } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |