public Main() { devicePanel = new SwingDeviceComponent(); devicePanel.addKeyListener(devicePanel); }
public SwingDeviceComponent() { dc = new SwingDisplayComponent(this); setLayout(new XYLayout()); addMouseListener(mouseListener); addMouseMotionListener(mouseMotionListener); }
public DisplayComponent getDisplayComponent() { return devicePanel.getDisplayComponent(); }
protected void paintComponent(Graphics g) { if (offg == null || offi.getWidth(null) != getSize().width || offi.getHeight(null) != getSize().height) { offi = new J2SEMutableImage(getSize().width, getSize().height).getImage(); offg = offi.getGraphics(); Dimension size = getSize(); offg.setColor(UIManager.getColor("text")); try { g.drawRect(0, 0, getWidth() - 1, getHeight() - 1); return; org.microemu.device.impl.Shape shape = prevOverButton.getShape(); if (shape != null) { 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);
DeviceDisplayImpl deviceDisplay = (DeviceDisplayImpl) DeviceFactory.getDevice().getDeviceDisplay(); if (deviceDisplay.isResizable()) { deviceDisplay.setDisplayRectangle(new Rectangle(0, 0, devicePanel.getWidth(), devicePanel.getHeight())); ((SwingDisplayComponent) devicePanel.getDisplayComponent()).init(); MIDletAccess ma = MIDletBridge.getMIDletAccess(); if (ma == null) { deviceDisplay.repaint(0, 0, deviceDisplay.getFullWidth(), deviceDisplay.getFullHeight()); devicePanel.revalidate(); statusBarListener.statusBarChanged("New size: " + deviceDisplay.getFullWidth() + "x" + deviceDisplay.getFullHeight());
public void init() { dc.init(); remove(dc); Rectangle r = ((J2SEDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getDisplayRectangle(); add(dc, new XYConstraints(r.x, r.y, -1, -1)); revalidate(); }
protected Component createContents(Container parent) { devicePanel = new SwingDeviceComponent(); devicePanel.addKeyListener(devicePanel); addKeyListener(devicePanel); return devicePanel; }
public DisplayComponent getDisplayComponent() { return devicePanel.getDisplayComponent(); }
public void actionPerformed(ActionEvent ev) { if (resizeDeviceDisplayDialog == null) { resizeDeviceDisplayDialog = new ResizeDeviceDisplayDialog(); } DeviceDisplayImpl deviceDisplay = (DeviceDisplayImpl) DeviceFactory.getDevice().getDeviceDisplay(); resizeDeviceDisplayDialog.setDeviceDisplaySize(deviceDisplay.getFullWidth(), deviceDisplay .getFullHeight()); if (SwingDialogWindow.show(Main.this, "Enter new size...", resizeDeviceDisplayDialog, true)) { deviceDisplay.setDisplayRectangle(new Rectangle(0, 0, resizeDeviceDisplayDialog .getDeviceDisplayWidth(), resizeDeviceDisplayDialog.getDeviceDisplayHeight())); ((SwingDisplayComponent) devicePanel.getDisplayComponent()).init(); MIDletAccess ma = MIDletBridge.getMIDletAccess(); if (ma == null) { return; } DisplayAccess da = ma.getDisplayAccess(); if (da != null) { da.sizeChanged(); deviceDisplay.repaint(0, 0, deviceDisplay.getFullWidth(), deviceDisplay.getFullHeight()); } pack(); } } });