本文整理汇总了Java中org.microemu.device.DeviceFactory.getDevice方法的典型用法代码示例。如果您正苦于以下问题:Java DeviceFactory.getDevice方法的具体用法?Java DeviceFactory.getDevice怎么用?Java DeviceFactory.getDevice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.microemu.device.DeviceFactory
的用法示例。
在下文中一共展示了DeviceFactory.getDevice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: SwtDisplayGraphics
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
public SwtDisplayGraphics(SwtGraphics a_g, MutableImage a_image)
{
this.g = a_g;
this.image = a_image;
Device device = DeviceFactory.getDevice();
this.g.setBackground(g.getColor(new RGB(
((SwtDeviceDisplay) device.getDeviceDisplay()).getBackgroundColor().getRed(),
((SwtDeviceDisplay) device.getDeviceDisplay()).getBackgroundColor().getGreen(),
((SwtDeviceDisplay) device.getDeviceDisplay()).getBackgroundColor().getBlue())));
SwtFont tmpFont = (SwtFont) ((SwtFontManager) device.getFontManager()).getFont(currentFont);
this.g.setFont(tmpFont.getFont());
if (device.getDeviceDisplay().isColor()) {
this.filter = new RGBImageFilter();
} else {
if (device.getDeviceDisplay().numColors() == 2) {
this.filter = new BWImageFilter();
} else {
this.filter = new GrayImageFilter();
}
}
}
示例2: onTouchEvent
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
Device device = DeviceFactory.getDevice();
AndroidInputMethod inputMethod = (AndroidInputMethod) device.getInputMethod();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN :
inputMethod.pointerPressed((int) event.getX(), (int) event.getY());
break;
case MotionEvent.ACTION_UP :
inputMethod.pointerReleased((int) event.getX(), (int) event.getY());
break;
case MotionEvent.ACTION_MOVE :
inputMethod.pointerDragged((int) event.getX(), (int) event.getY());
break;
default:
return false;
}
return true;
}
示例3: mouseReleased
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
public void mouseReleased(MouseEvent e) {
mouseButtonDown = false;
MouseRepeatedTimerTask.stop();
if (pressedButton == null) {
return;
}
if (MIDletBridge.getCurrentMIDlet() == null) {
return;
}
Device device = DeviceFactory.getDevice();
J2SEInputMethod inputMethod = (J2SEInputMethod) device.getInputMethod();
J2SEButton prevOverButton = J2SEDeviceButtonsHelper.getSkinButton(e);
if (prevOverButton != null) {
inputMethod.buttonReleased(prevOverButton, '\0');
}
pressedButton = null;
// optimize for some video cards.
if (prevOverButton != null) {
repaint(prevOverButton.getShape().getBounds());
} else {
repaint();
}
}
示例4: onKeyDown
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (MIDletBridge.getCurrentMIDlet() == null) {
return false;
}
// KEYCODE_SOFT_LEFT == menu key
if (keyCode == KeyEvent.KEYCODE_SOFT_LEFT) {
return false;
}
Device device = DeviceFactory.getDevice();
((AndroidInputMethod) device.getInputMethod()).buttonPressed(event);
return true;
}
示例5: onKeyUp
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (MIDletBridge.getCurrentMIDlet() == null) {
return false;
}
// KEYCODE_SOFT_LEFT == menu key
if (keyCode == KeyEvent.KEYCODE_SOFT_LEFT) {
return false;
}
Device device = DeviceFactory.getDevice();
((AndroidInputMethod) device.getInputMethod()).buttonReleased(event);
return true;
}
示例6: onTouchEvent
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
if (overlay != null && overlay.onTouchEvent(event)) {
return true;
}
Device device = DeviceFactory.getDevice();
AndroidInputMethod inputMethod = (AndroidInputMethod) device.getInputMethod();
int x = (int) event.getX();
int y = (int) event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN :
inputMethod.pointerPressed(x, y);
pressedX = x;
pressedY = y;
break;
case MotionEvent.ACTION_UP :
inputMethod.pointerReleased(x, y);
break;
case MotionEvent.ACTION_MOVE :
if (x > (pressedX - FIRST_DRAG_SENSITIVITY_X) && x < (pressedX + FIRST_DRAG_SENSITIVITY_X)
&& y > (pressedY - FIRST_DRAG_SENSITIVITY_Y) && y < (pressedY + FIRST_DRAG_SENSITIVITY_Y)) {
} else {
pressedX = -FIRST_DRAG_SENSITIVITY_X;
pressedY = -FIRST_DRAG_SENSITIVITY_Y;
inputMethod.pointerDragged(x, y);
}
break;
default:
return false;
}
return true;
}
示例7: onKeyUp
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && ignoreBackKeyUp) {
ignoreBackKeyUp = false;
return true;
}
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return false;
}
final DisplayAccess da = ma.getDisplayAccess();
if (da == null) {
return false;
}
AndroidDisplayableUI ui = (AndroidDisplayableUI) da.getDisplayableUI(da.getCurrent());
if (ui == null) {
return false;
}
if (ui instanceof AndroidCanvasUI) {
if (ignoreKey(keyCode)) {
return false;
}
Device device = DeviceFactory.getDevice();
((AndroidInputMethod) device.getInputMethod()).buttonReleased(event);
return true;
}
return super.onKeyUp(keyCode, event);
}
示例8: paintControls
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
public void paintControls(SwtGraphics g) {
Device device = DeviceFactory.getDevice();
g.setBackground(g.getColor(new RGB(backgroundColor.getRed(), backgroundColor.getGreen(), backgroundColor
.getBlue())));
g.fillRectangle(0, 0, displayRectangle.width, displayPaintable.y);
g.fillRectangle(0, displayPaintable.y, displayPaintable.x, displayPaintable.height);
g.fillRectangle(displayPaintable.x + displayPaintable.width, displayPaintable.y, displayRectangle.width
- displayPaintable.x - displayPaintable.width, displayPaintable.height);
g.fillRectangle(0, displayPaintable.y + displayPaintable.height, displayRectangle.width,
displayRectangle.height - displayPaintable.y - displayPaintable.height);
g.setForeground(g.getColor(new RGB(foregroundColor.getRed(), foregroundColor.getGreen(), foregroundColor
.getBlue())));
for (Enumeration s = device.getSoftButtons().elements(); s.hasMoreElements();) {
((SwtSoftButton) s.nextElement()).paint(g);
}
int inputMode = device.getInputMethod().getInputMode();
if (inputMode == InputMethod.INPUT_123) {
g.drawImage(((SwtImmutableImage) mode123Image.getImage()).getImage(), mode123Image.getRectangle().x,
mode123Image.getRectangle().y);
} else if (inputMode == InputMethod.INPUT_ABC_UPPER) {
g.drawImage(((SwtImmutableImage) modeAbcUpperImage.getImage()).getImage(),
modeAbcUpperImage.getRectangle().x, modeAbcUpperImage.getRectangle().y);
} else if (inputMode == InputMethod.INPUT_ABC_LOWER) {
g.drawImage(((SwtImmutableImage) modeAbcLowerImage.getImage()).getImage(),
modeAbcLowerImage.getRectangle().x, modeAbcLowerImage.getRectangle().y);
}
}
示例9: keyReleased
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
public void keyReleased(KeyEvent ev) {
if (MIDletBridge.getCurrentMIDlet() == null) {
return;
}
Device device = DeviceFactory.getDevice();
for (Iterator it = device.getButtons().iterator(); it.hasNext();) {
SwtButton button = (SwtButton) it.next();
if (ev.keyCode == button.getKeyboardKey()) {
ev.keyCode = button.getKeyCode();
break;
}
}
((SwtInputMethod) device.getInputMethod()).keyReleased(ev);
prevOverButton = pressedButton;
pressedButton = null;
if (prevOverButton != null) {
org.microemu.device.impl.Shape shape = prevOverButton.getShape();
if (shape != null) {
Rectangle r = shape.getBounds();
redraw(r.x, r.y, r.width, r.height, true);
}
} else {
redraw();
}
}
示例10: paintControls
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
public void paintControls(Graphics g) {
Device device = DeviceFactory.getDevice();
g.setColor(backgroundColor);
g.fillRect(0, 0, displayRectangle.width, displayPaintable.y);
g.fillRect(0, displayPaintable.y, displayPaintable.x, displayPaintable.height);
g.fillRect(displayPaintable.x + displayPaintable.width, displayPaintable.y, displayRectangle.width
- displayPaintable.x - displayPaintable.width, displayPaintable.height);
g.fillRect(0, displayPaintable.y + displayPaintable.height, displayRectangle.width, displayRectangle.height
- displayPaintable.y - displayPaintable.height);
g.setColor(foregroundColor);
for (Enumeration s = device.getSoftButtons().elements(); s.hasMoreElements();) {
((J2SESoftButton) s.nextElement()).paint(g);
}
int inputMode = device.getInputMethod().getInputMode();
if (inputMode == InputMethod.INPUT_123) {
g.drawImage(((J2SEImmutableImage) mode123Image.getImage()).getImage(), mode123Image.getRectangle().x,
mode123Image.getRectangle().y, null);
} else if (inputMode == InputMethod.INPUT_ABC_UPPER) {
g.drawImage(((J2SEImmutableImage) modeAbcUpperImage.getImage()).getImage(), modeAbcUpperImage
.getRectangle().x, modeAbcUpperImage.getRectangle().y, null);
} else if (inputMode == InputMethod.INPUT_ABC_LOWER) {
g.drawImage(((J2SEImmutableImage) modeAbcLowerImage.getImage()).getImage(), modeAbcLowerImage
.getRectangle().x, modeAbcLowerImage.getRectangle().y, null);
}
}
示例11: getDeviceInformation
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
private static DeviceInformation getDeviceInformation() {
Device dev = DeviceFactory.getDevice();
DeviceInformation inf;
synchronized (J2SEDeviceButtonsHelper.class) {
inf = (DeviceInformation) devices.get(dev);
if (inf == null) {
inf = createDeviceInformation(dev);
}
}
return inf;
}
示例12: mouseReleased
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
public void mouseReleased(MouseEvent e) {
if (MIDletBridge.getCurrentMIDlet() == null) {
return;
}
Device device = DeviceFactory.getDevice();
J2SEInputMethod inputMethod = (J2SEInputMethod) device.getInputMethod();
boolean fullScreenMode = device.getDeviceDisplay().isFullScreenMode();
if (device.hasPointerEvents()) {
if (!fullScreenMode) {
if (initialPressedSoftButton != null && initialPressedSoftButton.isPressed()) {
initialPressedSoftButton.setPressed(false);
org.microemu.device.impl.Rectangle pb = initialPressedSoftButton.getPaintable();
if (pb != null) {
repaintRequest(pb.x, pb.y, pb.width, pb.height);
if (pb.contains(e.getX(), e.getY())) {
Command cmd = initialPressedSoftButton.getCommand();
if (cmd != null) {
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return;
}
DisplayAccess da = ma.getDisplayAccess();
if (da == null) {
return;
}
da.commandAction(cmd, da.getCurrent());
}
}
}
}
initialPressedSoftButton = null;
}
Point p = deviceCoordinate(device.getDeviceDisplay(), e.getPoint());
inputMethod.pointerReleased(p.x, p.y);
}
}
示例13: getPreferredSize
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
public Dimension getPreferredSize() {
Device device = DeviceFactory.getDevice();
if (device == null) {
return new Dimension(0, 0);
}
return new Dimension(device.getDeviceDisplay().getFullWidth(), device.getDeviceDisplay().getFullHeight());
}
示例14: repaintRequest
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
public void repaintRequest(int x, int y, int width, int height) {
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return;
}
DisplayAccess da = ma.getDisplayAccess();
if (da == null) {
return;
}
Displayable current = da.getCurrent();
if (current == null) {
return;
}
Device device = DeviceFactory.getDevice();
if (device != null) {
synchronized (this) {
if (displayImage == null) {
displayImage = new J2SEMutableImage(device.getDeviceDisplay().getFullWidth(), device
.getDeviceDisplay().getFullHeight());
}
synchronized (displayImage) {
Graphics gc = displayImage.getImage().getGraphics();
J2SEDeviceDisplay deviceDisplay = (J2SEDeviceDisplay) device.getDeviceDisplay();
deviceDisplay.paintDisplayable(gc, x, y, width, height);
if (!deviceDisplay.isFullScreenMode()) {
deviceDisplay.paintControls(gc);
}
}
fireDisplayRepaint(displayImage);
}
}
repaint();
}
示例15: onKeyUp
import org.microemu.device.DeviceFactory; //导入方法依赖的package包/类
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && ignoreBackKeyUp) {
ignoreBackKeyUp = false;
return true;
}
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return false;
}
final DisplayAccess da = ma.getDisplayAccess();
if (da == null) {
return false;
}
AndroidDisplayableUI ui = (AndroidDisplayableUI) da.getDisplayableUI(da.getCurrent());
if (ui == null) {
return false;
}
if (ui instanceof AndroidCanvasUI) {
if (ignoreKey(keyCode)) {
return false;
}
Device device = DeviceFactory.getDevice();
((AndroidInputMethod) device.getInputMethod()).buttonReleased(event);
return true;
}
return super.onKeyUp(keyCode, event);
}