亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? persistentrankingmidlet.java

?? 隨書源碼
?? JAVA
字號(hào):
package ora.ch6;

import java.io.IOException;
import java.util.Vector;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.List;
import javax.microedition.lcdui.Screen;
import javax.microedition.lcdui.StringItem;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.rms.RecordEnumeration;
import javax.microedition.rms.RecordListener;
import javax.microedition.rms.RecordStore;
import javax.microedition.rms.RecordStoreException;


public class PersistentRankingMIDlet extends MIDlet
                implements CommandListener, RecordListener, Runnable {

    private Command exitCommand;
    private Command okCommand;
    private Command cancelCommand;
    private Command newCommand;
    private Command checkCommand;
    private Command detailsCommand;
    private Command backCommand;
    private Command deleteCommand;
    private Display display;
    private TextField isbnField;
    private StringItem isbnDisplay;
    private StringItem titleDisplay;
    private StringItem rankingDisplay;
    private StringItem reviewDisplay;
    private StringItem checkTitle;
    private Form isbnForm;
    private Form searchForm;
    private Form resultForm;
    private Form checkForm;
    private List bookList;
    private Vector bookInfoList;
    private Thread searchThread;
    private BookStore bookStore;
    private BookInfo searchBookInfo;

    protected void startApp() throws MIDletStateChangeException {
        if (display == null) {
            initialize();

            // If there are any books in the
            // book store, display the list.
            // Otherwise, start with the ISBN form.
            display.setCurrent(getSelectionScreen());
        }
    }

    protected void pauseApp() {
    }

    protected void destroyApp(boolean unconditional)
                        throws MIDletStateChangeException {
        // Close the book store
        if (bookStore != null) {
            try {
                bookStore.removeRecordListener(this);
                bookStore.close();
            } catch (RecordStoreException ex) {
            }
        }
    }

    public void commandAction(Command cmd, Displayable d) {
        if (cmd == exitCommand) {
            try {
                destroyApp(true);
            } catch (MIDletStateChangeException ex) {
            }
            notifyDestroyed();
        } else if (cmd == okCommand) {
            String isbn = isbnField.getString().trim();
            if (!isbn.equals("")) {
                isbnDisplay.setText(isbn);
                display.setCurrent(searchForm);
                searchForBook(new BookInfo(isbn));
            }
        } else if (cmd == cancelCommand) {
            searchThread = null;
            isbnField.setString(null);
            display.setCurrent(getSelectionScreen());
        } else if (cmd == newCommand) {
            isbnField.setString(null);
            display.setCurrent(isbnForm);
        } else if (cmd == detailsCommand || cmd == List.SELECT_COMMAND) {
            int index = bookList.getSelectedIndex();
            searchBookInfo = (BookInfo)bookInfoList.elementAt(index);
            isbnDisplay.setText(searchBookInfo.getIsbn());
            showBookInfo(searchBookInfo);
        } else if (cmd == deleteCommand) {
            int index = bookList.getSelectedIndex();
            BookInfo bookInfo = (BookInfo)bookInfoList.elementAt(index);
            try {
                bookStore.deleteBook(bookInfo);
            } catch (RecordStoreException ex) {
                System.out.println("Delete failed: " + ex);
            }
        } else if (cmd == checkCommand) {
            String isbn = searchBookInfo.getIsbn();
            checkTitle.setText(searchBookInfo.getTitle());
            display.setCurrent(checkForm);
            searchForBook(searchBookInfo);
        } else if (cmd == backCommand) {
            display.setCurrent(getSelectionScreen());
        }
    }

    public void searchForBook(BookInfo info) {
        searchBookInfo = info;
        searchThread = new Thread(this);
        searchThread.start();
    }

    public void recordAdded(RecordStore recordStore, int recordId) {
        // Update the book list
        populateBookList();
    }

    public void recordChanged(RecordStore recordStore, int recordId) {
        // Update the book list
        populateBookList();
    }

    public void recordDeleted(RecordStore recordStore, int recordId) {
        // Update the book list
        populateBookList();
    }

    public void run() {
        try {
            boolean found = Fetcher.fetch(searchBookInfo);
            if (searchThread == Thread.currentThread()) {
                if (found && searchBookInfo.getTitle() != null) {
                    // Display the book details
                    showBookInfo(searchBookInfo);

                    // Add the new book to the book store
                    bookStore.saveBookInfo(searchBookInfo);
                } else {
                    Alert alert = new Alert("Book not found", null,
                                        null, AlertType.ERROR);
                    alert.setTimeout(Alert.FOREVER);
                    alert.setString("No book with ISBN " +
                                        searchBookInfo.getIsbn() +
                                        " was found.");
                    isbnField.setString(null);
                    display.setCurrent(alert, getSelectionScreen());
                }
            }
        } catch (Throwable ex) {
            if (searchThread == Thread.currentThread()) {
                Alert alert = new Alert("Search Failed", null,
                                        null, AlertType.ERROR);
                alert.setTimeout(Alert.FOREVER);
                alert.setString("Search failed:\n" + ex.getMessage());
                isbnField.setString(null);
                display.setCurrent(alert, getSelectionScreen());
            }
        }
    }

    // Shows book details on the result screen
    private void showBookInfo(BookInfo info) {
        titleDisplay.setText(info.getTitle());

        int ranking = info.getRanking();
        int lastRanking = info.getLastRanking();
        int change = ranking - lastRanking;
        String rankingText =
                ranking == 0 ? "" :
                    String.valueOf(ranking);
        if (change > 0) {
            rankingText += ", down by " + change;
        } else if (change < 0) {
            rankingText += ", UP by " + (-change);
        }
        rankingDisplay.setText(rankingText);

        int reviews = info.getReviews();
        int lastReviews = info.getLastReviews();
        change = reviews - lastReviews;
        String reviewText =
            reviews == 0 ? "" :
                    String.valueOf(reviews);
        if (change > 0) {
            reviewText += ", up by " + change;
        } 
        reviewDisplay.setText(reviewText);

        display.setCurrent(resultForm);
    }

    // If there are any books in the
    // book store, display the list.
    // Otherwise, start with the ISBN form.
    private Screen getSelectionScreen() {
        return
            bookInfoList.isEmpty() ? (Screen)isbnForm : (Screen)bookList;
    }

    // Populates the list of books
    private void populateBookList() {
        // Clear out any existing content
        int count = bookList.size();
        for (int i = 0; i < count; i++) {
            bookList.delete(0);
        }
        bookInfoList.removeAllElements();

        // Add an entry for each book in the store
        try {
            RecordEnumeration enum = bookStore.getBooks();
            while (enum.hasNextElement()) {
                int id = enum.nextRecordId();
                BookInfo info = bookStore.getBookInfo(id);
                bookInfoList.addElement(info);
                String title = info.getTitle();
                if (title == null || title.equals("")) {
                    title = info.getIsbn();
                }
                bookList.append(title, null);
            }
            enum.destroy();
        } catch (Exception ex) {
            // Just leave an empty list.
        }

        // The ISBN list should have an exit command
        // only if the List screen is empty.
        isbnForm.removeCommand(exitCommand);
        if (bookInfoList.isEmpty()) {
            isbnForm.addCommand(exitCommand);
        }
    }

    private void initialize() {
        display = Display.getDisplay(this);

        // Open the book store
        bookStore = new BookStore();
 
        exitCommand = new Command("Exit", Command.EXIT, 0);
        okCommand = new Command("OK", Command.OK, 0);
        cancelCommand = new Command("Cancel", Command.CANCEL, 0);
        newCommand = new Command("New", Command.SCREEN, 1);
        detailsCommand = new Command("Details", Command.OK, 0);
        checkCommand = new Command("Check", Command.OK, 0);
        backCommand = new Command("Back", Command.CANCEL, 1);
        deleteCommand = new Command("Delete", Command.SCREEN, 1);

        bookList = new List("Books", List.IMPLICIT);
        bookList.addCommand(detailsCommand);
        bookList.addCommand(newCommand);
        bookList.addCommand(deleteCommand);
        bookList.addCommand(exitCommand);
        bookInfoList = new Vector();

        isbnForm = new Form("Book Query");
        isbnForm.append("Enter an ISBN and press OK:");
        isbnField = new TextField("", null, 10, TextField.ANY);
        isbnForm.append(isbnField);
        isbnForm.addCommand(okCommand);
        isbnForm.addCommand(exitCommand);
        isbnForm.addCommand(backCommand);

        searchForm = new Form("Book Search");
        searchForm.append("Searching for ISBN\n");
        isbnDisplay = new StringItem(null, null);
        searchForm.append(isbnDisplay);
        searchForm.append("\nPlease wait....");
        searchForm.addCommand(cancelCommand);

        checkForm = new Form("Details Update");
        checkForm.append("Getting details for\n");
        checkTitle = new StringItem(null, null);
        checkForm.append(checkTitle);
        checkForm.append(" from amazon.com\nPlease wait....");
        checkForm.addCommand(cancelCommand);

        resultForm = new Form("Search Results");
        titleDisplay = new StringItem("Book title: ", null);
        rankingDisplay = new StringItem("Ranking:    ", null);
        reviewDisplay = new StringItem("Reviews:    ", null);
        resultForm.append(titleDisplay);
        resultForm.append(rankingDisplay);
        resultForm.append(reviewDisplay);
        resultForm.addCommand(backCommand);
        resultForm.addCommand(checkCommand);

        // Register for events from all of the forms
        isbnForm.setCommandListener(this);
        searchForm.setCommandListener(this);
        resultForm.setCommandListener(this);
        bookList.setCommandListener(this);

        // Listen for changes in the content of the book store
        bookStore.addRecordListener(this);

        // Install the books held in the record store
        populateBookList();
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产美女浴室洗澡无遮挡| 成人理论电影网| 成人在线综合网| 在线91免费看| 亚洲婷婷综合久久一本伊一区| 日日摸夜夜添夜夜添国产精品| 国产不卡在线播放| 精品污污网站免费看| 中文字幕第一区综合| 韩国精品免费视频| 欧美一区二区在线免费播放| 1024国产精品| 懂色av中文一区二区三区| 欧美丰满少妇xxxxx高潮对白| 国产精品美女久久久久久久久| 久久国产福利国产秒拍| 在线免费观看日韩欧美| 国产精品视频第一区| 国产一区二区女| 欧美一区二区福利在线| 日日摸夜夜添夜夜添国产精品| 色狠狠av一区二区三区| 中文字幕在线观看不卡视频| 国产激情精品久久久第一区二区| 日韩久久免费av| 美女一区二区在线观看| 制服视频三区第一页精品| 亚洲激情在线激情| 一本大道久久a久久精品综合| 亚洲婷婷国产精品电影人久久| 粉嫩蜜臀av国产精品网站| 国产午夜精品一区二区| 国产精一区二区三区| 26uuuu精品一区二区| 国产米奇在线777精品观看| 日韩三级视频中文字幕| 美女视频免费一区| www欧美成人18+| 国产精品一区二区男女羞羞无遮挡| 精品区一区二区| 国产中文一区二区三区| 国产日韩精品一区二区三区| 国产成人一区二区精品非洲| 亚洲免费伊人电影| 91丨porny丨户外露出| 一区二区三区蜜桃| 91精品国产综合久久久久久久| 青娱乐精品视频在线| 久久久久久影视| 成人精品免费看| 一区二区三区成人| 欧美日韩一区二区三区在线看| 日韩专区中文字幕一区二区| 日韩一卡二卡三卡国产欧美| 国产一区美女在线| 国产精品福利电影一区二区三区四区| 91污片在线观看| 午夜在线成人av| 26uuu亚洲| 欧美中文字幕一区| 久久丁香综合五月国产三级网站| 国产午夜精品久久久久久免费视 | 久久久久久亚洲综合| 成人sese在线| 亚洲国产另类av| 久久精品综合网| 欧洲国产伦久久久久久久| 久久国产精品99精品国产| 中文字幕亚洲不卡| 日韩一级免费一区| 99久久婷婷国产综合精品| 午夜欧美在线一二页| 日本一区二区三区视频视频| 国产偷v国产偷v亚洲高清| 在线免费观看不卡av| 激情成人综合网| 一区二区三区日韩精品| 久久久久久电影| 欧美群妇大交群中文字幕| 国产美女久久久久| 亚洲电影第三页| 国产欧美一区二区三区在线老狼| 在线观看精品一区| 国产激情偷乱视频一区二区三区| 午夜伊人狠狠久久| 国产精品成人免费精品自在线观看| 欧美日韩日日骚| 97久久精品人人做人人爽50路| 精品一区二区在线播放| 午夜精品福利视频网站| 亚洲视频狠狠干| 久久日韩精品一区二区五区| 欧美高清视频不卡网| 色婷婷国产精品| 91在线观看高清| 福利视频网站一区二区三区| 麻豆精品国产传媒mv男同| 日欧美一区二区| 亚洲国产另类av| 亚洲国产视频直播| 亚洲人成网站影音先锋播放| 国产无遮挡一区二区三区毛片日本| 欧美人与z0zoxxxx视频| 在线观看欧美精品| 色老汉av一区二区三区| 一本到高清视频免费精品| 97久久超碰精品国产| 波多野结衣中文字幕一区二区三区 | av动漫一区二区| 国产精品18久久久久| 国产最新精品免费| 精品一区二区在线免费观看| 免费的成人av| 极品美女销魂一区二区三区免费| 丝袜a∨在线一区二区三区不卡| 亚洲午夜免费电影| 亚洲成人综合在线| 日韩av电影天堂| 日日摸夜夜添夜夜添精品视频| 日日噜噜夜夜狠狠视频欧美人| 亚洲第四色夜色| 奇米色777欧美一区二区| 五月婷婷综合在线| 日韩精品一二三区| 久久精品国产一区二区| 久久精品国产在热久久| 国产精一品亚洲二区在线视频| 国产乱码精品一区二区三| 福利91精品一区二区三区| 福利视频网站一区二区三区| 99re亚洲国产精品| 欧美在线观看禁18| 日韩精品资源二区在线| 久久亚洲一区二区三区四区| 国产欧美视频在线观看| 亚洲黄色片在线观看| 日本最新不卡在线| 国产乱码精品一品二品| 99视频超级精品| 欧美日韩国产成人在线免费| 精品国产一二三| 国产精品欧美久久久久一区二区| 亚洲欧美欧美一区二区三区| 亚洲国产欧美在线人成| 加勒比av一区二区| av电影在线观看完整版一区二区| 欧美亚洲一区二区在线| 欧美一区欧美二区| 国产精品久久久久天堂| 图片区日韩欧美亚洲| 国产精品一区二区男女羞羞无遮挡 | 国产精品久久久久一区| 亚洲国产欧美在线人成| 国产一区二区三区不卡在线观看 | 亚洲成人动漫在线免费观看| 精品在线免费视频| 色哦色哦哦色天天综合| 欧美v日韩v国产v| 亚洲最色的网站| 九九久久精品视频| 一本大道综合伊人精品热热| 26uuu国产一区二区三区| 亚洲国产一区在线观看| 成人午夜av在线| 日韩一区和二区| 一区二区免费看| 成人免费高清在线| 日韩欧美123| 亚洲一级二级三级| voyeur盗摄精品| 久久婷婷综合激情| 亚洲国产wwwccc36天堂| 99精品久久只有精品| 亚洲精品一区二区三区蜜桃下载| 亚洲国产欧美日韩另类综合| 欧美优质美女网站| 国产精品免费视频网站| 国产一区二区在线看| 在线播放亚洲一区| 亚洲一区免费视频| 91丨九色丨国产丨porny| 国产女人aaa级久久久级| 国内精品免费**视频| 日韩西西人体444www| 亚欧色一区w666天堂| 91麻豆国产在线观看| 亚洲欧洲另类国产综合| 国产不卡视频在线观看| 国产亚洲一区字幕| 国模娜娜一区二区三区| 日韩欧美专区在线| 免费在线看成人av| 欧美一级日韩免费不卡| 天堂资源在线中文精品| 欧美性猛交xxxx黑人交| 亚洲综合视频网| 欧美日韩久久久| 性做久久久久久免费观看欧美| 欧美性猛交xxxxxxxx| 日日摸夜夜添夜夜添精品视频|