private void breakpointHit(char pc) { registersModel.fireUpdate(); memoryModel.fireUpdate(0, RAM_SIZE - 1); // TODO optimize Integer srcline = asmMap.bin2src(pc); if (srcline != null) { try { sourceTextarea.requestFocus(); sourceTextarea.setCaretPosition(sourceTextarea.getLineStartOffset(srcline - 1)); } catch (BadLocationException e) { e.printStackTrace(); } } }
private void highlightError(int index) { String message = (String) messages.elementAt(index); int i = message.indexOf(":"); if ((i != -1) && (i < 10)) { try { int lineNumber = Integer.parseInt(message.substring(0, i).trim()) - 1; if (lineNumber < sourceArea.getLineCount()) { int start = sourceArea.getLineStartOffset(lineNumber); int end = sourceArea.getLineEndOffset(lineNumber); sourceArea.requestFocus(); sourceArea.setSelectionStart(start); sourceArea.setSelectionEnd(end - 1); } } catch (Exception ex) { ex.printStackTrace(); } } }
public void clearCard() { question.setText(""); answer.setText(""); question.requestFocus(); }