private void jbInit()
{
this.getContentPane().add(pnlMain);
pnlMain.setLayout(borderLayout1);
pnlMain.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
pnlMain.add(pnlCenter, BorderLayout.CENTER);
pnlMain.add(pnlSouth, BorderLayout.SOUTH);
pnlSouth.setLayout(flowLayout1);
flowLayout1.setAlignment(FlowLayout.RIGHT);
pnlSouth.add(btnRefresh);
pnlSouth.add(btnSet);
pnlSouth.add(btnClose);
pnlSouth.add(btnHelp);
btnRefresh.setText("刷新");
btnRefresh.setSize(new Dimension(83, 23));
btnRefresh.setMnemonic('R');
btnRefresh.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
btnRefresh_actionPerformed(e);
}
});
btnSet.setText("设置");
btnSet.setSize(new Dimension(83, 23));
btnSet.setMnemonic('S');
btnSet.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
btnSet_actionPerformed(e);
}
});
btnClose.setText("关闭");
btnClose.setSize(new Dimension(83, 23));
btnClose.setMnemonic('C');
btnClose.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
btnClose_actionPerformed(e);
}
});
btnHelp.setText("帮助");
btnHelp.setSize(new Dimension(83, 23));
btnHelp.setMnemonic('H');
btnHelp.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
btnHelp_actionPerformed(e);
}
});
pnlCenter.setLayout(borderLayout2);
pnlCenter.setBorder(border1);
pnlCenter.add(pnlCNorth, BorderLayout.NORTH);
pnlCenter.add(pnlCCenter, BorderLayout.CENTER);
pnlCenter.add(pnlCSouth, BorderLayout.SOUTH);
pnlCNorth.setBorder(border2);
pnlCNorth.setLayout(gridBagLayout1);
lblZxAnMldAdminStatus.setText("MLD协议使能");
lblZxAnMldAging.setText("老化时间");
lblZxAnMldWorkingMode.setText("工作模式");
lblZxAnMldMcastInAllVlan.setText("跨VLAN使能");
lblZxAnMldBandwidthCtrl.setText("带宽使能");
lblZxAnMldHostTrackOnOff.setText("主机跟踪使能");
lblZxAnMldGeneralLeaveGrpAddr.setText("通用离开组播地址");
lblZxAnMldGroupThreshold.setText("最大组播组门限");
pnlCNorth.add(lblZxAnMldAdminStatus, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(cmbZxAnMldAdminStatus, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(lblZxAnMldAging, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(txtZxAnMldAging, new GridBagConstraints(3, 0, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(lblZxAnMldWorkingMode, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(cmbZxAnMldWorkingMode, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(lblZxAnMldMcastInAllVlan, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(cmbZxAnMldMcastInAllVlan, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(lblZxAnMldBandwidthCtrl, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(cmbZxAnMldBandwidthCtrl, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(lblZxAnMldHostTrackOnOff, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(cmbZxAnMldHostTrackOnOff, new GridBagConstraints(3, 2, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(lblZxAnMldGeneralLeaveGrpAddr, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(txtZxAnMldGeneralLeaveGrpAddr, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(lblZxAnMldGroupThreshold, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(txtZxAnMldGroupThreshold, new GridBagConstraints(3, 3, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0)); pnlCCenter.setBorder(border3);
pnlCCenter.setLayout(gridBagLayout2);
lblZxAnMldRobustnessVariable.setText("健壮性变量");
lblZxAnMldQueryInterval.setText("查询间隔");
lblZxAnMldQueryMaxResponseTime.setText("查询最大响应时间");
lblZxAnMldLastMembQueryInterval.setText("最后成员查询间隔");
lblZxAnMldLastMembQueryCount.setText("最后成员查询记数");
lblZxAnMldUnsolicitedReportInterv.setText("主动报告间隔时间");
pnlCCenter.add(lblZxAnMldRobustnessVariable, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(cmbZxAnMldRobustnessVariable, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(lblZxAnMldQueryInterval, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(txtZxAnMldQueryInterval, new GridBagConstraints(3, 0, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(lblZxAnMldQueryMaxResponseTime, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(txtZxAnMldQueryMaxResponseTime, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(lblZxAnMldLastMembQueryInterval, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(txtZxAnMldLastMembQueryInterval, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(lblZxAnMldLastMembQueryCount, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(cmbZxAnMldLastMembQueryCount, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(lblZxAnMldUnsolicitedReportInterv, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(txtZxAnMldUnsolicitedReportInterv, new GridBagConstraints(3, 2, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCSouth.setBorder(border4);
pnlCSouth.setLayout(gridBagLayout3);
lblZxAnMcastIpv6CdrServerIP.setText("接收服务器地址");
lblNull1.setText(" ");
lblNull2.setText(" ");
pnlCSouth.add(lblZxAnMcastIpv6CdrServerIP, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCSouth.add(txtZxAnMcastIpv6CdrServerIP, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCSouth.add(lblNull1, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCSouth.add(lblNull2, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
}用的是GridBagConstraint布局
{
this.getContentPane().add(pnlMain);
pnlMain.setLayout(borderLayout1);
pnlMain.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
pnlMain.add(pnlCenter, BorderLayout.CENTER);
pnlMain.add(pnlSouth, BorderLayout.SOUTH);
pnlSouth.setLayout(flowLayout1);
flowLayout1.setAlignment(FlowLayout.RIGHT);
pnlSouth.add(btnRefresh);
pnlSouth.add(btnSet);
pnlSouth.add(btnClose);
pnlSouth.add(btnHelp);
btnRefresh.setText("刷新");
btnRefresh.setSize(new Dimension(83, 23));
btnRefresh.setMnemonic('R');
btnRefresh.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
btnRefresh_actionPerformed(e);
}
});
btnSet.setText("设置");
btnSet.setSize(new Dimension(83, 23));
btnSet.setMnemonic('S');
btnSet.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
btnSet_actionPerformed(e);
}
});
btnClose.setText("关闭");
btnClose.setSize(new Dimension(83, 23));
btnClose.setMnemonic('C');
btnClose.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
btnClose_actionPerformed(e);
}
});
btnHelp.setText("帮助");
btnHelp.setSize(new Dimension(83, 23));
btnHelp.setMnemonic('H');
btnHelp.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
btnHelp_actionPerformed(e);
}
});
pnlCenter.setLayout(borderLayout2);
pnlCenter.setBorder(border1);
pnlCenter.add(pnlCNorth, BorderLayout.NORTH);
pnlCenter.add(pnlCCenter, BorderLayout.CENTER);
pnlCenter.add(pnlCSouth, BorderLayout.SOUTH);
pnlCNorth.setBorder(border2);
pnlCNorth.setLayout(gridBagLayout1);
lblZxAnMldAdminStatus.setText("MLD协议使能");
lblZxAnMldAging.setText("老化时间");
lblZxAnMldWorkingMode.setText("工作模式");
lblZxAnMldMcastInAllVlan.setText("跨VLAN使能");
lblZxAnMldBandwidthCtrl.setText("带宽使能");
lblZxAnMldHostTrackOnOff.setText("主机跟踪使能");
lblZxAnMldGeneralLeaveGrpAddr.setText("通用离开组播地址");
lblZxAnMldGroupThreshold.setText("最大组播组门限");
pnlCNorth.add(lblZxAnMldAdminStatus, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(cmbZxAnMldAdminStatus, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(lblZxAnMldAging, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(txtZxAnMldAging, new GridBagConstraints(3, 0, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(lblZxAnMldWorkingMode, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(cmbZxAnMldWorkingMode, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(lblZxAnMldMcastInAllVlan, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(cmbZxAnMldMcastInAllVlan, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(lblZxAnMldBandwidthCtrl, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(cmbZxAnMldBandwidthCtrl, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(lblZxAnMldHostTrackOnOff, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(cmbZxAnMldHostTrackOnOff, new GridBagConstraints(3, 2, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(lblZxAnMldGeneralLeaveGrpAddr, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(txtZxAnMldGeneralLeaveGrpAddr, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(lblZxAnMldGroupThreshold, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCNorth.add(txtZxAnMldGroupThreshold, new GridBagConstraints(3, 3, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0)); pnlCCenter.setBorder(border3);
pnlCCenter.setLayout(gridBagLayout2);
lblZxAnMldRobustnessVariable.setText("健壮性变量");
lblZxAnMldQueryInterval.setText("查询间隔");
lblZxAnMldQueryMaxResponseTime.setText("查询最大响应时间");
lblZxAnMldLastMembQueryInterval.setText("最后成员查询间隔");
lblZxAnMldLastMembQueryCount.setText("最后成员查询记数");
lblZxAnMldUnsolicitedReportInterv.setText("主动报告间隔时间");
pnlCCenter.add(lblZxAnMldRobustnessVariable, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(cmbZxAnMldRobustnessVariable, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(lblZxAnMldQueryInterval, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(txtZxAnMldQueryInterval, new GridBagConstraints(3, 0, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(lblZxAnMldQueryMaxResponseTime, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(txtZxAnMldQueryMaxResponseTime, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(lblZxAnMldLastMembQueryInterval, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(txtZxAnMldLastMembQueryInterval, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(lblZxAnMldLastMembQueryCount, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(cmbZxAnMldLastMembQueryCount, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(lblZxAnMldUnsolicitedReportInterv, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCCenter.add(txtZxAnMldUnsolicitedReportInterv, new GridBagConstraints(3, 2, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCSouth.setBorder(border4);
pnlCSouth.setLayout(gridBagLayout3);
lblZxAnMcastIpv6CdrServerIP.setText("接收服务器地址");
lblNull1.setText(" ");
lblNull2.setText(" ");
pnlCSouth.add(lblZxAnMcastIpv6CdrServerIP, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCSouth.add(txtZxAnMcastIpv6CdrServerIP, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 6, 6), 0, 0));
pnlCSouth.add(lblNull1, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
pnlCSouth.add(lblNull2, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0));
}用的是GridBagConstraint布局
public void removeAllItems()
从项列表中移除所有项。 引用removeAll
public void removeAll()从此容器中移除所有组件。此方法还通知布局管理器,通过 removeLayoutComponent 方法从此容器的布局中移除这些组件。