下面都是流布局!为什么窗口控件的布局会有如此大的差距啊!!!!!!求解答.........
import java.awt.*;
public class LoginFrame extends Frame{
     public LoginFrame(){//设置框架窗口标题 
      super("显示整数数字"); 
      this.setSize(250,200);//设置框架的尺寸
      this.setBackground(Color.lightGray);//设置框架的背景颜色
      this.setLayout(new FlowLayout());//设置框架为流布局,居中
      this.add(new Label("整数"));//创建标签,添加到框架上
      this.add(new TextField(20));//创建文本行
      
      this.add(new Label("百位"));
      TextField TextField1=new TextField(20);
      this.add(TextField1);//创建文本行
      TextField1.setEditable(false);////创建文本行不可编辑
      
      this.add(new Label("十位"));
      TextField TextField2=new TextField(20);
      this.add(TextField2);
      TextField1.setEditable(false);
      
      this.add(new Label("个位"));
      TextField TextField3=new TextField(20);
      this.add(TextField3);
      TextField1.setEditable(false);
      
      this.setVisible(true);
     }
     public static void main(String arg[]){
      new LoginFrame();
     }
}/////////下面是第二个
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;import javax.swing.*;
import javax.swing.event.*;public class ShowJFrame extends JFrame implements CaretListener{ private JTextField t1,t2,t3,t4;//四个文本行
private MessageJDialog jdialog;//对话框,内部类对象

public  ShowJFrame(){ 
  super("显示整数数字");
  this.setSize(250,200);
  //this.pack();
  this.setBackground(Color.lightGray);
  this.setDefaultCloseOperation(EXIT_ON_CLOSE);//单击窗口关闭按钮时,结束运行程序
  this.getContentPane().setLayout(new FlowLayout(FlowLayout.RIGHT));//内容窗格流布局
  
  this.getContentPane().add(new Label("整数"));
  t1=new JTextField(20);
  t1.setHorizontalAlignment(JTextField.RIGHT);//设置水平对齐方式为右对齐
  this.getContentPane().add(t1);
  t1.addCaretListener(this);//注册文本编辑事件监听器
  
  this.getContentPane().add(new Label("百位"));
  t2=new JTextField(20);
  t2.setHorizontalAlignment(JTextField.RIGHT);
  t2.setEditable(false); //不可编辑
  this.getContentPane().add(t2);
  
  this.getContentPane().add(new Label("十位"));
  t3=new JTextField(20);
  t3.setHorizontalAlignment(JTextField.RIGHT);
  t3.setEditable(false);//不可编辑
  this.getContentPane().add(t3);
  
  this.getContentPane().add(new Label("个位"));
  t4=new JTextField(20);
  t4.setHorizontalAlignment(JTextField.RIGHT);
  t4.setEditable(false);//不可编辑
  this.add(t4);
  
  this.setVisible(true);
  //jdialog=new MessageJDialog(this);//创建对话框对象

}


private class MessageJDialog extends JDialog implements ActionListener{ //内部类,显示信息的对话框
        ShowJFrame showJFrame;//对话框所依附的框架窗口
        JLabel jlabel;//对话框显示的信息
        JButton jbutton;

    MessageJDialog(ShowJFrame showJFrame) {
super(showJFrame,"消息",true);//模态窗口
this.setBounds(600, 300, 200, 100);
this.setBackground(Color.lightGray);
this.setLayout(new FlowLayout(FlowLayout.RIGHT));

jlabel=new JLabel("",JLabel.CENTER);//标签的字符串为空,居中对齐
//this.getContentPane().add(jlabel);
jbutton=new JButton("确定");
this.getContentPane().add(jbutton);
jbutton.addActionListener(this);
this.setDefaultCloseOperation(HIDE_ON_CLOSE);//单击对话框的关闭按钮时,隐藏对话框为不结束程序运行
}
    
    void show(String message){
     jlabel.setText(message);
     this.setVisible(true);
    } public void actionPerformed(ActionEvent e) {
if(e.getSource()==jbutton);
System.exit(0); }
}

public void caretUpdate(CaretEvent e) {
int number;
try {
String str1=t1.getText();//获得文本行的字符串
 number = Integer.parseInt(str1);
 t4.setText(""+number%10);//个位
 number=number/10;
 t3.setText(""+number%10);//十位
 number=number/10;
 t2.setText(""+number%10);//百位

catch (NumberFormatException e1) {
jdialog.show(t1.getText()+"不能转化成整数,请重新输入");
}
finally{}

} public static void main(String[] args)
{
new ShowJFrame();
}
}