当前位置: 首页>>代码示例>>Java>>正文


Java Window.addWindowListener方法代码示例

本文整理汇总了Java中java.awt.Window.addWindowListener方法的典型用法代码示例。如果您正苦于以下问题:Java Window.addWindowListener方法的具体用法?Java Window.addWindowListener怎么用?Java Window.addWindowListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Window的用法示例。


在下文中一共展示了Window.addWindowListener方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: subscribeActual

import java.awt.Window; //导入方法依赖的package包/类
@Override
protected void subscribeActual(Observer<? super WindowEvent> observer) {
    Window w = widget;
    int f = flags;

    WindowEventConsumer aec = new WindowEventConsumer(observer, w, f);
    observer.onSubscribe(aec);

    if ((f & 1) != 0) {
        w.addWindowListener(aec);
    }
    if ((f & 2) != 0) {
        w.addWindowFocusListener(aec);
    }
    if ((f & 4) != 0) {
        w.addWindowStateListener(aec);
    }

    if (aec.get() == null) {
        aec.onDispose(w);
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Swing,代码行数:23,代码来源:WindowEventObservable.java

示例2: addNotify

import java.awt.Window; //导入方法依赖的package包/类
@Override
public void addNotify() {
    super.addNotify();
    Window window = SwingUtilities.getWindowAncestor(this);
    if (window != null) {
        window.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosed(WindowEvent e) {
                updateFromUI();
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:TableCustomizer.java

示例3: hierarchyChanged

import java.awt.Window; //导入方法依赖的package包/类
public void hierarchyChanged(HierarchyEvent e) {
    if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) != 0) {
        Window parentWindow = SwingUtilities.getWindowAncestor(BufferedCanvasComponent.this);
        if (lastParentWindow != parentWindow) {
            if (lastParentWindow != null) lastParentWindow.removeWindowListener(VisibilityHandler.this);
            if (parentWindow != null) parentWindow.addWindowListener(VisibilityHandler.this);
            lastParentWindow = parentWindow;
        }
    }
    
    if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
        if (isShowing()) BufferedCanvasComponent.this.shown();
        else BufferedCanvasComponent.this.hidden();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:BufferedCanvasComponent.java

示例4: addNotify

import java.awt.Window; //导入方法依赖的package包/类
@Override
public void addNotify () {
    super.addNotify ();
    //show progress for initialize method
    final Window w = findWindowParent ();
    if (w != null) {
        w.addWindowListener (new WindowAdapter (){
            @Override
            public void windowOpened (WindowEvent e) {
                final WindowAdapter waa = this;
                setWaitingState (true);
                Utilities.startAsWorkerThread (PluginManagerUI.this,
                        new Runnable () {
                            @Override
                            public void run () {
                                try {
                                    initTask.waitFinished ();
                                    w.removeWindowListener (waa);
                                } finally {
                                    setWaitingState (false);
                                }
                            }
                        },
                        NbBundle.getMessage (PluginManagerUI.class, "UnitTab_InitAndCheckingForUpdates"),
                        Utilities.getTimeOfInitialization ());
            }
        });
    }
    HelpCtx.setHelpIDString (this, PluginManagerUI.class.getName ());
    tpTabs.addChangeListener (new ChangeListener () {
        @Override
        public void stateChanged (ChangeEvent evt) {
            HelpCtx.setHelpIDString (PluginManagerUI.this, getHelpCtx ().getHelpID ());
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:PluginManagerUI.java

示例5: putTaskWindow

import java.awt.Window; //导入方法依赖的package包/类
public synchronized void putTaskWindow(Window win, TaskThreadGroup grp) {
    ArrayList<Window> vec;
    if ((vec = windowMap.get(grp)) == null) {
        vec = new ArrayList<Window>();
        windowMap.put(grp, vec);
    }
    vec.add(win);
    win.addWindowListener(winListener);
    super.put(win, grp);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:WindowTable.java

示例6: listenForClosing

import java.awt.Window; //导入方法依赖的package包/类
public static void listenForClosing(final Window window, final EditorInterface editor)
{
	if( window instanceof JFrame )
	{
		((JFrame) window).setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
	}

	if( window instanceof JDialog )
	{
		((JDialog) window).setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
	}

	window.addWindowListener(new WindowAdapter()
	{
		@Override
		public void windowClosing(WindowEvent e)
		{
			// If the spinner is showing, then something is happening and we
			// do not
			// want the window to be closed down.
			if( !editor.getStatusBar().isSpinnerVisible() )
			{
				if( !EditorHelper.onClose(editor, null) )
				{
					return;
				}
			}
			window.setVisible(false);
			window.dispose();
		}
	});
}
 
开发者ID:equella,项目名称:Equella,代码行数:33,代码来源:EditorHelper.java

示例7: Listener

import java.awt.Window; //导入方法依赖的package包/类
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);

		}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:12,代码来源:MatchedBracketPopup.java

示例8: addClientWindowListeners

import java.awt.Window; //导入方法依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:InputContext.java

示例9: addWindowListener

import java.awt.Window; //导入方法依赖的package包/类
void addWindowListener(Window w) {
    w.addWindowListener(this);
}
 
开发者ID:mathhobbit,项目名称:EditCalculateAndChart,代码行数:4,代码来源:AbstractFramePlt.java

示例10: setup

import java.awt.Window; //导入方法依赖的package包/类
/**
 * When a game is started, create a top-level window, if none exists.
 * When a game is ended, remove all boards from the map.
 *
 * @see GameComponent
 */
public void setup(boolean show) {
  if (show) {
    final GameModule g = GameModule.getGameModule();

    if (shouldDockIntoMainWindow()) {
      mainWindowDock.showComponent();
      final int height = ((Integer)
        Prefs.getGlobalPrefs().getValue(MAIN_WINDOW_HEIGHT)).intValue();
      if (height > 0) {
        final Container top = mainWindowDock.getTopLevelAncestor();
        top.setSize(top.getWidth(), height);
      }
      if (toolBar.getParent() == null) {
        g.getToolBar().addSeparator();
        g.getToolBar().add(toolBar);
      }
      toolBar.setVisible(true);
    }
    else {
      if (SwingUtilities.getWindowAncestor(theMap) == null) {
        final Window topWindow = createParentFrame();
        topWindow.addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            if (useLaunchButton) {
              topWindow.setVisible(false);
            }
            else {
              g.getGameState().setup(false);
            }
          }
        });
        ((RootPaneContainer) topWindow).getContentPane().add("North", getToolBar()); //$NON-NLS-1$
        ((RootPaneContainer) topWindow).getContentPane().add("Center", layeredPane); //$NON-NLS-1$
        topWindow.setSize(600, 400);
        final PositionOption option =
          new PositionOption(PositionOption.key + getIdentifier(), topWindow);
        g.getPrefs().addOption(option);
      }
      theMap.getTopLevelAncestor().setVisible(!useLaunchButton);
      theMap.revalidate();
    }
  }
  else {
    pieces.clear();
    boards.clear();
    if (mainWindowDock != null) {
      if (mainWindowDock.getHideableComponent().isShowing()) {
        Prefs.getGlobalPrefs().getOption(MAIN_WINDOW_HEIGHT)
             .setValue(mainWindowDock.getTopLevelAncestor().getHeight());
      }
      mainWindowDock.hideComponent();
      toolBar.setVisible(false);
    }
    else if (theMap.getTopLevelAncestor() != null) {
      theMap.getTopLevelAncestor().setVisible(false);
    }
  }
  launchButton.setEnabled(show);
  launchButton.setVisible(useLaunchButton);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:67,代码来源:Map.java


注:本文中的java.awt.Window.addWindowListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。