private SwtButton getButton(int x, int y) { for (Enumeration e = DeviceFactory.getDevice().getButtons().elements(); e.hasMoreElements(); ) { SwtButton button = (SwtButton) e.nextElement(); if (button.getShape() != null) { try { org.microemu.device.impl.Shape tmp = (org.microemu.device.impl.Shape) button.getShape().clone(); if (tmp.contains(x, y)) { return button; } } catch (CloneNotSupportedException ex) { ex.printStackTrace(); } } } return null; }
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(); } } };
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(); } }
org.microemu.device.impl.Shape shape = prevOverButton.getShape(); if (shape != null) { drawImageInShape( org.microemu.device.impl.Shape shape = overButton.getShape(); if (shape != null) { drawImageInShape( org.microemu.device.impl.Shape shape = pressedButton.getShape(); if (shape != null) { drawImageInShape( rect = prevOverButton.getShape().getBounds(); if (rect != null) { gc.drawImage(((SwtImmutableImage) DeviceFactory.getDevice().getNormalImage()).getImage(), rect = overButton.getShape().getBounds(); if (rect != null) { gc.drawImage(((SwtImmutableImage) DeviceFactory.getDevice().getOverImage()).getImage(), rect = pressedButton.getShape().getBounds(); if (rect != null) { gc.drawImage(((SwtImmutableImage) DeviceFactory.getDevice().getPressedImage()).getImage(),
Rectangle r = pressedButton.getShape().getBounds(); redraw(r.x, r.y, r.width, r.height, true);
Rectangle r = prevOverButton.getShape().getBounds(); redraw(r.x, r.y, r.width, r.height, true); } else {