@Override public void roboyStarmindStateChanged(int state) { switch (state) { case RoboyStarmindState.CONNECTED: this.guiConnected(true); break; case RoboyStarmindState.DISCONNECTED: imagePanel.setImage(null); this.guiConnected(false); break; case RoboyStarmindState.TEXT_SENT: resetTextArea(); break; case RoboyStarmindState.VOICES_RECEIVED: speechComboBox.removeAllItems(); for (String t : model.getVoices()) { speechComboBox.addItem(t); } if (model.getVoices().length > 0) { String voice = prefs.get("roboy_voice", model.getVoices()[0]); speechComboBox.setSelectedItem(voice); } break; case RoboyStarmindState.MODE_SENT: resetMode(); break; case RoboyStarmindState.HEAD_SENT: break; case RoboyStarmindState.FACIAL_SENT: break; case RoboyStarmindState.BODY_SENT: break; } }
private void assignItems() { this.expressionComboBox.removeAllItems(); for (String t : model.getFacialExpressions()) { this.expressionComboBox.addItem(t); } this.movementComboBox.removeAllItems(); for (String t : model.getBodyMovements()) { this.movementComboBox.addItem(t); } }
/** Create the application. */ public RoboyStarmindGUI() { initialize(); model = new RoboyStarmindModel(this); this.guiConnected(model.isConnected()); assignItems(); prefs = Preferences.userNodeForPackage(this.getClass()); assignAddress(); }
private void sendText() { String text = textField.getText().trim(); String voice = (String) speechComboBox.getSelectedItem(); if (text != null && !text.isEmpty()) { prefs.put("roboy_voice", voice); try { prefs.flush(); } catch (BackingStoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (model.sendText(text, voice)) { // btnSpeech.setEnabled(false); // textField.setEnabled(false); } } }