亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? window.java

?? Micro Window Toolkit(MWT)是一個用于開發J2ME用戶界面(UI)的工具包。它具有友好
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * MWT - Micro Window Toolkit
 * Copyright (C) 2007 Lucas Domanico - lucazd@gmail.com
 * 
 * Licensed under the terms of the GNU Lesser General Public License:
 * 		http://www.opensource.org/licenses/lgpl-license.php
 * 
 * For further information visit:
 * 		http://j2me-mwt.sourceforge.net/
 */

package mwt;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;

/**
 * <p>In MWT the Window class is like a Frame/Form/Shell in other UI frameworks.<br>
 * Normally, an application that uses MWT should instance at least one window.</p>
 * 
 * A window has the following functionallity:
 * <ul>
 * <li><a href="#input"   >Handles input</a></li>
 * <li><a href="#focus"   >Keeps track of the focus</a></li>
 * <li><a href="#painting">Paints components</a></li>
 * <li><a href="#dialogs" >Shows dialogs</a></li>
 * </ul>
 *
 * 
 * 
 * <h3>Handling Input<a name="input"></a></h3>
 * <p>A window should be notified whenever a key is pressed or released using
 * {@link #setKeyState(int, int, boolean)} method.<br>
 * Normally you will invoke this method from your canvas implementation:
 * <pre>
 * 	class MyCanvas extends Canvas {
 * 		Window win;
 * 		protected void keyPressed(int keyCode)	{ win.setKeyState(keyCode,Window.KEYSTATE_PRESSED,true); }
 * 		protected void keyReleased(int keyCode) { win.setKeyState(keyCode,Window.KEYSTATE_RELEASED,true); }
 * 		...
 * 	}
 * </pre>
 * 
 * <p>Some devices don't support the {@link Canvas#keyRepeated(int)} event. MWT can "simulate" this event calling
 * {@link #repeatKeys(boolean)} from your application's main loop.</p> 
 * 
 * <p>You may get a key state at anytime using {@link #getKeyState(int)}.</p>
 * 
 * <h4>Focus Actions</h4>
 * <p>Usually in UI frameworks the keyboard's TAB and ARROWS keys are used to move
 * the focus, the ENTER key is used to trigger actions. Similarly, "focus actions" are
 * used to handle such things.</p>
 * 
 * <p>A focus action can be either {@link #FOCUSACTION_FIRE}, {@link #FOCUSACTION_NEXT},
 * {@link #FOCUSACTION_PREV} or {@link #FOCUSACTION_NONE}.</p>
 * 
 * <p>The MWT Window has a default implementation which uses {@link Canvas#KEY_NUM2},
 * {@link Canvas#KEY_NUM8}, {@link Canvas#KEY_NUM6} and {@link Canvas#KEY_NUM4} to move the focus
 * and {@link Canvas#KEY_NUM5} to trigger actions.<br>
 * You can define your own implementation overriding {@link #getFocusAction(long)} method.</p>
 * 
 * 
 * <br>
 * 
 * 
 * <h3>Handling Focus<a name="focus"></a></h3>
 * <p>A window can focus one or none components simultaneously.<br>
 * To set the focus directely use {@link #setFocus(Component)}, but if you like to move it
 * use {@link #setFocusNext()} and {@link #setFocusPrevious()}.<br>
 * Note that when a window is created and components are added into it focus is still null.
 * You must set the focus "manually".</p>
 * 
 * <p>Components don't have a "focusIndex" (or "tabIndex" in other UI frameworks)
 * propery, focus is moved according to the component hierarchy.</p>
 * 
 * <p>Remember that a component can gain focus only if
 * {@link mwt.Component#acceptsFocus()} is true.</p>
 *
 *
 * <br>
 *
 *
 * <h3>Painting<a name="painting"></a></h3>
 * <p>The {@link #paint(Graphics)} paints all childs components into the graphics in
 * hierarchy order; there is not a "z-index" property.</p>
 * 
 * <p>A window paints all components during each paint call, there is not a dirty rectangle
 * implementation.</p>
 * 
 * 
 * <br>
 * 
 *  
 * <h3>Dialogs<a name="dialogs"></a></h3>
 * <p>MWT allows you create dialogs, setting another window in front.<br>
 * You don't need to notify input events to the new dialog window, its owner window
 * dispatch these events automatically to the dialog.</p>
 * 
 * <p>Unlike other UI frameworks, the method {@link #dialogOpen(Window)} returns immediately,
 * without waiting the dialog to close. However, is possible to simulate this trick by
 * calling your application main loop.</p> 
 * <pre>
 *  Window main = ...;
 *  boolean result;
 *  Window dialog = ...; // sets the result before closing
 *  
 *  void save() {
 *    main.dialogOpen(dialog);
 *    while(main.getDialog() == dialog)
 *      mainLoop();
 *    if(result) ...
 *    else ... 
 *  }
 * </pre>
 * Remember, everytime you use a {@link #dialogOpen(Window)}, a {@link #dialogClose()}
 * should be called somewhere.
 * 
 * <h3><a name="keys">Keys, KeyCodes and Key's States</a></h3>
 * <p>A key code is a value that maps a device's key, like
 * {@link javax.microedition.lcdui.Canvas}'s KEY_NUMs.</p>
 * 
 * <p>MWT uses two more concepts; key's states and keys.<br>
 * A key state is a value that represents the state of a key at anytime.
 * That is, if it is released, pressed or repeated.<br>
 * {@link #KEYSTATE_PRESSED} or 1 is for key pressed states.<br>
 * {@link #KEYSTATE_RELEASED} or 0 is for key released states.<br>
 * Other values are for key repeated states.<br>
 * A key is a long value where the integer part is the key code, and the key >> 32
 * value is its key state.
 * 
 */
public class Window extends Component {
	/** Constant returned by {@link #getFocusAction(long)} when there's not action. */
	final static public int FOCUSACTION_NONE = 0;
	/** Constant returned by {@link #getFocusAction(long)} to "fire" events. */
	final static public int FOCUSACTION_FIRE = 1;
	/** Constant returned by {@link #getFocusAction(long)} to request focus next. */
	final static public int FOCUSACTION_NEXT = 2;
	/** Constant returned by {@link #getFocusAction(long)} to request focus previous. */
	final static public int FOCUSACTION_PREV = 4;
	
	/** Constant value to get/set a skin/font. */
	static public final int STYLE_DEFAULT = 0;
	/** Constant value to get/set a skin/font. */
	static public final int STYLE_DISABLED = 1;
	
	/** Constant which represents the state of a key when is pressed. See also <a href="#keys">Keys</a>. */
	public static final int KEYSTATE_PRESSED = 1;
	/** Constant which represents the state of a key when is released. See also <a href="#keys">Keys</a>. */ 
	public static final int KEYSTATE_RELEASED = 0;
	
	private Window dialog;
	private Component focus;

	static private final int KEYS_INC = 20;
	private int keysLength; // warning, must be synchronized
	private long[] keys = new long[KEYS_INC];  // warning, must be synchronized
	
	// stores the graphics' clip durning the Component's '_paint' method
	int rectX;
	int rectY;
	int rectW;
	int rectH;
	
	private final Skin[] skins;
	
	final static private Skin[] defaultSkins = {
		new Skin(new int[] {0xFFFFFF,0,0,0xC6C6C6,0xC6C6C6}),
		new Skin(new int[] {0xFFFFFF,0xC6C6C6,0xC6C6C6,0xC6C6C6})
	};
	
	/** Creates a new window with the given position and size. */
	public Window(int x, int y, int width, int height) {
		super(x,y,width,height,true);
		skins = new Skin[] { defaultSkins[0].clone(), defaultSkins[1].clone() };
	}
	
	/** Gets the default skin for the given style. */
	static final public Skin getDefaultSkin(int style) { return defaultSkins[style]; }
	/** Sets the default skin for the given style. */
	static final public void setDefaultSkin(int style, Skin skin) { defaultSkins[style] = skin; }
	
	/** Gets this window skin for the given style. */
	public Skin getSkin(int style) { return skins[style]; }
	/** Sets this window skin for the given style. */
	public void setSkin(int style, Skin skin) { skins[style] = skin; }
	
	
	/**
	 * Gets the current key state for the given keycode.
	 * @param keyCode the key code
	 * @return the current key state for the given keycode
	 * @see <a href="#keys">Keys</a>
	 */
	final public int getKeyState(int keyCode) {
		synchronized(keys) {
			return (int) (keys[getKeyIndex(keyCode)] >> 32);
		}
	}
	
