Your contentPane has a GroupLayout, set in initComponents(). You can't just add a toolbar or any other component without specifying its group.
This is why I repeatedly point out that the NetBeans visual designer isn't a beginners' tool. Go through the Swing tutorials and learn how to write Swing code and how to layout your components using layout manager(s) that are easier to understand than GroupLayout. While you're there. go through the section on How to Use Toolbars.
There are no new questions, but there may be new answers.
posted 7 years ago
what happen if i add this tool bar into jpanel.will it give any errors