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 void handleEvent(Event e) { Config.setWindow("main", new Rectangle( shell.getLocation().x, shell.getLocation().y, shell.getSize().x, shell.getSize().y)); System.exit(0); } };
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();
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; }
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();
DeviceDisplayImpl deviceDisplay = (DeviceDisplayImpl) DeviceFactory.getDevice().getDeviceDisplay(); if (overrideDeviceWidth != -1 && overrideDeviceHeight != -1) { deviceDisplay.setDisplayRectangle(new Rectangle(0, 0, overrideDeviceWidth, overrideDeviceHeight));
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); } };
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; }
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()); } };
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(); public void run() { if (counter == count) { Config.setDeviceEntryDisplaySize(deviceEntry, new Rectangle(0, 0, devicePanel .getWidth(), devicePanel.getHeight())); statusBarListener.statusBarChanged("");
Rectangle window = Config.getWindow("main", new Rectangle(0, 0, 160, 120)); shell.setLocation(window.x, window.y);
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(); } } });