/*
JEditListTest
Test applet/application for JEditList

(C) Copyright 1998, Wildcrest Associates, http://www.wildcrest.com
All rights reserved

This source code may be freely used, modified, incorporated, and
distributed without restriction as part of any software that uses
JEditList by Wildcrest Associates.

V1.0 June 29, 1998
V1.1 October 28, 1998 - rev for javax.swing package names
*/

// package names for swing 1.1beta3 and JDK1.2fcs
import javax.swing.*;

// package names for swing 1.0.x and JDK1.2beta4
//import com.sun.java.swing.*;

import java.awt.*;

import com.wildcrest.jeditlist.JEditList;
public class JEditListTest extends JApplet
{
	public void init()
	{
		//{{INIT_CONTROLS
		getContentPane().setLayout(null);
		setSize(585,498);
		jComboBox1 = new JComboBox();
		jComboBox1.setEditable(true);
		jComboBox1.setBounds(420,220,140,30);
		jComboBox1.setFont(new Font("Dialog", Font.PLAIN, 12));
		jComboBox1.setForeground(new Color(0));
		jComboBox1.setBackground(new Color(-3355444));
		getContentPane().add(jComboBox1);
		jScrollPane3 = new JScrollPane();
		jScrollPane3.setOpaque(true);
		jScrollPane3.setBounds(420,40,140,120);
		jScrollPane3.setFont(new Font("Dialog", Font.PLAIN, 12));
		jScrollPane3.setForeground(new Color(0));
		jScrollPane3.setBackground(new Color(-3355444));
		getContentPane().add(jScrollPane3);
		jList3 = new JList();
		jList3.setBounds(30,40,20,40);
		jList3.setFont(new Font("Dialog", Font.PLAIN, 12));
		jList3.setForeground(new Color(0));
		jList3.setBackground(new Color(16777215));
		jScrollPane3.getViewport().add(jList3);
		jLabel2 = new JLabel();
		jLabel2.setText("JEditList:");
		jLabel2.setBounds(190,20,140,15);
		jLabel2.setFont(new Font("Dialog", Font.BOLD, 16));
		jLabel2.setForeground(new Color(0));
		jLabel2.setBackground(new Color(-3355444));
		getContentPane().add(jLabel2);
		jLabel3 = new JLabel();
		jLabel3.setText("JEditList:");
		jLabel3.setBounds(20,20,140,15);
		jLabel3.setFont(new Font("Dialog", Font.BOLD, 16));
		jLabel3.setForeground(new Color(0));
		jLabel3.setBackground(new Color(-3355444));
		getContentPane().add(jLabel3);
		jLabel4 = new JLabel();
		jLabel4.setText("JList:");
		jLabel4.setBounds(420,20,140,15);
		jLabel4.setFont(new Font("Dialog", Font.BOLD, 12));
		jLabel4.setForeground(new Color(4210752));
		jLabel4.setBackground(new Color(-3355444));
		getContentPane().add(jLabel4);
		jLabel5 = new JLabel();
		jLabel5.setText("JComboBox:");
		jLabel5.setBounds(420,200,140,15);
		jLabel5.setFont(new Font("Dialog", Font.BOLD, 12));
		jLabel5.setForeground(new Color(4210752));
		jLabel5.setBackground(new Color(-3355444));
		getContentPane().add(jLabel5);
		jLabel6 = new JLabel();
		jLabel6.setText("JTextArea:");
		jLabel6.setBounds(20,290,140,15);
		jLabel6.setFont(new Font("Dialog", Font.BOLD, 12));
		jLabel6.setForeground(new Color(4210752));
		jLabel6.setBackground(new Color(-3355444));
		getContentPane().add(jLabel6);
		jScrollPane1 = new JScrollPane();
		jScrollPane1.setOpaque(true);
		jScrollPane1.setBounds(20,40,140,120);
		jScrollPane1.setFont(new Font("Dialog", Font.PLAIN, 12));
		jScrollPane1.setForeground(new Color(0));
		jScrollPane1.setBackground(new Color(-3355444));
		getContentPane().add(jScrollPane1);
		jEditList1 = new com.wildcrest.jeditlist.JEditList();
		jEditList1.setListItems("");
		jEditList1.setBounds(50,30,0,0);
		jEditList1.setFont(new Font("Dialog", Font.PLAIN, 12));
		jEditList1.setForeground(new Color(0));
		jEditList1.setBackground(new Color(16777215));
		jScrollPane1.getViewport().add(jEditList1);
		jScrollPane2 = new JScrollPane();
		jScrollPane2.setOpaque(true);
		jScrollPane2.setBounds(190,40,200,120);
		jScrollPane2.setFont(new Font("Dialog", Font.PLAIN, 12));
		jScrollPane2.setForeground(new Color(0));
		jScrollPane2.setBackground(new Color(-3355444));
		getContentPane().add(jScrollPane2);
		jEditList2 = new com.wildcrest.jeditlist.JEditList();
		jEditList2.setListItems("");
		jEditList2.setBounds(40,40,0,0);
		jEditList2.setFont(new Font("Dialog", Font.PLAIN, 12));
		jEditList2.setForeground(new Color(0));
		jEditList2.setBackground(new Color(16777215));
		jScrollPane2.getViewport().add(jEditList2);
		jScrollPane4 = new JScrollPane();
		jScrollPane4.setOpaque(true);
		jScrollPane4.setBounds(20,310,540,150);
		jScrollPane4.setFont(new Font("Dialog", Font.PLAIN, 12));
		jScrollPane4.setForeground(new Color(0));
		jScrollPane4.setBackground(new Color(-3355444));
		getContentPane().add(jScrollPane4);
		jTextArea1 = new JTextArea();
		jTextArea1.setMargin(new java.awt.Insets(0,0,0,0));
		jTextArea1.setBounds(90,20,90,90);
		jTextArea1.setFont(new Font("Monospaced", Font.PLAIN, 12));
		jTextArea1.setForeground(new Color(0));
		jTextArea1.setBackground(new Color(16777215));
		jScrollPane4.getViewport().add(jTextArea1);
		jLabel1 = new JLabel();
		jLabel1.setText("JTextField:");
		jLabel1.setBounds(20,200,140,15);
		jLabel1.setFont(new Font("Dialog", Font.BOLD, 12));
		jLabel1.setForeground(new Color(4210752));
		jLabel1.setBackground(new Color(-3355444));
		getContentPane().add(jLabel1);
		jTextField1 = new JTextField();
		jTextField1.setMargin(new java.awt.Insets(0,0,0,0));
		jTextField1.setBounds(20,220,370,30);
		jTextField1.setFont(new Font("SansSerif", Font.PLAIN, 12));
		jTextField1.setForeground(new Color(0));
		jTextField1.setBackground(new Color(16777215));
		getContentPane().add(jTextField1);
		//}}


    	String[] listItems = {"General Motors"
        	,"Ford Motor"
    	    ,"Exxon"
    	    ,"Wal-Mart"
    	    ,"General Electric"
    	    ,"IBM"
    	    ,"Chrysler"
    	    ,"Mobil"
    	    ,"Philip Morris"
    	    ,"AT&T"
    	    ,"Boeing"
    	    ,"Texaco"
    	    ,"State Farm"
    	    ,"Hewlett-Packard"
    	    ,"DuPont"
    	    ,"Sears Roebuck"
    	    ,"Travelers"
    	    ,"Prudential"
    	    ,"Chevron"
    	    ,"Procter & Gamble"
    	    ,"Citicorp"
    	    ,"Amoco"
    	    ,"Kmart"
    	    ,"Merrill Lynch"
    	    ,"J.C. Penney"
    	    };


        jEditList1.setListData(listItems);
        jEditList1.requestFocus();  // otherwise takes 2 clicks to get first focus
        jList3.setListData(listItems);
        
        for (int i=0; i<listItems.length; i++)
            jComboBox1.addItem(listItems[i]);
            
        String moreItems[] = {
            "http://www.yahoo.com", 
            "http://www.altavista.digital.com",
            "http://www.gamelan.com",
            "http://www.download.com",
            "http://www.usatoday.com",
            "http://www.amazon.com",
            "http://espnet.sportzone.com",
            "http://www.nba.com",
            "http://www.wildcrest.com",
            "http://www.travelocity.com",
            "http://www.weather.com",
            "http://java.sun.com",
            "http://www.four11.com",
            "http://www.hotbot.com",
            "http://www.excite.com",
            "http://www.quote.com",
            "http://www.fool.com",
            "http://cnnfn.com",
            "http://www.discovery.com",
            "http://www.nytimes.com",
            "http://www.sjmercury.com",
            "http://www.cdnow.com",
            "http://www.firefly.com",
            "http://www.cdnow.com",
            "http://www.mapquest.com",
            "http://www.developer.com",
            "http://www.dilbert.com",            
            };
            
        jEditList2.setListData(moreItems);
        
	}

