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

📄 popupcanvas.java

📁 J2me应用开发经典例子
💻 JAVA
字号:
// Copyright (c) 2005 Sony Ericsson Mobile Communications AB
//
// This software is provided "AS IS," without a warranty of any kind. 
// ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, 
// INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A 
// PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. 
//
// THIS SOFTWARE IS COMPLEMENTARY OF JAYWAY AB (www.jayway.se)

package com.ultrapower.gui;

import javax.microedition.lcdui.Canvas;

import com.ultrapower.gui.popup.Popup;
import com.ultrapower.gui.popup.TextFieldPopup;

/**
 * Represents a canvas that can show popups.
 * @author Peter Andersson
 */
public abstract class PopupCanvas extends Canvas
{
  	/** The popup in this canvas */
	protected Popup m_popup;
	
	/** The TextField in this canvas */
	protected TextFieldPopup m_textfield;
	
	/**
	 * Returns the popup in this canvas or null if popup.
	 * @return	The current popup or null.
	 */
	public Popup getPopup()
	{
		return m_popup;
	}
	public TextFieldPopup getTextField()
	{
		return m_textfield;
	}
	
	/**
	 * Sets the popup in this canvas.
	 * @param p	The popup.
	 */
	public void setPopup(Popup p)
	{
		m_popup = p;
	}
	public void setTextField(TextFieldPopup p)
	{
		m_textfield = p;
	}
	
	/*
	   * 针对Nokia全屏情况下getHeight的BUG,此函数出自于
	   * http://discussion.forum.nokia.com/forum/showthread.php?s=5858f71392d6153eca8588dde860b4bc&threadid=48826
	   */
	  public int getHeight(){
		  try{
			  if("Nokia".compareTo(System.getProperty("microedition.platform").substring(0,5)) == 0)
				  return 208;
			  else
				  return super.getHeight();
		  }
		  catch(Exception e){
			  return super.getHeight();
		  }
		}
}

⌨️ 快捷键说明

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