Search in sources :

Example 11 with ComponentListener

use of java.awt.event.ComponentListener in project lwjgl by LWJGL.

the class MacOSXCanvasPeerInfo method addComponentListener.

private void addComponentListener(final Canvas component) {
    ComponentListener[] components = component.getComponentListeners();
    // avoid adding duplicate listners by checking if one has already been added
    for (int i = 0; i < components.length; i++) {
        ComponentListener c = components[i];
        if (c.toString() == "CanvasPeerInfoListener") {
            // already contains the listner below return without adding
            return;
        }
    }
    ComponentListener comp = new ComponentListener() {

        public void componentHidden(ComponentEvent e) {
        }

        public void componentMoved(ComponentEvent e) {
            // nSetLayerPosition(getHandle(), component.getX() - left, component.getY() - top);
            reSetLayerBounds(component, getHandle());
        }

        public void componentResized(ComponentEvent e) {
            // nSetLayerPosition(getHandle(), component.getX() - left, component.getY() - top);
            reSetLayerBounds(component, getHandle());
        }

        public void componentShown(ComponentEvent e) {
        }

        public String toString() {
            return "CanvasPeerInfoListener";
        }
    };
    component.addComponentListener(comp);
}
Also used : ComponentListener(java.awt.event.ComponentListener) ComponentEvent(java.awt.event.ComponentEvent) Point(java.awt.Point)

Example 12 with ComponentListener

use of java.awt.event.ComponentListener in project freeplane by freeplane.

the class EditNodeDialog method show.

public void show(final RootPaneContainer frame) {
    if (title == null) {
        title = TextUtils.getText("edit_long_node");
    }
    final EditDialog dialog = new LongNodeDialog(frame, title, getBackground());
    redispatchKeyEvents(textComponent, firstEvent);
    if (firstEvent == null) {
        textComponent.setCaretPosition(textComponent.getDocument().getLength());
    }
    dialog.getDialog().setModal(isModal);
    dialog.getDialog().pack();
    Controller.getCurrentModeController().getController().getMapViewManager().scrollNodeToVisible(node);
    if (ResourceController.getResourceController().getBooleanProperty("el__position_window_below_node")) {
        UITools.setDialogLocationUnder(dialog.getDialog(), getNode());
    } else {
        UITools.setDialogLocationRelativeTo(dialog.getDialog(), getNode());
    }
    dialog.show();
    dialog.getDialog().addComponentListener(new ComponentListener() {

        public void componentShown(final ComponentEvent e) {
        }

        public void componentResized(final ComponentEvent e) {
        }

        public void componentMoved(final ComponentEvent e) {
        }

        public void componentHidden(final ComponentEvent e) {
            dialog.dispose();
        }
    });
}
Also used : ComponentListener(java.awt.event.ComponentListener) ComponentEvent(java.awt.event.ComponentEvent)

Example 13 with ComponentListener

use of java.awt.event.ComponentListener in project sirix by sirixdb.

the class TreeView method dispose.

@Override
public void dispose() {
    mTree.clearSelection();
    mTree.setModel(null);
    mTree.setCellRenderer(null);
    for (final FocusListener listener : mTree.getFocusListeners()) {
        mTree.removeFocusListener(listener);
    }
    for (final ComponentListener listener : mTree.getComponentListeners()) {
        mTree.removeComponentListener(listener);
    }
    for (final TreeSelectionListener listener : mTree.getTreeSelectionListeners()) {
        mTree.removeTreeSelectionListener(listener);
    }
    for (final ContainerListener listener : mTree.getContainerListeners()) {
        mTree.removeContainerListener(listener);
    }
}
Also used : ComponentListener(java.awt.event.ComponentListener) ContainerListener(java.awt.event.ContainerListener) TreeSelectionListener(javax.swing.event.TreeSelectionListener) FocusListener(java.awt.event.FocusListener)

Example 14 with ComponentListener

use of java.awt.event.ComponentListener in project cytoscape-impl by cytoscape.

the class NetworkViewMainPanel method remove.

