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

  1. //------------------------------------------------------------------------------
  2. // AppCtrls.java:
  3. //        Implementation for container control initialization class AppCtrls
  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 AppCtrls;
  16. //
  17. // 2) Create an instance of this class in your Applet's 'init' member, and call
  18. //    CreateControls() through this object:
  19. //
  20. //      AppCtrls ctrls = new AppCtrls (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 AppCtrls
  36. {
  37.     Container    m_Parent       = null;
  38.     boolean      m_fInitialized = false;
  39.     DLayout m_Layout;
  40.  
  41.     // Control definitions
  42.     //--------------------------------------------------------------------------
  43.     Button        btnJoin;
  44.     Button        btnHangup;
  45.     Button        btnNew;
  46.     Button        btnDelete;
  47.     Button        btnRefresh;
  48.     List          lstConferences;
  49.     Label         IDC_STATIC1;
  50.     TextField     tfStatusBox;
  51.     Label         IDC_STATIC2;
  52.  
  53.  
  54.     // Constructor
  55.     //--------------------------------------------------------------------------
  56.     public AppCtrls (Container parent)
  57.     {
  58.         m_Parent = parent;
  59.     }
  60.  
  61.     // Initialization.
  62.     //--------------------------------------------------------------------------
  63.     public boolean CreateControls()
  64.     {
  65.         // Can only init controls once
  66.         //----------------------------------------------------------------------
  67.         if (m_fInitialized || m_Parent == null)
  68.             return false;
  69.  
  70.         // Parent must be a derivation of the Container class
  71.         //----------------------------------------------------------------------
  72.         if (!(m_Parent instanceof Container))
  73.             return false;
  74.  
  75.         // Since there is no way to know if a given font is supported from
  76.         // platform to platform, we only change the size of the font, and not
  77.         // type face name.  And, we only change the font if the dialog resource
  78.         // specified a font.
  79.         //----------------------------------------------------------------------
  80.         Font OldFnt = m_Parent.getFont();
  81.         
  82.         if (OldFnt != null)
  83.         {
  84.             Font NewFnt = new Font(OldFnt.getName(), OldFnt.getStyle(), 8);
  85.  
  86.             m_Parent.setFont(NewFnt);
  87.         }
  88.  
  89.         // All position and sizes are in Dialog Units, so, we use the
  90.         // DLayout manager.
  91.         //----------------------------------------------------------------------
  92.         m_Layout = new DLayout(m_Parent, 284, 175);
  93.         m_Parent.setLayout(m_Layout);
  94.         m_Parent.addNotify();
  95.  
  96.         Dimension size   = m_Layout.getDialogSize();
  97.         Insets    insets = m_Parent.insets();
  98.         
  99.         m_Parent.resize(insets.left + size.width  + insets.right,
  100.                         insets.top  + size.height + insets.bottom);
  101.  
  102.         // Control creation
  103.         //----------------------------------------------------------------------
  104.         btnJoin = new Button ("Join");
  105.         m_Parent.add(btnJoin);
  106.         m_Layout.setShape(btnJoin, 7, 155, 50, 14);
  107.  
  108.         btnHangup = new Button ("Hangup");
  109.         m_Parent.add(btnHangup);
  110.         m_Layout.setShape(btnHangup, 57, 155, 50, 14);
  111.  
  112.         btnNew = new Button ("New");
  113.         m_Parent.add(btnNew);
  114.         m_Layout.setShape(btnNew, 122, 155, 50, 14);
  115.  
  116.         btnDelete = new Button ("Delete");
  117.         m_Parent.add(btnDelete);
  118.         m_Layout.setShape(btnDelete, 172, 155, 50, 14);
  119.  
  120.         btnRefresh = new Button ("Refresh");
  121.         m_Parent.add(btnRefresh);
  122.         m_Layout.setShape(btnRefresh, 227, 155, 50, 14);
  123.  
  124.         lstConferences = new List (1, false);
  125.         m_Parent.add(lstConferences);
  126.         m_Layout.setShape(lstConferences, 7, 17, 270, 105);
  127.  
  128.         IDC_STATIC1 = new Label ("Conference Name", Label.LEFT);
  129.         m_Parent.add(IDC_STATIC1);
  130.         m_Layout.setShape(IDC_STATIC1, 7, 7, 58, 8);
  131.  
  132.         tfStatusBox = new TextField ("");
  133.         m_Parent.add(tfStatusBox);
  134.         m_Layout.setShape(tfStatusBox, 7, 135, 270, 12);
  135.  
  136.         IDC_STATIC2 = new Label ("Status:", Label.LEFT);
  137.         m_Parent.add(IDC_STATIC2);
  138.         m_Layout.setShape(IDC_STATIC2, 7, 125, 23, 8);
  139.  
  140.         m_fInitialized = true;
  141.         return true;
  142.     }
  143. }
  144.