Handle headless exception in java

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • de_subhadeep@hotmail.com

    Handle headless exception in java

    Hi All,

    My program is running on a headless mode and I need to set the look
    and feel of my program but it gives me Headless Exception when I try
    to set the look and feel.
    The exception is as follows

    at sun.java2d.Head lessGraphicsEnv ironment.getDef aultScreenDevic e(null:-1)
    at com.sun.java.sw ing.plaf.window s.XPStyle.getIm age(null:-1)
    at com.sun.java.sw ing.plaf.window s.XPStyle.acces s$200(null:-1)
    at com.sun.java.sw ing.plaf.window s.XPStyle$Skin. <init>(null:-1)
    at com.sun.java.sw ing.plaf.window s.XPStyle$Skin. <init>(null:-1)
    at com.sun.java.sw ing.plaf.window s.XPStyle.getSk in(null:-1)
    at com.sun.java.sw ing.plaf.window s.WindowsTreeUI $ExpandedIcon.< init>(null:-1)
    at com.sun.java.sw ing.plaf.window s.WindowsTreeUI $ExpandedIcon.c reateExpandedIc on(null:-1)
    at com.sun.java.sw ing.plaf.window s.WindowsLookAn dFeel.initCompo nentDefaults(nu ll:-1)
    at javax.swing.pla f.basic.BasicLo okAndFeel.getDe faults(null:-1)
    at javax.swing.UIM anager.setLookA ndFeel(null:-1)
    at javax.swing.UIM anager.setLookA ndFeel(null:-1)

    Can any one tell me please how I can set the look and feel without
    gettig this exception?

    Thanks,
    Subhadeep.
  • Joost van Stuijvenberg

    #2
    Re: Handle headless exception in java

    > My program is running on a headless mode and I need to set the look[color=blue]
    > and feel of my program but it gives me Headless Exception when I try
    > to set the look and feel.[/color]

    From the Sun API:

    "public class HeadlessExcepti on extends UnsupportedOper ationException
    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."

    You say you want to set the Look & Feel of an application that has no
    Look & Feel... Aren't you trying to fix the tires of a boat, buying
    Happy Meals without having children, calling interrupt() on a Thread
    that is already dead, etc.?

    Regards,
    Joost

    Comment

    Working...