home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 10 / ioProg_10.iso / soft / platsdk / inetwork.exe / TAPI-S.cab / 91newctrls.java < prev    next >
Encoding:
Java Source  |  1997-09-10  |  7.8 KB  |  249 lines

  1. //------------------------------------------------------------------------------
  2. // NewCtrls.java:
  3. //        Implementation for container control initialization class NewCtrls
  4. //
  5. // WARNING: Do not modify this file.  This file is recreated each time its
  6. //          associated .rct/.res file is sent through the Java Resource Wizard!
  7. //
  8. // This class can be use to create controls within any container, however, the
  9. // following describes how to use this class with an Applet.  For addtional
  10. // information on using Java Resource Wizard generated classes, refer to the
  11. // Visual J++ 1.1 documention.
  12. //
  13. // 1) Import this class in the .java file for the Applet that will use it:
  14. //
  15. //      import NewCtrls;
  16. //
  17. // 2) Create an instance of this class in your Applet's 'init' member, and call
  18. //    CreateControls() through this object:
  19. //
  20. //      NewCtrls ctrls = new NewCtrls (this);
  21. //      ctrls.CreateControls();
  22. //
  23. // 3) To process events generated from user action on these controls, implement
  24. //    the 'handleEvent' member for your applet:
  25. //
  26. //      public boolean handleEvent (Event evt)
  27. //      {
  28. //
  29. //      }
  30. //
  31. //------------------------------------------------------------------------------
  32. import java.awt.*;
  33. import DLayout;
  34.  
  35. public class NewCtrls
  36. {
  37.     Container    m_Parent       = null;
  38.     boolean      m_fInitialized = false;
  39.     DLayout m_Layout;
  40.  
  41.     // Control definitions
  42.     //--------------------------------------------------------------------------
  43.     Button        btnCreate;
  44.     Button        btnCancel;
  45.     Label         IDC_STATIC1;
  46.     TextField     tfConfName;
  47.     Label         IDC_STATIC2;
  48.     TextArea      taDesc;
  49.     Label         IDC_STATIC3;
  50.     TextField     tfUserName;
  51.     Label         IDC_STATIC4;
  52.     Choice        cmbStartMonth;
  53.     TextField     tfStartDay;
  54.     TextField     tfStartYear;
  55.     Label         IDC_STATIC5;
  56.     Label         IDC_STATIC6;
  57.     Label         IDC_STATIC7;
  58.     Label         IDC_STATIC8;
  59.     Label         IDC_STATIC9;
  60.     Label         IDC_STATIC10;
  61.     TextField     tfStopHour;
  62.     TextField     tfStopMinute;
  63.     Label         IDC_STATIC11;
  64.     Label         IDC_STATIC12;
  65.     TextField     tfStartHour;
  66.     TextField     tfStartMinute;
  67.     Label         IDC_STATIC13;
  68.     Label         IDC_STATIC14;
  69.     Label         IDC_STATIC15;
  70.     TextField     tfStopYear;
  71.     TextField     tfStopDay;
  72.     Choice        cmbStopMonth;
  73.  
  74.  
  75.     // Constructor
  76.     //--------------------------------------------------------------------------
  77.     public NewCtrls (Container parent)
  78.     {
  79.         m_Parent = parent;
  80.     }
  81.  
  82.     // Initialization.
  83.     //--------------------------------------------------------------------------
  84.     public boolean CreateControls()
  85.     {
  86.         // Can only init controls once
  87.         //----------------------------------------------------------------------
  88.         if (m_fInitialized || m_Parent == null)
  89.             return false;
  90.  
  91.         // Parent must be a derivation of the Container class
  92.         //----------------------------------------------------------------------
  93.         if (!(m_Parent instanceof Container))
  94.             return false;
  95.  
  96.         // Since there is no way to know if a given font is supported from
  97.         // platform to platform, we only change the size of the font, and not
  98.         // type face name.  And, we only change the font if the dialog resource
  99.         // specified a font.
  100.         //----------------------------------------------------------------------
  101.         Font OldFnt = m_Parent.getFont();
  102.         
  103.         if (OldFnt != null)
  104.         {
  105.             Font NewFnt = new Font(OldFnt.getName(), OldFnt.getStyle(), 8);
  106.  
  107.             m_Parent.setFont(NewFnt);
  108.         }
  109.  
  110.         // All position and sizes are in Dialog Units, so, we use the
  111.         // DLayout manager.
  112.         //----------------------------------------------------------------------
  113.         m_Layout = new DLayout(m_Parent, 344, 143);
  114.         m_Parent.setLayout(m_Layout);
  115.         m_Parent.addNotify();
  116.  
  117.         Dimension size   = m_Layout.getDialogSize();
  118.         Insets    insets = m_Parent.insets();
  119.         
  120.         m_Parent.resize(insets.left + size.width  + insets.right,
  121.                         insets.top  + size.height + insets.bottom);
  122.  
  123.         // Control creation
  124.         //----------------------------------------------------------------------
  125.         btnCreate = new Button ("Create");
  126.         m_Parent.add(btnCreate);
  127.         m_Layout.setShape(btnCreate, 118, 122, 50, 14);
  128.  
  129.         btnCancel = new Button ("Cancel");
  130.         m_Parent.add(btnCancel);
  131.         m_Layout.setShape(btnCancel, 174, 122, 50, 14);
  132.  
  133.         IDC_STATIC1 = new Label ("Conference Name:", Label.LEFT);
  134.         m_Parent.add(IDC_STATIC1);
  135.         m_Layout.setShape(IDC_STATIC1, 7, 7, 60, 8);
  136.  
  137.         tfConfName = new TextField ("");
  138.         m_Parent.add(tfConfName);
  139.         m_Layout.setShape(tfConfName, 7, 17, 160, 13);
  140.  
  141.         IDC_STATIC2 = new Label ("Description:", Label.LEFT);
  142.         m_Parent.add(IDC_STATIC2);
  143.         m_Layout.setShape(IDC_STATIC2, 7, 37, 38, 8);
  144.  
  145.         taDesc = new TextArea ("");
  146.         m_Parent.add(taDesc);
  147.         m_Layout.setShape(taDesc, 7, 47, 160, 65);
  148.  
  149.         IDC_STATIC3 = new Label ("User Name:", Label.LEFT);
  150.         m_Parent.add(IDC_STATIC3);
  151.         m_Layout.setShape(IDC_STATIC3, 177, 7, 38, 8);
  152.  
  153.         tfUserName = new TextField ("");
  154.         m_Parent.add(tfUserName);
  155.         m_Layout.setShape(tfUserName, 177, 17, 160, 13);
  156.  
  157.         IDC_STATIC4 = new Label ("Month:", Label.LEFT);
  158.         m_Parent.add(IDC_STATIC4);
  159.         m_Layout.setShape(IDC_STATIC4, 177, 47, 23, 8);
  160.  
  161.         cmbStartMonth = new Choice ();
  162.         m_Parent.add(cmbStartMonth);
  163.         m_Layout.setShape(cmbStartMonth, 177, 57, 60, 65);
  164.  
  165.         tfStartDay = new TextField ("");
  166.         m_Parent.add(tfStartDay);
  167.         m_Layout.setShape(tfStartDay, 242, 57, 20, 13);
  168.  
  169.         tfStartYear = new TextField ("");
  170.         m_Parent.add(tfStartYear);
  171.         m_Layout.setShape(tfStartYear, 267, 57, 25, 13);
  172.  
  173.         IDC_STATIC5 = new Label ("Day:", Label.LEFT);
  174.         m_Parent.add(IDC_STATIC5);
  175.         m_Layout.setShape(IDC_STATIC5, 242, 47, 16, 8);
  176.  
  177.         IDC_STATIC6 = new Label ("Year:", Label.LEFT);
  178.         m_Parent.add(IDC_STATIC6);
  179.         m_Layout.setShape(IDC_STATIC6, 267, 47, 18, 8);
  180.  
  181.         IDC_STATIC7 = new Label ("Start Time:", Label.LEFT);
  182.         m_Parent.add(IDC_STATIC7);
  183.         m_Layout.setShape(IDC_STATIC7, 177, 37, 35, 8);
  184.  
  185.         IDC_STATIC8 = new Label ("Stop Time:", Label.LEFT);
  186.         m_Parent.add(IDC_STATIC8);
  187.         m_Layout.setShape(IDC_STATIC8, 177, 77, 35, 8);
  188.  
  189.         IDC_STATIC9 = new Label ("Hr:", Label.LEFT);
  190.         m_Parent.add(IDC_STATIC9);
  191.         m_Layout.setShape(IDC_STATIC9, 297, 87, 10, 8);
  192.  
  193.         IDC_STATIC10 = new Label ("Min:", Label.LEFT);
  194.         m_Parent.add(IDC_STATIC10);
  195.         m_Layout.setShape(IDC_STATIC10, 322, 87, 14, 8);
  196.  
  197.         tfStopHour = new TextField ("");
  198.         m_Parent.add(tfStopHour);
  199.         m_Layout.setShape(tfStopHour, 297, 97, 20, 13);
  200.  
  201.         tfStopMinute = new TextField ("");
  202.         m_Parent.add(tfStopMinute);
  203.         m_Layout.setShape(tfStopMinute, 322, 97, 15, 13);
  204.  
  205.         IDC_STATIC11 = new Label ("Hr:", Label.LEFT);
  206.         m_Parent.add(IDC_STATIC11);
  207.         m_Layout.setShape(IDC_STATIC11, 297, 47, 10, 8);
  208.  
  209.         IDC_STATIC12 = new Label ("Min:", Label.LEFT);
  210.         m_Parent.add(IDC_STATIC12);
  211.         m_Layout.setShape(IDC_STATIC12, 322, 47, 14, 8);
  212.  
  213.         tfStartHour = new TextField ("");
  214.         m_Parent.add(tfStartHour);
  215.         m_Layout.setShape(tfStartHour, 297, 57, 20, 13);
  216.  
  217.         tfStartMinute = new TextField ("");
  218.         m_Parent.add(tfStartMinute);
  219.         m_Layout.setShape(tfStartMinute, 322, 57, 15, 13);
  220.  
  221.         IDC_STATIC13 = new Label ("Month:", Label.LEFT);
  222.         m_Parent.add(IDC_STATIC13);
  223.         m_Layout.setShape(IDC_STATIC13, 177, 87, 23, 8);
  224.  
  225.         IDC_STATIC14 = new Label ("Day:", Label.LEFT);
  226.         m_Parent.add(IDC_STATIC14);
  227.         m_Layout.setShape(IDC_STATIC14, 242, 87, 16, 8);
  228.  
  229.         IDC_STATIC15 = new Label ("Year:", Label.LEFT);
  230.         m_Parent.add(IDC_STATIC15);
  231.         m_Layout.setShape(IDC_STATIC15, 267, 87, 18, 8);
  232.  
  233.         tfStopYear = new TextField ("");
  234.         m_Parent.add(tfStopYear);
  235.         m_Layout.setShape(tfStopYear, 267, 97, 25, 13);
  236.  
  237.         tfStopDay = new TextField ("");
  238.         m_Parent.add(tfStopDay);
  239.         m_Layout.setShape(tfStopDay, 242, 97, 20, 13);
  240.  
  241.         cmbStopMonth = new Choice ();
  242.         m_Parent.add(cmbStopMonth);
  243.         m_Layout.setShape(cmbStopMonth, 177, 97, 60, 65);
  244.  
  245.         m_fInitialized = true;
  246.         return true;
  247.     }
  248. }
  249.