How to Use Borders. Create a panel with an EmptyBorder and then add a second JPanel to the panel.
Don't mix AWT components in a Swing application. Canvas is an AWT component. Just use a JPanel, you still have access to all the Graphics methods.
Edit:
Quit calling your JPanel a Canvas. A Canvas is an AWT component and it works differently than a JPanel.
If you don't want your JPanel to resize then give it a preferred size and add it to a JPanel using a FlowLayout. You can control the horizontal/vertical gaps of a FlowLayout to give the appearance of a Border.
Post your SSCCE (http://sscce.org) showing what you have tried and the problems you have encountered rather than us posting all the code and guessing what your problems are.