Example usage for java.awt HeadlessException HeadlessException

List of usage examples for java.awt HeadlessException HeadlessException

Introduction

In this page you can find the example usage for java.awt HeadlessException HeadlessException.

Prototype

public HeadlessException() 

Source Link

Document

Constructs new HeadlessException with empty message.

Usage

From source file:com.googlecode.vfsjfilechooser2.VFSJFileChooser.java

/**
 * Sets the <code>dragEnabled</code> property,
 * which must be <code>true</code> to enable
 * automatic drag handling (the first part of drag and drop)
 * on this component.//from ww  w .ja  v  a  2 s.c  om
 * The <code>transferHandler</code> property needs to be set
 * to a non-<code>null</code> value for the drag to do
 * anything.  The default value of the <code>dragEnabled</code>
 * property
 * is <code>false</code>.
 *
 * <p>
 *
 * When automatic drag handling is enabled,
 * most look and feels begin a drag-and-drop operation
 * whenever the user presses the mouse button over an item
 * and then moves the mouse a few pixels.
 * Setting this property to <code>true</code>
 * can therefore have a subtle effect on
 * how selections behave.
 *
 * <p>
 *
 * Some look and feels might not support automatic drag and drop;
 * they will ignore this property.  You can work around such
 * look and feels by modifying the component
 * to directly call the <code>exportAsDrag</code> method of a
 * <code>TransferHandler</code>.
 *
 * @param b the value to set the <code>dragEnabled</code> property to
 * @exception HeadlessException if
 *            <code>b</code> is <code>true</code> and
 *            <code>GraphicsEnvironment.isHeadless()</code>
 *            returns <code>true</code>
 * @see java.awt.GraphicsEnvironment#isHeadless
 * @see #getDragEnabled
 * @see #setTransferHandler
 * @see TransferHandler
 * @since 1.4
 *
 * @beaninfo
 *  description: determines whether automatic drag handling is enabled
 *        bound: false
 */
public void setDragEnabled(boolean b) {
    if (b && GraphicsEnvironment.isHeadless()) {
        throw new HeadlessException();
    }

    dragEnabled = b;
}