⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 firescreen.java

📁 soure code for j2me browser
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
	{		return rightSoftKey;	}	public static void setRightSoftKey(int rightSoftKey)	{		FireScreen.rightSoftKey = rightSoftKey;	}	public void setContainerCurrent()	{		if(panel!=null)		{			setCurrent(panel);		}					}	public Image getBgImageSrc()	{		return defaultBgImageSrc;	}	public void setBgImageSrc(Image bgImageSrc)	{		bgImage=null;		defaultBgImageSrc = bgImageSrc;	}	public int getColor()	{		return defaultColor;	}	public void setColor(int color)	{		if(defaultColor!=color)		{			bgImage=null;			defaultColor = color;		}	}	public Image getGradImage()	{		return defaultGradImage;	}	public void setGradImage(Image gradImage)	{		bgImage=null;		defaultGradImage = gradImage;	}	public int getHpos()	{		return hpos;	}	public void setHpos(int hpos)	{		if(this.hpos!=hpos)		{			bgImage=null;			this.hpos = hpos;		}	}	public Image getBgImage()	{		return bgImage;	}		protected void pointerReleased(int x, int y)	{		if(animationImage!=null) return; // ignore events while in animation.				if(orientation!=NORMAL) 		{			int tmp = y;			if(orientation==LANDSCAPERIGHT)			{				y= getHeight()-x;				x=tmp;			}			else			{				y= x;				x=getWidth()-tmp;							}		}		if(y<getHeight()-bottomOffset && busyMode && !interactiveBusyMode) return; // only the cancel command is allowed 				if(popups.size()>0)		{			Popup p = (Popup)popups.lastElement();			if(p.pointerEvent(x-p.getPosX(),y-p.getPosY())) // XXX Thelei mono to top level popup na ginete repaint gia na glitonoume CPU TIme 			{				userActionRepaint=true;				repaint();			}		}		else if(panel!=null)		{			if(panel.pointerEvent(x,y))			{				userActionRepaint=true;				repaint();			}		}			}		protected void keyReleased(int k)	{		if(animationImage!=null) return; // ignore events while in animation.				if(orientationKey!=null && k==orientationKey.intValue())		{ // change the orientation of the screen			if(orientation==NORMAL)			{				orientation=LANDSCAPELEFT;			}			else if(orientation==LANDSCAPELEFT)			{				orientation = LANDSCAPERIGHT;			}			else if(orientation==LANDSCAPERIGHT)			{				orientation=NORMAL;			}			sizeChanged(super.getWidth(),super.getHeight());			repaint();			return;		}				int kkey,key;		boolean repaint;		if(k==FireScreen.leftSoftKey) key = Canvas.GAME_A;		else if(k==FireScreen.rightSoftKey) key = Canvas.GAME_B;		else		{			kkey = getGameAction(k);			switch(orientation)			{				case LANDSCAPELEFT:// translate joystick for left handed land scape.					switch(kkey)					{						case Canvas.UP:							key=Canvas.RIGHT;break;						case Canvas.DOWN:							key=Canvas.LEFT;break;						case Canvas.LEFT:							key=Canvas.UP;break;						case Canvas.RIGHT:							key=Canvas.DOWN;break;						default:							if(k==Canvas.KEY_NUM9)								key=Canvas.GAME_A;							else if(k==Canvas.KEY_NUM3)								key=Canvas.GAME_B;							else								key=kkey;					}					break;				case LANDSCAPERIGHT:// translate joystick for right handed land scape.					switch(kkey)					{						case Canvas.UP:							key=Canvas.LEFT;break;						case Canvas.DOWN:							key=Canvas.RIGHT;break;						case Canvas.RIGHT:							key=Canvas.UP;break;						case Canvas.LEFT:							key=Canvas.DOWN;break;						default:							if(k==Canvas.KEY_NUM1)								key=Canvas.GAME_A;							else if(k==Canvas.KEY_NUM7)								key=Canvas.GAME_B;							else 								key=kkey;					}					break;				default: // normal orientation					switch(k)					{						case Canvas.KEY_NUM1:							key=Canvas.GAME_A;break;						case Canvas.KEY_NUM3:							key=Canvas.GAME_B;break;						default:							key=kkey;					}			}		}				if((busyMode && !interactiveBusyMode)  && key!=Canvas.GAME_A) return; // only cancel event is allowed.				if(popups.size()>0)		{			Panel p = (Panel)popups.lastElement();			repaint = p.keyEvent(key);			if(repaint)			{				userActionRepaint=true;				repaint();			} 		}		else if(panel!=null)		{			repaint = panel.keyEvent(key);			if(repaint)			{				userActionRepaint=true;				repaint();			}		}	}	/**	 * Shows a popup panel on the screen. The popups can stuck on each other.	 * @param popup	 */	public void showPopup(Popup popup)	{		popup.validate();		popup.resetPointer();		Image img = Image.createImage(popup.getWidth(),popup.getHeight());		popup.paint(img.getGraphics());				animationFrameCount=0;		animationX=popup.getPosX();		animationY=popup.getPosY();				if(animationY<0)		{			animationDirection = DOWN;		}		else		{			animationDirection = UP;		}				animationImage=img;		popups.addElement(popup);	}	/**	 * Closes the top-level popup, shown on the FireScreen	 * @return	 */	public boolean closePopup()	{		if(popups.size()>0)		{ // remove top-level popup			popups.removeElementAt(popups.size()-1);			forceRepaint =true;			repaint();			return true;		}		return false;	}	public boolean isBusyMode()	{		return busyMode;	}	/**	 * When a FireScreen instance is in busy mode, it displayes a "busy indicator" 	 * gauge on the bottom of the screen.	 * If the screen instance is not in interactiveBusyMode, it will not allow user input until the busy mode is set to false.	 *  	 * @param busyMode	 */	public void setBusyMode(boolean busyMode)	{		this.busyMode = busyMode;		if(!interactiveBusyMode)		{			if(!busyMode)  			{// repaint the screen so that the shaded offscreen is 							busyModeRepaint=false;				forceRepaint=true;			}		}	}	/**	 * Destroys the FireScreen instance. This method should be called on clean-up 	 * in order to stop the animation thread inside the FireScreen Singleton. 	 *	 */	public void destroy()	{		if(alive)		{			try{				alive=false;			}catch(Throwable e){}		}		singleton=null;	}		public void reloadTheme()	{		loadTheme();		bgImage=prepareBgImage(getWidth(),getHeight());		offscreen=Image.createImage(getWidth(),getHeight());				forceRepaint=true;	}		/**	 * Sets the possition of the logo (found in the theme file) on the top border of a panel. 	 * Valid options are FireScreen.RIGHT, FireScreen.CENTER, FireScreen.LEFT.	 * Default value is RIGHT. All values different than the three mentioned will be ignored. 	 * @param pos	 */	public static void setLogoPossition(int pos)	{		if(pos==CENTRE || pos==LEFT || pos==RIGHT)			logoPossition = pos;	}		public static int getLogoPossition()	{		return logoPossition;	}	public int getOrientation()	{		return orientation;	}	/**	 * Sets the orientation of the screen. 	 * Possible values: NORMAL, LANDSCAPELEFT, LANDSCAPERIGHT	 * Default value is NORMAL. All values different than the three mentionted will be ignored.	 * @param orientation	 */	public void setOrientation(int o)	{		if(o==NORMAL || o==LANDSCAPELEFT || o==LANDSCAPERIGHT)		{			orientation = o;			sizeChanged(super.getWidth(),super.getHeight());			repaint();		}	}		/**	 * Sets the keycode (@see Canvas) that changes the orientation of the screen. 	 * If the parameter is null, then no shortcut is set. 	 * Repeated presses to the "key" will circle through the orientation modes.	 * 	 * Note that the orientationKey event is not sent to the panel(s) inside the FireScreen.	 * 	 * @param key	 */	public void setOrientationChangeKey(Integer key)	{		this.orientationKey = key;	}		/**	 * Returns the width of this FireScreen. If the screen is in landscape mode, it will return the real height of the screen.	 * @see javax.microedition.lcdui.Displayable#getWidth()	 */	public int getWidth()	{		if(orientation==NORMAL)		{			return super.getWidth();		}		return super.getHeight();	}		/**	 * Returns the height of this FireScreen. If the screen is in landscape mode, it will return the real width of the screen.	 * @see javax.microedition.lcdui.Displayable#getHeight()	 */	public int getHeight()	{		if(orientation==NORMAL)		{			return super.getHeight();		}		return super.getWidth();	}				/**	 * Return left softkey shortcut, depending on the screen orientation (left/right landscare or normal) 	 * @return	 */	public String getLeftSoftKeyShortcut()	{		switch (orientation)		{			case LANDSCAPELEFT:				return "[9]";			case LANDSCAPERIGHT:				return "[1]";			default:				return "[1]";		}	}		/**	 * Returns right softkey shortcut, depending on the screen orientation (left/right landscare or normal)	 * @return 	 */	public String getRightSoftKeyShortcut()	{		switch (orientation)		{			case LANDSCAPELEFT:				return "[3]";			case LANDSCAPERIGHT:				return "[7]";			default:				return "[3]";		}	}	/**	 * If this FireScreen instance is in interactive busy mode, it will allow user actions when busyMode==true.	 * (see the setBusyMode() method)	 	 * @return	 */	public boolean isInteractiveBusyMode()	{		return interactiveBusyMode;	}	/**	 * If this FireScreen instance is in interactive busy mode, it will allow user actions when busyMode==true.	 * (see the setBusyMode() method)	 	 * @param	 */	public void setInteractiveBusyMode(boolean interactiveBusyMode)	{		this.interactiveBusyMode = interactiveBusyMode;	}		/**	 * Sets the gauge that is shown when the Screen is set to busy mode.	 * @param g	 * @throws NullPointerException if g is null.	 */	public void setGauge(FGauge g)	{		if(g!=null) innerGauge = g;		else throw new NullPointerException("Gauge cannot be null");	}		public FGauge getGauge()	{		return innerGauge;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -