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);
}
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();
}
});
}
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);
}
}
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();
}
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);
}
});
}
Aggregations