Exemplo n.º 1
0
 private void pressButton(int button) {
   switch (button) {
     case BUTTON_OK:
       instance.dispose();
       result = BUTTON_OK;
       break;
     case BUTTON_CANCEL:
       date = old_date;
       instance.dispose();
       result = BUTTON_CANCEL;
       break;
     default:
       break;
   }
 }
Exemplo n.º 2
0
 /** 传进来一个显示位置点 */
 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;
 }
Exemplo n.º 3
0
 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;
 }