
package paavohuh.sourcream.ui;

import java.awt.Dialog;
import java.awt.GridLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import paavohuh.sourcream.configuration.DeviceConfiguration;

/**
 * The panel for the device configuration.
 */
class DeviceConfigPanel extends JPanel {
    private final DeviceConfiguration config;

    /**
     * Creates a new device configuration panel.
     * @param parent The parent.
     * @param config The device configuration.
     */
    public DeviceConfigPanel(Dialog parent, DeviceConfiguration config) {
        this.setLayout(new GridLayout(5, 2));
        add(new JLabel("These settings can and will affect emulation."));
        this.config = config;
    }

    public DeviceConfiguration getConfig() {
        return config;
    }
}

@@ -26,16 +26,46 @@
 am.ui;%0A%0A
+import java.awt.BorderLayout;%0A
 import j
@@ -131,39 +131,141 @@
 ing.
-JLabel;%0Aimport javax.swing.JPan
+BorderFactory;%0Aimport javax.swing.JLabel;%0Aimport javax.swing.JPanel;%0Aimport javax.swing.JSpinner;%0Aimport javax.swing.SpinnerNumberMod
 el;%0A
@@ -464,17 +464,16 @@
 config;%0A
-%0A
     /**%0A
@@ -691,21 +691,16 @@
         
-this.
 setLayou
@@ -705,16 +705,96 @@
 out(new 
+BorderLayout(15, 15));%0A        %0A        JPanel clockSpeedGroup = new JPanel(new 
 GridLayo
@@ -800,12 +800,20 @@
 out(
+1, 2, 1
 5, 
-2
+15
 ));%0A
@@ -824,73 +824,759 @@
     
-add(new JLabel(%22These settings can and will affect emulation.%22));
+%0A        clockSpeedGroup.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));%0A        %0A        SpinnerNumberModel clockSpeedSpinnerModel =%0A            new SpinnerNumberModel(%0A                config.getClockSpeed(),%0A                100,%0A                1000,%0A                100);%0A        %0A        clockSpeedGroup.add(new JLabel(%22Emulated clock speed%22));%0A        %0A        JSpinner clockSpeedSpinner = new JSpinner(clockSpeedSpinnerModel);%0A        clockSpeedSpinner.addChangeListener(event -%3E %7B%0A            int newClockSpeed = clockSpeedSpinnerModel.getNumber().intValue();%0A            config.setClockSpeed(newClockSpeed);%0A        %7D);%0A        clockSpeedGroup.add(clockSpeedSpinner);%0A        %0A        add(clockSpeedGroup, BorderLayout.NORTH);%0A        
 %0A   

Add clock speed configuration