public boolean action(Event e, Object o) { int curCursorType; String session; Vector values; if (e.target == close) removeSelf(); else if (e.target == start) { selection = sessionList.getSelectedIndex(); if (selection < 0) { (new ErrorFrame()).showMsg("Please select a session."); return true; } session = sessionList.getSelectedItem(); curCursorType = getCursorType(); setCursor(Frame.WAIT_CURSOR); values = theAR.getValues(new Date(session)); numSteps = values.size(); setCursor(curCursorType); theApplet.playStart(values); step.enable(); stepIndex = -1; } else if (e.target == step) { int newSelection = sessionList.getSelectedIndex(); if (selection == newSelection) { stepIndex++; if (stepIndex < numSteps) theApplet.playStep(stepIndex); else { (new ErrorFrame()) .showMsg( "End of session has been reached. Please select a new session or click cancel."); step.disable(); } } else if (newSelection < 0) (new ErrorFrame()).showMsg("Please select a session."); else (new ErrorFrame()) .showMsg( "A session must be selected and started before clicking step. 1) Select a session and press start OR 2) Reselect the session you were stepping through"); } return true; }
@Override public void actionPerformed(ActionEvent e) { int selectedIndex = lista.getSelectedIndex(); if (selectedIndex == -1) { JOptionPane.showMessageDialog(null, "debe seleccionar una pc"); } else { Pc pcExterna = pcService.obtenerListaPcExternas().get(selectedIndex); new VistaEnviarMensajePrompt(pcExterna); } }
public int getSelectedIndex() { return awtList.getSelectedIndex(); }
public AbstractClient getSelectedProject() { int i = awtList.getSelectedIndex(); if (i < 0) return null; return projects.get(i); }