Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Dialog$DialogStateListenerList


    @Override
    public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
        boolean consumed = false;

        Dialog dialog = (Dialog)getComponent();

        if (keyCode == Keyboard.KeyCode.ENTER) {
            dialog.close(true);
            consumed = true;
        } else if (keyCode == Keyboard.KeyCode.ESCAPE) {
            dialog.close(false);
            consumed = true;
        } else {
            consumed = super.keyPressed(component, keyCode, keyLocation);
        }
View Full Code Here


    private class RepositionCallback implements Runnable {
        private static final float GOLDEN_SECTION = 0.382f;

        @Override
        public void run() {
            Dialog dialog = (Dialog)getComponent();
            Container ancestor = dialog.getOwner();

            if (ancestor == null) {
                ancestor = dialog.getDisplay();
            }

            int deltaWidth = ancestor.getWidth() - getWidth();
            int deltaHeight = ancestor.getHeight() - getHeight();

            int x = Math.max(0, Math.round(ancestor.getX() + 0.5f * deltaWidth));
            int y = Math.max(0, Math.round(ancestor.getY() + GOLDEN_SECTION * deltaHeight));

            dialog.setLocation(x, y);
        }
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.Dialog$DialogStateListenerList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.