Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经开始在 Netbeans 中使用 Swing 做一些经验。我创建了两个面板,并在每个面板中插入了一个JLabel.
JLabel
如何定义标签在框架内的垂直位置?
由于我无法对齐两个标签(每个面板上一个),我想将每个标签设置为某种垂直对齐。
具有布局填充和组件边框的布局。
看:
您可以使用
setBounds(x,y,width,height); JLabel label = new JLabel(); label.setBounds(10,10,40,20);