private static void saveWindowPosition(Frame frame) { if (!isWindowPositioningEnabled()) { return; } Point point; try { point = frame.getLocationOnScreen(); } catch (Exception e) { e.printStackTrace(); try { point = frame.getLocation(); } catch (Exception e2) { e2.printStackTrace(); return; } } int x = (int)point.getX(); int y = (int)point.getY(); int w = frame.getWidth(); int h = frame.getHeight(); Utils.setConfigInteger("window.x", x); Utils.setConfigInteger("window.y", y); Utils.setConfigInteger("window.w", w); Utils.setConfigInteger("window.h", h); LOGGER.debug("Saved window position (x=" + x + ", y=" + y + ", w=" + w + ", h=" + h + ")"); }
public MessageDialog(Frame parent, String sender, String msg) { super(parent, "Msg from " + sender); Button ok=new Button("OK"); setLayout(new BorderLayout()); setBackground(Color.white); ok.setFont(default_font); text.setFont(default_font); text.setEditable(false); text.setText(msg); ok.addActionListener(this); add("Center", text); add("South", ok); setSize(300, 150); Point my_loc=parent.getLocation(); my_loc.x+=50; my_loc.y+=150; setLocation(my_loc); Toolkit.getDefaultToolkit().beep(); show(); }
public SendDialog(Frame parent, Node dest, String src, RpcDispatcher disp) { super(parent, "Send message to " + dest.lbl + " at " + dest.addr, true); Panel p1=new Panel(), p2=new Panel(); Button send=new Button("Send"), send_all=new Button("Send to all"); Button cancel=new Button("Cancel"); this.disp=disp; this.dest=dest; sender=src; send.setFont(default_font); send_all.setFont(default_font); cancel.setFont(default_font); msg.setFont(default_font); p1.setLayout(new BorderLayout()); p1.add(msg); p2.setLayout(new FlowLayout()); send.addActionListener(this); send_all.addActionListener(this); cancel.addActionListener(this); p2.add(send); p2.add(send_all); p2.add(cancel); add("Center", p1); add("South", p2); setSize(300, 150); Point my_loc=parent.getLocation(); my_loc.x+=50; my_loc.y+=150; setLocation(my_loc); setVisible(true); }
public UserInfoDialog(Frame parent) { super(parent, "Input", true); setLayout(null); l.setFont(default_font); l.setSize(50, 30); l.setLocation(30, 50); name.setFont(default_font); name.setSize(150, 30); name.setLocation(90, 50); //name.selectAll(); ok.setFont(default_font); ok.setSize(50, 30); ok.setLocation(30, 90); add(l); add(name); add(ok); ok.addActionListener(this); setSize(300, 150); Point my_loc=parent.getLocation(); my_loc.x+=50; my_loc.y+=150; setLocation(my_loc); show(); }
public static Point getCenter(Frame parent, Dimension size){ Dimension d = parent.getSize(); Point result=new Point(parent.getLocation().x+ d.width / 2 - size.width / 2,parent.getLocation().y+ d.height / 2 - size.height / 2); return result; }
public static Point getCenter(Dimension size, Frame frame){ Dimension d = frame.getSize(); Point result=new Point( (d.width / 2 - size.width / 2)+frame.getLocation().x, (d.height / 2 - size.height / 2)+frame.getLocation().y); return result; }
/** * Obtains the {@link Macro} to show the {@link JFrame}. * * @return {@link Macro} to show the {@link JFrame}. */ public Macro getShowFrameMacro() { // Obtain location of frame for showing again after hiding Point frameLocation = RecordComponent.this.frame.getLocation(); // Return the macro to show the frame return new ShowFrameMacro(frameLocation); }
Point getCenter(Dimension size){ Dimension d = resources.getMainFrame().getSize(); Point result=new Point( (d.width / 2 - size.width / 2)+resources.getMainFrame().getLocation().x, (d.height / 2 - size.height / 2)+resources.getMainFrame().getLocation().y); return result; } }
public void setVisible(boolean visible) { if (visible) { setLocation((int) frame.getLocation().getX() + (frame.getWidth() / 2) - (getWidth() / 2), (int) frame.getLocation().getY() + (frame.getHeight() / 2) - (getHeight() / 2)); } super.setVisible(visible); }
@Override public void componentMoved(ComponentEvent e) { Point where = ((Frame) e.getSource()).getLocation(); sketch.frameMoved(where.x, where.y); } });
public static void centerDialog(Frame parent, JDialog dialog) { if(parent != null && dialog != null) { dialog.setLocation(parent.getLocation().x + (parent.getSize().width - dialog.getSize().width) / 2, parent.getLocation().y + (parent.getSize().height - dialog.getSize().height) / 2); } } }
public static void centerDialog(Frame parent, JDialog dialog) { if(parent != null && dialog != null) { dialog.setLocation(parent.getLocation().x + (parent.getSize().width - dialog.getSize().width) / 2, parent.getLocation().y + (parent.getSize().height - dialog.getSize().height) / 2); } } }
public DevToolsDialog(Frame owner, String title, CefBrowser browser, Point inspectAt) { super(owner, title, false); setLayout(new BorderLayout()); setSize(800, 600); setLocation(owner.getLocation().x+20, owner.getLocation().y+20); devTools_ = browser.getDevTools(inspectAt); add(devTools_.getUIComponent()); addComponentListener(new ComponentAdapter() { @Override public void componentHidden(ComponentEvent e) { dispose(); } }); }
@Override public void beforeSave(WindowSystemEvent event) { Frame mainWindow = WindowManager.getDefault().getMainWindow(); if (mainWindow != null) { lastDimension = mainWindow.getSize(); lastLocation = mainWindow.getLocation(); lastState = mainWindow.getExtendedState(); } }
private void openThingEditor(Point mapPoint) { if(thingEditor == null) { thingEditor = new ThingEditor(); thingEditor.setDesigner(this); thingEditor.buildUI(); thingEditor.getFrame().setLocation(frame.getLocation().x + frame.getSize().width, frame.getLocation().y); thingEditor.getFrame().setVisible(true); } thingEditor.inspect(mapPoint == null ? null : map.getThings(mapPoint.x, mapPoint.y)); thingEditor.setVisible(true); }
public MessageDialog(Frame parent, String sender, String msg) { super(parent, "Msg from " + sender); Button ok=new Button("OK"); setLayout(new BorderLayout()); setBackground(Color.white); ok.setFont(default_font); text.setFont(default_font); text.setEditable(false); text.setText(msg); ok.addActionListener(this); add("Center", text); add("South", ok); setSize(300, 150); Point my_loc=parent.getLocation(); my_loc.x+=50; my_loc.y+=150; setLocation(my_loc); Toolkit.getDefaultToolkit().beep(); show(); }
public MessageDialog(Frame parent, String sender, String msg) { super(parent, "Msg from " + sender); Button ok=new Button("OK"); setLayout(new BorderLayout()); setBackground(Color.white); ok.setFont(default_font); text.setFont(default_font); text.setEditable(false); text.setText(msg); ok.addActionListener(this); add("Center", text); add("South", ok); setSize(300, 150); Point my_loc=parent.getLocation(); my_loc.x+=50; my_loc.y+=150; setLocation(my_loc); Toolkit.getDefaultToolkit().beep(); show(); }
public MessageDialog(Frame parent, String sender, String msg) { super(parent, "Msg from " + sender); Button ok=new Button("OK"); setLayout(new BorderLayout()); setBackground(Color.white); ok.setFont(default_font); text.setFont(default_font); text.setEditable(false); text.setText(msg); ok.addActionListener(this); add("Center", text); add("South", ok); setSize(300, 150); Point my_loc=parent.getLocation(); my_loc.x+=50; my_loc.y+=150; setLocation(my_loc); Toolkit.getDefaultToolkit().beep(); show(); }
public MessageDialog(Frame parent, String sender, String msg) { super(parent, "Msg from " + sender); Button ok=new Button("OK"); setLayout(new BorderLayout()); setBackground(Color.white); ok.setFont(default_font); text.setFont(default_font); text.setEditable(false); text.setText(msg); ok.addActionListener(this); add("Center", text); add("South", ok); setSize(300, 150); Point my_loc=parent.getLocation(); my_loc.x+=50; my_loc.y+=150; setLocation(my_loc); Toolkit.getDefaultToolkit().beep(); show(); }
public MessageDialog(Frame parent, String sender, String msg) { super(parent, "Msg from " + sender); Button ok=new Button("OK"); setLayout(new BorderLayout()); setBackground(Color.white); ok.setFont(default_font); text.setFont(default_font); text.setEditable(false); text.setText(msg); ok.addActionListener(this); add("Center", text); add("South", ok); setSize(300, 150); Point my_loc=parent.getLocation(); my_loc.x+=50; my_loc.y+=150; setLocation(my_loc); Toolkit.getDefaultToolkit().beep(); show(); }