Graphic Environment Abstract Methods
Hi,
I was recently looking at the GraphicsEnvironment class in Javadoc and some example code on google. I am confused on the usage of the abstract method .getAllFonts() and .getAllAvailableFontsFamily(). I understand getting a GraphicsEnvironment by calling getLocalGraphicEnvironment, but what I am confused about is calling the static abstract method getAllFonts() and getAllAvailableFontsFamily() on the GraphicEnvironment object when both methods are abstract. Can somebody explain to me why?
Re: Graphic Environment Abstract Methods
In Java you can't have static abstract methods. Those methods are in fact only declared abstract.
If you want to get all the fonts, get the local graphics environment, then the respective methods from the object you get.
Re: Graphic Environment Abstract Methods
The reference returned from getLocalGraphicEnvironment() is a reference to an object of a class that extends GraphicsEnvironment -- and implements all abstract methods.
Try printing the class of the object returned -- after the first line of the code posted by helloworld922 add
Code :
System.out.println(local.getClass());
System.out.println(local.getClass().getSuperclass());
db