private void setCaretValue(String s) { try { int i = Integer.parseInt(s); setCaretValue(i); } catch (NumberFormatException e) { Messages.writeStackTrace(e); // System.out.println("invalid caret position "+caretValue); } }
/** Update state from Infostat. */ public void updateStatus(String msg) { // Messages.postDebug("VLcStatusChart.updateStatus(" + msg + ")");/*CMP*/ if (msg == null) { return; } StringTokenizer tok = new StringTokenizer(msg); if (tok.hasMoreTokens()) { String key = tok.nextToken(); String val = ""; if (tok.hasMoreTokens()) { val = tok.nextToken("").trim(); // Get remainder of msg } if (key.equals(statkey)) { if (val != null && !val.equals("-")) { valstr = val; setState(state); } /*System.out.println("Chart: statkey=" + statkey + ", val=" + val);/*CMP*/ } if (key.equals(statpar)) { if (val != null && !val.equals("-")) { /*System.out.println("Chart statpar=" + statpar + ", value=" + value);/*CMP*/ setState(state); } } if (key.equals(statset)) { if (val != null && !val.equals("-")) { setval = val; try { String num = val.substring(0, val.indexOf(' ')); setStatusValue(Double.parseDouble(num)); } catch (NumberFormatException nfe) { Messages.postDebug("VLcStatusChart.updateStatus(): " + "Non-numeric value: " + msg); } catch (StringIndexOutOfBoundsException sioobe) { setStatusValue(0); // No value found } /*System.out.println("Chart statset=" + statset + ", setval=" + setval);/*CMP*/ setState(state); } } } repaint(); }