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

📄 color2.java

📁 最强手机阅读器Anyview3.0版的界面代码
💻 JAVA
字号:
package com.ismyway.anyview.win;

import javax.microedition.lcdui.Command;

import com.ismyway.anyview.others.Configure;
import com.ismyway.fairyui.Callback;
import com.ismyway.fairyui.Component;
import com.ismyway.fairyui.DropList;
import com.ismyway.fairyui.FlowPanel;
import com.ismyway.fairyui.NewLine;
import com.ismyway.fairyui.Row;
import com.ismyway.fairyui.Slider;
import com.ismyway.fairyui.ValueChangeListener;
import com.ismyway.util.Res;


public class Color2 extends FlowPanel implements ValueChangeListener {
	DropList color;
	Slider red = new Slider(), green = new Slider(), blue = new Slider();
	private int index = 0;
	int oldColor;

	public Color2(Callback callback, int index) {
		super(callback);
		String[] colors = new String[] { 
				Res.get("Foreground Color"),
				Res.get("Foreground Color2"), 
				Res.get("Background Color"),
				Res.get("Underline Color"),
				Res.get("Indicator") + Res.get("Color")
		};

		this.index = index;
		int c = 0;
		switch (index) {
		case 0:
			c = Configure.fontColor1;
			break;
		case 1:
			c = Configure.fontColor2;
			break;
		case 2:
			c = Configure.backgroundColor;
			break;
		case 3:
			c = Configure.underlineColor;
			break;
		case 4:
			c = Configure.indicatorColor;
			break;
		}
		oldColor = c;

		setTitle(Res.get("Color") + Res.get("Setup") + " - " + colors[index]);
		red.setParameters(0, 255, (c >> 16) & 0xff);
		//red.setFastmode(true);
		//red.setFaststep(0x11);
		red.setStep(0x11);
		red.setHexMode(true);
		add(red);
		green.setParameters(0, 255, (c >> 8) & 0xff);
		//green.setFastmode(true);
		//green.setFaststep(0x11);
		green.setStep(0x11);
		green.setHexMode(true);
		add(green);
		blue.setParameters(0, 255, c & 0xff);
		//blue.setFastmode(true);
		//blue.setFaststep(0x11);
		blue.setStep(0x11);
		blue.setHexMode(true);
		add(blue);
		red.setValueChangeListener(this);
		blue.setValueChangeListener(this);
		green.setValueChangeListener(this);
		
		Row row = new Row();
		row.add(new NewLine(10));
		add(row);

		setMaxHeight(140);
		validate();
		setTop(mainCanvas.getHeight() - getHeight());
		addCommand(new Command(Res.get("OK"), Command.OK, 1));
		addCommand(new Command(Res.get("Close"), Command.EXIT, 1));
	}

	public void commandAction(Command cmd, Component c) {
		String str = cmd.getLabel();
		if (str.equals(Res.get("Close"))) {
			
		} else if (str.equals(Res.get("OK"))) {
			oldColor = red.getCurrent() << 16 | green.getCurrent() << 8
					| blue.getCurrent();
		}
		mainCanvas.closePopup();
		callback.callback(this, new Command(Res.get("OK"), Command.OK, 1),
				new Object[] { new Integer(oldColor), new Integer(index) });
	}

	public void valueChanged(Object obj) {
		int value = red.getCurrent() << 16 | green.getCurrent() << 8
				| blue.getCurrent();
		callback.callback(this, new Command(Res.get("OK"), Command.OK, 1),
				new Object[] { new Integer(value), new Integer(index) });
	}
}

⌨️ 快捷键说明

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