Print this page
4719 update gate build environment to [open]jdk7 4742 update manifests for javadoc7 4743 Fix deprecated /usr/j2se usage in slp and remove from filesystem(5) manpage 4744 remove traces of /var/sadm/system/admin/default_java Reviewed by: Dan McDonald <danmcd@omniti.com> Reviewed by: Richard Lowe <richlowe@richlowe.net>


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * ident        "%Z%%M% %I%     %E% SMI"
  24  *
  25  * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
  26  * All rights reserved.
  27  */
  28 
  29 import java.awt.*;
  30 import java.awt.event.*;
  31 import java.text.*;
  32 import java.util.*;
  33 
  34 /**
  35  * This class creates a dialog box that helps the user enter date and
  36  * time with mouse clicks.  The dialog box need only be created
  37  * once. The Ok and Cancel buttons merely call setVisible with an
  38  *  argument of false.
  39  */
  40 
  41 // The layout will consist of 3 panels: topPanel contains the
  42 // different labels and fields. middlePanel contains the buttons
  43 // midnight and now. bottomPanel contains the buttons ok, cancel and
  44 // help. The last two panels are separated by a LineSeparator.


 474     private class DCButtonListener implements ActionListener {
 475     public void actionPerformed(ActionEvent e) {
 476         if (e.getSource() == ok) {
 477         DateTimeDialog.this.dateTimeDialogClose(true);
 478         }
 479         else
 480         if (e.getSource() == cancel) {
 481           DateTimeDialog.this.dateTimeDialogClose(false);
 482         }
 483         else
 484           if (e.getSource() == now) {
 485             DateTimeDialog.this.setCurrentTime();
 486           }
 487           else
 488             if (e.getSource() == midnight) {
 489                 DateTimeDialog.this.setMidnight();
 490             }
 491             else
 492                if (e.getSource() == help) {
 493                 if (hd != null)
 494                   hd.show();
 495                 else {
 496                   hd = new
 497                     HelpDialog(DateTimeDialog.this.parent,
 498                         getString("Help for Date and Time Dialog"), false);
 499                   hd.setVisible(true);
 500                   hd.setText(getString(hrb, "DateTimeDialogHelp"));
 501                    }
 502                 }
 503         } // actionPerformed
 504     }
 505 
 506     /**
 507      * Listener for any change in focus with respect to the text
 508      * fields. When a text field is going out of focus, it detemines if the
 509      * text value in it is valid. If not, it returns focus to that text
 510      * field.
 511      */
 512     private class DCFocusListener extends FocusAdapter {
 513 
 514         public void focusLost(FocusEvent e) {


 534 
 535     /**
 536      * Call rb.getString(), but catch exception and return English
 537      * key so that small spelling errors don't cripple the GUI
 538      *
 539      */
 540     private static final String getString(String key) {
 541     return (getString(rb, key));
 542     }
 543 
 544     private static final String getString(ResourceBundle rb, String key) {
 545     try {
 546         String res = rb.getString(key);
 547         return res;
 548     } catch (MissingResourceException e) {
 549         System.out.println("Missing resource "+key+", using English.");
 550         return key;
 551         }
 552     }
 553 

 554     /*
 555     public static final void main(String args[]) {
 556     Frame f = new Frame();
 557     //  while (true){
 558         DateTimeDialog d = new DateTimeDialog(f, Color.white, Color.black);
 559         d.setVisible(true);
 560         System.out.println(d.toString());
 561       //    }
 562     }
 563     */

 564 }


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*


  23  * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
  24  * All rights reserved.
  25  */
  26 
  27 import java.awt.*;
  28 import java.awt.event.*;
  29 import java.text.*;
  30 import java.util.*;
  31 
  32 /**
  33  * This class creates a dialog box that helps the user enter date and
  34  * time with mouse clicks.  The dialog box need only be created
  35  * once. The Ok and Cancel buttons merely call setVisible with an
  36  *  argument of false.
  37  */
  38 
  39 // The layout will consist of 3 panels: topPanel contains the
  40 // different labels and fields. middlePanel contains the buttons
  41 // midnight and now. bottomPanel contains the buttons ok, cancel and
  42 // help. The last two panels are separated by a LineSeparator.


 472     private class DCButtonListener implements ActionListener {
 473     public void actionPerformed(ActionEvent e) {
 474         if (e.getSource() == ok) {
 475         DateTimeDialog.this.dateTimeDialogClose(true);
 476         }
 477         else
 478         if (e.getSource() == cancel) {
 479           DateTimeDialog.this.dateTimeDialogClose(false);
 480         }
 481         else
 482           if (e.getSource() == now) {
 483             DateTimeDialog.this.setCurrentTime();
 484           }
 485           else
 486             if (e.getSource() == midnight) {
 487                 DateTimeDialog.this.setMidnight();
 488             }
 489             else
 490                 if (e.getSource() == help) {
 491                     if (hd != null)
 492                         hd.setVisible(true);
 493                 else {
 494                     hd = new
 495                     HelpDialog(DateTimeDialog.this.parent,
 496                         getString("Help for Date and Time Dialog"), false);
 497                     hd.setVisible(true);
 498                     hd.setText(getString(hrb, "DateTimeDialogHelp"));
 499                 }
 500             }
 501         } // actionPerformed
 502     }
 503 
 504     /**
 505      * Listener for any change in focus with respect to the text
 506      * fields. When a text field is going out of focus, it detemines if the
 507      * text value in it is valid. If not, it returns focus to that text
 508      * field.
 509      */
 510     private class DCFocusListener extends FocusAdapter {
 511 
 512         public void focusLost(FocusEvent e) {


 532 
 533     /**
 534      * Call rb.getString(), but catch exception and return English
 535      * key so that small spelling errors don't cripple the GUI
 536      *
 537      */
 538     private static final String getString(String key) {
 539     return (getString(rb, key));
 540     }
 541 
 542     private static final String getString(ResourceBundle rb, String key) {
 543     try {
 544         String res = rb.getString(key);
 545         return res;
 546     } catch (MissingResourceException e) {
 547         System.out.println("Missing resource "+key+", using English.");
 548         return key;
 549         }
 550     }
 551 
 552     /* BEGIN JSTYLED */
 553     /*
 554     public static final void main(String args[]) {
 555     Frame f = new Frame();
 556     //  while (true){
 557         DateTimeDialog d = new DateTimeDialog(f, Color.white, Color.black);
 558         d.setVisible(true);
 559         System.out.println(d.toString());
 560       //    }
 561     }
 562     */
 563     /* END JSTYLED */
 564 }