这是两个按钮水平摆放在窗体中,用GUI设计的一段布局代码,谁能讲讲什么意思:
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
layout.createSequentialGroup()
.addGap(50, 50, 50)
.addComponent(jButton1)
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.RELATED,
161, Short.MAX_VALUE)
.addComponent(jButton2).addGap(75, 75, 75)));
layout.setVerticalGroup(layout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addContainerGap(39, Short.MAX_VALUE)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.addGap(43, 43, 43)));
|
|