📄 post.java
字号:
/* * Copyright (C) 2004 MobileBlogger Development Team */package net.sourceforge.mobileblogger;import java.io.*;import java.util.*;import javax.microedition.lcdui.*;import javax.microedition.midlet.*;import javax.microedition.rms.*;public class Post extends TextBox implements CommandListener, Runnable { private MIDlet midlet; private Display display; private RecordStore settingsDB; private static final int MAXSIZE = 4096; private final static Command CMD_OK = new Command("OK", Command.ITEM, 1); private final static Command CMD_NEXT = new Command("Next", Command.ITEM, 1); private final static Command CMD_ENTER = new Command("Enter", Command.ITEM, 1); private final static Command CMD_SETSITE = new Command("OK", Command.ITEM, 1); private final static Command CMD_SETUSER = new Command("OK", Command.ITEM, 2); private final static Command CMD_BACK = new Command("Back", Command.BACK, 2); private final static Command CMD_EXIT = new Command("Exit", Command.STOP, 3); private final static Command CMD_POST = new Command("Post", Command.OK, 1); private final static Command CMD_SAVE = new Command("Save", Command.OK, 1); public Post(MIDlet m, Display d) { super("Post an entry", null, MAXSIZE, TextField.ANY); midlet = m; display = d; addCommand(CMD_BACK); addCommand(CMD_POST); setCommandListener(this); } public void run() { String inputUser = null; String inputPass = null; String inputBlog = null; inputUser = BloggerSettings.getUsername(); inputPass = BloggerSettings.getPassword(); inputBlog = BloggerSettings.getBlogid(); Vector v = null; try { v = BloggerProtocol.newPost(MobileBlogger.APPKEY, inputBlog, inputUser, inputPass, this.getString(), true); } catch(SecurityException se) { Alert a = new Alert("Action Not Allowed", "You must restart the program to enable this action.", null, AlertType.INFO); display.setCurrent(a); return; } if(v!=null) { Alert a = new Alert("Blog Results", "Blog Successfully Published!", null, AlertType.INFO); display.setCurrent(a); display.setCurrent( new Menu(midlet, display) ); } else { String text = "XMLRPC Error"; Alert a = new Alert("Sorry we are not enable to Publish the Blog. Check your settings!", text, null, AlertType.INFO); display.setCurrent(a); } } public void post() { new Thread(this).start(); } public void commandAction(Command c, Displayable d) { if (c == CMD_POST) { post(); } else if (c == CMD_BACK) { display.setCurrent( new Menu(midlet, display) ); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -