當前位置: 首頁>>代碼示例>>Java>>正文


Java WindowStateListener類代碼示例

本文整理匯總了Java中java.awt.event.WindowStateListener的典型用法代碼示例。如果您正苦於以下問題:Java WindowStateListener類的具體用法?Java WindowStateListener怎麽用?Java WindowStateListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WindowStateListener類屬於java.awt.event包,在下文中一共展示了WindowStateListener類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import java.awt.event.WindowStateListener; //導入依賴的package包/類
public void init(String title) {
	w = new JFrame(title);
	w.addKeyListener(this);
	w.addMouseListener(this);
	w.addMouseMotionListener(this);
	w.addMouseWheelListener(this);
	w.addWindowStateListener(new WindowStateListener() {
		
		@Override
		public void windowStateChanged(WindowEvent e) {
			w.setExtendedState(JFrame.NORMAL);
		}
	});
	w.setBackground(Color.black);
	w.setForeground(Color.white);
	w.getContentPane().setBackground(Color.black);
	w.getContentPane().setIgnoreRepaint(true);
	
	w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
	frames = 0;
	start = 0;
	layers = new CopyOnWriteArrayList<>();
	
	initGame();
}
 
開發者ID:Dakror,項目名稱:GameSetup,代碼行數:27,代碼來源:GameFrame.java

示例2: processWindowStateEvent

import java.awt.event.WindowStateListener; //導入依賴的package包/類
protected void processWindowStateEvent(WindowEvent e) {
	try{
	WindowStateListener[] wl = getWindowStateListeners();
	if(wl == null){
		return;
	}
       switch (e.getID()) {
           case WindowEvent.WINDOW_STATE_CHANGED:
           	DebugLogger.log("fire WindowListener.windowStateChanged.");
			for (int i = 0; i < wl.length; i++) {
				wl[i].windowStateChanged(e);
			}
               break;
           default:
               break;
       }
	}catch (Throwable ex) {
		ex.printStackTrace();
	}
}
 
開發者ID:javalovercn,項目名稱:j2se_for_android,代碼行數:21,代碼來源:Window.java

示例3: getWindowStateListener

import java.awt.event.WindowStateListener; //導入依賴的package包/類
public WindowStateListener getWindowStateListener() {
		if (fullFrameStateListener == null) {
			fullFrameStateListener = new WindowAdapter() {
				public void windowStateChanged(WindowEvent e) {
					if ((e.getNewState() & java.awt.Frame.ICONIFIED) == java.awt.Frame.ICONIFIED) {
						if (kernel.state.isShowSystemTray())
							frame.setVisible(false);
					}
				}
//				public void windowClosing(WindowEvent e) {
//					if (kernel.state.isShowSystemTray())
//						frame.setVisible(false);
//				}
			};
		}
		return fullFrameStateListener;
	}
 
開發者ID:michellemulkey,項目名稱:aTunes,代碼行數:18,代碼來源:VisualHandler.java

示例4: main

import java.awt.event.WindowStateListener; //導入依賴的package包/類
/**
 * @param args the command line arguments
 */
public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {

        public void run() {
            LoginOptionsFrame lfe = new LoginOptionsFrame();
            lfe.addWindowStateListener(new WindowStateListener() {

                public void windowStateChanged(WindowEvent evt) {
                    if (evt.getNewState() == WindowEvent.WINDOW_CLOSED) {
                        System.exit(0);
                    }
                }
            });

            lfe.setVisible(true);
        }
    });
}
 
開發者ID:josmas,項目名稱:openwonderland,代碼行數:22,代碼來源:LoginOptionsFrame.java

示例5: getWindowStateListeners

import java.awt.event.WindowStateListener; //導入依賴的package包/類
/**
 * Returns an array of all the window state listeners registered on this
 * window.
 *
 * @since 1.4
 */
public synchronized WindowStateListener[] getWindowStateListeners()
{
  return (WindowStateListener[])
    AWTEventMulticaster.getListeners(windowStateListener,
                                     WindowStateListener.class);
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:13,代碼來源:Window.java

示例6: addWindowStateListener

import java.awt.event.WindowStateListener; //導入依賴的package包/類
/**
 * Adds the specified listener to this window.
 *
 * @since 1.4
 */
public void addWindowStateListener (WindowStateListener wsl)
{
  if (wsl != null)
    {
      newEventsOnly = true;
      windowStateListener = AWTEventMulticaster.add (windowStateListener,
                                                     wsl);
    }
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:15,代碼來源:Window.java

示例7: addWindowStateListener

import java.awt.event.WindowStateListener; //導入依賴的package包/類
/**
 * Adds the specified listener to this window.
 *
 * @since 1.4
 */
public void addWindowStateListener (WindowStateListener wsl)
{
  if (wsl != null)
    {
      newEventsOnly = true;
      windowStateListener = AWTEventMulticaster.add (windowStateListener,
                                                     wsl);  
    }
}
 
開發者ID:nmldiegues,項目名稱:jvm-stm,代碼行數:15,代碼來源:Window.java

示例8: macSpecials

import java.awt.event.WindowStateListener; //導入依賴的package包/類
/**
 * 
 */
private void macSpecials() {
    if (CrossSystem.isMac()) {
        addWindowStateListener(new WindowStateListener() {

            private boolean oldVisibleState = true;

            @Override
            public void windowStateChanged(WindowEvent e) {

                if ((getExtendedState() & JFrame.ICONIFIED) == JFrame.ICONIFIED) {
                    // there is a bug that caused MAC OS 10.9 under java
                    // 1.7.0_25-b15 to popup the iconified owner. the
                    // visible owner
                    // cannot be used or accessed in any way.
                    // workaround: setting the frame invisible in iconified
                    // state should do the job
                    oldVisibleState = isVisible();
                    setVisible(false);
                } else {
                    setVisible(oldVisibleState);
                }

            }
        });
    }

}
 
開發者ID:friedlwo,項目名稱:AppWoksUtils,代碼行數:31,代碼來源:ExtJFrame.java

示例9: AWindowListener

import java.awt.event.WindowStateListener; //導入依賴的package包/類
/**
 *	Constructor
 *
 * 	@param win Window
 * 	@param l Listener
 */
public AWindowListener (Window win, WindowStateListener l)
{
	m_window = win;
	m_listener = l;
	win.addWindowListener(this);
}
 
開發者ID:metasfresh,項目名稱:metasfresh,代碼行數:13,代碼來源:AWindowListener.java

示例10: MainWindow

import java.awt.event.WindowStateListener; //導入依賴的package包/類
/** The window of the program. */
public MainWindow()
{

	String title = Generator.translate("GUI:main.title");
	title = title.replaceAll("<version>", Resources.versions[Resources.versions.length - 1]);
	title = title.replaceAll("<minecraft>", Resources.versionMinecraft);

	setTitle(title);
	setSize(new Dimension(1000, 700));
	setVisible(true);
	setResizable(true);
	setLayout(new GridLayout());
	setDefaultCloseOperation(EXIT_ON_CLOSE);
	try
	{
		setIconImage(Generator.registry.getObjectFromId("command_block").getTexture().getImage());
	} catch (Exception e)
	{}

	panelGeneral = new PanelCommandSelection(true);
	panelGeneral.setSize(new Dimension(getSize().width - 10, getSize().height - 10));
	JScrollPane scrollpane = new JScrollPane(panelGeneral);
	scrollpane.getVerticalScrollBar().setUnitIncrement(20);
	menubar = new CGMenubar();

	add(scrollpane);
	setJMenuBar(menubar);

	addWindowStateListener(new WindowStateListener() {
		@Override
		public void windowStateChanged(WindowEvent arg0)
		{
			panelGeneral.setSize(new Dimension(getSize().width - 10, getSize().height - 10));
		}
	});
}
 
開發者ID:Cubiccl,項目名稱:CommandGenerator,代碼行數:38,代碼來源:MainWindow.java

示例11: Button

import java.awt.event.WindowStateListener; //導入依賴的package包/類
public Button(Callback normal, Callback events, Callback callback, Window event) {
	this(normal, events, callback);
	
	Button instance = this;
	
	event.addWindowStateListener(new WindowStateListener() {
		@Override
		public void windowStateChanged(WindowEvent e) {
			if(events != null) {
    			events.run(instance);
    		}
		}
	});
}
 
開發者ID:MyChannel-Apps,項目名稱:Emulator,代碼行數:15,代碼來源:Button.java

示例12: windowStateListener

import java.awt.event.WindowStateListener; //導入依賴的package包/類
public static WindowStateListener windowStateListener(final String value){
	return new WindowStateListener() {
		public void windowStateChanged(WindowEvent e) {
			actionEvent(e.getSource(), value);
		}
	};
}
 
開發者ID:dipoo,項目名稱:AXmlSwing,代碼行數:8,代碼來源:AttributeTransfer.java

示例13: windowStateChanged

import java.awt.event.WindowStateListener; //導入依賴的package包/類
public void windowStateChanged(WindowEvent e) {
    if ((a != null) && (a instanceof WindowStateListener)) {
        ((WindowStateListener) a).windowStateChanged(e);
    }
    if ((b != null) && (b instanceof WindowStateListener)) {
        ((WindowStateListener) b).windowStateChanged(e);
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:9,代碼來源:AWTEventMulticaster.java

示例14: getListeners

import java.awt.event.WindowStateListener; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
    if (WindowFocusListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getWindowFocusListeners();
    } else if (WindowStateListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getWindowStateListeners();
    } else if (WindowListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getWindowListeners();
    } else {
        return super.getListeners(listenerType);
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:14,代碼來源:Window.java

示例15: processWindowStateEvent

import java.awt.event.WindowStateListener; //導入依賴的package包/類
protected void processWindowStateEvent(WindowEvent e) {
    for (Iterator<?> i = windowStateListeners.getUserIterator(); i.hasNext();) {
        WindowStateListener listener = (WindowStateListener) i.next();
        switch (e.getID()) {
            case WindowEvent.WINDOW_STATE_CHANGED:
                listener.windowStateChanged(e);
                break;
        }
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:11,代碼來源:Window.java


注:本文中的java.awt.event.WindowStateListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。