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

📄 qitem.java

📁 j2me 高级UI
💻 JAVA
字号:
/**
 * 作者:cat 戚永城
 * 时间:2008-3-1
 * QQ:415898635
 * E-Mail:	415898635@qq.com
 * 			qyc_12345@163.com
 * 
 * */
package org.qui.manager;

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

import org.qui.event.ActionListener;
import org.qui.event.EventListenerList;
import org.qui.event.ItemEvent;
import org.qui.info.Attribute;
import org.qui.info.Tip;

public class QItem {

	public int x = -1;

	public int y = -1;

	public int width = 0;

	public int height = 0;

	// 默认背景色
	public int br = 241;

	public int bg = 240;

	public int bb = 227;

	// 默认前景色
	public int fr = 0;

	public int fg = 0;

	public int fb = 0;

	public boolean keyPressed = false;

	private Tip tip = null;

	private boolean visible = true;

	public UIManager ui=null;
	
	public boolean focus = false;
	
	public QItem() {
		this.br = Attribute.backR;
		this.bb = Attribute.backG;
		this.bg = Attribute.backB;
		this.fr = Attribute.foreR;
		this.fg = Attribute.foreG;
		this.fb = Attribute.foreB;
	}

	public QItem(int x, int y, int width, int height) {
		this.br = Attribute.backR;
		this.bb = Attribute.backG;
		this.bg = Attribute.backB;
		this.fr = Attribute.foreR;
		this.fg = Attribute.foreG;
		this.fb = Attribute.foreB;
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;
	}

	public void paint(Graphics g) {

	}

	public void setUIManager(UIManager ui){
		this.ui=ui;
	}
	
	public void setPosition(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public void setSize(int width, int height) {
		this.width = width;
		this.height = height;
	}

	public void setBounds(int x, int y, int width, int height) {
		setPosition(x, y);
		setSize(width, height);
	}

	public EventListenerList listenerList = new EventListenerList();

	public void addActionListener(ActionListener e) {
		listenerList.add(e);
	}

	public void setForeground(int fr, int fg, int fb) {
		this.fr = fr;
		this.fg = fg;
		this.fb = fb;
	}

	public void setBackground(int br, int bg, int bb) {
		this.br = br;
		this.bg = bg;
		this.bb = bb;
	}
	public boolean noback=false;
	public void setNoBack(){
		noback=true;
	}
	public void setVisible(boolean visible) {
		this.visible = visible;
	}

	public boolean isVisible() {
		return visible;
	}

	public void keyPressed(int keyCode) {
		keyPressed = true;
	}

	public void keyReleased(int keyCode) {
		keyPressed = false;
		actionPerformed(keyCode);
	}

	public void actionPerformed(int keyCode) {
		ActionListener action = this.listenerList.getActionListener();
		if (action != null) {
			ItemEvent e = new ItemEvent(this, keyCode);
			action.actionPerformed(e);
		}
	}

	public boolean enableTip = false;

	public boolean editable = true;
	
	public void setEidtable(boolean editable){
		this.editable=editable;
	}
	public void enableTip() {
		enableTip = true;
		tip = new Tip(this);
	}

	public void disableTip() {
		enableTip = false;
	}

	public Tip getTip() {
		return tip;
	}

	public Font font = Font.getDefaultFont();

	public int fontHeight = font.getHeight();

	public void setFont(int face, int style, int size) {
		font = Font.getFont(face, style, size);
		fontHeight = font.getHeight();
	}

	public Font getFont() {
		return font;
	}

}

⌨️ 快捷键说明

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