StdDraw Java Import
This tutorial demonstrates how to import the
stddraw in Java.
StdDraw Class in Java
StdDraw class is a part of the
StdLib package, which is used for the basic capabilities of drawing. This class allows us to draw simple drawings like lines, squares, circles, and other geometric shapes, including text, animations, and colors.
StdDraw class includes
EventListener interfaces which are used to perform events on different listener options.
As mentioned above, the
StdDraw is included in the
StdLib package, and the
StdLib package is included in the basic JRE or JDK package. If you can’t find the
StdDraw, you can always import it separately in your environment.
Follow the steps below to import the
StdDraw in your environment:
First, we must download the
stdlib.jarfile as the
StdDrawis included in that package. Download it from here:
Create a folder
libin your Java project folder.
Copy the downloaded
StdLib.jarfile to the
Open your IDE; in our case, it is the
Right-click on your project name and go to
Properties, go to
Java Build Path:
In Java Build Path, go to
Now, under the classpath, Click on
Add External Jar, browse to the
Libfolder, and select
Once the jar is added to the classpath. Click
Apply and Close, and you are ready to use the
Now we can use the
StdDraw class without importing it into our Java class file.