How do I open a JInternalFrame centered in a JDesktopPane?

For reference, here is the solution I used, based on dogbane's advice:

Dimension desktopSize = desktopPane.getSize();
Dimension jInternalFrameSize = jInternalFrame.getSize();
jInternalFrame.setLocation((desktopSize.width - jInternalFrameSize.width)/2,
    (desktopSize.height- jInternalFrameSize.height)/2);

Work out the top-left corner of the new location (based on the size of the JDesktopPane and JInternalFrame) and then call JInternalFrame.setLocation.