本文整理汇总了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);
}
}
示例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();
}
});
}
}
示例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();
}
}
示例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 ());
}
});
}
示例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);
}
示例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();
}
});
}
示例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);
}
示例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;
}
示例9: addWindowListener
import java.awt.Window; //导入方法依赖的package包/类
void addWindowListener(Window w) {
w.addWindowListener(this);
}
示例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);
}