	/**
	 * Gets the focus action for the given key.<br>
	 * The default implementation is:
	 * <pre>
	 * protected int getFocusAction(long key) {
	 *	switch((int) key) {
	 *		case Canvas.KEY_NUM4:
	 *		case Canvas.KEY_NUM2: return FOCUSACTION_PREV;
	 *		case Canvas.KEY_NUM6:
	 *		case Canvas.KEY_NUM8: return FOCUSACTION_NEXT;
	 *		case Canvas.KEY_NUM5: return FOCUSACTION_FIRE;
	 *		default: return FOCUSACTION_NONE;
	 *	}
	 * }
	 * </pre>
	 * Note that you can ask for other key states using {@link #getKeyState(int)}.
	 * This allow you, for example, poll if another key is pressed.
	 * <pre>
	 * if((int)key && getKeyState(Canvas.KEY_NUM0)) ...
	 * </pre>
	 * @param key the key
	 * @return the focus action
	 * @see <a href="#keys">Keys</a>
	 */
	public int getFocusAction(long key) {
		switch((int) key) {
		case Canvas.KEY_NUM4:
		case Canvas.KEY_NUM2: return FOCUSACTION_PREV;
		case Canvas.KEY_NUM6:
		case Canvas.KEY_NUM8: return FOCUSACTION_NEXT;
		case Canvas.KEY_NUM5: return FOCUSACTION_FIRE;
		default: return FOCUSACTION_NONE;
		}
	}
	
	private static final int KEYSTATE_REPEATED = -1;
	final static private long KEY_STATE = 0xFFFFFFFF00000000l;
	
