Java Code Examples for java.awt.Window#addComponentListener()

The following examples show how to use java.awt.Window#addComponentListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WindowGeometryPersisterImpl.java    From pgptool with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @param scheduledExecutorService it's used to dealy interraction with
 *                                 configPairs to avoid spamming it with values
 *                                 while user still dragging element
 */
public WindowGeometryPersisterImpl(Window window, String windowId, ConfigPairs configPairs,
		ScheduledExecutorService scheduledExecutorService) {
	Preconditions.checkArgument(scheduledExecutorService != null);
	Preconditions.checkArgument(window != null);
	Preconditions.checkArgument(StringUtils.hasText(windowId));
	Preconditions.checkArgument(configPairs != null);

	this.window = window;
	// NOTE: We do + window.getMinimumSize() because from
	// version to version application windows sizes might change
	this.keyId = windowId + "_" + window.getMinimumSize();
	this.configPairs = configPairs;
	this.scheduledExecutorService = scheduledExecutorService;
	window.addComponentListener(this);
}
 
Example 2
Source File: InputContext.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void addClientWindowListeners() {
    Component client = getClientComponent();
    if (client == null) {
        return;
    }
    Window window = getComponentWindow(client);
    if (window == null) {
        return;
    }
    window.addComponentListener(this);
    window.addWindowListener(this);
    clientWindowListened = window;
}
 
Example 3
Source File: InputContext.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void addClientWindowListeners() {
    Component client = getClientComponent();
    if (client == null) {
        return;
    }
    Window window = getComponentWindow(client);
    if (window == null) {
        return;
    }
    window.addComponentListener(this);
    window.addWindowListener(this);
    clientWindowListened = window;
}
 
Example 4
Source File: InputContext.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void addClientWindowListeners() {
    Component client = getClientComponent();
    if (client == null) {
        return;
    }
    Window window = getComponentWindow(client);
    if (window == null) {
        return;
    }
    window.addComponentListener(this);
    window.addWindowListener(this);
    clientWindowListened = window;
}
 
Example 5
Source File: InputContext.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void addClientWindowListeners() {
    Component client = getClientComponent();
    if (client == null) {
        return;
    }
    Window window = getComponentWindow(client);
    if (window == null) {
        return;
    }
    window.addComponentListener(this);
    window.addWindowListener(this);
    clientWindowListened = window;
}
 
Example 6
Source File: UserPreferences.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Restores the window size, position and state if possible. Tracks the
 * window size, position and state.
 * 
 * @param window
 */
public static void track(Window window) {
  Preferences prefs = node().node("Windows");

  String bounds = prefs.get(window.getName() + ".bounds", null);
  if (bounds != null) {
    Rectangle rect =
      (Rectangle)ConverterRegistry.instance().convert(
        Rectangle.class,
        bounds);
    window.setBounds(rect);
  }

  window.addComponentListener(windowDimension);
}
 
Example 7
Source File: InputContext.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void addClientWindowListeners() {
    Component client = getClientComponent();
    if (client == null) {
        return;
    }
    Window window = getComponentWindow(client);
    if (window == null) {
        return;
    }
    window.addComponentListener(this);
    window.addWindowListener(this);
    clientWindowListened = window;
}
 
Example 8
Source File: InputContext.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void addClientWindowListeners() {
    Component client = getClientComponent();
    if (client == null) {
        return;
    }
    Window window = getComponentWindow(client);
    if (window == null) {
        return;
    }
    window.addComponentListener(this);
    window.addWindowListener(this);
    clientWindowListened = window;
}
 
Example 9
Source File: UserPreferences.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Restores the window size, position and state if possible. Tracks the window
 * size, position and state.
 * 
 * @param window
 */
public static void track(Window window) {
  Preferences prefs = node().node("Windows");

  String bounds = prefs.get(window.getName() + ".bounds", null);
  if (bounds != null) {
    Rectangle rect = (Rectangle) ConverterRegistry.instance().convert(
        Rectangle.class, bounds);
    window.setBounds(rect);
  }

  window.addComponentListener(windowDimension);
}
 
Example 10
Source File: InputContext.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void addClientWindowListeners() {
    Component client = getClientComponent();
    if (client == null) {
        return;
    }
    Window window = getComponentWindow(client);
    if (window == null) {
        return;
    }
    window.addComponentListener(this);
    window.addWindowListener(this);
    clientWindowListened = window;
}
 
Example 11
Source File: InputContext.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void addClientWindowListeners() {
    Component client = getClientComponent();
    if (client == null) {
        return;
    }
    Window window = getComponentWindow(client);
    if (window == null) {
        return;
    }
    window.addComponentListener(this);
    window.addWindowListener(this);
    clientWindowListened = window;
}
 
Example 12
Source File: InputContext.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private synchronized void addClientWindowListeners() {
    Component client = getClientComponent();
    if (client == null) {
        return;
    }
    Window window = getComponentWindow(client);
    if (window == null) {
        return;
    }
    window.addComponentListener(this);
    window.addWindowListener(this);
    clientWindowListened = window;
}
 
Example 13
Source File: InputContext.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void addClientWindowListeners() {
    Component client = getClientComponent();
    if (client == null) {
        return;
    }
    Window window = getComponentWindow(client);
    if (window == null) {
        return;
    }
    window.addComponentListener(this);
    window.addWindowListener(this);
    clientWindowListened = window;
}
 
Example 14
Source File: InputContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void addClientWindowListeners() {
    Component client = getClientComponent();
    if (client == null) {
        return;
    }
    Window window = getComponentWindow(client);
    if (window == null) {
        return;
    }
    window.addComponentListener(this);
    window.addWindowListener(this);
    clientWindowListened = window;
}
 
Example 15
Source File: InputContext.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void addClientWindowListeners() {
    Component client = getClientComponent();
    if (client == null) {
        return;
    }
    Window window = getComponentWindow(client);
    if (window == null) {
        return;
    }
    window.addComponentListener(this);
    window.addWindowListener(this);
    clientWindowListened = window;
}
 
Example 16
Source File: InputContext.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void addClientWindowListeners() {
    Component client = getClientComponent();
    if (client == null) {
        return;
    }
    Window window = getComponentWindow(client);
    if (window == null) {
        return;
    }
    window.addComponentListener(this);
    window.addWindowListener(this);
    clientWindowListened = window;
}
 
Example 17
Source File: InputContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void addClientWindowListeners() {
    Component client = getClientComponent();
    if (client == null) {
        return;
    }
    Window window = getComponentWindow(client);
    if (window == null) {
        return;
    }
    window.addComponentListener(this);
    window.addWindowListener(this);
    clientWindowListened = window;
}
 
Example 18
Source File: WindowStateAdapter.java    From consulo with Apache License 2.0 4 votes vote down vote up
private WindowStateAdapter(@Nonnull Window window) {
  myWindowState.applyFrom(window);
  window.addComponentListener(this);
  window.addWindowListener(this);
  window.addWindowStateListener(this);
}
 
Example 19
Source File: AnimationAutoCompletion.java    From 3Dscript with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void addTo(Window w) {
	w.addComponentListener(this);
	w.addWindowFocusListener(this);
}
 
Example 20
Source File: WindowSizeEnforcer.java    From gcs with Mozilla Public License 2.0 2 votes vote down vote up
/**
 * Monitors a window for resizing.
 *
 * @param window The window to monitor.
 */
public static void monitor(Window window) {
    window.addComponentListener(new WindowSizeEnforcer());
}