import javax.swing.JPanel; //导入方法依赖的package包/类
/**
* Creates an instance of this class.
*/
protected GASettings () {
setTitle("Genetic Algorithm Settings");
setBounds(50,50,520,520);
centerPanel = new JPanel(new FlowLayout());
JPanel southPanel = new JPanel(new FlowLayout());
maxGenerationsLabel = new JLabel("Max Generations");
maxGenerationsField = new JTextField((new Integer(TSProblemModel.DEFAULT_GA_MAX_GENERATIONS)).toString(), 5);
popSizeLabel = new JLabel("Population Size");
popSizeField = new JTextField((new Integer(TSProblemModel.DEFAULT_GA_POP_SIZE)).toString(), 5);
mutationRateLabel = new JLabel("Mutation Rate");
mutationRateField = new JTextField((new Double(TSProblemModel.DEFAULT_MUTATION_RATE)).toString(), 5);
orderedCrossoverBox = new JCheckBox("Ordered Crossover", TSProblemModel.DEFAULT_ORDERED_CROSSOVER);
cyclicCrossoverBox = new JCheckBox("Cyclic Crossover", TSProblemModel.DEFAULT_CYCLIC_CROSSOVER);
pmxCrossoverBox = new JCheckBox("PMX Crossover", TSProblemModel.DEFAULT_PMX_CROSSOVER);
simulatedAnnealingBox = new JCheckBox("Simulated Annealing", TSProblemModel.DEFAULT_ANNEAL);
inverOverBox = new JCheckBox("Inver Over", TSProblemModel.DEFAULT_INVER_OVER);
centerPanel.add(maxGenerationsLabel);
centerPanel.add(maxGenerationsField);
centerPanel.add(popSizeLabel);
centerPanel.add(popSizeField);
centerPanel.add(mutationRateLabel);
centerPanel.add(mutationRateField);
centerPanel.add(orderedCrossoverBox);
centerPanel.add(cyclicCrossoverBox);
centerPanel.add(pmxCrossoverBox);
centerPanel.add(inverOverBox);
centerPanel.add(simulatedAnnealingBox);
centerPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
centerPanel.setForeground(Color.getColor("202,198,202"));
// Create buttons and buttons panel
JPanel buttonsPanel = new JPanel(new FlowLayout());
buttonsPanel.add(new JButton(RESTORE_DEFAULT_ACTION));
buttonsPanel.add(new JButton(OK_ACTION));
buttonsPanel.add(new JButton(CANCEL_ACTION));
// Add buttons panel in South Panel
southPanel.add(buttonsPanel,BorderLayout.EAST);
// Add panels in Main Panel
this.getContentPane().setLayout(new BorderLayout());
this.getContentPane().add(southPanel,BorderLayout.SOUTH);
this.getContentPane().add(centerPanel,BorderLayout.CENTER);
}