By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,731 Members | 1,104 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,731 IT Pros & Developers. It's quick & easy.

Handle headless exception in java

P: n/a
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.HeadlessGraphicsEnvironment.getDefaultS creenDevice(null:-1)
at com.sun.java.swing.plaf.windows.XPStyle.getImage(n ull:-1)
at com.sun.java.swing.plaf.windows.XPStyle.access$200 (null:-1)
at com.sun.java.swing.plaf.windows.XPStyle$Skin.<init >(null:-1)
at com.sun.java.swing.plaf.windows.XPStyle$Skin.<init >(null:-1)
at com.sun.java.swing.plaf.windows.XPStyle.getSkin(nu ll:-1)
at com.sun.java.swing.plaf.windows.WindowsTreeUI$Expa ndedIcon.<init>(null:-1)
at com.sun.java.swing.plaf.windows.WindowsTreeUI$Expa ndedIcon.createExpandedIcon(null:-1)
at com.sun.java.swing.plaf.windows.WindowsLookAndFeel .initComponentDefaults(null:-1)
at javax.swing.plaf.basic.BasicLookAndFeel.getDefault s(null:-1)
at javax.swing.UIManager.setLookAndFeel(null:-1)
at javax.swing.UIManager.setLookAndFeel(null:-1)

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

Thanks,
Subhadeep.
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
> 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.


From the Sun API:

"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."

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
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.