lagPanel.setLayout(new GridLayout(1,2));
//lagPanel.setBorder(BorderFactory.createTitledBorder("Lag creation"));
SpinnerNumberModel snm = new SpinnerNumberModel();
snm.setValue(1); snm.setMinimum(1);
m_minLagSpinner = new JSpinner(snm);
Dimension spinD = m_minLagSpinner.getPreferredSize();
spinD = new Dimension((int)(spinD.getWidth() * 1.5),
(int)spinD.getHeight());
m_minLagSpinner.setPreferredSize(spinD);
JPanel temp1 = new JPanel();
temp1.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0));
temp1.setLayout(new BorderLayout());
final JLabel minLagLab = new JLabel("Minimum lag", JLabel.RIGHT);
temp1.add(minLagLab, BorderLayout.CENTER);
temp1.add(m_minLagSpinner, BorderLayout.EAST);
JPanel spinnerHolder = new JPanel();
spinnerHolder.setLayout(new BorderLayout());
spinnerHolder.setBorder(BorderFactory.createTitledBorder("Lag length"));
JPanel vH = new JPanel();
vH.setLayout(new BorderLayout());
JPanel varianceHolder = new JPanel();
varianceHolder.setLayout(new BorderLayout());
varianceHolder.add(m_adjustForVarianceCheckBox, BorderLayout.EAST);
m_adjustForVarianceCheckBox.setSelected(false);
vH.add(varianceHolder, BorderLayout.NORTH);
JPanel checkHolder = new JPanel();
checkHolder.setLayout(new BorderLayout());
checkHolder.add(m_useCustomLags, BorderLayout.EAST);
vH.add(checkHolder, BorderLayout.SOUTH);
spinnerHolder.add(vH, BorderLayout.NORTH);
spinnerHolder.add(temp1, BorderLayout.CENTER);
snm = new SpinnerNumberModel();
snm.setValue(12); snm.setMinimum(1);
m_maxLagSpinner = new JSpinner(snm);
m_maxLagSpinner.setPreferredSize(spinD);
JPanel temp2 = new JPanel();
temp2.setLayout(new BorderLayout());
temp2.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
final JLabel maxLagLab = new JLabel("Maximum lag", JLabel.RIGHT);
temp2.add(maxLagLab, BorderLayout.CENTER);
temp2.add(m_maxLagSpinner, BorderLayout.EAST);
final JLabel fineTuneLab = new JLabel("Fine tune lag selection", JLabel.RIGHT);
JPanel fPanel = new JPanel(); fPanel.setLayout(new BorderLayout());
fPanel.add(temp2, BorderLayout.NORTH);
JPanel fineHolder = new JPanel(); fineHolder.setLayout(new BorderLayout());
fineHolder.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 0));
fineHolder.add(fineTuneLab, BorderLayout.CENTER);
fineHolder.add(m_fineTuneLagsField, BorderLayout.EAST);
m_fineTuneLagsField.setPreferredSize(spinD);
fineTuneLab.setEnabled(false);
fineTuneLab.setToolTipText("Specify ranges to fine tune " +
"lags within minimum and maximum (e.g. 2,3,6-8)");
m_fineTuneLagsField.setEnabled(false);
m_fineTuneLagsField.setToolTipText("Specify ranges to fine tune " +
"lags within minimum and maximum (e.g. 2,3,6-8)");
fPanel.add(fineHolder,BorderLayout.SOUTH);
spinnerHolder.add(fPanel, BorderLayout.SOUTH);
m_useCustomLags.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
boolean enabled = m_useCustomLags.isSelected();
m_minLagSpinner.setEnabled(enabled);
m_maxLagSpinner.setEnabled(enabled);
minLagLab.setEnabled(enabled);
maxLagLab.setEnabled(enabled);
fineTuneLab.setEnabled(enabled);
m_fineTuneLagsField.setEnabled(enabled);
m_averageLongLags.setEnabled(enabled);
if (!enabled) {
m_averageLongLags.setSelected(false);
}
/*m_averageLagsAfter.setEnabled(enabled);
m_numConsecutiveToAverage.setEnabled(enabled); */
}
});
snm = new SpinnerNumberModel();
snm.setValue(2); snm.setMinimum(1);
m_averageLagsAfter = new JSpinner(snm);
m_averageLagsAfter.setPreferredSize(spinD);
snm = new SpinnerNumberModel();
snm.setValue(2); snm.setMinimum(2);
m_numConsecutiveToAverage = new JSpinner(snm);
m_numConsecutiveToAverage.setPreferredSize(spinD);
JPanel averageLagHolder = new JPanel();
averageLagHolder.setBorder(BorderFactory.createTitledBorder("Averaging"));
averageLagHolder.setLayout(new BorderLayout());