	/**
	 * Sets the key state for the given key code.<br>
	 * This method triggers component's key events if processKeyEvents is true.
	 * @param keyCode The key code
	 * @param keyState The new key state for the given key code. Either {@link #KEYSTATE_PRESSED} or {@link #KEYSTATE_RELEASED}
	 * @param processKeyEvents True if component's key events should be triggered
	 * @throws IllegalArgumentException
	 * @see <a href="#keys">Keys</a>
	 */
	final public void setKeyState(int keyCode, int keyState, boolean processKeyEvents) throws IllegalArgumentException {
		if(dialog != null) { dialog.setKeyState(keyCode,keyState,processKeyEvents); return; }
		
		synchronized(keys) {
			final int index = getKeyIndex(keyCode);			
			switch(keyState) {
			case KEYSTATE_RELEASED:	keys[index] &= ~KEY_STATE; break;
			case KEYSTATE_PRESSED:	keys[index] = (keys[index] & ~KEY_STATE) | (0x0000000100000000l); break;
			case KEYSTATE_REPEATED:	keys[index] = (keys[index] & ~KEY_STATE) | (((keys[index] >> 32)+1) << 32); break;
			default: throw new IllegalArgumentException("Invalid key state");
			}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一区二区三区电影在线观看| 色婷婷综合激情| 男男视频亚洲欧美| 亚洲1区2区3区4区| 亚洲成av人**亚洲成av**| 亚洲国产aⅴ成人精品无吗| 一区二区三区.www| 亚洲bt欧美bt精品777| 日韩二区三区四区| 精品一区二区免费看| 国产在线国偷精品免费看| 国产乱色国产精品免费视频| 国产成人综合亚洲91猫咪| 成人性生交大片免费看中文| 91在线小视频| 欧美日韩夫妻久久| 久久众筹精品私拍模特| 国产欧美日韩三区| 亚洲精品美国一| 午夜一区二区三区在线观看| 久久99久久久久久久久久久| 国产乱码精品一区二区三区av | 亚洲黄色小视频| 亚洲精品美腿丝袜| 日本在线不卡一区| 高清成人免费视频| 欧美在线综合视频| 日韩欧美激情在线| 欧美激情综合五月色丁香| 一区二区三区在线观看网站| 视频一区二区三区中文字幕| 国产一本一道久久香蕉| 91香蕉视频黄| 精品对白一区国产伦| 亚洲天堂2016| 久久99精品国产麻豆婷婷 | heyzo一本久久综合| 欧美中文一区二区三区| 国产亚洲精品bt天堂精选| 一区二区日韩av| 国产一区中文字幕| 欧美日韩另类一区| 国产精品每日更新在线播放网址| 天堂va蜜桃一区二区三区漫画版| 国产成人精品免费一区二区| 欧美美女视频在线观看| 国产精品久久久久久久久久久免费看 | 无码av中文一区二区三区桃花岛| 国产做a爰片久久毛片| 在线观看网站黄不卡| 国产三级久久久| 蜜桃免费网站一区二区三区| 色综合夜色一区| 久久综合九色欧美综合狠狠| 午夜精品久久久久久| 91在线视频官网| 日本一区二区视频在线| 久久国产精品无码网站| 欧美日韩视频在线第一区| 一区免费观看视频| 国产盗摄一区二区| 欧美电视剧在线看免费| 日韩电影在线免费观看| 在线观看日韩av先锋影音电影院| 国产精品美日韩| 国产成人av一区二区| 欧美成人精品1314www| 日本欧美肥老太交大片| 欧美日韩中文字幕一区二区| 亚洲欧美日韩国产另类专区| 成人福利视频在线| 久久亚洲影视婷婷| 激情国产一区二区| 2023国产精品视频| 国产一区二区三区综合| 欧美成va人片在线观看| 久久99国产精品免费| 日韩欧美在线一区二区三区| 秋霞成人午夜伦在线观看| 在线播放91灌醉迷j高跟美女| 亚洲一区二区三区在线看| 欧美性感一区二区三区| 亚洲高清在线视频| 欧美一区二区三区不卡| 美女视频黄 久久| 精品88久久久久88久久久| 黄页网站大全一区二区| 国产精品精品国产色婷婷| 国产美女精品在线| 中文字幕高清不卡| 不卡的电影网站| 玉米视频成人免费看| 欧美日韩国产综合久久| 美女任你摸久久| 久久久久久久久岛国免费| 丰满白嫩尤物一区二区| 成人欧美一区二区三区在线播放| 一本一道久久a久久精品| 亚洲一区二区视频在线| 欧美一级国产精品| 国产成人综合精品三级| 亚洲色图制服诱惑 | 国产一区二区三区电影在线观看| 久久久久久久精| 色妞www精品视频| 麻豆国产精品777777在线| 国产日韩欧美不卡| 在线欧美日韩国产| 另类人妖一区二区av| 国产精品久久久久精k8| 91精品国产综合久久香蕉的特点| 国产福利视频一区二区三区| 亚洲精品日韩综合观看成人91| 337p亚洲精品色噜噜| 丰满少妇久久久久久久| 三级欧美韩日大片在线看| 国产欧美一区二区在线| 欧美日韩国产123区| av中文字幕在线不卡| 日本一道高清亚洲日美韩| ...xxx性欧美| 欧美精品一区二区三区在线| 色综合久久久久久久久久久| 精品在线免费视频| 亚洲一区二区美女| 国产精品日韩精品欧美在线| 亚洲婷婷在线视频| 久久这里只有精品首页| 欧美日韩在线免费视频| 成人免费视频一区| 久久99精品久久久久久国产越南| 亚洲综合av网| 亚洲欧洲日韩av| 国产日韩欧美精品一区| 精品乱人伦小说| 欧美一级精品大片| 欧美日韩三级在线| 色天天综合色天天久久| 99久久久精品| 丰满岳乱妇一区二区三区| 激情六月婷婷综合| 久久99精品视频| 蜜桃视频在线观看一区二区| 亚洲成av人片在线| 一区二区三区四区精品在线视频| 国产精品久久久久毛片软件| 国产欧美中文在线| 久久久国产一区二区三区四区小说 | 欧美日韩国产一级片| 色噜噜夜夜夜综合网| 91麻豆免费观看| 97久久精品人人做人人爽 | 亚洲男人的天堂在线观看| 国产色一区二区| 国产午夜精品福利| 亚洲国产高清aⅴ视频| 国产婷婷精品av在线| 久久久国产综合精品女国产盗摄| 久久影院电视剧免费观看| 久久嫩草精品久久久精品一| 久久一区二区视频| 亚洲国产高清在线| 亚洲欧洲成人自拍| 一个色综合网站| 亚洲福利电影网| 日韩电影一区二区三区| 美女视频黄久久| 国产成人精品三级麻豆| 成人激情校园春色| 在线精品亚洲一区二区不卡| 欧美色视频在线观看| 4438x亚洲最大成人网| 精品久久久久久最新网址| 久久精品综合网| 亚洲精品久久嫩草网站秘色| 亚洲国产日韩在线一区模特| 麻豆免费精品视频| 成人激情视频网站| 欧美主播一区二区三区| 91精品一区二区三区在线观看| 精品国产乱码久久久久久闺蜜| 久久久午夜精品理论片中文字幕| 国产精品视频你懂的| 亚洲精品国久久99热| 五月天丁香久久| 成人手机电影网| 在线免费视频一区二区| 日韩视频国产视频| 国产亚洲精品精华液| 午夜伊人狠狠久久| 粉嫩绯色av一区二区在线观看| 一本大道av一区二区在线播放| 91精品国产一区二区三区| 亚洲国产精品传媒在线观看| 亚洲国产视频在线| 国产一区二区免费看| 欧美视频一区二区在线观看| 精品福利一二区| 亚洲午夜一区二区| 盗摄精品av一区二区三区|