Why were stained glass windows created in medieval times?

They didn't have Paint in their Windows operating systems yet. So how else will they create longstanding masterpieces for everyone to enjoy?