//这是一个由Applet改成的JFrame的布局问题
//为什么要用鼠标拖动窗体一下,改变窗体的大小才能显示GridLayout中的布局
//请高人指点,谢了
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.util.EventObject;
import javax.swing.*;public class Larry_hh extends JFrame
implements ActionListener, ItemListener
{
 private JPanel buttonPanel;
    private JPanel checkPanel;
    private JLabel prompt1;
    private JLabel prompt2;
    private JLabel prompt3;
    private JLabel prompt4;
    private JLabel prompt5;
    private JLabel promptg;
    private JLabel promptgg;
    private JLabel promptg2;
    private JLabel promptg3;
    private JTextField input1;
    private JTextField input2;
    private JTextField input3;
    private JTextField input4;
    private JTextField input5;
    private double result;
    JButton butt;
    JButton butp;
    JCheckBox checkv;
    JCheckBox checkm;
    JCheckBox checkh;
    JCheckBox checkn;
    JCheckBox checkd;
    JCheckBox checkf;
    JCheckBox checkx;
    JCheckBox checkca;
    boolean firsttime;
    private JTextField inputs1;
    private JTextField inputtime;
    private JLabel prompts1;
    private JLabel prompttime;
    
    
    public Larry_hh()
    {
      setVisible(true);
       
         setTitle("The Hodgkin-Huxley Model one cell");
         
      setSize(620,290);
        buttonPanel = new JPanel();
        butt = new JButton("Start");
        butt.addActionListener(this);
        prompt2 = new JLabel("   gna");
        input2 = new JTextField(3);
        input2.addActionListener(this);
        prompt3 = new JLabel("  gk");
        input3 = new JTextField(3);
        input3.addActionListener(this);
        prompt4 = new JLabel("    gcl");
        input4 = new JTextField(3);
        input4.addActionListener(this);
        prompts1 = new JLabel(" S1 at");
        inputs1 = new JTextField(3);
        inputs1.addActionListener(this);
        prompttime = new JLabel(" time ");
        inputtime = new JTextField(3);
        inputtime.addActionListener(this);
        prompt5 = new JLabel(" S2 at");
        input5 = new JTextField(3);
        input5.addActionListener(this);
        input2.setText("120.0");
        input3.setText("36.0");
        input4.setText("0.3");
        input5.setText("18");
        inputs1.setText("5");
        inputtime.setText("40");
        
        checkPanel = new JPanel();
        
        butp = new JButton("Replot");
        butp.addActionListener(this);
        promptg = new JLabel("     ");
        promptgg = new JLabel("    ");
        promptg2 = new JLabel("     ");
        promptg3 = new JLabel("    ");
        checkv = new JCheckBox("Voltage", true);
        checkv.addItemListener(this);
        checkm = new JCheckBox("m gate", false);
        checkm.addItemListener(this);
        checkh = new JCheckBox("h gate", false);
        checkh.addItemListener(this);
        checkn = new JCheckBox("n gate", false);
        checkn.addItemListener(this);
        
     //   repaint();
        
        buttonPanel.setLayout(new GridLayout(1, 13));
        buttonPanel.add(butt);
        buttonPanel.add(prompt2);
        buttonPanel.add(input2);
        buttonPanel.add(prompt3);
        buttonPanel.add(input3);
        buttonPanel.add(prompt4);
        buttonPanel.add(input4);
        buttonPanel.add(prompts1);
        buttonPanel.add(inputs1);
        buttonPanel.add(prompt5);
        buttonPanel.add(input5);
        buttonPanel.add(prompttime);
        buttonPanel.add(inputtime);
        checkPanel.setLayout(new GridLayout(7, 1));
        checkPanel.add(butp);
        checkPanel.add(checkv);
        checkPanel.add(checkm);
        checkPanel.add(checkh);
        checkPanel.add(checkn);
        checkPanel.add(promptgg);
        checkPanel.add(promptg);
        setLayout(new BorderLayout());
        add(checkPanel, "East");
        add(buttonPanel, "North");
    }
    
    public void actionPerformed(ActionEvent actionevent)
    {
    
    }
    
    public void itemStateChanged(ItemEvent itemevent)
    {
    
    }
    
    
    public static void main(String args[])
    {
     Larry_hh application = new Larry_hh();
    
     application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
    }
    

}