@PostConstruct public void init() { setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 1; JPanel mazes = new JPanel(new GridLayout(0, 4)); mazes.add(maze2); mazes.add(maze3); mazes.add(maze4); mazes.add(maze5); mazes.add(maze6); mazes.add(maze7); mazes.add(maze8); add(mazes, constraints); JPanel energy = new JPanel(new FlowLayout()); energyTf.setPreferredSize(new Dimension(50, 23)); energy.add(new JLabel("当选中迷宫通关且行动力大于")); energy.add(energyTf); energy.add(new JLabel("时")); constraints.gridy = 1; add(energy, constraints); JPanel conditions = new JPanel(new FlowLayout()); conditions.add(new JLabel("其它条件:")); conditions.add(noChip); conditions.add(noThief); constraints.gridy = 2; add(conditions, constraints); constraints.weighty = 1; constraints.gridy = 3; add(new JLabel(), constraints); JButton start = new JButton("一键执行"); start.addActionListener( new AsyncActionListener(executorService) { @Override public void run() { oneKeyStart(); } }); start.setPreferredSize(new Dimension(120, 50)); constraints.weighty = 0; constraints.gridy = 4; constraints.insets = new Insets(5, 20, 5, 20); add(start, constraints); JPanel schedule = new JPanel(new FlowLayout()); schedule.add(new JLabel("每")); hour.setPreferredSize(new Dimension(50, 23)); schedule.add(hour); schedule.add(new JLabel("小时")); schedule.add(new JLabel("第")); minute.setPreferredSize(new Dimension(50, 23)); schedule.add(minute); schedule.add(new JLabel("分钟")); schedule.add(auto); constraints.gridy = 5; constraints.insets = new Insets(0, 0, 5, 0); add(schedule, constraints); }