// Loads the defalt stylesheet from an external file
mxCodec codec = new mxCodec();
Document doc = mxUtils.loadDocument(GraphEditor.class.getResource(
"/com/mxgraph/examples/swing/resources/default-style.xml")
.toString());
codec.decode(doc.getDocumentElement(), graph.getStylesheet());
// Sets the background to white
getViewport().setOpaque(true);
getViewport().setBackground(Color.WHITE);
}