I want to implement some functionality in a library and make it available as a GUI building block for my applications. I think I would like to implement it as something that extends a `JPanel`, so it can be embedded as a component in other windows.

Is there a reason I should use a `JDialog` instead? How easy is it to create a `JDialog` which displays a `JPanel` along with minimal other appropriate components? (e.g. just a border/closebox/etc for modeless dialog; for modal, the same + an OK/Cancel)