📄 tester.java
字号:
/** * */package gr.fire.test;import gr.fire.browser.Browser;import gr.fire.browser.util.HTMLUtil;import gr.fire.core.CommandListener;import gr.fire.core.Component;import gr.fire.core.Container;import gr.fire.core.FireScreen;import gr.fire.core.Panel;import gr.fire.ui.FireTheme;import gr.fire.ui.TransitionAnimation;import gr.fire.util.FireIO;import gr.fire.util.Log;import java.io.IOException;import java.io.UnsupportedEncodingException;import javax.microedition.io.HttpConnection;import javax.microedition.lcdui.Command;import javax.microedition.lcdui.Display;import javax.microedition.lcdui.Displayable;import javax.microedition.midlet.MIDlet;import javax.microedition.midlet.MIDletStateChangeException;/** * @author padeler * */public class Tester extends MIDlet implements CommandListener{ /* (non-Javadoc) * @see javax.microedition.midlet.MIDlet#destroyApp(boolean) */ protected void destroyApp(boolean arg0) throws MIDletStateChangeException { // TODO Auto-generated method stub } /* (non-Javadoc) * @see javax.microedition.midlet.MIDlet#pauseApp() */ protected void pauseApp() { } Command next= new Command("Next",Command.OK,1); Command prev = new Command("Prev",Command.OK,1); Command nextScroll = new Command("NextScroll",Command.OK,1); Command prevScroll = new Command("PrevScroll",Command.OK,1); Browser b; /* (non-Javadoc) * @see javax.microedition.midlet.MIDlet#startApp() */ protected void startApp() throws MIDletStateChangeException { FireIO.setBufferSize(10); try{ try { FireScreen.setTheme(new FireTheme("/themef.png")); } catch (IOException e) { e.printStackTrace(); } FireScreen screen = FireScreen.getScreen(Display.getDisplay(this)); screen.setFullScreenMode(true); b = new Browser(); HTMLUtil.registerHtmlTags(b); FireScreen.getScreen().setCurrent(createPanelFrom("file://index.html",next,nextScroll));// FireScreen.getScreen().setCurrent(createPanelFrom("file://other.html",next,nextScroll));// FireScreen.getScreen().setCurrent(createPanelFrom("http://139.91.23.30/~padeler/simple.html",next,nextScroll));// FireScreen.getScreen().setCurrent(createPanelFrom("http://www.google.com/xhtml",next,nextScroll));// FireScreen.getScreen().setCurrent(createPanelFrom("http://www.msn.com",next,nextScroll)); }catch(Throwable e) { Log.logError("Application Failed to start",e); } } public Panel createPanelFrom(String file,Command left, Command right) { try { Container page = b.requestPage(file,HttpConnection.GET,null,null); if(page==null) return null; Panel panel = new Panel(page,Panel.VERTICAL_SCROLLBAR|Panel.HORIZONTAL_SCROLLBAR,true); panel.setLeftSoftKeyCommand(left); panel.setRightSoftKeyCommand(right); panel.setCommandListener(this); return panel; } catch (UnsupportedEncodingException e) { Log.logError("Unsuported Encoding.",e); } catch (Exception e) { Log.logError("Exception in createPanelFrom.",e); } return null; } public void commandAction(Command cmd, Component c) { Log.logInfo("Command "+cmd.getLabel()); if(cmd==next) { FireScreen.getScreen().setCurrent(createPanelFrom("file://other.html",prev,prevScroll),TransitionAnimation.TRANSITION_CARD |TransitionAnimation.TRANSITION_LEFT); return; } if(cmd==nextScroll) { FireScreen.getScreen().setCurrent(createPanelFrom("file://other.html",prev,prevScroll),TransitionAnimation.TRANSITION_SCROLL|TransitionAnimation.TRANSITION_LEFT); return; } if(cmd==prev) { FireScreen.getScreen().setCurrent(createPanelFrom("file://index.html",next,nextScroll),TransitionAnimation.TRANSITION_CARD|TransitionAnimation.TRANSITION_RIGHT); return; } if(cmd==prevScroll) { FireScreen.getScreen().setCurrent(createPanelFrom("file://index.html",next,nextScroll),TransitionAnimation.TRANSITION_SCROLL|TransitionAnimation.TRANSITION_RIGHT); return; } } public void commandAction(Command arg0, Displayable arg1) { }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -