Hi,
I am not able to use panels that implement interfaces to realize a composition with other panels.
I would like to do this composition to decide at run time (using a method factory pattern) how the panels have to be arranged.
The the code is this...:
public ClassDialog extends JFrame {
Interface_one panel1 ;
Interface_two panel2 ;
public ClassDialog() {
panel1 = new Panel1();
panel2 = new Panel2();
add(panel1);
add(panel2)
}
public class Panel1 extends JPanel implements Interface_one{
..
}
public class Panel2 extends JPanel implements Interface_two{
..
}
When this code is wrote, the error: "no suitable method found for add" is showed in the IDE of NetBean..
I cannot understand what can be the reason because is not allowed to add component that implements interface..
So I would ask an explanation for the problem that I am having.
I should also get an advice how realize composition of panels using factory method pattern
thank you
regards
Angelo Moreschini