📄 stockscreen.java
字号:
import javax.microedition.lcdui.*;
public class StockScreen extends Form
{
private StringItem _symbolField = null;
private StringItem _numSharesField = null;
protected TextField _symbolEntry = null;
protected TextField _numEntry = null;
protected Command nextCommand = null;
protected Command backCommand = null;
protected Controller _controller = null;
protected StockDatabase _stockDB = null;
public StockScreen(String title, Controller controller)
{
super(title);
_controller = controller;
_stockDB = controller.getStockDatabase();
}
public void displayScreen(String symbol, int numShares)
{
_symbolField = new StringItem("Stock Symbol: ", symbol);
_numSharesField = new StringItem("Num Shares: ", ""+ numShares);
append(_symbolField);
append(_numSharesField);
generateButtons();
}
public void displayScreen()
{
_symbolEntry = new TextField("Enter Stock Symbol", "", 6, TextField.ANY);
_numEntry = new TextField("Enter Num Shares", "", 10, TextField.NUMERIC);
append(_symbolEntry);
append(_numEntry);
generateButtons();
}
public void generateButtons()
{
this.nextCommand = new Command("Next", Command.SCREEN, 1);
this.backCommand = new Command("Back", Command.BACK, 1);
this.addCommand(backCommand);
this.addCommand(nextCommand);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -