Constant Current LED Circuit
The circut will work and the main transistor will dissipate around 300mW and have a temperature of 55°C.

P = (Vc-Ve)*Ie

300mW = (17V-0.8V)*0.018A

(You could use Ic, the diffrence will be very small since Ie=Ic+Ib and base current is insignificant.)

You should use a transistor able to dissipate more than 0.6W (ideally 1W), such as 2N3904.

The temperature can be calculated this way:

Tj=P*Rthj-amb (thermal resistance)

For 2N3904:

55°C=0.3W*200°C/W

This is hot to touch but will not damage the transistor, I suggest to put it away from the plastic case and capacitors.