How is it possible to set "read only" property in the component?

How is it possible to set “read only” property in the component?

In Java you should just use autocomplete.setReadOnly(true);