scriptsPanel = new JPanel();
scriptsPanel.setLayout(new BoxLayout(scriptsPanel, BoxLayout.Y_AXIS));
scriptsPanel.setBackground(Color.WHITE);
int numberOfFields = Math.max(2, currentScripts.size());
for (int index = 0; index < numberOfFields; index++) {
RSyntaxTextArea scriptField = SyntaxEditorUtil.createDefaultJavaScriptSyntaxTextArea();
String scriptName = (index < DEFAULT_SCRIPT_NAMES.length ? DEFAULT_SCRIPT_NAMES[index] : "Page " + (index + 1));
scriptField.setName(scriptName);
if (currentScripts.size() > index) {
scriptField.setText(currentScripts.get(index));
}
scriptField.getDocument().addDocumentListener(scriptUpdater);
scriptFields.add(scriptField);
InputPanel inputPanel = new InputPanel(scriptName, scriptField);
inputPanel.setName("Input panel " + (index + 1));
inputPanels.add(inputPanel);
scriptsPanel.add(inputPanel);