我想添加到窗口从x,y位置JTextArea
与滚动。 问题是,当我做可视化代码时,它确实填充了500x500窗口,我希望在x,y pos只填充200x200的完整值。GUI JTextArea&JScrollPane&定位
我在做什么错?这里是我的代码:
public static void main(String args[])
{
JFrame window = new JFrame();
window.setSize(500, 500);
window.setResizable(false);
JTextArea ta = new JTextArea("Default message");
ta.setEditable(true);
JScrollPane scroll = new JScrollPane(ta);
scroll.setBounds(10,10,200,200);
window.add(scroll);
window.setVisible(true);
}
@AndrewThompson,对于一个强大的图形用户界面,最合理的举动是使用布局管理器? Arent还有其他的选择吗? – user1768615