0

我正在尝试让用户界面页面正确显示在我的页面上。它必须以某种方式在屏幕上显示,但我无法显示正确的布局。有什么建议或帮助吗?!我已经尝试了很多东西,但 Java 可能会有点混乱。附件是图片的链接,了解它的外观

https://courses.eas.asu.edu/cse205/current/assignments/assignment6/assignment6.html

  public CreatePanel(Vector accountList, TransferPanel tPanel)
    {
   this.accountList = accountList;
   this.transferPanel = tPanel;



     JLabel label1 =new JLabel("Account ID: ");
     JLabel label2 = new JLabel("Amount: ");
     JTextField field1 = new JTextField();
     field1.setPreferredSize(new Dimension(250,70));
     JTextField field2 = new JTextField();
     field2.setPreferredSize(new Dimension(250,70));
     button1 = new JButton("Create an Account");
     JTextArea textArea = new JTextArea();
      textArea.setPreferredSize(new Dimension(500, 600));
      textArea.append("No account");
      textArea.setEditable(true);


      JPanel panel1 = new JPanel();
      panel1.setLayout(new GridLayout(3,3));
      panel1.add(label1);

      panel1.add(field1);

       panel1.add(label2);

       panel1.add(field2);



       JPanel panel2 = new JPanel();
      panel2.setLayout(new BorderLayout());
      panel2.add(button1, BorderLayout.SOUTH);



      JPanel panel3 = new JPanel();
      panel3.setLayout(new BorderLayout());
      panel3.add(textArea, BorderLayout.WEST);




     add(panel1);

     add(panel3);
     add(panel2);

  //ActionListener listener = new ButtonListener();
 //button1.addActionListener(listener);





    }
4

0 回答 0