我还在学习java,我有简单的代码
import javax.swing.*;
Public class Test extends JFrame{
JLabel name = new JLabel("Name");
JTextArea ta = new JTextArea();
Test(){
this.setSize(435, 400);
this.setTitle("Test");
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setLayout(null);
name.setBounds(10, 10, 50, 20);
this.add(name);
ta.setBounds(90, 10, 300, 200);
ta.setLineWrap(true);
JScrollPane scroll = new JScrollPane(ta);
this.add(scroll);
}
public static void main(String [] args){
new Test().setVisible(true);
}
}
我应该选择什么布局?我希望在名称标签旁边显示 textarea