Since mxGraphComponent
extends JScrollPane
change the background of the view port:
graphComponent.getViewport().setOpaque(true);
graphComponent.getViewport().setBackground(Color.BLACK);
From JScrollPane docs:
This can be accomplished by setting the background color of the viewport, via scrollPane.getViewport().setBackground(). The reason for setting the color of the viewport and not the scrollpane is that by default JViewport is opaque which, among other things, means it will completely fill in its background using its background color. Therefore when JScrollPane draws its background the viewport will usually draw over it.