For setting the preferred size of the viewport for scrolling, use mxGraph.setMinimumGraphSize. This component is a combined scrollpane with an inner mxGraphControl. The control contains the actual graph display. To set the background color of the graph, use the following code:
graphComponent.getViewport().setOpaque(true); graphComponent.getViewport().setBackground(newColor);
This class fires the following events: mxEvent.START_EDITING fires before starting the in-place editor for an existing cell in startEditingAtCell. The
cell
property contains the cell that is being edit and the
event
property contains optional EventObject which was passed to startEditingAtCell. mxEvent.LABEL_CHANGED fires between begin- and endUpdate after the call to mxGraph.cellLabelChanged in labelChanged. The
cell
property contains the cell, the
value
property contains the new value for the cell and the optional
event
property contains the EventObject that started the edit. mxEvent.ADD_OVERLAY and mxEvent.REMOVE_OVERLAY fire afer an overlay was added or removed using add-/removeOverlay. The
cell
property contains the cell for which the overlay was added or removed and the
overlay
property contain the mxOverlay. mxEvent.BEFORE_PAINT and mxEvent.AFTER_PAINT fire before and after the paint method is called on the component. The
g
property contains the graphics context which is used for painting.