Java Code Examples for java.awt.event.ComponentEvent#getID()

The following examples show how to use java.awt.event.ComponentEvent#getID() . 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: PicMap.java    From megamek with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void processComponentEvent(ComponentEvent e) {
    switch (e.getID()) {
        case ComponentEvent.COMPONENT_RESIZED:
            onResize();
            update();
            break;
    }
}
 
Example 2
Source File: DesktopWindowWatcher.java    From consulo with Apache License 2.0 5 votes vote down vote up
final void dispatchComponentEvent(final ComponentEvent e) {
  final int id = e.getID();
  if (WindowEvent.WINDOW_CLOSED == id || (ComponentEvent.COMPONENT_HIDDEN == id && e.getSource() instanceof Window)) {
    dispatchHiddenOrClosed(TargetAWT.from((Window)e.getSource()));
  }
  // Clear obsolete reference on root frame
  if (WindowEvent.WINDOW_CLOSED == id) {
    final Window window = (Window)e.getSource();

    if (JOptionPane.getRootFrame() == window) {
      JOptionPane.setRootFrame(null);
    }
  }
}
 
Example 3
Source File: MainPanel.java    From java-swing-tips with MIT License 4 votes vote down vote up
@Override protected void processComponentEvent(ComponentEvent e, JLayer<? extends JScrollPane> l) {
  Component c = e.getComponent();
  if (e.getID() == ComponentEvent.COMPONENT_RESIZED && c instanceof JTableHeader) {
    l.repaint(c.getBounds());
  }
}