Developing with the SDK > Using and Writing Data Models > JavaBeans Example > Loading the Molecule into the Diagram Component

You must define a project file to tell the diagram component to use the data source. The project file is an XML file called phenol-molecule.idpr. This file contains the class name of the data source, and also the path of the style sheet used to represent the molecule.

Code Sample 2.11 shows the project file contents.

<diagrammer style="molecule.css">
  <datasource class="PhenolMoleculeDataSource"/>
</diagrammer>

Code Sample 2.10 The Project File for the Molecule Example

To display the molecule, you can simply load the project file into the diagram component as follows:

Diagrammer.setDataFile(new URL("file:phenol-molecule.idpr"));

Note
The sample uses the prebuilt class IlvDiagrammerApplication, so you do not see the call to setDataFile. Instead the project file is passed as a command-line argument to the application.