I'm using a URL to import a font. But since not in all cases will internet be present nor do I want to download a file everytime I run the program I want to use the same method of using a url but instead point it to a font in the same location as the program.
Here is what I tried:
File fontfile = new File("TexasLED.ttf");
File.toURI(fontfile).toURL(fontfile);
URL fontUrl = new URL("fontfile");
Though I'm getting this error:
Error: F:\Computer Science\draw.java:250: toURI() in java.io.File cannot be applied to (java.io.File)
I know I'm doing something wrong. Does anyone know what and how I could fix it?
V2:
File fontfile = new File("TexasLED.ttf"); fontfile.toURI().toURL(); URL fontUrl = new URL("fontfile");
Error:
java.net.MalformedURLException: no protocol: fontfile