爲什麼我的組件使用FlowLayout封裝在這個JPanel中?他們只是跑出屏幕,只是部分可見。爲什麼我的組件不能在Swing的FlowLayout中包裝?
JPanel panel = new JPanel(new FlowLayout());
panel.add(new JLabel("TEST"));
// ... repeat adding JLabels until they go off screen when they SHOULD wrap
// to the next line...
這是我的代碼的全部(除了添加和打包框架)。我誤解了FlowLayout?我是否必須在標籤或面板上設置某種尺寸?
我猜的解決方案是,它是與'panel'的父容器。 – 2012-08-10 21:01:18