/** 传进来一个显示位置点 */ public static DateChooserDialog showWhitLocation(Frame owner, Date date, Point point) { DateChooserDialog dialog = new DateChooserDialog(owner, date); dialog.setSize(width, height); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.pack(); Dimension d = dialog.getSize(); point.translate(0, -d.height / 3); dialog.setLocation(point); dialog.setVisible(true); return dialog; }
public static DateChooserDialog show(Frame owner, Date date) { DateChooserDialog dialog = new DateChooserDialog(owner, date); dialog.setSize(width, height); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.pack(); Point p = owner.getLocationOnScreen(); p.y = p.y + 30; dialog.setLocation(getAppropriateLocation(owner, p)); dialog.setVisible(true); return dialog; }