private Rectangle getRectangle(XMLElement source) { Rectangle rect = new Rectangle(); for (Enumeration e_rectangle = source.enumerateChildren(); e_rectangle.hasMoreElements();) { XMLElement tmp_rectangle = (XMLElement) e_rectangle.nextElement(); if (tmp_rectangle.getName().equals("x")) { rect.x = Integer.parseInt(tmp_rectangle.getContent()); } else if (tmp_rectangle.getName().equals("y")) { rect.y = Integer.parseInt(tmp_rectangle.getContent()); } else if (tmp_rectangle.getName().equals("width")) { rect.width = Integer.parseInt(tmp_rectangle.getContent()); } else if (tmp_rectangle.getName().equals("height")) { rect.height = Integer.parseInt(tmp_rectangle.getContent()); } } return rect; }
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; }
/** * Construct a polygon with full details. * * @param id Polygon ID. * @param xcent X-coordinate of centroid. * @param ycent Y-coordinate of centroid. * @param xpoints Array of x values (npoints in size). * @param ypoints Array of y values (npoints in size). * @param npoints Number of points. */ public Polygon(int[] xpoints, int[] ypoints, int npoints) { this.xpoints = new int[npoints]; this.ypoints = new int[npoints]; this.npoints = npoints; //Add a try here to catch failed array copy System.arraycopy(xpoints, 0, this.xpoints, 0, npoints); System.arraycopy(ypoints, 0, this.ypoints, 0, npoints); for (int i = 0; i < npoints; i++) { bounds.add(xpoints[i], ypoints[i]); } }
public void handleEvent(Event e) { Config.setWindow("main", new Rectangle( shell.getLocation().x, shell.getLocation().y, shell.getSize().x, shell.getSize().y)); System.exit(0); } };
if (getBounds().contains(x, y)) {
/** * Add a vertex to the polygon. * * @param x X-coordinate of point to add. * @param y Y-coordinate of point to add. */ public void addPoint(int x, int y) { if (npoints > 0) { int xtemp[]; int ytemp[]; xtemp = xpoints; ytemp = ypoints; xpoints = new int[npoints + 1]; System.arraycopy(xtemp, 0, xpoints, 0, npoints); xtemp = null; ypoints = new int[npoints + 1]; System.arraycopy(ytemp, 0, ypoints, 0, npoints); ytemp = null; } else { xpoints = new int[1]; ypoints = new int[1]; } npoints++; xpoints[npoints - 1] = x;//-1 to account for 0 array indexing ypoints[npoints - 1] = y; bounds.add(x, y); }
Logger.setLocationEnabled(Config.isLogConsoleLocationEnabled()); Rectangle window = Config.getWindow("main", new Rectangle(0, 0, 160, 120)); this.setLocation(window.x, window.y); .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();
org.microemu.device.impl.Rectangle pb = initialPressedSoftButton.getPaintable(); if (pb != null) { if (pb.contains(e.getX(), e.getY())) { if (!initialPressedSoftButton.isPressed()) { initialPressedSoftButton.setPressed(true);
public static Rectangle getDeviceEntryDisplaySize(DeviceEntry entry) { XMLElement devicesXml = configXml.getChild("devices"); if (devicesXml != null) { for (Enumeration e_device = devicesXml.enumerateChildren(); e_device.hasMoreElements();) { XMLElement tmp_device = (XMLElement) e_device.nextElement(); if (tmp_device.getName().equals("device")) { String testDescriptor = tmp_device.getChildString("descriptor", null); if (testDescriptor.equals(entry.getDescriptorLocation())) { XMLElement rectangleXml = tmp_device.getChild("rectangle"); if (rectangleXml != null) { Rectangle result = new Rectangle(); result.x = rectangleXml.getChildInteger("x", -1); result.y = rectangleXml.getChildInteger("y", -1); result.width = rectangleXml.getChildInteger("width", -1); result.height = rectangleXml.getChildInteger("height", -1); return result; } } } } } return null; }
if (button.isVisible()) { org.microemu.device.impl.Rectangle pb = button.getPaintable(); if (pb != null && pb.contains(e.getX(), e.getY())) { initialPressedSoftButton = button; button.setPressed(true);
DeviceDisplayImpl deviceDisplay = (DeviceDisplayImpl) DeviceFactory.getDevice().getDeviceDisplay(); if (overrideDeviceWidth != -1 && overrideDeviceHeight != -1) { deviceDisplay.setDisplayRectangle(new Rectangle(0, 0, overrideDeviceWidth, overrideDeviceHeight));
if (pb != null) { repaintRequest(pb.x, pb.y, pb.width, pb.height); if (pb.contains(e.getX(), e.getY())) { MIDletAccess ma = MIDletBridge.getMIDletAccess(); if (ma == null) {
Point location = getLocation(); Dimension size = getSize(); Rectangle window = Config.getWindow("scaledDisplay", new Rectangle(location.x + size.width, location.y, 0, 0)); scaledDisplayFrame.setLocation(window.x, window.y); Config.setWindow("scaledDisplay", new Rectangle(scaledDisplayFrame.getX(), scaledDisplayFrame.getY(), 0, 0), false); scaledDisplayFrame.pack();
if (button.isVisible()) { org.microemu.device.impl.Rectangle pb = button.getPaintable(); if (pb != null && pb.contains(e.x - rect.x, e.y - rect.y)) { initialPressedSoftButton = button; button.setPressed(true);
public void actionPerformed(ActionEvent e) { synchronized (Main.this) { if (encoder != null) { encoder.finish(); encoder = null; } } if (logConsoleDialog != null) { Config.setWindow("logConsole", new Rectangle(logConsoleDialog.getX(), logConsoleDialog.getY(), logConsoleDialog.getWidth(), logConsoleDialog.getHeight()), logConsoleDialog.isVisible()); } if (recordStoreManagerDialog != null) { Config.setWindow("recordStoreManager", new Rectangle(recordStoreManagerDialog.getX(), recordStoreManagerDialog.getY(), recordStoreManagerDialog.getWidth(), recordStoreManagerDialog .getHeight()), recordStoreManagerDialog.isVisible()); } if (scaledDisplayFrame != null) { Config.setWindow("scaledDisplay", new Rectangle(scaledDisplayFrame.getX(), scaledDisplayFrame.getY(), 0, 0), false); } Config.setWindow("main", new Rectangle(Main.this.getX(), Main.this.getY(), Main.this.getWidth(), Main.this .getHeight()), true); System.exit(0); } };
org.microemu.device.impl.Rectangle pb = initialPressedSoftButton.getPaintable(); if (pb != null) { if (pb.contains(e.x - rect.x, e.y - rect.y)) { if (!initialPressedSoftButton.isPressed()) { initialPressedSoftButton.setPressed(true);
public static Rectangle getWindow(String name, Rectangle defaultWindow) { XMLElement windowsXml = configXml.getChild("windows"); if (windowsXml == null) { return defaultWindow; } XMLElement mainXml = windowsXml.getChild(name); if (mainXml == null) { return defaultWindow; } Rectangle window = new Rectangle(); window.x = mainXml.getChildInteger("x", defaultWindow.x); window.y = mainXml.getChildInteger("y", defaultWindow.y); window.width = mainXml.getChildInteger("width", defaultWindow.width); window.height = mainXml.getChildInteger("height", defaultWindow.height); return window; }
if (pb != null) { dc.repaintRequest(pb.x, pb.y, pb.width, pb.height); if (pb.contains(e.x - rect.x, e.y - rect.y)) { Command cmd = initialPressedSoftButton.getCommand(); if (cmd != null) {
public void actionPerformed(ActionEvent e) { if (recordStoreManagerDialog == null) { recordStoreManagerDialog = new RecordStoreManagerDialog(Main.this, common); recordStoreManagerDialog.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { menuRecordStoreManager.setState(false); } }); recordStoreManagerDialog.pack(); Rectangle window = Config.getWindow("recordStoreManager", new Rectangle(0, 0, 640, 320)); recordStoreManagerDialog.setBounds(window.x, window.y, window.width, window.height); } recordStoreManagerDialog.setVisible(!recordStoreManagerDialog.isVisible()); } };
public void actionPerformed(ActionEvent e) { if (logConsoleDialog == null) { logConsoleDialog = new SwingLogConsoleDialog(Main.this, Main.this.logQueueAppender); logConsoleDialog.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { menuLogConsole.setState(false); } }); logConsoleDialog.pack(); // To avoid NPE on MacOS setFocusableWindowState(false) have to be called after pack() logConsoleDialog.setFocusableWindowState(false); Rectangle window = Config.getWindow("logConsole", new Rectangle(0, 0, 640, 320)); logConsoleDialog.setBounds(window.x, window.y, window.width, window.height); } logConsoleDialog.setVisible(!logConsoleDialog.isVisible()); } };