B
BEHROUZ
Hi every body
I am new at Java and I have a question for you.I just wonder how I can
add several objects from several classes(lets say I have three
classes MyLine, MyRectangle, and MyOval) to one JPanel class .
I have tried this way but it did not work!
public class MyPanel extends JPanel {
MyPanel(){
MyRect rec = new MyRect();
MyOval ova = new MyOval();
add(rec);
add(ova);
}
}
I know that I can add several JLabel or JButton to Jpanel object but
can I do this for Graphic classes as well?
could you please give a hint about that?
best regards,
Behrouz
I am new at Java and I have a question for you.I just wonder how I can
add several objects from several classes(lets say I have three
classes MyLine, MyRectangle, and MyOval) to one JPanel class .
I have tried this way but it did not work!
public class MyPanel extends JPanel {
MyPanel(){
MyRect rec = new MyRect();
MyOval ova = new MyOval();
add(rec);
add(ova);
}
}
I know that I can add several JLabel or JButton to Jpanel object but
can I do this for Graphic classes as well?
could you please give a hint about that?
best regards,
Behrouz