ByteViewerComponent addView(String viewName, DataFormatModel model, boolean editMode,
			boolean updateViewPosition) {

		if (viewList.size() != 0) {
			addingView = true;
		}
		final ViewerPosition vp = getViewerPosition();

		// create new ByteViewerComponent

		ByteViewerComponent c = newByteViewerComponent(model);
		c.setEditColor(editColor);
		c.setNonFocusCursorColor(ByteViewerComponentProvider.CURSOR_NOT_FOCUSED_COLOR);
		c.setCurrentCursorColor(currentCursorColor);
		c.setCurrentCursorLineColor(currentCursorLineColor);
		c.setEditMode(editMode);
		c.setIndexMap(indexMap);
		c.setMouseButtonHighlightColor(highlightColor);
		c.setHighlightButton(highlightButton);
		viewList.add(c);
		c.setSize(c.getPreferredSize());
		indexedView.addView(viewName, c);
		c.addListeners();

		if (viewList.size() == 1) {
			currentView = c;
			if (blocks != null) {
				setCursorLocation(blocks[0], BigInteger.ZERO, 0);
			}
		}
		else {
			ByteBlockSelection sel = currentView.getViewerSelection();
			if (sel != null) {
				c.setViewerSelection(sel);
			}

			ByteBlockSelection hl = currentView.getViewerHighlight();
			if (hl != null) {
				c.setViewerHighlight(hl);
			}

			ByteBlockInfo info = currentView.getViewerCursorLocation();
			if (info != null) {
				c.setViewerCursorLocation(info.getBlock(), info.getOffset(), info.getColumn());
			}
			if (updateViewPosition) {
				Swing.runLater(() -> indexPanel.setViewerPosition(vp.getIndex(), vp.getXOffset(),
					vp.getYOffset()));
			}
			addingView = false;
		}
		validate();
		repaint();
		return c;
	}
Add a view to the panel.

@param viewName name of the format, e.g., Hex, Ascii, etc.
@param model model that understands the format
@param editMode true if edit mode is on
@param updateViewPosition true if the view position should be set
@return the new component
Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerPanel.java