//********************************************************************
//  Project2.java   Author: Chonho Lee
//
//  Demonstrates a frame containing basic componenet and console.
//********************************************************************

import acm.io.*;
import java.awt.*;
import javax.swing.*;

public class Project2
{
   //-----------------------------------------------------------------
   //  Presents two colored panels nested within a third.
   //-----------------------------------------------------------------
   public static void main (String[] args)
   {
      /////////////////////////////////////////////////////////////////
      // creating a frame
      JFrame frame = new JFrame ("title");     // frame title
      frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
      frame.setLocation(0, 0);     // frame location 
      frame.setSize(950, 400);     // frame size

      /////////////////////////////////////////////////////////////////
      // Set up first subpanel
      JPanel subPanel1 = new JPanel();
      subPanel1.setPreferredSize (new Dimension(300, 350));
      subPanel1.setBackground (Color.blue);     // background color

      // label a
      JLabel labela = new JLabel ("aaa", SwingConstants.LEFT);
      labela.setForeground(Color.white);
      labela.setFont(new Font("Serif", Font.BOLD, 24));

      // label b
      JLabel labelb = new JLabel ("bbb");
      labelb.setForeground(new Color(0xffffff));
      labelb.setFont(new Font("Serif", Font.ITALIC, 20));

      // label c
      ImageIcon icon1 = new ImageIcon ("filename.gif");     // file name of your image
      JLabel labelc = new JLabel ("", icon1, SwingConstants.CENTER);

      // add all labels to subpanel 1
      subPanel1.add (labela);
      subPanel1.add (labelb);
      subPanel1.add (labelc);

      ///////////////////////////////////////////////////////////////////
      // Set up second subpanel
      JPanel subPanel2  = new JPanel();
      subPanel2.setPreferredSize (new Dimension(300, 350));
      subPanel2.setBackground (Color.white);
      
      // label 2a
      ImageIcon icon2 = new ImageIcon ("filename.jpg");     // file name of your image
      JLabel label2a = new JLabel ("", icon2, SwingConstants.CENTER);

      // label 2b
      JLabel label2b = new JLabel ("title");
      
      // add all labels to subpanel 2
      subPanel2.add (label2a);
      subPanel2.add (label2b);

      ////////////////////////////////////////////////////////////////////
      // Set up a primary panel
      JPanel primary = new JPanel();
      primary.setBackground (Color.yellow);
      
      // add subpanels to a primary panel
      primary.add (subPanel1);
      primary.add (subPanel2);
      
      //////////////////////////////////////////////////////
      // Create a console for converter
      IOConsole console = new IOConsole();
      
      //////////////////////////////////////////////////////////////////////
      // Add the primary panel and console into a frame
      frame.getContentPane().add(BorderLayout.WEST, primary);
      frame.getContentPane().add(BorderLayout.CENTER, console);
      
      // then show the frame
      frame.setVisible(true);
   
      //////////////////////////////////////////////////////////////////////
      // activate a converter so that users enter their information
      MyConverter conv = new MyConverter();
      conv.showConverter( console );

   }
}

