qmenuitem.java

来自「j2me 高级UI」· Java 代码 · 共 49 行

JAVA
49
字号
/**
 * 作者:cat 戚永城
 * 时间:2008-3-1
 * QQ:415898635
 * E-Mail:	415898635@qq.com
 * 			qyc_12345@163.com
 * 
 * */
package org.qui.menu;

import javax.microedition.lcdui.Graphics;

import org.qui.conmponent.QMenuBar;
import org.qui.container.QFrame;
import org.qui.manager.QAbstructButton;
import org.qui.manager.UIManager;

public class QMenuItem extends QAbstructButton {

	// private Vector item = new Vector();// 0 menuItem 1 radio 2 check 3 menu

	// private Vector style = new Vector();// 1表示拥有下级菜单

	// private Vector open = new Vector();// 1表示打开

	public int root = 0;// 0表示从左菜单衍生

	public QMenuItem(String label) {
		super(0, QMenuBar.frame.frm_Height, 75, 20);
		this.label = label;
	}

	public void paint(Graphics g) {
		g.setFont(font);
		g.setColor(fr, fg, fb);
		int offx = 0;
		if (level != 0) {
			if (root == 0) {
				offx = level * width;
			} else if (root == 1) {
				offx = -level * width;
			}
		}
		int str_offy = 10 - font.getHeight() / 2;
		g.drawImage(UIManager.menu_back, x+ offx, y ,  Graphics.LEFT | Graphics.TOP);
		g.drawString(getLabel(), x + offx + 2, y  + str_offy, Graphics.LEFT| Graphics.TOP);
	}
}

⌨️ 快捷键说明

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