WinDerivedClassCatTest
import javax.swing.*;
import java.awt.*;
public class WinDerivedClassCatTest extends JFrame{
//ds
int row = 10, col = 10;
String output = "";
public static void main(String[] args){
WinDerivedClassCatTest cattest = new WinDerivedClassCatTest();
cattest.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
cattest.setBounds(150,150,400,300);
cattest.setVisible(true);
}
public WinDerivedClassCatTest(){
super("Inheritance Demo For Cats");
Container pane = getContentPane();
pane.setLayout(new BorderLayout());
pane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
pane.setBackground(new Color(250,100,50));
//add text area
JTextArea textarea = new JTextArea(row,col);
//pane.add(textarea);
DerivedClass aCat = new DerivedClass("Toger","Tiger");
Cat bCat = new Cat("Meeeiaow");
//output here
output += aCat+"\n";
output += bCat+"\n";
//display here
textarea.setText(output);
pane.add(textarea,BorderLayout.NORTH);
}
}