skip to main content
Programmer's documentation > Rogue Wave JViews Framework Essential Features > Managers > Hover highlighting in a manager
 
Hover highlighting in a manager
Describes how to use hover highlighting in a top-level manager.
*Managing hover highlighting
*Describes how to set up and enable hover highlighting.
*Creating your own highlighting effect
*Describes how to create a Java 2D™ image to use as a highlighting effect and how to customize the effect.
Managing hover highlighting
The manager allows you to highlight objects when the pointer hovers on top of them.
To display highlighted objects within a manager, the manager creates specific images that are drawn on top of the selected objects as a highlighting effect. By default, hover highlighting is not enabled. If you want to activate it, you need first to decide what highlighting effect you want to use.
The images used as highlighting effects are transient Java 2D™ artifacts, they are internally managed and cannot be manipulated.
Each effect is applied through a Java 2D image operation on the regular object representation, and then displayed on top of all the objects with a set opacity.
The manager provides 5 predefined effects:
*Invert colors: This changes the intensity of each color component (red, green, blue). For example, a red object will be highlighted with a yellow color.
*Blur: The highlighted object becomes blurred.
*Brighten: Every color used when drawing the object becomes brighter. This may have no effect on objects that are already very bright.
*Gray scale: The colors of the object are converted into tones of grays.
*Sharpen: the borders of the object are accentuated.
*None: to remove the hover highlight effect.
A sixth effect (Custom) is detailed in Creating your own highlighting effect.
To select your hover highlight effect, call setHoverHighlightingMode.
1. The hover highlighting effect will only be used when set on a top-level manager (See Nested managers and nested graphers for more information on nested managers).
2. The hover highlighting mode and the operation - see Creating your own highlighting effect are not persistent. This means that the information is not stored in .ivl files.
Creating your own highlighting effect
If you do not want or cannot use (because of your color scheme, for example) a predefined effect, you can also build your own instance of IlvHoverHighlightingImageOperation.
This class allows you to define which Java 2D™ image operation you want to use to highlight your objects. It also contains methods to provide a filter, to indicate which objects will be highlighted, and an opacity (or alpha) if you want to see the regular object representation through the highlighting effect.
For example, here is an operation that will have a more blurred effect, be half transparent and only for nongraphic bag objects.
 
float[] blur5Kernel = new float[5 * 5];
    for (int i = 0; i < blur5Kernel.length; i++) {
      blur5Kernel[i] = 1f / blur5Kernel.length;
    }
  IlvHoverHighlightingImageOperation myOperation=new
          IlvHoverHighlightingImageOperation(
            new ConvolveOp(new Kernel(5, 5, blur5Kernel)), 1));
  myOperation.setAlpha(0.5f);
  myOperation.setHighlightFilter(new
IlvHoverHighlightingImageOperation.NonGraphicBagFilter());
You can set your operation instance on the manager by means of setHoverHighlightingImageOperation. The mode will then be known to the manager as "Custom".

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.