第4回:実機に載せよう(ダウンサイズ)
001: //package com.s_cradle.improve.client;
002:
003: import javax.microedition.lcdui.Canvas;
004: import javax.microedition.lcdui.Graphics;
005: import java.util.Timer;
006: import java.util.TimerTask;
007:
008: /**
009: *
010: * Ticker を貼り付けられる Improve 用の Canvas です。
011: *
012: * @author Masaru Yoshimura
013: */
014: public abstract class H/*ImproveAbstractCanvas*/ extends Canvas{
015: //downsize 定数展開
016: /*
017: public static final int LIST_BG_COLOR = (153<<16) | (153<<8) | 255;
018: protected static final int TICKER_HEIGHT = 18;
019: */
020:
021: public static I/*ImproveMIDlet*//*Ticker*/ I/*ticker*/;
022:
023: public H/*ImproveAbstractCanvas*/() {
024: if( I/*ticker*/ == null ){
025: //ticker = new Ticker(0,0,getWidth(),18/*TICKER_HEIGHT*/);
026: I/*ticker*/ = new I/*ImproveMIDlet*/();
027: I/*ticker*/.Code/*initializeTicker*/(0,0,getWidth(),18/*TICKER_HEIGHT*/);
028:
029: //downsize 即値の利用
030: Z/*TickerTask*/ task = new Z/*TickerTask*/();
031: new Timer().scheduleAtFixedRate(task,200,200);
032: }
033: }
034:
035: private class Z/*TickerTask*/ extends TimerTask{
036: public void run(){
037: I/*ticker*/.Z/*timerExpired*/();
038: repaint();
039: }
040: }
041:
042: /**
043: * 明暗付の矩形の描画
044: */
045: //downsize メソッドインライン化
046: /*
047: protected static void draw3DRect(Graphics graph, int x, int y, int dx, int dy,
048: int base, int light, int shadow){
049: graph.setColor(base);
050: graph.fillRect(x,y,dx,dy);
051: graph.setColor(light);
052: graph.drawLine(x,y,x + dx - 2,y);
053: graph.drawLine(x,y,x,y + dy - 2);
054: graph.setColor(shadow);
055: graph.drawLine(x + dx - 1,y + 1,x + dx - 1,y + dy - 1);
056: graph.drawLine(x + 1,y + dy - 1,x + dx - 1,y + dy - 1);
057: return;
058: }
059: */
060: }