📄 textviewermidlet.java
字号:
package textViewer;import javax.microedition.lcdui.*;import javax.microedition.midlet.*;import java.io.InputStream;// import java.io.DataInputStream;import java.io.InputStreamReader;import java.lang.*;import java.util.Vector;import midletLib.*;public class textViewerMIDlet extends MIDlet implements ResourceIncrementLoadedListener { // startApp and destroyApp can throw a MIDletStateChangeException if they want private Display display; private TextViewerForm textViewerForm; private String text; private StringLoadThread stringLoadThread; public textViewerMIDlet() { // should anything go here???? textViewerForm = new TextViewerForm("Text Viewer", "hello katherine", this); stringLoadThread = new StringLoadThread(getClass().getResourceAsStream("text.1.txt"), this, null, this, 15, textViewerForm.getTextChunkLength()); //TODO: constant stringLoadThread.start(); // stringLoadThread.run(); } protected void startApp() { // textViewerForm.setText(text); // textViewerForm = new TextViewerForm("Text Viewer", "text test"); display = Display.getDisplay(this); display.setCurrent(textViewerForm); } protected void pauseApp( ) { } protected void destroyApp( boolean unconditional ) { } public void resourceLoaded(Object rsrcID, Object rsrc) { // there is only one thing we could be waiting for... textStringLoaded((String)rsrc); } public void moreOfResourceLoaded(Object rsrcID, Object rsrc) { // there is only one thing we could be waiting for... moreOfTextStringLoaded((String)rsrc); } private void textStringLoaded(String text) { this.text = text; textViewerForm.setText(text); try { this.stringLoadThread.join(); } catch (InterruptedException e) {} //TODO: handle this.stringLoadThread = null; //so gc can get it System.gc(); } public void moreOfTextStringLoaded(String text) { this.text = text; textViewerForm.setText(text); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -