默认是BorderLayout
你改一下Layout的方法就好了
可以用
FlowLayout 或者GridLayout

解决方案 »

  1.   

    在super("a example");后面加上
    setLayout(new FlowLayout());
      

  2.   

    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;public class Frame1 extends Frame
    {
            public static void main(String args[])
            {
                    Frame f=new Frame1();
                    f.setSize(500,400);
                    f.setVisible(true);
                    f.addWindowListener(new WindowAdapter()
                    {
                       public void windowClosing(WindowEvent e){
                           System.exit(0);
                       }
                });
        }        public  Frame1(){
                    super("a example");
                    Label one=new Label("please choose method");
                    Choice eny=new Choice();
                    eny.add("des");
                    eny.add("rsa");
                    Button desEncry=new Button("desEncry");
                    Button rsaEncry=new Button("rsaEncry");
                    TextField tencry=new TextField(50);
                    TextField tdencry=new TextField(50);
                    setLayout(null);
                    one.setBounds(20,40,150,30);
                    eny.setBounds(200,40,200,30);
                    tencry.setBounds(20,90,400,30);
                    tdencry.setBounds(20,150,400,30);
                    desEncry.setBounds(50,200,80,30);
                    rsaEncry.setBounds(150,250,80,30);
                    add(one);
                    add(eny);
                    add(tencry);
                    add(tdencry);
                    add(desEncry);
                    add(rsaEncry);
                       show();
            }
    }
      

  3.   

    在encry构造函数中增加getContendPane().setLayout(null);
      

  4.   

    你用的是awt,那要在构造函数里增加:setLayout(null);