本文整理汇总了Java中javax.microedition.lcdui.Display类的典型用法代码示例。如果您正苦于以下问题:Java Display类的具体用法?Java Display怎么用?Java Display使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Display类属于javax.microedition.lcdui包,在下文中一共展示了Display类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startApp
import javax.microedition.lcdui.Display; //导入依赖的package包/类
public void startApp() {
if (isInitialized) {
return;
}
form = new Form("Heart Diag Application");
form.append(textFieldSampleUrl);
form.append(stringItemStatus);
signalItem.setPreferredSize(form.getWidth(), form.getHeight() - textFieldSampleUrl.getPreferredHeight() - stringItemStatus.getPreferredHeight());
form.append(signalItem);
form.addCommand(exitCommand);
form.addCommand(chooseCommand);
form.addCommand(drawCommand);
form.setCommandListener(this);
Display.getDisplay(this).setCurrent(form);
alert.addCommand(new Command("Back", Command.SCREEN, 1));
isInitialized = true;
}
示例2: displayAndCalculate
import javax.microedition.lcdui.Display; //导入依赖的package包/类
public void displayAndCalculate() {
try {
Display.getDisplay(this).setCurrent(form);
FileConnection fileConnection = (FileConnection) Connector.open(textFieldSampleUrl.getString(), Connector.READ);
InputStream inputStream = fileConnection.openInputStream();
currentSignal = SignalFactory.fromStream(inputStream);
((SimpleSignal) currentSignal).calculateMaxAltitude();
((SimpleSignal) currentSignal).calculateHighPoints();
PanAndTimpkins panAndTimpkins = new PanAndTimpkins();
panAndTimpkins.analyze(currentSignal);
String diseaseName;
if (panAndTimpkins.getDistanceTimeAverage() < 0.6) {
diseaseName = "Sinus Tachycardia";
} else if (panAndTimpkins.getDistanceTimeAverage() > 1.0) {
diseaseName = "Sinus Bradicardia";
} else if (panAndTimpkins.getDistanceTimeAverage() >= 0.6 && panAndTimpkins.getDistanceTimeAverage() <= 1.0) {
diseaseName = "HEALTHY - No Disease!";
} else {
diseaseName = "Atrial Fibrillation";
}
stringItemStatus.setText("Disease: " + diseaseName);
signalItem.setSignal(currentSignal);
} catch (IOException e) {
}
}
示例3: displayAndCalculate
import javax.microedition.lcdui.Display; //导入依赖的package包/类
public void displayAndCalculate() {
try {
Display.getDisplay(this).setCurrent(form);
FileConnection fileConnection = (FileConnection) Connector.open(textFieldSampleUrl.getString(), Connector.READ);
InputStream inputStream = fileConnection.openInputStream();
FileReader fileReader = new FileReader(inputStream);
String totalString = "";
Vector lines = fileReader.readLines();
for (int i = 0; i < lines.size(); i++) {
String line = (String)lines.elementAt(i);
totalString += line + "\r\n";
}
stringItemStatus.setText(totalString);
} catch (IOException e) {
}
}
示例4: getScreenHeight
import javax.microedition.lcdui.Display; //导入依赖的package包/类
public static int getScreenHeight(int fallback) {
int staticHeight = -1;
int guess = de.enough.polish.ui.Display.getScreenHeight();
//#ifdef polish.fullcanvasheight:defined
//#= staticHeight = ${ polish.fullcanvasheight };
//#elifdef polish.screenheight:defined
//#= staticHeight = ${ polish.screenheight };
//#endif
if(guess == -1 && staticHeight == -1) {
return fallback;
} else if(guess != 1) {
return guess;
} else {
return staticHeight;
}
}
示例5: getScreenWidth
import javax.microedition.lcdui.Display; //导入依赖的package包/类
public static int getScreenWidth(int fallback) {
int staticWidth = -1;
int guess = de.enough.polish.ui.Display.getScreenWidth();
//#ifdef polish.fullcanvaswidth:defined
//#= staticWidth = ${ polish.fullcanvaswidth };
//#elifdef polish.screenwidth:defined
//#= staticWidth = ${ polish.screenwidth };
//#endif
if(guess == -1 && staticWidth == -1) {
return fallback;
} else if(guess != 1) {
return guess;
} else {
return staticWidth;
}
}
示例6: commandAction
import javax.microedition.lcdui.Display; //导入依赖的package包/类
public void commandAction(Command cmd, Displayable disp) {
if (cmd.equals(RadioPlayerView.CMD_START)) {
int selIdx = stationChoice.getSelectedIndex();
RadioPlayerView playerView = new RadioPlayerView(selIdx, midlet);
RadioPlayer player = new RadioPlayer(selIdx);
Display.getDisplay(midlet).setCurrent(playerView);
playerView.setPlayer(player);
player.startPlayer();
} else if (cmd.equals(RadioPlayerView.CMD_EXIT)) {
this.midlet.destroyApp(false);
this.midlet.notifyDestroyed();
} else if (cmd.equals(ABOUT)) {
Display.getDisplay(midlet).setCurrent(new AboutForm(midlet));
} else if (cmd.equals(HELP)) {
Display.getDisplay(midlet).setCurrent(new HelpForm(midlet));
}
}
示例7: startApp
import javax.microedition.lcdui.Display; //导入依赖的package包/类
protected void startApp() throws MIDletStateChangeException
{
DeviceControl.setLights( 0, 100 );
Display disp = Display.getDisplay( this );
try
{
iCanvas = new PanoramaCanvas( Image.createImage(PHOTO_NAME), this );
disp.setCurrent( iCanvas );
iConnection = openAccelerationSensor();
if (iConnection != null)
iConnection.setDataListener( this, BUFFER_SIZE );
}
catch (IOException e)
{
e.printStackTrace();
}
}
示例8: getDisplayEventHandler
import javax.microedition.lcdui.Display; //导入依赖的package包/类
/**
* Return a reference to the singleton display manager object.
*
* @param token security token with the MIDP permission "allowed"
*
* @return display manager reference.
*/
public static DisplayEventHandler
getDisplayEventHandler(SecurityToken token) {
token.checkIfPermissionAllowed(Permissions.MIDP);
if (managerImpl != null) {
return managerImpl;
}
/**
* The display manager implementation is a private class of Display
* and is create in the class init of Display, we need to call a
* static method of display to get the class init to run, because
* some classes need to get the display manager to create a display
*/
try {
// this will yield a null pointer exception on purpose
Display.getDisplay(null);
} catch (NullPointerException npe) {
// this is normal for this case, do nothing
}
return managerImpl;
}
示例9: midletActivated
import javax.microedition.lcdui.Display; //导入依赖的package包/类
/**
* Called after a MIDlet is successfully activated. This is after
* the startApp method is called.
*
* @param suite reference to the loaded suite
* @param midlet reference to the MIDlet
*/
public void midletActivated(MIDletSuite suite, MIDlet midlet) {
String className = midlet.getClass().getName();
/*
* JAMS UE feature: If a MIDlet has not set a current displayable
* in its display by the time it has returned from startApp,
* display the headless alert. The headless alert has been
* set as the initial displayable but for the display but the
* foreground has not been requested, to avoid displaying the
* alert for MIDlet that do set a current displayable.
*/
if (!previouslyActive) {
previouslyActive = true;
if (Display.getDisplay(midlet).getCurrent() == null) {
displayContainer.requestForegroundForDisplay(className);
}
}
midletControllerEventProducer.sendMIDletActiveNotifyEvent(
suite.getID(), className);
}
示例10: startApp
import javax.microedition.lcdui.Display; //导入依赖的package包/类
public void startApp() {
Display display = Display.getDisplay(this);
BouncyColors bouncyColors = new BouncyColors();
display.setCurrent(bouncyColors);
for (int i = 0; i < 16; i++) {
Thread thread = new Thread(new Worker(), "T" + i);
thread.setPriority(Thread.MIN_PRIORITY);
thread.start();
}
Thread current = Thread.currentThread();
current.setPriority(Thread.MAX_PRIORITY);
while (true) {
bouncyColors.repaint();
try {
Thread.sleep(16);
} catch (InterruptedException e) {}
}
}
示例11: Screen
import javax.microedition.lcdui.Display; //导入依赖的package包/类
public Screen(Display display) {
super();
this.setFullScreenMode(true);
this.parentDisplay = display;
updateOrientation();
try {
// Create background image
this.background = Image.createImage("midlets/blogwriter/images/Background.png");
} catch (IOException e) {
this.parentDisplay.setCurrent(
new Alert("Cannot create graphics."), this);
}
VirtualKeyboard.setVisibilityListener(this);
}
示例12: createEventDispatcher
import javax.microedition.lcdui.Display; //导入依赖的package包/类
public EventDispatcher createEventDispatcher(Display display) {
EventDispatcher eventDispatcher = new EventDispatcher();
Thread thread = new Thread(eventDispatcher, EventDispatcher.EVENT_DISPATCHER_NAME);
thread.setDaemon(true);
thread.start();
return eventDispatcher;
}
示例13: startApp
import javax.microedition.lcdui.Display; //导入依赖的package包/类
protected void startApp() throws MIDletStateChangeException {
// TODO Auto-generated method stub
display=Display.getDisplay(this);
list.append("����Ϸ", null);
list.append("�������", null);
list.append("��Ϸ˵��", null);
list.addCommand(cmd_ok);
list.addCommand(cmd_back);
list.setCommandListener(this);
display.setCurrent(list);
predisplay=display.getCurrent(); //��ʼ��ǰһ����ʾ
form=new Form("");
form.addCommand(cmd_back);
form.addCommand(cmd_ok);
}
示例14: startApp
import javax.microedition.lcdui.Display; //导入依赖的package包/类
public void startApp() {
if (isInitialized) {
return;
}
form = new Form("Heart Diag Application");
form.append(textFieldSampleUrl);
form.append(stringItemStatus);
form.addCommand(exitCommand);
form.addCommand(chooseCommand);
form.setCommandListener(this);
Display.getDisplay(this).setCurrent(form);
alert.addCommand(new Command("Back", Command.SCREEN, 1));
isInitialized = true;
}
示例15: commandAction
import javax.microedition.lcdui.Display; //导入依赖的package包/类
public void commandAction(Command c, Displayable d) {
if (c == exitCommand) {
destroyApp(false);
notifyDestroyed();
} else if (c == chooseCommand) {
FileSelector f = new FileSelector(this);
Display.getDisplay(this).setCurrent(f);
}
}