public void actionPerformed(ActionEvent e) {
helpPopup.open();
}
}, helpPanel);
CRSettings settings = CRSettings.getSingleton();
//---- create report folder panel if this is not build for online applet
reportFolderPanel = CRComponentFactory.createFlowLayoutJPanel(-1, 80, this);
CRComponentFactory.createJLabel("Saved reports folder name: ", reportFolderPanel);
DateFormat dateFormat = new SimpleDateFormat("yyMMdd-HHmmss");
Date date = new Date();
reportFolderField = CRComponentFactory.createJTextField("reports" + dateFormat.format(date) , this.getSize().width - 190, reportFolderPanel);
CRComponentFactory.createFlowLayoutJPanel(-1, 10, reportFolderPanel);
CRComponentFactory.createJCheckBox("Save graphic reports ", settings.getShouldPrintGraphicReports(), new ActionListener() {
public void actionPerformed(ActionEvent e) {
CRSettings.getSingleton().setShouldPrintGraphicReports(((JCheckBox)e.getSource()).isSelected());
}
}, reportFolderPanel);
CRComponentFactory.createJCheckBox("Save text reports ", settings.getShouldPrintTextReports(), new ActionListener() {
public void actionPerformed(ActionEvent e) {
CRSettings.getSingleton().setShouldPrintTextReports(((JCheckBox)e.getSource()).isSelected());
}
}, reportFolderPanel);
CRComponentFactory.createJCheckBox("Quit when done", settings.getShouldQuitAfterDone(), new ActionListener() {
public void actionPerformed(ActionEvent e) {
CRSettings.getSingleton().setShouldQuitAfterDone(((JCheckBox)e.getSource()).isSelected());
}
}, reportFolderPanel);
//---- create panel with selection of world types
if (controller.getWorld().getHasScenarios()) {
scenarioPanel = CRComponentFactory.createFlowLayoutJPanel(-1, 40, this);
CRComponentFactory.createJLabel("Scenario: ", scenarioPanel);
scenarioComboBox = CRComponentFactory.createJComboBox(300, controller.getWorld().getScenariosAsArray(), 0, null, scenarioPanel);
}
//---- create panel above the start simulation panel
preStartSimulationPanel = CRComponentFactory.createFlowLayoutJPanel(-1, 0, this);
//---- create the start simulation button in a separate panel
startSimulationPanel = CRComponentFactory.createFlowLayoutJPanel(-1, 40, this);
//-- number of runs
CRComponentFactory.createJLabel("Number of runs: ", startSimulationPanel);
numberOfRunsField = CRComponentFactory.createJTextField("1", 50, startSimulationPanel);
//-- trial duration
CRComponentFactory.createJLabel(" Trial duration: ", startSimulationPanel);
trialDurationField = CRComponentFactory.createJTextField("120", 50, startSimulationPanel);
//-- start button
CRComponentFactory.createJLabel(" ", startSimulationPanel);
CRComponentFactory.createJButton("Start simulation", new ActionListener() { public void actionPerformed(ActionEvent e) {
onStartSimulationClicked(e);
}}, startSimulationPanel);
//---- create divider
CRComponentFactory.createDividerJPanel(-1, 5, this);
//---- create time settings
timeSettingsPanel = CRComponentFactory.createFlowLayoutJPanel(-1, 60, this);
//-- play / pause
timeStartPauseButton = CRComponentFactory.createJButton(">", new ActionListener() { public void actionPerformed(ActionEvent e) {
CRSettings settings = CRSettings.getSingleton();
if (settings.isTimeRunning()) {
//---- pause clicked:
controller.stopTime();
settings.setIsTimeRunning(false);
onTimePaused();
} else {
//----- play clicked:
controller.startTime();
settings.setIsTimeRunning(true);
onTimeStarted();
}
}}, timeSettingsPanel);
timeStartPauseButton.setEnabled(false);
CRComponentFactory.createJLabel(" Time speed:", timeSettingsPanel);
//-- slider
timeSpeedSlider = CRComponentFactory.createJSlider(this.getSize().width - 170, 0, 100, settings.getInitialTimeSpeed(), new ChangeListener() {
public void stateChanged(ChangeEvent e) {
if (CRSettings.getSingleton().isTimeRunning()) {
controller.setTimeSpeed(timeSpeedSlider.getValue()/100.0);
}
}