本文整理汇总了Java中javax.microedition.lcdui.StringItem类的典型用法代码示例。如果您正苦于以下问题:Java StringItem类的具体用法?Java StringItem怎么用?Java StringItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringItem类属于javax.microedition.lcdui包,在下文中一共展示了StringItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cycleDemoStyles
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
public static void cycleDemoStyles(boolean demo) {
try{
//Below exists to make the style pop into code if it exists.
//#style demotitle?
UiAccess.setStyle(new StringItem("test","test"));
//#style normaltitle?
UiAccess.setStyle(new StringItem("test","test"));
Style title = StyleSheet.getStyle("title");
Style demotitle = StyleSheet.getStyle("demotitle");
Style normaltitle = StyleSheet.getStyle("normaltitle");
if(title == null || demotitle == null || normaltitle ==null) {
return;
}
if(demo) {
title.background = demotitle.background;
} else {
title.background = normaltitle.background;
}
} catch (Exception e) {
//Don't worry about this, this is all gravy anyway
e.printStackTrace();
}
}
示例2: addRMSInfoJ2MEOnly
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
private void addRMSInfoJ2MEOnly () {
try {
String[] stores = RecordStore.listRecordStores();
for (int i = 0; i < stores.length; i++) {
String rmsName = stores[i];
RecordStore rms = RecordStore.openRecordStore(rmsName, false);
int size = rms.getSize();
// int avail = rms.getSizeAvailable();
int numRecs = rms.getNumRecords();
int perRecord = (numRecs == 0 ? -1 : size / numRecs);
this.append(new StringItem(null, rmsName));
this.append(new StringItem(null, "Used: " + formatBytes(size)));
this.append(new StringItem(null, "Records: " + numRecs + (numRecs > 0 ? " (" + formatBytes(perRecord) + " per record)" : "")));
//this.append(new StringItem(null, "Available: " + formatBytes(avail)));
}
} catch (RecordStoreException rse) { }
}
示例3: AboutForm
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
public AboutForm(WandersmannMIDlet midlet) {
super("About Wandersmann");
this.midlet = midlet;
append(new StringItem("Name", midlet.getAppProperty("MIDlet-Name")));
append(new StringItem("Version", midlet.getAppProperty("MIDlet-Version")));
append(new StringItem("Author", midlet.getAppProperty("MIDlet-Vendor")));
append(new Spacer(getWidth(), 5));
append("Geodata � OpenStreetMap and contributors, CC-BY-SA");
append(new Spacer(getWidth(), 5));
append("This program is free software: you can redistribute it and/or modify"
+ " it under the terms of the GNU General Public License as published by "
+ "the Free Software Foundation, either version 3 of the License, or "
+ "(at your option) any later version.");
addCommand(BACK);
setCommandListener(this);
}
示例4: RecordStoreForm
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
public RecordStoreForm() {
super("RecordStore");
addCommand(loadCommand);
addCommand(storeCommand);
addCommand(deleteCommand);
addCommand(listCommand);
textFiled = new TextField("Enter data", "", 128, TextField.ANY);
append(textFiled);
stringItem = new StringItem("Loaded data", "n/a");
append(stringItem);
messageItem = new StringItem("Info:", "Use menu to load and store data");
append(messageItem);
}
示例5: HTTPPanel
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
public HTTPPanel() {
super("HTTP Connection");
String host = SimpleDemoMIDlet.instance.getAppProperty("microemu.accessible.host");
if (host == null) {
demoLocation = "http://www.microemu.org/test/";
} else {
demoLocation = "http://" + host + "/test/";
}
append(url = new TextField("URL:", demoLocation, 128, TextField.URL));
append(message = new StringItem("Message:", null));
append(status = new StringItem("Status:", null));
addCommand(goCommand);
}
示例6: waitForInput
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
/**
* Blocks current thread until some text is put
* into text field and "input" button is pressed.
*/
private synchronized String waitForInput() {
input.setString("");
append(input);
inputvisible = true;
addCommand(cmdInput);
try {
wait();
} catch (InterruptedException ie) {
print("interrupted");
}
delete(size()-1);
append(new StringItem(input.getLabel(), input.getString()+'\n'));
inputvisible = false;
removeCommand(cmdInput);
return input.getString()+'\n';
}
示例7: setupFields
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
private void setupFields() {
imageItem = new ImageItem("Category: " + note.getCategory().toString(), note.getCategory().getIcon(), 0, "ctgimg");
titleItem = new StringItem("Title", null);
titleItem.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE));
contentItem = new StringItem("Content", null);
dateItem = new StringItem("Date", null);
priorityItem = new StringItem("Priority", null);
this.append(imageItem);
this.append(titleItem);
this.append(contentItem);
this.append(dateItem);
this.append(priorityItem);
}
示例8: FormTransportSubmitStatusScreen
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
public FormTransportSubmitStatusScreen(CommandListener listener, TransportResponseProcessor responder) {
//#style submitPopup
super(Localization.get("sending.status.title"));
setCommandListener(listener);
this.responder = responder;
//#style submitText
this.msg = new StringItem(null, Localization.get("sending.status.going"));
append(new Spacer(80, 0));
append(this.msg);
}
示例9: setMessage
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
private void setMessage() {
append(new Spacer(80, 0));
if (this.ids.size() == 0) {
this.msg = new StringItem(null, Localization.get("sending.status.none"));
} else {
this.msg = new StringItem(null, getCurrentDisplay());
}
append(this.msg);
}
示例10: RecordForm
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
public RecordForm(){
super("Record Audio");
messageItem = new StringItem("Record", "Click record to start recording.");
this.append(messageItem);
errorItem = new StringItem("", "");
this.append(errorItem);
recordCommand = new Command("Record", Command.SCREEN, 1);
this.addCommand(recordCommand);
playCommand = new Command("Play", Command.SCREEN, 2);
this.addCommand(playCommand);
// StringBuffer inhalt = new StringBuffer();
this.setCommandListener(this);
}
示例11: RecorderForm
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
public RecorderForm()
{
super("Record Audio");
messageItem = new StringItem("", "Press Record to start recording.");
append(messageItem);
errorItem = new StringItem("", "");
append(errorItem);
//StringBuffer inhalt = new StringBuffer();
}
示例12: loadLogs
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
private void loadLogs() {
view.deleteAll();
this.view.removeCommand(ok);
try {
//TODO: Start from other end of logs
Logger._().serializeLogs(new StreamLogSerializer() {
String prevDateStr;
protected void serializeLog(LogEntry entry) throws IOException {
String fullDateStr = DateUtils.formatDateTime(entry.getTime(), DateUtils.FORMAT_ISO8601).substring(0, 19);
String dateStr = fullDateStr.substring(11);
if (prevDateStr == null || !fullDateStr.substring(0, 10).equals(prevDateStr.substring(0, 10))) {
view.append("= " + fullDateStr.substring(0, 10) + " =");
}
prevDateStr = fullDateStr;
String line = dateStr + ":" + entry.getType() + "> " + entry.getMessage();
view.append(new StringItem("", line));
}
}, max_entries);
} catch (IOException e) {
view.append(new StringItem("", "Error reading logs..."));
}
int count = Logger._().logSize();
if(count > max_entries) {
view.append("..." + count + " More");
}
addCmd();
}
示例13: start
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
public void start () {
messages = new Vector<String>();
//#style networkTestForm
interactiveView = new FramedForm(Localization.get("network.test.title"));
exit = new Command(Localization.get("polish.command.ok"), Command.BACK, 0);
back = new Command(Localization.get("polish.command.back"), Command.BACK, 0);
details = new Command(Localization.get("network.test.details"), Command.SCREEN, 2);
interactiveView.setCommandListener(this);
interactiveView.addCommand(exit);
//#style networkTestImage
imageView = new ImageItem(null, null, ImageItem.LAYOUT_CENTER | ImageItem.LAYOUT_VCENTER, "");
interactiveMessage = new StringItem(null, "");
interactiveView.append(Graphics.TOP, imageView);
interactiveView.append(interactiveMessage);
J2MEDisplay.setView(interactiveView);
final GPRSTestState parent = this;
new HandledThread () {
public void _run () {
networkTest(parent);
}
}.start();
}
示例14: addLine
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
public void addLine (String line) {
Date now = new Date();
if (start == null)
start = now;
int diff = (int)(now.getTime() - start.getTime()) / 10;
String sDiff = (diff / 100) + "." + DateUtils.intPad(diff % 100, 2);
view.append(new StringItem("", sDiff + ": " + line));
}
示例15: showResults
import javax.microedition.lcdui.StringItem; //导入依赖的package包/类
private void showResults (Vector log) {
String[] lines = new String[log.size()];
for (int i = 0; i < lines.length; i++) {
lines[i] = (String)log.elementAt(i);
}
Form f = new Form("Test Result");
for (int i = 0; i < lines.length; i++) {
f.append(new StringItem(null, lines[i]));
}
Display.getDisplay(this).setCurrent(f);
}