congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Window.addComponentListener
Code IndexAdd Tabnine to your IDE (free)

How to use
addComponentListener
method
in
java.awt.Window

Best Java code snippets using java.awt.Window.addComponentListener (Showing top 20 results out of 360)

origin: bobbylight/RSyntaxTextArea

Listener() {
  addWindowFocusListener(this);
  // If anything happens to the "parent" window, hide this popup
  Window parent = (Window)getParent();
  parent.addWindowFocusListener(this);
  parent.addWindowListener(this);
  parent.addComponentListener(this);
}
origin: bobbylight/RSyntaxTextArea

Listener() {
  addWindowFocusListener(this);
  list.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      if (e.getClickCount()==2) {
        insertSelectedItem();
      }
    }
  });
  list.getInputMap().put(
      KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "onEnter");
  list.getActionMap().put("onEnter", new AbstractAction() {
    @Override
    public void actionPerformed(ActionEvent e) {
      insertSelectedItem();
    }
  });
  // If anything happens to the "parent" window, hide this popup
  Window parent = (Window)getParent();
  parent.addWindowFocusListener(this);
  parent.addWindowListener(this);
  parent.addComponentListener(this);
}
origin: abbot/abbot

/**
 * Do not call directly as can cause a stack overflow with multiple attacments to the 
 * listener list
 */
