private JPanel createBattlefieldSlidersPanel() {
    JPanel panel = new JPanel();

    GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);

    GroupLayout.SequentialGroup leftToRight = layout.createSequentialGroup();

    GroupLayout.ParallelGroup left = layout.createParallelGroup();
    left.addComponent(battlefieldSizeLabel);
    left.addComponent(battlefieldWidthSlider);
    leftToRight.addGroup(left);

    GroupLayout.ParallelGroup right = layout.createParallelGroup();
    right.addComponent(battlefieldHeightSlider);
    leftToRight.addGroup(right);

    GroupLayout.SequentialGroup topToBottom = layout.createSequentialGroup();

    GroupLayout.ParallelGroup top = layout.createParallelGroup();
    top.addComponent(battlefieldSizeLabel);
    top.addComponent(battlefieldHeightSlider);
    topToBottom.addGroup(top);

    GroupLayout.ParallelGroup bottom = layout.createParallelGroup();
    bottom.addComponent(battlefieldWidthSlider);
    topToBottom.addGroup(bottom);

    layout.setHorizontalGroup(leftToRight);
    layout.setVerticalGroup(topToBottom);

    return panel;
  }
Beispiel #2
0
 private void initGUI() {
   /** 北部panel */
   Font font_12 = new Font("微软雅黑", Font.PLAIN, 14);
   /** 设置字体 */
   crackButton.setFont(font_12);
   northPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
   northPane.setBorder(BorderFactory.createTitledBorder("破解地址"));
   GroupLayout layout_north = new GroupLayout(northPane);
   northPane.setLayout(layout_north);
   /** 自动设定组件、组之间的间隙 */
   layout_north.setAutoCreateGaps(true);
   layout_north.setAutoCreateContainerGaps(true);
   /** 垂直一 */
   GroupLayout.ParallelGroup hpg_north_1 =
       layout_north.createParallelGroup(GroupLayout.Alignment.LEADING);
   hpg_north_1.addComponent(label_for_pageUrl);
   /** 垂直二 */
   GroupLayout.ParallelGroup hpg_north_2 =
       layout_north.createParallelGroup(GroupLayout.Alignment.LEADING);
   hpg_north_2.addComponent(pageUrl);
   /** 垂直三 */
   GroupLayout.ParallelGroup hpg_north_3 =
       layout_north.createParallelGroup(GroupLayout.Alignment.LEADING);
   hpg_north_3.addComponent(crackButton);
   /** 垂直 */
   layout_north.setHorizontalGroup(
       layout_north
           .createSequentialGroup()
           .addGroup(hpg_north_1)
           .addGroup(hpg_north_2)
           .addGroup(hpg_north_3));
   /** 水平一 */
   GroupLayout.ParallelGroup vpg_north_1 =
       layout_north.createParallelGroup(GroupLayout.Alignment.CENTER);
   vpg_north_1.addComponent(label_for_pageUrl).addComponent(pageUrl).addComponent(crackButton);
   /** 水平 */
   layout_north.setVerticalGroup(layout_north.createSequentialGroup().addGroup(vpg_north_1));
   this.add(northPane, BorderLayout.NORTH);
   /** 南部panel */
   mCode.setColumns(50);
   regCode.setColumns(50);
   mCode.setEditable(false);
   southPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
   southPane.setBorder(BorderFactory.createTitledBorder("软件注册"));
   southPane.add(label_for_mCode);
   southPane.add(mCode);
   southPane.add(label_for_regCode);
   southPane.add(regCode);
   /** 新增为布局的南部 */
   this.add(southPane, BorderLayout.SOUTH);
   /** 中部panel */
   videoInfo = new JPanel();
   videoInfo.setBorder(BorderFactory.createTitledBorder("视频信息"));
   GroupLayout layout = new GroupLayout(videoInfo);
   videoInfo.setLayout(layout);
   /** 自动设定组件、组之间的间隙 */
   layout.setAutoCreateGaps(true);
   layout.setAutoCreateContainerGaps(true);
   JButton cancelButton = new JButton("Cancel");
   /** LEADING -- 左对齐 BASELINE -- 底部对齐 CENTER -- 中心对齐 */
   /** 垂直一 */
   GroupLayout.ParallelGroup hpg1 = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
   hpg1.addComponent(label_for_title)
       .addComponent(label_for_time)
       .addComponent(label_for_addTime)
       .addComponent(label_for_imgPre)
       .addComponent(label_for_crack_video)
       .addComponent(label_for_fileSize);
   /** 垂直二 */
   GroupLayout.ParallelGroup hpg2 = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
   hpg2.addComponent(title)
       .addComponent(time)
       .addComponent(addTime)
       .addComponent(image)
       .addComponent(crackVideo)
       .addComponent(fileSize);
   /** 垂直三 */
   GroupLayout.ParallelGroup hpg3 = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
   hpg3.addComponent(cancelButton);
   /** 垂直 */
   layout.setHorizontalGroup(
       layout.createSequentialGroup().addGroup(hpg1).addGroup(hpg2).addGroup(hpg3));
   /** 设定两个Button在水平方向一样宽 */
   //        layout.linkSize(SwingConstants.HORIZONTAL, new Component[]{crackButton,
   // cancelButton});
   /** 水平一 */
   GroupLayout.ParallelGroup vpg1 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
   //        vpg1.addComponent(crackButton);
   /** 水平二 */
   GroupLayout.ParallelGroup vpg2 = layout.createParallelGroup(GroupLayout.Alignment.CENTER);
   vpg2.addComponent(label_for_title).addComponent(title).addComponent(cancelButton);
   /** 水平三 */
   GroupLayout.ParallelGroup vpg3 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
   vpg3.addComponent(label_for_time).addComponent(time);
   /** 水平四 */
   GroupLayout.ParallelGroup vpg4 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
   vpg4.addComponent(label_for_addTime).addComponent(addTime);
   /** 水平五 */
   GroupLayout.ParallelGroup vpg5 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
   vpg5.addComponent(label_for_imgPre).addComponent(image);
   /** 水平六 */
   GroupLayout.ParallelGroup vpg6 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
   vpg6.addComponent(label_for_crack_video).addComponent(crackVideo);
   /** 水平七 */
   GroupLayout.ParallelGroup vpg7 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
   vpg7.addComponent(label_for_fileSize).addComponent(fileSize);
   /** 水平 */
   layout.setVerticalGroup(
       layout
           .createSequentialGroup()
           .addGroup(vpg1)
           .addGroup(vpg2)
           .addGroup(vpg3)
           .addGroup(vpg4)
           .addGroup(vpg5)
           .addGroup(vpg6)
           .addGroup(vpg7));
   this.add(videoInfo, BorderLayout.CENTER);
 }
  private JPanel createRulesPanel() {
    JPanel panel = new JPanel();

    panel.addAncestorListener(new EventHandler());
    panel.setBorder(BorderFactory.createEtchedBorder());

    GroupLayout layout = new GroupLayout(panel);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    panel.setLayout(layout);

    GroupLayout.SequentialGroup leftToRight = layout.createSequentialGroup();

    GroupLayout.ParallelGroup left = layout.createParallelGroup();
    left.addComponent(numberOfRoundsLabel);
    left.addComponent(gunCoolingRateLabel);
    left.addComponent(inactivityTimeLabel);
    left.addComponent(sentryBorderSizeLabel);
    left.addComponent(hideEnemyNamesLabel);
    leftToRight.addGroup(left);

    GroupLayout.ParallelGroup right = layout.createParallelGroup();
    right.addComponent(getNumberOfRoundsTextField());
    right.addComponent(getGunCoolingRateTextField());
    right.addComponent(getInactivityTimeTextField());
    right.addComponent(getSentryBorderSizeTextField());
    right.addComponent(hideEnemyNamesCheckBox);
    leftToRight.addGroup(right);

    GroupLayout.SequentialGroup topToBottom = layout.createSequentialGroup();

    GroupLayout.ParallelGroup row0 = layout.createParallelGroup(Alignment.BASELINE);
    row0.addComponent(numberOfRoundsLabel);
    row0.addComponent(numberOfRoundsTextField);
    topToBottom.addGroup(row0);

    GroupLayout.ParallelGroup row1 = layout.createParallelGroup(Alignment.BASELINE);
    row1.addComponent(gunCoolingRateLabel);
    row1.addComponent(getGunCoolingRateTextField());
    topToBottom.addGroup(row1);

    GroupLayout.ParallelGroup row2 = layout.createParallelGroup(Alignment.BASELINE);
    row2.addComponent(inactivityTimeLabel);
    row2.addComponent(inactivityTimeTextField);
    topToBottom.addGroup(row2);

    GroupLayout.ParallelGroup row3 = layout.createParallelGroup(Alignment.BASELINE);
    row3.addComponent(sentryBorderSizeLabel);
    row3.addComponent(sentryBorderSizeTextField);
    topToBottom.addGroup(row3);

    GroupLayout.ParallelGroup row4 = layout.createParallelGroup(Alignment.CENTER);
    row4.addComponent(hideEnemyNamesLabel);
    row4.addComponent(hideEnemyNamesCheckBox);
    topToBottom.addGroup(row4);

    layout.setHorizontalGroup(leftToRight);
    layout.setVerticalGroup(topToBottom);

    return panel;
  }