public void setLocation(int x, int y) { super.setLocation(x, y); centerDialog = false; }
public void setLocation(int x, int y) { super.setLocation(x, y); centerDialog = false; }
private void loadBounds(Dialog d, String key) { d.pack(); // Position the dialog according to the history Rectangle lastBounds = (Rectangle) EditorState.get(key); if (lastBounds != null) { d.setBounds(lastBounds); } else { // no history, center it on the screen Dimension dim = d.getPreferredSize(); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int x = Math.max(0, (screen.width - dim.width) / 2); int y = Math.max(0, (screen.height - dim.height) / 2); d.setLocation(x, y); } }
public static void makeSheet(Dialog dialog) { dialog.addNotify(); ComponentPeer peer = dialog.getPeer(); // File dialogs are CFileDialog instead. Unfortunately this means this hack // can't work for those. :( if (peer instanceof LWWindowPeer) { LWWindowPeer windowPeer = (LWWindowPeer) dialog.getPeer(); //XXX: Should check this before casting too. CPlatformWindow platformWindow = (CPlatformWindow) windowPeer.getPlatformWindow(); try { Method method = CPlatformWindow.class.getDeclaredMethod( "setStyleBits", int.class, boolean.class); method.setAccessible(true); method.invoke(platformWindow, 64 /* CPlatformWindow.SHEET */, true); Window parent = dialog.getOwner(); dialog.setLocation(dialog.getLocation().x, parent.getLocation().y + parent.getInsets().top); } catch (Exception e) { Logger.getLogger(SheetHack.class.getName()) .log(Level.WARNING, "Couldn't call setStyleBits", e); } } }
if (info == null) return; //pointer not on a graphics device Point mouseLoc = info.getLocation(); pickerFrame.setLocation(mouseLoc.x - pickerFrame.getWidth() / 2, mouseLoc.y - pickerFrame.getHeight() / 2);
protected synchronized Dialog createGotoDialog() { if (gotoDialog == null) { gotoDialog = DialogSupport.createDialog(LocaleSupport.getString("goto-title"), // NOI18N gotoPanel, false, // non-modal gotoButtons, false, // sidebuttons, 0, // defaultIndex = 0 => gotoButton 1, // cancelIndex = 1 => cancelButton this // listener ); gotoDialog.pack(); // Position the dialog according to the history Rectangle lastBounds = (Rectangle) EditorState.get(BOUNDS_KEY); if (lastBounds != null) { gotoDialog.setBounds(lastBounds); } else { // no history, center it on the screen Dimension dim = gotoDialog.getPreferredSize(); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int x = Math.max(0, (screen.width - dim.width) / 2); int y = Math.max(0, (screen.height - dim.height) / 2); gotoDialog.setLocation(x, y); } return gotoDialog; } else { gotoDialog.toFront(); return null; } }
PointerInfo info = MouseInfo.getPointerInfo(); Point mouseLoc = info.getLocation(); pickerFrame.setLocation(mouseLoc.x - pickerFrame.getWidth() / 2, mouseLoc.y - pickerFrame.getHeight() / 2);
if (info == null) return; //pointer not on a graphics device Point mouseLoc = info.getLocation(); pickerFrame.setLocation(mouseLoc.x - pickerFrame.getWidth() / 2, mouseLoc.y - pickerFrame.getHeight() / 2);
PointerInfo info = MouseInfo.getPointerInfo(); Point mouseLoc = info.getLocation(); pickerFrame.setLocation(mouseLoc.x - pickerFrame.getWidth() / 2, mouseLoc.y - pickerFrame.getHeight() / 2);
int x = Math.max( 0, (screen.width - dim.width)/2 ); int y = Math.max( 0, (screen.height - dim.height)/2 ); gotoDialog.setLocation( x, y );
d.setLocation( ( Toolkit.getDefaultToolkit().getScreenSize().width / 2 ) - ( d.getSize().width / 2 ), ( java.awt.Toolkit.getDefaultToolkit().getScreenSize().height / 2 ) - ( d.getSize().height / 2 ) );
private void makeWindow() { dialog = new java.awt.Dialog(IJ.getInstance(), "Loading...", false); dialog.setUndecorated(true); bytes = new Label("Loaded: 0 bytes "); speed = new Label("Speed: 0 bytes/s "); time = new Label ("Elapsed time: 0 s "); dialog.setLayout(new GridLayout(3,1)); dialog.addWindowListener(new java.awt.event.WindowAdapter() { public void windowDeactivated(java.awt.event.WindowEvent we) { dialog.toFront(); } }); dialog.add(time); dialog.add(bytes); dialog.add(speed); java.awt.Dimension screen = dialog.getToolkit().getScreenSize(); dialog.pack(); dialog.setLocation(screen.width/2 - dialog.getWidth()/2, screen.height/2 - dialog.getHeight()/2); //dialog.setVisible(true); } Monitor(Connection con) {
int initialX = (int)posi.getX() + 38; int initialY = (int)posi.getY() + 84; dialog.setLocation(initialX,initialY); dialog.setVisible(true); dialog.toFront();
int initialX = (int)posi.getX() + 38; int initialY = (int)posi.getY() + 84; dialog.setLocation(initialX,initialY); dialog.setVisible(true); dialog.toFront();
dialog.pack(); if (pos.x < 0 || pos.y < 0) GUI.center(dialog); else dialog.setLocation(pos); dialog.setVisible(true);
loc.x += (parentSize.width - size.width) / 2; loc.y += (parentSize.height - size.height) / 2; this._dialog.setLocation(loc); this._waiting = true; this._returnVal = 0;
dialog.pack(); if (position.x < 0 || position.y < 0) GUI.center(dialog); else dialog.setLocation(position); dialog.setVisible(true);
dialog.pack(); if (position.x < 0 || position.y < 0) GUI.center(dialog); else dialog.setLocation(position); dialog.setVisible(true);