KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > HeadlessException


1 /*
2  * @(#)HeadlessException.java 1.8 04/03/29
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.awt;
9
10 /**
11  * Thrown when code that is dependent on a keyboard, display, or mouse
12  * is called in an environment that does not support a keyboard, display,
13  * or mouse.
14  *
15  * @since 1.4
16  * @author Michael Martak
17  */

18 public class HeadlessException extends UnsupportedOperationException JavaDoc {
19     /*
20      * JDK 1.4 serialVersionUID
21      */

22     private static final long serialVersionUID = 167183644944358563L;
23     public HeadlessException() {}
24     public HeadlessException(String JavaDoc msg) {
25         super(msg);
26     }
27     public String JavaDoc getMessage() {
28         String JavaDoc superMessage = super.getMessage();
29         String JavaDoc headlessMessage = GraphicsEnvironment.getHeadlessMessage();
30         
31         if (superMessage == null) {
32             return headlessMessage;
33         } else if (headlessMessage == null) {
34             return superMessage;
35         } else {
36             return superMessage + headlessMessage;
37         }
38     }
39 }
40
Popular Tags