public Device getDevice() { return DeviceFactory.getDevice(); }
public void setDevice(Device device) { MIDletSystemProperties.setDevice(device); DeviceFactory.setDevice(device); }
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; }
if (deviceParameter == null) { device = new J2SEDevice(); DeviceFactory.setDevice(device); device.init(emulatorContext); } else { Class cl = Class.forName(deviceParameter); device = (DeviceImpl) cl.newInstance(); DeviceFactory.setDevice(device); device.init(emulatorContext); } catch (ClassNotFoundException ex) { device = DeviceImpl.create(emulatorContext, Main.class.getClassLoader(), deviceParameter, J2SEDevice.class); DeviceFactory.setDevice(device); } catch (IOException ex1) { Logger.error(ex);
private J2SEButton getButtonByButtonName(ButtonName buttonName) { J2SEButton result; for (Enumeration e = DeviceFactory.getDevice().getButtons().elements(); e.hasMoreElements();) { result = (J2SEButton) e.nextElement(); if (result.getFunctionalName() == buttonName) { return result; } } return null; } }
public void mouseMoved(MouseEvent e) { if (showMouseCoordinates) { StringBuffer buf = new StringBuffer(); Point p = deviceCoordinate(DeviceFactory.getDevice().getDeviceDisplay(), e.getPoint()); buf.append(p.x).append(",").append(p.y); Common.setStatusBar(buf.toString()); } }
/** * @return a string name for the key * @throws IllegalArgumentException * if <code>keyCode</code> is not a valid key code */ public String getKeyName(int keyCode) throws IllegalArgumentException { for (Iterator it = DeviceFactory.getDevice().getButtons().iterator(); it.hasNext();) { J2SEButton button = (J2SEButton) it.next(); if (button.getKeyCode() == keyCode) { return button.getName(); } } return Character.toString((char) keyCode); }
public static J2SEButton getSkinButton(MouseEvent ev) { for (Enumeration en = DeviceFactory.getDevice().getButtons().elements(); en.hasMoreElements();) { J2SEButton button = (J2SEButton) en.nextElement(); if (button.getShape() != null) { if (button.getShape().contains(ev.getX(), ev.getY())) { return button; } } } return null; }
public static SoftButton getSoftButton(MouseEvent ev) { Iterator it = DeviceFactory.getDevice().getSoftButtons().iterator(); while (it.hasNext()) { SoftButton button = (SoftButton) it.next(); if (button.isVisible()) { org.microemu.device.impl.Rectangle pb = button.getPaintable(); if (pb != null && pb.contains(ev.getX(), ev.getY())) { return button; } } } return null; }
public void setScrollDown(boolean state) { Enumeration en = DeviceFactory.getDevice().getSoftButtons().elements(); while (en.hasMoreElements()) { SoftButton button = (SoftButton) en.nextElement(); if (button.getType() == SoftButton.TYPE_ICON && button.getName().equals("down")) { button.setVisible(state); } } }
public void setScrollDown(boolean state) { Enumeration en = DeviceFactory.getDevice().getSoftButtons().elements(); while (en.hasMoreElements()) { SoftButton button = (SoftButton) en.nextElement(); if (button.getType() == SoftButton.TYPE_ICON && button.getName().equals("down")) { button.setVisible(state); } } }
public void setScrollUp(boolean state) { Enumeration en = DeviceFactory.getDevice().getSoftButtons().elements(); while (en.hasMoreElements()) { SoftButton button = (SoftButton) en.nextElement(); if (button.getType() == SoftButton.TYPE_ICON && button.getName().equals("up")) { button.setVisible(state); } } }
public void setScrollUp(boolean state) { Enumeration en = DeviceFactory.getDevice().getSoftButtons().elements(); while (en.hasMoreElements()) { SoftButton button = (SoftButton) en.nextElement(); if (button.getType() == SoftButton.TYPE_ICON && button.getName().equals("up")) { button.setVisible(state); } } }
public String getKeyName(int keyCode) throws IllegalArgumentException { for (Iterator it = DeviceFactory.getDevice().getButtons().iterator(); it.hasNext(); ) { SwtButton button = (SwtButton) it.next(); if (button.getKeyCode() == keyCode) { return button.getName(); } } for (Iterator it = DeviceFactory.getDevice().getButtons().iterator(); it.hasNext(); ) { SwtButton button = (SwtButton) it.next(); if (button.getKeyboardKey() == keyCode) { return button.getName(); } } throw new IllegalArgumentException(); }
public SwtButton getButton(KeyEvent ev) { for (Enumeration e = DeviceFactory.getDevice().getButtons().elements(); e.hasMoreElements(); ) { SwtButton button = (SwtButton) e.nextElement(); if (ev.keyCode == button.getKeyCode()) { return button; } if (button.isChar(ev.character, getInputMode())) { return button; } } return null; }
public void setFont(javax.microedition.lcdui.Font font) { currentFont = font; J2SEFont tmpFont = (J2SEFont) ((J2SEFontManager) DeviceFactory.getDevice().getFontManager()) .getFont(currentFont); g.setFont(tmpFont.getFont()); }
public Point computeSize(int wHint, int hHint, boolean changed) { javax.microedition.lcdui.Image tmp = DeviceFactory.getDevice().getNormalImage(); return new Point(tmp.getWidth(), tmp.getHeight()); }
/** * Gets the game action associated with the given key code of the device. * * @return the game action corresponding to this key, or <code>0</code> if * none */ public int getGameAction(int keyCode) { for (Iterator it = DeviceFactory.getDevice().getButtons().iterator(); it.hasNext();) { J2SEButton button = (J2SEButton) it.next(); if (button.getKeyCode() == keyCode) { return ButtonDetaultDeviceKeyCodes.getGameAction(button.getFunctionalName()); } } return 0; }
public Dimension getPreferredSize() { Device device = DeviceFactory.getDevice(); if (device == null) { return new Dimension(0, 0); } return new Dimension(device.getDeviceDisplay().getFullWidth(), device.getDeviceDisplay().getFullHeight()); }
public Dimension getPreferredSize() { Device device = DeviceFactory.getDevice(); if (device == null) { return new Dimension(0, 0); } DeviceDisplayImpl deviceDisplay = (DeviceDisplayImpl) DeviceFactory.getDevice().getDeviceDisplay(); if (deviceDisplay.isResizable()) { return new Dimension(deviceDisplay.getFullWidth(), deviceDisplay.getFullHeight()); } else { javax.microedition.lcdui.Image img = device.getNormalImage(); return new Dimension(img.getWidth(), img.getHeight()); } }