- /*
- * Copyright 1999,2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- package peaklau.eaglefund;
- import javax.microedition.lcdui.Font;
- import javax.microedition.lcdui.Graphics;
- import javax.microedition.lcdui.Image;
- /**
- * MainScreen class<br>
- * EagleFund logo is painted in the center of the screen, <br>
- * and the application version is showed at the bottom.
- *
- *
- * <br>
- * @author peaklau <br>
- * email:<A HREF="mailto:peaklau@hotmail.com">peaklau@hotmail.com</A> <br>
- * <a href="http://www.peaklau.com/fund/english/">HomePage</a>
- * @version $Revision: 1.1 $ $Date: 2007/05/09 16:07:04 $
- */
- public class MainScreen extends BaseCanvas {
- private Font defaultFont=Font.getDefaultFont();
- private int FONT_HEIGHT=defaultFont.getHeight();
- private int width=0;
- private int height=0;
- private Image logo=null;
- public MainScreen(INavigator navigator){
- super(navigator);
- width=getWidth();
- height=getHeight();
- try{
- logo=Image.createImage("/jj.png");
- }catch(Exception e){
- e.printStackTrace();
- }
- }
- protected void paint(Graphics g){
- g.setColor(0x00FFFFFF);
- g.fillRect(0,0,width,height);
- int x=(width-logo.getWidth())/2;
- int y=(height-logo.getHeight())/2;
- g.drawImage(logo,x,y,Graphics.LEFT|Graphics.TOP);
- String version="Version: "+navigator.getAppVersion();
- x=(width-defaultFont.stringWidth(version))/2;
- x=x<0?0:x;
- y=height-FONT_HEIGHT;
- //System.out.println(version+" "+x+" "+y);
- g.setColor(0x00000000);
- g.drawString(version,x,y,Graphics.LEFT|Graphics.TOP);
- }
- }