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

📄 menu.java

📁 手机电子书阅读软件基本框架
💻 JAVA
字号:
/********************************************************************
 * 
 * 版权说明,此程序仅供学习参考。不能用于商业
 * 
 ********************************************************************/
package org.pook.ui;


import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

import org.pook.ui.core.Platform;

/**
 * <b>类名:Menu.java</b> </br> 编写日期: 2006-6-13 <br/> 程序功能描述:程序的住菜单部�?<br/> Demo:
 * <br/> Bug: <br/>
 * 
 * 程序变更日期 �?<br/> 变更作�?? �?<br/> 变更说明 �?<br/>
 * 
 * @author wuhua </br> <a href="mailto:rrq12345@163.com">rrq12345@163.com</a>
 */
public abstract class Menu extends Part {

	/**
	 * 这个页面菜单的数�?
	 */
	int numOfEls;

	/**
	 * 菜单的宽�?,固定死了
	 */
	int menuWidth;

	/**
	 * 菜单的高�?,固定死了.
	 */
	int menuHeight;

	/**
	 * 图标Icon
	 */
	Image[] icons;

	String[][] title;

	/** 如果为false�?,表示此菜单是图标形式* */

	public Menu(Image[] icons, String[][] title) {
		super(0, 45, Platform.WIDTH, Platform.HEIGHT - 20);
		checkObject(icons);
		this.icons = icons;
		this.title = title;
		if (title == null  || title.length > icons.length)
			numOfEls = icons.length;
		else
			numOfEls = title.length;

	}
	
	private void checkObject(Object o) {
		if (o == null){
			 throw new NullPointerException("Object is not null");
		}
			
	}

	/** 改变显示位置 */
	void changeView() {
		if (Platform.HEIGHT - 20 > view[HEIGHT]) {
			view[HEIGHT] = Platform.HEIGHT - 20;
		}
	}

	void fillClip(Graphics g) {
		changeView();
		g.setColor(0x001E67);
		g.fillRect(0, 45, Platform.WIDTH, Platform.HEIGHT);
	}

	/**
	 * 改变状�??
	 */
	void paintItemTitle(Graphics g) {
		g.setColor(0xFFFFFF);
		Font font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN,
				Font.SIZE_SMALL);

		g.setFont(font);

		g
				.drawString(title[selectIndex][1], 4, 30, Graphics.TOP
						| Graphics.LEFT);

	}

}

⌨️ 快捷键说明

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