Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.openide.util 6.8.22
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.openide.util
Class HelpCtx

    java.lang.Object
      org.openide.util.HelpCtx

    public final class HelpCtx

extends Object

Provides help for any window or other feature in the system. It is designed to be JavaHelp-compatible and to use the same tactics when assigning help to `JComponent` instances.

See Also:
  JavaHelp Integration API

Nested Class Summary
`static interface` | `HelpCtx.Provider` An object implementing this interface is willing to answer the HelpCtx.findHelp() query itself.

Field Summary
`static HelpCtx` | `DEFAULT_HELP` Default help page.

Constructor Summary
`HelpCtx(Class clazz)` Create a help context by class.
`HelpCtx(String helpID)` Create a help context by tag.
`HelpCtx(URL helpCtx)` Deprecated. Does not work nicely with JavaHelp.

Method Summary
`boolean` | `equals(Object o)`
`static HelpCtx` | `findHelp(Component comp)` Find the help ID for a component.
`static HelpCtx` | `findHelp(Object instance)` Finds help context for a generic object.
`URL` | `getHelp()` Get a URL to the help page, if applicable.
`String` | `getHelpID()` Get the ID of the help page, if applicable.
`int` | `hashCode()`
`static void` | `setHelpIDString(JComponent comp, String helpID)` Set the help ID for a component.
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### DEFAULT_HELP

    public static final HelpCtx DEFAULT_HELP

  Default help page. This (hopefully) points to a note explaining to the user that no help is available. Precisely, the Help ID is set to `org.openide.util.HelpCtx.DEFAULT_HELP`.

Constructor Detail

### HelpCtx

    public HelpCtx(URL helpCtx)

  Deprecated. Does not work nicely with JavaHelp.

  Create a help context by URL.

  Parameters:
    `helpCtx` - URL to point help to

### HelpCtx

    public HelpCtx(String helpID)

  Create a help context by tag. You must provide an ID of the desired help for the item. The ID should refer to an already installed help; this can be easily installed by specifying a JavaHelp help set for the module (see the Modules API for details).

  Parameters:
    `helpID` - the JavaHelp ID of the help

### HelpCtx

    public HelpCtx(Class clazz)

  Create a help context by class. Assigns the name of a class as the ID.

  Parameters:
    `clazz` - the class to take the name from

Method Detail

### getHelp

    public URL getHelp()

  Get a URL to the help page, if applicable.

  Returns:
    a URL to the page, or `null` if the target was specified by ID

### getHelpID

    public String getHelpID()

  Get the ID of the help page, if applicable.

  Returns:
    the JavaHelp ID string, or `null` if specified by URL

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### setHelpIDString

    public static void setHelpIDString(JComponent comp,
                                       String helpID)

  Set the help ID for a component.

  Parameters:
    `comp` - the visual component to associate help to
    `helpID` - help ID, or `null` if the help ID should be removed

### findHelp

    public static HelpCtx findHelp(Component comp)

  Find the help ID for a component. If the component implements `HelpCtx.Provider`, its method `HelpCtx.Provider.getHelpCtx()` is called. If the component has help attached by `setHelpIDString(javax.swing.JComponent, java.lang.String)`, it returns that. Otherwise it checks the parent component recursively.

  Parameters:
    `comp` - the component to find help for
  Returns:
    the help for that component (never `null`)

### findHelp

    public static HelpCtx findHelp(Object instance)

  Finds help context for a generic object. Right now checks for HelpCtx.Provider and handles java.awt.Component in a special way compatible with JavaHelp. Also `BeanDescriptor`'s are checked for a string-valued attribute `helpID`, as per the JavaHelp specification (but no help sets will be loaded).

  Parameters:
    `instance` - to search help for
  Returns:
    the help for the object or `HelpCtx.DEFAULT_HELP` if HelpCtx cannot be found
  Since:
    4.3

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.openide.util 6.8.22
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Built on December 7 2006. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.