root/www.mail/JavaPopWeb/src/jp/ac/nime/computer/websim/CookieListDialog.java

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. CookieListDialog
  2. actionPerformed

package jp.ac.nime.computer.websim;

import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;

import jp.ac.nime.computer.*;

/**
 * WWWシミュレータ Cookieリストダイアログ
 * 
 * @version 1.00 2003/03/31
 * @author Toshikazu Matsumoto Avion Corp.
 */
public class CookieListDialog extends JDialog implements ActionListener
{
        private Frame m_Parent;                 //親フレームクラス
        private Hashtable       m_htCook;       //Cookieハッシュテーブル
        private Vector          m_vcCook;       //Cookie列
        private JButton m_btOk;                 //OKボタン
        private JList   m_lsCook;               //リストボックス
        
        /**
         * クラスコンストラクタ
         * @param parent 親フレームクラス
         * @param htCook Cookieハッシュテーブル
         * @param vcCook Cookie列
         */
        public CookieListDialog(Frame parent,Hashtable htCook,Vector vcCook)
        {
                super(parent,"cookie");
                this.m_htCook=htCook;
                this.m_vcCook=vcCook;
                this.m_Parent=parent;
                
                Panel pButton=new Panel();
                pButton.setLayout(new FlowLayout(FlowLayout.CENTER));
                pButton.add(this.m_btOk=new JButton("OK"));
                
                this.m_btOk.addActionListener(this);
                
                this.getContentPane().setLayout(new BorderLayout());
                this.getContentPane().add("Center",this.m_lsCook=new JList(this.m_vcCook));
                this.getContentPane().add("South",pButton);
                
                this.m_lsCook.setVisibleRowCount(10);

                MouseListener mouseListener = new MouseAdapter()
                {
                    public void mouseClicked(MouseEvent e)
                        {
                        if (e.getClickCount() == 2)
                                {
                            int index = m_lsCook.locationToIndex(e.getPoint());
                                        String sText="handle\n\n\n";
                                        sText+="www.home.jp/\n";
                                        sText+="0\n";
                                        sText+="416055296\n";
                            new TextAreaDialog(m_Parent,"cookie",sText);
                         }
                    }
                };
                this.m_lsCook.addMouseListener(mouseListener);
                
                
                //this.pack();
                this.setSize(150,300);
                Toolkit tool=Toolkit.getDefaultToolkit();
                Dimension d=tool.getScreenSize();
                this.setLocation(new Point((d.width-this.getSize().width)/2,(d.height-this.getSize().height)/2));
                this.show();
        }
        /**
         * 各種ボタン押下時のアクション
         */
        public void actionPerformed(ActionEvent evt)
        {
                //OKボタン押下時
                if(evt.getSource().equals(this.m_btOk))
            {
                        this.dispose();
                }
        }
}

/* [<][>][^][v][top][bottom][index][help] */