Search in sources :

Example 1 with FadeDecorator

use of org.apache.pivot.wtk.effects.FadeDecorator in project pivot by apache.

the class DecoratorDemo method startup.

@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
    BXMLSerializer bxmlSerializer = new BXMLSerializer();
    reflectionWindow = (Window) bxmlSerializer.readObject(DecoratorDemo.class, "reflection_window.bxml");
    translucentFrame = (Frame) bxmlSerializer.readObject(DecoratorDemo.class, "translucent_frame.bxml");
    final FadeDecorator fadeDecorator = new FadeDecorator();
    translucentFrame.getDecorators().insert(fadeDecorator, 0);
    translucentFrame.getComponentMouseListeners().add(new ComponentMouseListener() {

        @Override
        public void mouseOver(Component component) {
            fadeDecorator.setOpacity(0.9f);
            component.repaint();
        }

        @Override
        public void mouseOut(Component component) {
            fadeDecorator.setOpacity(0.5f);
            component.repaint();
        }
    });
    reflectionWindow.open(display);
    translucentFrame.open(reflectionWindow);
}
Also used : FadeDecorator(org.apache.pivot.wtk.effects.FadeDecorator) Component(org.apache.pivot.wtk.Component) ComponentMouseListener(org.apache.pivot.wtk.ComponentMouseListener) BXMLSerializer(org.apache.pivot.beans.BXMLSerializer)

Aggregations

BXMLSerializer (org.apache.pivot.beans.BXMLSerializer)1 Component (org.apache.pivot.wtk.Component)1 ComponentMouseListener (org.apache.pivot.wtk.ComponentMouseListener)1 FadeDecorator (org.apache.pivot.wtk.effects.FadeDecorator)1