Assignment #43

Code

///Name: Mahima Choudhary
///Period: 6
///Project Name: Prog43
///File Name: Prog43.java
///Date Finished: 11/6/15

    import javax.swing.*;
    import java.awt.*;
    
    public class Prog43
    {
        public static void main(String[] args)
        {
            Frame43 f = new Frame43();
            f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
            f.setVisible(true);
        }
    }
    
    class Frame43 extends JFrame
    {
        public Frame43()
        {
            setTitle("43 rocks!");
            setSize(300,200);
            setLocation(100,200);
            
            Panel143 panel = new Panel143();
            Container cp = getContentPane();
            cp.add(panel);
        }
    }
    
    class Panel143 extends JPanel
    {
        public void paintComponent( Graphics g )
        {
            super.paintComponent(g);
            g.drawString("Hi",75,100);
        }
    }

Picture of the output

YourInitials.html