All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.sarxos.webcam.WebcamPickerModel Maven / Gradle / Ivy

Go to download

This library allows you to use your PC webcam, IP or network cameras directly from Java. It's compatible with most operating systems (Windows, Linux, MacOS).

There is a newer version: 0.3.12
Show newest version
package com.github.sarxos.webcam;

import java.util.List;

import javax.swing.DefaultComboBoxModel;


public class WebcamPickerModel extends DefaultComboBoxModel {

	private static final long serialVersionUID = 1L;

	public WebcamPickerModel(List webcams) {
		super(webcams.toArray(new Webcam[webcams.size()]));
	}

	@Override
	public Webcam getSelectedItem() {
		return (Webcam) super.getSelectedItem();
	}

	@Override
	public void setSelectedItem(Object webcam) {
		if (!(webcam instanceof Webcam)) {
			throw new IllegalArgumentException("Selected object has to be an Webcam instance");
		}
		super.setSelectedItem(webcam);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy