// BugPanel.java
// Dedicated drawing panel
import java.awt.*;
import javax.swing.*;

public class BugPanel extends JPanel {
        Bug ref;  // superclass reference
        RedBug red1 = new RedBug( "Laverne", 5, 400, 50, 50, 24, 8, 4, 10 );
        RedBug red2 = new RedBug( "Shirley", 6, 350, 130, 60, 30, 10, 6, 12 );
        GreenBug green1 = new GreenBug( "Kermit", 7, 300, 190, 20, 8, 4, 5 );
        GreenBug green2 = new GreenBug( "Gumby", 4, 200, 70, 16, 6, 3, 4 );
        BlueBug blue1 = new BlueBug( "Blue", 4, new Triangle( 70, 90, 40, 15 ), 8, 4 );
        BlueBug blue2 = new BlueBug( "Flix", 6, new Triangle( 420, 180, 80, 30 ), 12, 6 );

        public void paintComponent( Graphics g ) {
                super.paintComponent( g );
                int xPos = 60;
                int yPos = 220;

                ref = red1;
                ref.crawl( );
                ref.draw( g );
                g.drawString( ref.toString( ), xPos, yPos );
                yPos += 30;

                ref = red2;
                ref.crawl( );
                ref.draw( g );
                g.drawString( ref.toString( ), xPos, yPos );
                yPos += 30;

                ref = green1;
                ref.crawl( );
                ref.draw( g );
                g.drawString( ref.toString( ), xPos, yPos );
                yPos += 30;
        
                ref = green2;
                ref.crawl( );
                ref.draw( g );
                g.drawString( ref.toString( ), xPos, yPos );
                yPos += 30;

                ref = blue1;
                ref.crawl( );
                ref.draw( g );
                g.drawString( ref.toString( ), xPos, yPos );
                yPos += 30;

                ref = blue2;
                ref.crawl( );
                ref.draw( g );
                g.drawString( ref.toString( ), xPos, yPos );
                yPos += 30;
        }
}