JPanel
uses FlowLayout
which respects preferred sizes but the default size of the Dot
component is too small to be seen. You need to use a layout manager that uses the maximum area available or override getPreferredSize
. Remember to call pack
before calling JFrame#setVisible
jpanel.setLayout(new BorderLayout());