public void remove(final CyNetworkView view) {
    if (view == null)
        return;
    allViewContainers.remove(view);
    final Component[] components = getContentPane().getComponents();
    if (components != null) {
        for (Component c : components) {
            if (c instanceof NetworkViewContainer) {
                final NetworkViewContainer vc = (NetworkViewContainer) c;
                if (vc.getNetworkView().equals(view)) {
                    networkViewGrid.removeItems(Collections.singleton(vc.getRenderingEngine()));
                    removeCard(vc);
                    vc.dispose();
                }
            } else if (c instanceof NetworkViewComparisonPanel) {
                final NetworkViewContainer vc = ((NetworkViewComparisonPanel) c).getContainer(view);
                if (vc != null) {
                    networkViewGrid.removeItems(Collections.singleton(vc.getRenderingEngine()));
                    ((NetworkViewComparisonPanel) c).removeView(view);
                    // Show regular view container if only one remains
                    if (((NetworkViewComparisonPanel) c).viewCount() < 2)
                        endComparison(((NetworkViewComparisonPanel) c));
                }
            } else if (c instanceof NullNetworkViewPanel) {
                if (view.equals(((NullNetworkViewPanel) c).getNetworkView()))
                    ;
                nullViewPanel.update((CyNetwork) null);
            }
        }
    }
    final NetworkViewFrame frame = viewFrames.remove(createUniqueKey(view));
    if (frame != null) {
        networkViewGrid.removeItems(Collections.singleton(frame.getRenderingEngine()));
        frame.getRootPane().getLayeredPane().removeAll();
        frame.getRootPane().getContentPane().removeAll();
        frame.dispose();
        for (ComponentListener l : frame.getComponentListeners()) frame.removeComponentListener(l);
        for (WindowListener l : frame.getWindowListeners()) frame.removeWindowListener(l);
    }
    if (isGridMode())
        updateGrid();
}
Also used : ComponentListener(java.awt.event.ComponentListener) WindowListener(java.awt.event.WindowListener) Component(java.awt.Component) JComponent(javax.swing.JComponent)

Example 15 with ComponentListener

use of java.awt.event.ComponentListener in project Universal-G-Code-Sender by winder.

the class MainWindow method visualizeButtonActionPerformed.

// GEN-LAST:event_browseButtonActionPerformed
private void visualizeButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // Create new object if it is null.
    if (this.vw == null) {
        this.vw = new VisualizerWindow(settings.getVisualizerWindowSettings());
        final MainWindow mw = this;
        vw.addComponentListener(new ComponentListener() {

            @Override
            public void componentResized(ComponentEvent ce) {
                mw.settings.getVisualizerWindowSettings().height = ce.getComponent().getSize().height;
                mw.settings.getVisualizerWindowSettings().width = ce.getComponent().getSize().width;
            }

            @Override
            public void componentMoved(ComponentEvent ce) {
                mw.settings.getVisualizerWindowSettings().xLocation = ce.getComponent().getLocation().x;
                mw.settings.getVisualizerWindowSettings().yLocation = ce.getComponent().getLocation().y;
            }

            @Override
            public void componentShown(ComponentEvent ce) {
            }

            @Override
            public void componentHidden(ComponentEvent ce) {
            }
        });
        setVisualizerFile();
        // Add listener
        this.backend.addControllerListener(vw);
    }
    // Display the form
    java.awt.EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            vw.setVisible(true);
        }
    });
}
Also used : ComponentListener(java.awt.event.ComponentListener) VisualizerWindow(com.willwinder.universalgcodesender.visualizer.VisualizerWindow) ComponentEvent(java.awt.event.ComponentEvent)

Aggregations

ComponentListener (java.awt.event.ComponentListener)18 ComponentEvent (java.awt.event.ComponentEvent)14 Component (java.awt.Component)4 Dimension (java.awt.Dimension)4 JScrollPane (javax.swing.JScrollPane)4 Point (java.awt.Point)3 JLabel (javax.swing.JLabel)3 JTextArea (javax.swing.JTextArea)3 ComponentAdapter (java.awt.event.ComponentAdapter)2 File (java.io.File)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Timer (java.util.Timer)2 TimerTask (java.util.TimerTask)2 javax.swing (javax.swing)2 DefaultListCellRenderer (javax.swing.DefaultListCellRenderer)2 Helper (chatty.Helper)1 Action (chatty.gui.components.JListActionHelper.Action)1 ContextMenuListener (chatty.gui.components.menus.ContextMenuListener)1 StreamInfosContextMenu (chatty.gui.components.menus.StreamInfosContextMenu)1