import java.awt.*;
import java.awt.event.*;

// Module 1 Exercises 1 thru 3
public class Mod1Info extends Panel {
    //private static final Color bgcolor = new Color(236,236,236);
    private static final Color bgcolor = Color.white;
    TitlePanel titlePanel;
    Mod1State state;
    private Font textfont= new Font("SanSerif",Font.PLAIN,14);


    public Mod1Info(Mod1State state) {
        super();
        this.state = state;
        setBackground(bgcolor);
        
        textfont = new Font("SanSerif",Font.PLAIN,state.font14);
        
        if(state.OS_Windows){
            textfont = new Font("SanSerif",Font.PLAIN,state.font14);
        }
        else{
            textfont = new Font("SanSerif",Font.PLAIN,state.font13);
        }
    }


    public void paint(Graphics g){
        Graphics2D g2d = (Graphics2D)g;
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);

        //NEW:
        //g.setFont(TheFonts.bold16);  
        g.setFont(new Font("SanSerif",Font.BOLD,state.font16));
        g.setColor(Color.black);
        String s0 = "Instructions";
        int ex = STR.displayString(s0,g,state.s15,state.s20);
        
        //g.setFont(TheFonts.sanSerif14); // state.ttfFont.deriveFont(14f));
        g.setFont(textfont);
        //g.setFont(TheFonts.sanSerif12);
        g.setColor(Color.black);

        String s1 = "The waveform shown in "+STR.REDBOLD+"red"+STR.ENDREDBOLD+
            " is a "+STR.REDBOLD+"reference"+STR.ENDREDBOLD+" wave given by "+
            STR.REDBOLD+"y = 5 cos( 4"+Character.toString((char)0x03c0)+" t ) :"+
            STR.ENDREDBOLD+"";
        String s2 = "amplitude = 5 volts, f = 2 Hz, and "+
            //STR.PHIFONT+Character.toString((char)0x03c6)+STR.ENDPHIFONT+
            STR.PHIFONT+Character.toString((char)0x03d5)+STR.ENDPHIFONT+
            STR.SUB+"0"+STR.ENDSUB+" = 0.";
        //g.setFont(TheFonts.sanSerif12);
        //g.setColor(Color.black);

        int endingX = STR.displayString(s1,g,state.s15,state.s50);
        endingX = STR.displayString(s2,g,state.s100,state.s70);

        String s3 = "For comparison, you can generate and display in "+
            STR.BLUEBOLD+"blue"+STR.ENDBLUEBOLD+" a waveform given by";
        /*
        String s4 = STR.BLUEBOLD+"y = Acos(2"+
            Character.toString((char)0x03c0)+" ft+"+STR.ENDBLUEBOLD+
            STR.PHIFONT+Character.toString((char)0x03c6)+STR.ENDPHIFONT+
            STR.SUB+"0"+STR.ENDSUB+STR.BLUEBOLD+")"+STR.ENDBLUEBOLD;
        */
        /*
        String s4 = STR.BLUEBOLD+"y = Acos(2"+
            Character.toString((char)0x03c0)+" ft+"+
            Character.toString((char)0x03c6)+STR.ENDBLUEBOLD+
            STR.SUB+"0"+STR.ENDSUB+STR.BLUEBOLD+")"+STR.ENDBLUEBOLD;
        */
        String s4 = STR.BLUEBOLD+"y = A cos( 2"+
            Character.toString((char)0x03c0)+" f t + "+STR.ENDBLUEBOLD+
            STR.BOLDPHI+Character.toString((char)0x03d5)+STR.ENDBOLDPHI+
            STR.SUB+"0"+STR.ENDSUB+STR.BLUEBOLD+")"+STR.ENDBLUEBOLD;
        String s5 = "by specifying its attributes in the Input Panel.";

        endingX = STR.displayString(s3,g,state.s15,state.s110);
        g.setColor(Color.blue);
        endingX = STR.displayString(s4,g,state.s165,state.s135);
        g.setColor(Color.black);
        //endingX = STR.displayString(s5,g,110,150);
        endingX = STR.displayString(s5,g,state.s15,state.s160);
    }

    

    public static void main(String[] args) {

        Frame f = new Frame("Test 2 panels ... and choice");
        
        f.addWindowListener(new WindowAdapter(){
                public void windowClosing(WindowEvent e) {
                    System.exit(0);
                }
            });
        
        //f.add("Center",  new Module1_1());
        //f.setSize(new Dimension(700, 600));
        //f.setVisible(true);
        f.setLayout(new GridLayout(1,0));
        f.setSize(700, 600);
        f.setVisible(true);
        //Mod1Info myApplet = new Mod1Info();
        //f.add(myApplet);
        f.pack();
    }
}
