// Initializes the memory segment private void init(Memory mainMemory, MemorySegmentGUI gui) { m_mainMemory = mainMemory; m_gui = gui; if (hasGUI) { gui.addListener(this); gui.addErrorListener(this); } }
@Override public void refreshGUI() { super.refreshGUI(); if (displayChanges) { m_gui.setStartAddress(startAddress); } }
/** Sets the start address with the given one. */ public void setStartAddress(int startAddress) { this.startAddress = startAddress; if (displayChanges) { m_gui.setStartAddress(startAddress); } }
/** Scrolls the memory such that the given address will be on top. (assumes legal address). */ public void scrollTo(int address) { if (displayChanges) { m_gui.scrollTo(startAddress + address); } }
/** Hides all selections. */ public void hideSelect() { if (displayChanges) { m_gui.hideSelect(); } }