This is a very general question. What exactly do you want to know? Developing a library is not much different from developing any other application.
Libraries are normally packaged in JAR files. You package class files into a JAR file using the jar tool (if you use an IDE, it might have a way to do this from the IDE).
See Oracle's very good Java Tutorials to learn about many different Java programming topics. Java already has a comprehensive graphics API, which you can learn more about in the 2D Graphics tutorial.