Since I’m quite often making use of the system clipboard under Java in various projects, I ended up copying the same code around. Instead of duplicating even more, I decided to move the clipboard-handling code out into its own project and simply use it as a dependency:
https://github.com/fracpete/jclipboardhelper
Straight out of the box you can copy/paste String and BufferedImage objects. But you can also implement your own data flavors.