public WindowWatcher(Window w) {
  w.addComponentListener(this);
  w.addWindowListener(this);
}
public void componentShown(ComponentEvent e) {
origin: xyz.cofe/docking-frames-core

public void addWindowProviderListener( WindowProviderListener listener ) {
  if( listener == null )
    throw new IllegalArgumentException( "null is not allowed as listener" );
  
  if( listeners.size() == 0 ){
    updateVisibility();
    if( window != null ){
      window.addComponentListener( windowListener );
      // updateVisibility();
    }
  }
  
  listeners.add( listener );
}

origin: com.github.lgooddatepicker/LGoodDatePicker

/**
 * registerListeners, This function registers this class as a listener with the appropriate
 * components. De-registration is handled in the hide() function.
 */
private void registerListeners() {
  // Register this class as a focus listener with the display window.
  displayWindow.addWindowFocusListener(this);
  // Register this class as a window movement listener with the top window.
  topWindow.addComponentListener(this);
}
origin: com.fifesoft/autocomplete

public void addTo(Window w) {
  w.addComponentListener(this);
  w.addWindowFocusListener(this);
}
origin: robo-code/robocode

public Rectangle getWindowRect(Window window) {
  window.addComponentListener(this);
  String rString = (String) getWindowPositions().get(window.getClass().getName());
  if (rString == null) {
    return null;
  }
  StringTokenizer tokenizer = new StringTokenizer(rString, ",");
  int x = Integer.parseInt(tokenizer.nextToken());
  int y = Integer.parseInt(tokenizer.nextToken());
  int width = Integer.parseInt(tokenizer.nextToken());
  int height = Integer.parseInt(tokenizer.nextToken());
  return fitWindowBoundsToScreen(new Rectangle(x, y, width, height));
}
origin: org.apache.cayenne.modeler/cayenne-modeler

/**
 * Binds this preference object to synchronize its state with a given component,
 * allowing to specify an initial offset compared to the stored position.
 */
public void bindSize(final Window window, int initialWidth, int initialHeight) {
  updateSize(window, initialWidth, initialHeight);
  window.addComponentListener(new ComponentAdapter() {
    @Override
    public void componentResized(ComponentEvent e) {
      setWidth(window.getWidth());
      setHeight(window.getHeight());
    }
  });
}
origin: com.fifesoft.rtext/fife.common

/**
 * Called when this component receives a parent.  This method is
 * overridden so we can add a component listener to the parent window
 * to know when it is maximized/de-maximized.
 */
@Override
public void addNotify() {
  super.addNotify();
  window = (Window)SwingUtilities.getRoot(this);
  window.addComponentListener(maximizeWindow);
}
origin: joel-costigliola/assertj-swing

/**
 * Creates a new {@link WindowVisibilityMonitor} and attaches it to the given {@code Window}.
 *
 * @param target the {@code Window} to attach the new monitor to.
 */
void attachNewWindowVisibilityMonitor(Window target) {
 WindowVisibilityMonitor monitor = new WindowVisibilityMonitor(this);
 target.addWindowListener(monitor);
 target.addComponentListener(monitor);
}
origin: de.sciss/scisslib

private void learnWindow( Container c )
{
  if( c != null && c instanceof Window ) {
    win = (Window) c;
    win.addWindowListener( winL );
    win.addComponentListener( cmpL );
    if( EventManager.DEBUG_EVENTS ) {
      System.err.println( "DynamicAncestorAdapter added WindowListener : "+
        win.getClass().getName() );
    }
    if( !listening && win.isShowing() ) startListening();
  }
}
origin: net.java.dev.jna/jna-platform

@Override
public void addNotify() {
  super.addNotify();
  Window w = SwingUtilities.getWindowAncestor(this);
  setSize(getParent().getSize());
  w.addComponentListener(listener);
  w.addWindowListener(listener);
  Toolkit.getDefaultToolkit().addAWTEventListener(listener, AWTEvent.MOUSE_EVENT_MASK|AWTEvent.MOUSE_MOTION_EVENT_MASK);
}
origin: net.java.dev.jna/platform

public void addNotify() {
  super.addNotify();
  Window w = SwingUtilities.getWindowAncestor(this);
  setSize(getParent().getSize());
  w.addComponentListener(listener);
  w.addWindowListener(listener);
  Toolkit.getDefaultToolkit().addAWTEventListener(listener, AWTEvent.MOUSE_EVENT_MASK|AWTEvent.MOUSE_MOTION_EVENT_MASK);
}
origin: mucommander/mucommander

private void init(Window window, JComponent leftComponent, JComponent rightComponent) {
  this.window = window;
  window.addComponentListener(this);
  BasicSplitPaneDivider divider = getDividerComponent();
  divider.addComponentListener(this);
  divider.addMouseListener(this);
  // Set null minimum size for both components so that divider can be moved all the way left/up and right/down
  Dimension nullDimension = new Dimension(0,0);
  if(leftComponent!=null)
    leftComponent.setMinimumSize(nullDimension);
  if(rightComponent!=null)
    rightComponent.setMinimumSize(nullDimension);
}
origin: com.l2fprod.common/l2fprod-common-shared

/**
 * 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);
}
origin: com.fifesoft/rsyntaxtextarea

Listener() {
  addWindowFocusListener(this);
  // If anything happens to the "parent" window, hide this popup
  Window parent = (Window)getParent();
  parent.addWindowFocusListener(this);
  parent.addWindowListener(this);
  parent.addComponentListener(this);
}
origin: xyz.cofe/docking-frames-core

/**
 * Updates the visibility state and listeners that observe the 
 * visibility state.
 */
protected void updateVisibility(){
  Window current = searchWindow();
  if( window != current ){
    if( listeners.size() > 0 ){
      if( window != null )
        window.removeComponentListener( windowListener );
      if( current != null )
        current.addComponentListener( windowListener );
    }
    window = current;
  }
  
  boolean showing = isShowing();
  if( windowShowing != showing ){
    windowShowing = showing;
    fireVisibilityChanged( showing );
  }
}

origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf

/**
 * Description of the Method
 *
 * @param e  Description of Parameter
 */
public void windowActivated(WindowEvent e) {
 if (ignoreEvents) {
  // ok the next event will be processed
  ignoreEvents = false;
  return;
 }
 if (lastActivate != null) {
  lastActivate.removeComponentListener(this);
 }
 attachSnapTo(e.getWindow());
 lastActivate = e.getWindow();
 lastActivate.addComponentListener(this);
}
origin: xyz.cofe/docking-frames-core

/**
 * Sets the shape to apply, this method does nothing if this adapter is not {@link #isEnabled() enabled}. 
 * @param shape the shape to apply or <code>null</code>
 */
public void setShape( ScreenWindowShape shape ){
  if( (isEnabled() || shape == null) && shape != this.shape ){
    if( this.shape != null ){
      this.shape.setCallback( null );
      window.removeComponentListener( callback );
    }
    
    this.shape = shape;
    
    if( this.shape != null ){
      this.shape.setCallback( callback );
      this.shape.onShown();
      window.addComponentListener( callback );
    }
  }
}

origin: org.opentcs.thirdparty.dockingframes/docking-frames-core

/**
 * Sets the shape to apply, this method does nothing if this adapter is not {@link #isEnabled() enabled}. 
 * @param shape the shape to apply or <code>null</code>
 */
public void setShape( ScreenWindowShape shape ){
  if( (isEnabled() || shape == null) && shape != this.shape ){
    if( this.shape != null ){
      this.shape.setCallback( null );
      window.removeComponentListener( callback );
    }
    
    this.shape = shape;
    
    if( this.shape != null ){
      this.shape.setCallback( callback );
      this.shape.onShown();
      window.addComponentListener( callback );
    }
  }
}

java.awtWindowaddComponentListener

Popular methods of Window

  • dispose
    Releases all of the native screen resources used by thisWindow, its subcomponents, and all of its ow
  • setVisible
  • setLocation
  • pack
    Causes this Window to be sized to fit the preferred size and layouts of its subcomponents. If the wi
  • addWindowListener
    Adds the specified window listener to receive window events from this window. If l is null, no excep
  • getSize
  • getWidth
  • getHeight
  • setSize
  • setBounds
  • getBounds
  • removeWindowListener
    Removes the specified window listener so that it no longer receives window events from this window.
  • getBounds,
  • removeWindowListener,
  • getGraphicsConfiguration,
  • isVisible,
  • getX,
  • getY,
  • toFront,
  • getLocation,
  • removeComponentListener

Popular in Java

  • Making http post requests using okhttp
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • addToBackStack (FragmentTransaction)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now