No problem. This is one reason people argue for "composition over inheritance". If FirstPanel doesn't actually modify the functionality of JPanel, there's no reason for it to extend JPanel. Instead,...
Type: Posts; User: KevinWorkman
No problem. This is one reason people argue for "composition over inheritance". If FirstPanel doesn't actually modify the functionality of JPanel, there's no reason for it to extend JPanel. Instead,...
FirstPanel IS A JPanel (it extends JPanel). It also HAS A JPanel (named panel). You're adding the JButton to the HAS A JPanel, but you're adding the IS A JPanel to the JFrame.