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);
}
}
2 comments:
Hi Sir,
I'm Jovanie from Cor Jesu College..
BS ComSci student.,..,
ask ko lng poh sna bout sa nodes, stacks and queues.. mewon din nmn poh ako naintindihan sa mga ito.. concept lng ata.. pero pag dating sa code zero balance ako.. stuck up poh ako sa (Previous Next) na gnagawa nming prog sa java... post ko poh bukas ang mga codes kso bka kulangin ang size sa comment d2.. <
Mewon poh kmi bago na ggwin.. users will input any number and as many as he want.. then it displays his inputs.. then displays another that is arranged from lowest to highest and vise versa... mdyo nhihirapan p ako s concept.. prang hnd kaya.. anu poh suggestion nyo?
Post a Comment