private Switch swLightSwitch;
private ImageControl icLight;
//Create switch components
swLightSwitch = new Switch();
//Set the colors of the switch's parts
swLightSwitch.colorBallOn = Colors.COLOR_DARK_YELLOW;
swLightSwitch.colorBallOff = Colors.COLOR_LIGHT_GRAY;
swLightSwitch.colorBarOn = Colors.COLOR_LIGHT_YELLOW;
swLightSwitch.colorBarOff = Colors.COLOR_MEDIUM_GRAY;
//Create image control component with initial light off image
icLight = new ImageControl(Images.iLightOff);
icLight.scaleToFit = true;
// Position light bulb at the center of the screen,
// using the original size of the image
add(icLight, CENTER, CENTER - UnitsConverter.toPixels(DP + 40),
// Position the switch below the image
add(swLightSwitch, CENTER, AFTER, UnitsConverter.toPixels(DP + 150),
UnitsConverter.toPixels(DP + 30));