J2SEInputMethod inputMethod = (J2SEInputMethod) device.getInputMethod(); boolean fullScreenMode = device.getDeviceDisplay().isFullScreenMode(); if (device.hasPointerEvents()) { if (!fullScreenMode) { Iterator it = device.getSoftButtons().iterator(); while (it.hasNext()) { SoftButton button = (SoftButton) it.next(); Point p = deviceCoordinate(device.getDeviceDisplay(), e.getPoint()); inputMethod.pointerPressed(p.x, p.y);
int width = e.getX() - pressedPoint.x; int height = e.getY() - pressedPoint.y; Point p = deviceCoordinate(DeviceFactory.getDevice().getDeviceDisplay(), pressedPoint); buf.append(p.x).append(",").append(p.y).append(" ").append(width).append("x").append(height); Common.setStatusBar(buf.toString()); InputMethodImpl inputMethod = (InputMethodImpl) device.getInputMethod(); boolean fullScreenMode = device.getDeviceDisplay().isFullScreenMode(); if (device.hasPointerMotionEvents()) { if (!fullScreenMode) { if (initialPressedSoftButton != null) { Point p = deviceCoordinate(device.getDeviceDisplay(), e.getPoint()); inputMethod.pointerDragged(p.x, p.y);
public void keyPressed(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()).keyPressed(ev); pressedButton = ((SwtInputMethod) device.getInputMethod()).getButton(ev); if (pressedButton != null) { org.microemu.device.impl.Shape shape = pressedButton.getShape(); if (shape != null) { Rectangle r = shape.getBounds(); redraw(r.x, r.y, r.width, r.height, true); } } else { redraw(); } }
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()); } }
public J2SEDisplayGraphics(java.awt.Graphics2D a_g, MutableImage a_image) // Andres Navarro { this.g = a_g; this.image = a_image; this.clip = a_g.getClipBounds(); Device device = DeviceFactory.getDevice(); J2SEFontManager fontManager = (J2SEFontManager) device.getFontManager(); J2SEFont tmpFont = (J2SEFont) fontManager.getFont(currentFont); this.g.setFont(tmpFont.getFont()); if (fontManager.getAntialiasing()) { this.g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); } else { this.g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); } J2SEDeviceDisplay display = (J2SEDeviceDisplay) device.getDeviceDisplay(); if (display.isColor()) { if (display.backgroundColor.getRed() != 255 || display.backgroundColor.getGreen() != 255 || display.backgroundColor.getBlue() != 255 || display.foregroundColor.getRed() != 0 || display.foregroundColor.getGreen() != 0 || display.foregroundColor.getBlue() != 0) { this.filter = new RGBImageFilter(); } } else { if (display.numColors() == 2) { this.filter = new BWImageFilter(); } else { this.filter = new GrayImageFilter(); } } }
public Dimension getPreferredSize() { Device device = DeviceFactory.getDevice(); if (device == null) { return new Dimension(0, 0); } return new Dimension(device.getDeviceDisplay().getFullWidth(), device.getDeviceDisplay().getFullHeight()); }
return; if (((DeviceDisplayImpl) device.getDeviceDisplay()).isResizable()) { return; offg.drawImage(((J2SEImmutableImage) device.getNormalImage()).getImage(), 0, 0, this); drawImageInShape(offg, ((J2SEImmutableImage) device.getNormalImage()).getImage(), shape); org.microemu.device.impl.Shape shape = overButton.getShape(); if (shape != null) { drawImageInShape(offg, ((J2SEImmutableImage) device.getOverImage()).getImage(), shape); org.microemu.device.impl.Shape shape = pressedButton.getShape(); if (shape != null) { drawImageInShape(offg, ((J2SEImmutableImage) device.getPressedImage()).getImage(), shape);
J2SEInputMethod inputMethod = (J2SEInputMethod) device.getInputMethod(); boolean fullScreenMode = device.getDeviceDisplay().isFullScreenMode(); if (device.hasPointerEvents()) { if (!fullScreenMode) { if (initialPressedSoftButton != null && initialPressedSoftButton.isPressed()) { Point p = deviceCoordinate(device.getDeviceDisplay(), e.getPoint()); inputMethod.pointerReleased(p.x, p.y);
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); } }
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 keyPressed(KeyEvent ev) if (DeviceFactory.getDevice().hasRepeatEvents() && inputMethodListener == null) { clearRepeatFlag = false; if (repeatModeKeyCode == ev.keyCode) { boolean rawSoftKeys = DeviceFactory.getDevice().getDeviceDisplay().isFullScreenMode(); SwtButton pressedButton = getButton(ev); if (pressedButton != null) {
J2SEInputMethod inputMethod = (J2SEInputMethod) device.getInputMethod(); boolean fullScreenMode = device.getDeviceDisplay().isFullScreenMode();
J2SEInputMethod inputMethod = (J2SEInputMethod) device.getInputMethod();
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 pointerPressed(int x, int y) { if (DeviceFactory.getDevice().hasPointerEvents()) { MIDletBridge.getMIDletAccess().getDisplayAccess().pointerPressed(x, y); } }
public void pointerDragged(int x, int y) { if (DeviceFactory.getDevice().hasPointerMotionEvents()) { MIDletBridge.getMIDletAccess().getDisplayAccess().pointerDragged(x, y); } }
public void setFont(javax.microedition.lcdui.Font font) { currentFont = font; J2SEFont tmpFont = (J2SEFont) ((J2SEFontManager) DeviceFactory.getDevice().getFontManager()) .getFont(currentFont); g.setFont(tmpFont.getFont()); }
entry = new DeviceEntry(manifestDeviceName, deviceFile.getName(), descriptorLocation, false); } else { entry = new DeviceEntry(device.getName(), deviceFile.getName(), descriptorLocation, false);
public Point computeSize(int wHint, int hHint, boolean changed) { javax.microedition.lcdui.Image tmp = DeviceFactory.getDevice().getNormalImage(); return new Point(tmp.getWidth(), tmp.getHeight()); }
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()); } }