Summary: By the end of this tutorial you will come to know the possibility of raising HeadlessException
It falls under the category unchecked exception. This runtime exception is thrown when the code that is dependent on the hardware like keyboard, display, or mouse is called in an environment that does not support a keyboard, display, or mouse. This exception came into existence from JDK 1.4 version. Following is the hierarchy.
Object –> Throwable –>Exception –> RuntimeException –> UnsupportedOperationException –> HeadlessException
Many constructors of TextArea, Menu, List and Checkbox etc. throw HeadlessException. Some examples are given.
1. public java.awt.TextArea() throws java.awt.HeadlessException
2. public java.awt.TextArea(java.lang.String) throws java.awt.HeadlessException
3. public java.awt.Menu() throws java.awt.HeadlessException
4. public java.awt.Menu(java.lang.String) throws java.awt.HeadlessException
Java comes with many classes grouped as categories. A group gives common properties. Click here for a few groups to know.