	//{{DECLARE_CONTROLS
	JComboBox jComboBox1;
	JScrollPane jScrollPane3;
	JList jList3;
	JLabel jLabel2;
	JLabel jLabel3;
	JLabel jLabel4;
	JLabel jLabel5;
	JLabel jLabel6;
	JScrollPane jScrollPane1;
	com.wildcrest.jeditlist.JEditList jEditList1;
	JScrollPane jScrollPane2;
	com.wildcrest.jeditlist.JEditList jEditList2;
	JScrollPane jScrollPane4;
	JTextArea jTextArea1;
	JLabel jLabel1;
	JTextField jTextField1;
	//}}
	
	
	static public void main(String args[])    // self-test main method (can run applet as application)
	{
		class DriverFrame extends JFrame {
		//class DriverFrame extends java.awt.Frame {
			public DriverFrame() {
			    setTitle("JEditListTest");
				addWindowListener(new java.awt.event.WindowAdapter() {
					public void windowClosing(java.awt.event.WindowEvent event)
					{
						dispose();	    // free the system resources
						System.exit(0); // close the application
					}
				});
				
				getContentPane().setLayout(new java.awt.BorderLayout());
                setLocation(100,75);
                setSize(600,525);
                JEditListTest applet = new JEditListTest();
                getContentPane().add("Center",applet);
                applet.init();
                applet.start();
				
			}
		}

		new DriverFrame().show();
	}
	
}
