Package java.awt.event

Examples of java.awt.event.ComponentListener


    public void testAncestorAddedEventWhenComponentAdded() throws Exception {
        frame = createVisibleFrameWithAncestor();
        ancestor.remove(component);
        waitForIdle();
        listener.reset();
        ComponentListener compListener = addComponentListener(component);
        ancestor.add(component);
        waitForIdle();
        synchronized (compListener) {
            compListener.wait(1000);
        }
        assertTrue(listener.getNumEvents() >= 1);
        performChecksInQueue(component, ancestor, AncestorEvent.ANCESTOR_ADDED);
    }
View Full Code Here


        frame = createVisibleFrameWithAncestor();
        ancestor.setBounds(10, 10, 10, 10);
        ancestor.setVisible(false);
        waitForIdle();
        listener.reset();
        ComponentListener compListener = addComponentListener(component);
        ancestor.setBounds(20, 20, 20, 20);
        waitForIdle();
        synchronized (compListener) {
            compListener.wait(1000);
        }
        assertTrue(listener.getNumEvents() >= 1);
        performChecksInQueue(ancestor, frame.getContentPane(), AncestorEvent.ANCESTOR_MOVED);
    }
View Full Code Here

        frame = createVisibleFrameWithAncestor();
        ancestor.setBounds(10, 10, 10, 10);
        component.setVisible(false);
        waitForIdle();
        listener.reset();
        ComponentListener compListener = addComponentListener(component);
        ancestor.setBounds(20, 20, 20, 20);
        waitForIdle();
        synchronized (compListener) {
            compListener.wait(1000);
        }
        assertEquals(0, listener.getNumEvents());
    }
View Full Code Here

        frame = createVisibleFrameWithAncestor();
        component.setBounds(10, 10, 10, 10);
        ancestor.setVisible(false);
        waitForIdle();
        listener.reset();
        ComponentListener compListener = addComponentListener(component);
        component.setBounds(20, 20, 20, 20);
        waitForIdle();
        synchronized (compListener) {
            compListener.wait(1000);
        }
        assertTrue(listener.getNumEvents() >= 1);
        performChecksInQueue(component, ancestor, AncestorEvent.ANCESTOR_MOVED);
    }
View Full Code Here

        frame = createVisibleFrameWithAncestor();
        component.setBounds(10, 10, 10, 10);
        component.setVisible(false);
        waitForIdle();
        listener.reset();
        ComponentListener compListener = addComponentListener(component);
        component.setBounds(20, 20, 20, 20);
        waitForIdle();
        synchronized (compListener) {
            compListener.wait(1000);
        }
        assertEquals(1, listener.getNumEvents());
        performChecks(component, ancestor, AncestorEvent.ANCESTOR_MOVED);
    }
View Full Code Here

    public void testAncestorMovedEventWhenAncestorMoved() throws Exception {
        frame = createVisibleFrameWithAncestor();
        ancestor.setBounds(10, 10, 10, 10);
        waitForIdle();
        listener.reset();
        ComponentListener compListener = addComponentListener(component);
        ancestor.setBounds(20, 20, 20, 20);
        waitForIdle();
        synchronized (compListener) {
            compListener.wait(1000);
        }
        assertTrue(listener.getNumEvents() >= 1);
        performChecksInQueue(ancestor, frame.getContentPane(), AncestorEvent.ANCESTOR_MOVED);
    }
View Full Code Here

        assertEquals("ancestor", ancestor, event.getAncestor());
        assertEquals("ancestorParent", ancestorParent, event.getAncestorParent());
    }

    private ComponentListener addComponentListener(final Component c) {
        final ComponentListener compListener = new ComponentListener() {
            public void componentMoved(final ComponentEvent e) {
                synchronized (this) {
                    notifyAll();
                }
            }
View Full Code Here

        dialog.setLocation(appWindow.getLocation().x + (appWindow.getSize().width / 2 - wSize.width / 2),
                appWindow.getLocation().y + (appWindow.getSize().height / 2 - wSize.height / 2));

        // set the component listener
        final PosDialog  thisPosDialog = this;
        dialog.addComponentListener(new ComponentListener() {

            public void componentResized(ComponentEvent event) {
                this.reset();
            }
View Full Code Here

    public void setComponent(JComponent component) {
        this.component = component;
        JmeClientMain.getFrame().getCanvas3DPanel().add(component);
        setBounds(0, 0, (int) component.getPreferredSize().getWidth(), (int) component.getPreferredSize().getHeight());

        component.addComponentListener(new ComponentListener() {

            public void componentShown(ComponentEvent e) {
            }

            public void componentHidden(ComponentEvent e) {
View Full Code Here

    protected final Map<String, HUD> huds = Collections.synchronizedMap(new HashMap());

    public WonderlandHUDManager(Canvas display) {
        this.display = display;

        display.addComponentListener(new ComponentListener() {

            public void componentResized(ComponentEvent e) {
                Iterator<String> iter = huds.keySet().iterator();
                while (iter.hasNext()) {
                    HUD hud = huds.get(iter.next());
View Full Code Here

TOP

Related Classes of java.awt.event.ComponentListener

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.