Java 调整Jframe中的JButton大小,使其水平放置在页面底部

Java 调整Jframe中的JButton大小,使其水平放置在页面底部,java,swing,resize,jbutton,Java,Swing,Resize,Jbutton,我需要编写一个代码,从1001生成库号,并且每个后续的数字都应该大一个。生成库号并在文本字段中显示后,按钮文本应更改为“确认” I need to write a code that generates library number and resize the JButton to put it to the bottom of the frame. 好的,现在你给了我们要求,问题是什么?atm我的按钮放在框架的左下角,我需要把我的按钮文本放在框架的底部中心。如果有帮助的话,我可以上传

我需要编写一个代码,从1001生成库号,并且每个后续的数字都应该大一个。生成库号并在文本字段中显示后,按钮文本应更改为“确认”

  I need to write a code that generates library number and resize the JButton to put it to the bottom of the frame. 

好的,现在你给了我们要求,问题是什么?atm我的按钮放在框架的左下角,我需要把我的按钮文本放在框架的底部中心。如果有帮助的话,我可以上传相框的图片。当在texfield中输入名字和姓氏时,我还需要为action Executed方法编写一个代码。每次按下add borrower按钮时,按钮文本必须更改以确认并从1001100210031004生成一个数字。
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class HW4GUI extends JFrame implements ActionListener
{
    private JButton jbtAction;
    private JTextField jtfFName;
    private JTextField jtfLName;
    private JTextField jtfLibNo;
    private int nextLibNo;
    private JPanel textPanel;

    public HW4GUI()   
    {
        setTitle("HW4 GUI");
        makeFrame();
        showFrame();
    }

    public void actionPerformed(ActionEvent e)
    {
      I need to write a code that generates library number from 1001 and each subsequent number should be one greater. Once the library number has been generated and shown in the text field, the button text should change to ‘Confirm’.
    }

    public void makeFrame() Make frame method
    {       
        setLayout( new GridLayout(4,0) ); 
        jtfFName = new JTextField( 15 ) ; 
        JLabel aLabel = new JLabel("First Name: ");
        jtfFName.setActionCommand("First Name");
        jtfFName.setHorizontalAlignment(aLabel.RIGHT);

        jtfLName = new JTextField( 15 ) ; 
        JLabel aLabel1 = new JLabel("Last Name: ");
        jtfLName.setActionCommand("Last Name");
        jtfLName.setHorizontalAlignment(aLabel1.RIGHT);

        jtfLibNo = new JTextField( 10 ) ; 
        JLabel aLabel2 = new JLabel("Library Number: "); 
        jtfLibNo.setActionCommand("Library Number");
        jtfLibNo.setEditable(false);
        jtfLibNo.setHorizontalAlignment(aLabel2.RIGHT);

        add(aLabel);
        add(jtfFName);
        add(aLabel1);
        add(jtfLName);
        add(aLabel2);
        add(jtfLibNo);

        JPanel textPanel = new JPanel();
        jbtAction = new JButton("Add Borrower");
        jbtAction.setLayout(new BoxLayout(jbtAction, BoxLayout.PAGE_AXIS));
        add(jbtAction); I need to resize this button 

        jtfFName.addActionListener( this );
        jtfLName.addActionListener( this );
        jtfLibNo.addActionListener( this );
        jbtAction.addActionListener( this );

    }

    public void showFrame()
    {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);
        setSize(400,200);
        setVisible(true);
    }

}