Im trying to pass Swing components to another object but the system keeps throwing a NullPointerException. When I print out the component to String before passing it, it does not equal null. What's going wrong here?
Thanks alot
public ResizePanel() {
initComponents();
setLayout(null);
this.setBackground(Color.red);
JButton b = new JButton();
System.out.println("b = " + b.toString());
resizer.addJButton(b, 10, 10); //THROWS NULLPOINTEREXCEPTION HERE
b.setName("b");
b.setBounds(100, 100, 100, 40);
this.add(b);
}