molding reinstallation?

I want to remove the moldings around the rear windows
to paint my car, (S13).
But I don’t no what to use to put them back on,what does the factory use to stick them there?If anyone has done this what did you use?Any suggestions will help.
Thanks.

If you remove the molding the window basicly has to come out. I belive they are connected to the window.

I thought they were attached to the window,but theres a spot were it came of a bit,and the back side is smooth and don’t see how they would clip in.But there is no old epoxy/calking under it so maybe they do clip in,I guess I’ll just have to pull it of and find out.
Thanks for the help.