- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- java.lang.UnsupportedOperationException
-
- java.awt.HeadlessException
-
- All Implemented Interfaces:
Serializable
public class HeadlessException extends UnsupportedOperationException
Thrown when code that is dependent on a keyboard, display, or mouse is called in an environment that does not support a keyboard, display, or mouse. Any code that depends on any of those devices should firstly ensure their availability using theGraphicsEnvironment.isHeadless()
method and throwHeadlessException
if the latter returnstrue
.- Since:
- 1.4
- See Also:
GraphicsEnvironment.isHeadless()
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description HeadlessException()
Constructs newHeadlessException
with empty message.HeadlessException(String msg)
Create a new instance with the specified detailed error message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getMessage()
Returns the detail message string of thisHeadlessException
.-
Methods declared in class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
HeadlessException
public HeadlessException()
Constructs newHeadlessException
with empty message. For suchHeadlessException
the default headless error message may be auto-generated for some platforms. The text of the default headless message may depend on whether the GraphicsEnvironment is in fact headless. That is, the default headless message is both system and environmentally dependent.
HeadlessException
public HeadlessException(String msg)
Create a new instance with the specified detailed error message. For some platforms the default headless error message may be added at the end of the specified message. The text of the default headless message may depend on whether the GraphicsEnvironment is in fact headless. That is, the default headless message is both system and environmentally dependent.- Parameters:
msg
- the error message
-
Method Detail
getMessage
public String getMessage()
Returns the detail message string of thisHeadlessException
. Depending on the platform the message specified in the constructor may be followed by the default headless error message. The text of the default headless message may depend on whether the GraphicsEnvironment is in fact headless. That is, the default headless message is both system and environmentally dependent.- Overrides:
getMessage
in classThrowable
- Returns:
-
the detail message string of this
HeadlessException
instance (which may benull
).
-