Lm317.
The formula for constant current is 1.25/R. If I want 300mA current. 1.25/R=0.3. therefore R=4.1ohm. But I want to be able to adjust current from 150mA to 300mA. How to attach trimmer? What size trimmer and how to calculate?
What is the starting voltage Vin? What is the min/max output voltage Vout (compliance)?
At 300mA, you will likely be dissipating so much power that you will need substantial heat-sinking, which is not compatible with a small size, anyway...
P = (Vin-Vout)*0.3
Suppose Vin = 12V and Voutmin = 1V, then P= (12-1)*0.3 = 3.3W is huge...
You could use a 5Ω trimmer in series with a 4Ω resistor.
But the trimmer should be at least a 1/2W device (to carry the maximum of 300mA current) which may be difficult to find.
An alternate would be to use a 10Ω resistor in parallel with a 10Ω 1/4W pot (along with the 4Ω resistor in series with both).