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

📄 list.java

📁 手机资源管理系统
💻 JAVA
字号:
package com.cuit.lui;

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

public class List extends Panel {
	private Shortcut shortcut;

	private boolean shortcutShow = false;

	public List() {
		super();
	}

	public List(PopUp l, PopUp r) {
		super(l, r);
	}

	public void append(String strpart, Image imgpart) {
		append(imgpart, strpart);
		needRepaint=true;
	}

	public void append(Image imgpart, String strpart) {
		Row r = new Row(imgpart, strpart,LScreen.screenWidth-30);
	
		add(r);
		needRepaint=true;
	}

	public void append(String strpart){
		append(strpart,null);
	}
	public String getString(int i) {
		if (i < 0 || i > rows.size() - 1) {
			LScreen.error("List:getString() index out of bounds");
			return null;
		} else {
			return ((Row) rows.elementAt(i)).getText();
		}
	}
	public String getSelectedString(){
		
		return getString(rowPointer);
	}

	public Image getImage(int i) {
		if (i < 0 || i > rows.size() - 1) {

			LScreen.error("List:getImage() index out of bounds");
			return null;
		} else {
			return ((Row) rows.elementAt(i)).getIcon();
		}
	}

	public void addCommand(Command c) {
		for (int i = 0; i < rows.size(); i++) {
			((Row) rows.elementAt(i)).addCommand(c);
		}
	}

	public void pin(Shortcut s) {
		if (s != null) {
			shortcut = s;
			
		} else {
			LScreen.error("list shortcut is null!");
		}
	}

	public Shortcut getShortcut() {
		return shortcut;
	}

	public boolean keyEvent(int keyCode) {
		needRepaint = false;
		if (keyCode == LUIConfig.POUND) {
			shortcutShow = !shortcutShow;
			if (shortcutShow && shortcut != null && rowPointer >= 0) {
				adjustShortcut();

			}
			needRepaint = true;
		} else {
			if (shortcutShow) {
				needRepaint = shortcut.keyEvent(keyCode);
				if(needRepaint&&keyCode==LUIConfig.FIRE){
					shortcutShow=false;
				}
				return needRepaint;
			} else {
				needRepaint = super.keyEvent(keyCode);
			}
		}
		return needRepaint;
	}

	public void paint(Graphics g) {
		super.paint(g);
		if (shortcutShow && shortcut != null && rowPointer >= 0) {
			g.setClip(shortcut.getPosx(), shortcut.getPosy(), shortcut
					.getWidth(), shortcut.getHeight());
			shortcut.paint(g);
//			g.setClip(0, 0, LScreen.screenWidth, LScreen.screenHeight);
		}
	}

	public void adjustShortcut() {

		int scposx = posx + getWidth() / 2 - 20;
		Row r = (Row) rows.elementAt(rowPointer);
		int scposy = r.getPosy() + r.getHeight() / 2;
		if (scposy + shortcut.getHeight() > posy + getHeight() - taskBarHeight) {
			scposy -= shortcut.getHeight();
		}
		shortcut.setPosx(scposx);
		shortcut.setPosy(scposy);
		shortcut.adjustLayout();
		shortcut.reset();
		shortcut.isBorder=true;
	}
	public void insert(int nb,Image imgpart ,String strpart){
		
		insert(nb,new Row(imgpart,strpart));
		
	}
}

⌨️ 快捷键说明

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