home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 10 / ioProg_10.iso / soft / platsdk / inetwork.exe / TAPI-S.cab / 95appctrls.java < prev    next >
Encoding:
Java Source  |  1997-09-10  |  4.7 KB  |  149 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.     List          lstMediaTypes;
  44.     Button        btnClose;
  45.     Label         IDC_STATIC1;
  46.     Button        btnListen;
  47.     Button        btnStop;
  48.     TextField     tfStatusBox;
  49.     Label         IDC_STATIC2;
  50.     Button        btnAnswer;
  51.     Button        btnReject;
  52.     Button        btnHangup;
  53.  
  54.  
  55.     // Constructor
  56.     //--------------------------------------------------------------------------
  57.     public AppCtrls (Container parent)
  58.     {
  59.         m_Parent = parent;
  60.     }
  61.  
  62.     // Initialization.
  63.     //--------------------------------------------------------------------------
  64.     public boolean CreateControls()
  65.     {
  66.         // Can only init controls once
  67.         //----------------------------------------------------------------------
  68.         if (m_fInitialized || m_Parent == null)
  69.             return false;
  70.  
  71.         // Parent must be a derivation of the Container class
  72.         //----------------------------------------------------------------------
  73.         if (!(m_Parent instanceof Container))
  74.             return false;
  75.  
  76.         // Since there is no way to know if a given font is supported from
  77.         // platform to platform, we only change the size of the font, and not
  78.         // type face name.  And, we only change the font if the dialog resource
  79.         // specified a font.
  80.         //----------------------------------------------------------------------
  81.         Font OldFnt = m_Parent.getFont();
  82.         
  83.         if (OldFnt != null)
  84.         {
  85.             Font NewFnt = new Font(OldFnt.getName(), OldFnt.getStyle(), 8);
  86.  
  87.             m_Parent.setFont(NewFnt);
  88.         }
  89.  
  90.         // All position and sizes are in Dialog Units, so, we use the
  91.         // DLayout manager.
  92.         //----------------------------------------------------------------------
  93.         m_Layout = new DLayout(m_Parent, 244, 118);
  94.         m_Parent.setLayout(m_Layout);
  95.         m_Parent.addNotify();
  96.  
  97.         Dimension size   = m_Layout.getDialogSize();
  98.         Insets    insets = m_Parent.insets();
  99.         
  100.         m_Parent.resize(insets.left + size.width  + insets.right,
  101.                         insets.top  + size.height + insets.bottom);
  102.  
  103.         // Control creation
  104.         //----------------------------------------------------------------------
  105.         lstMediaTypes = new List (1, false);
  106.         m_Parent.add(lstMediaTypes);
  107.         m_Layout.setShape(lstMediaTypes, 7, 17, 65, 70);
  108.  
  109.         btnClose = new Button ("Close");
  110.         m_Parent.add(btnClose);
  111.         m_Layout.setShape(btnClose, 187, 97, 50, 14);
  112.  
  113.         IDC_STATIC1 = new Label ("Mediatypes:", Label.LEFT);
  114.         m_Parent.add(IDC_STATIC1);
  115.         m_Layout.setShape(IDC_STATIC1, 7, 7, 39, 8);
  116.  
  117.         btnListen = new Button ("Listen");
  118.         m_Parent.add(btnListen);
  119.         m_Layout.setShape(btnListen, 83, 17, 50, 14);
  120.  
  121.         btnStop = new Button ("Stop");
  122.         m_Parent.add(btnStop);
  123.         m_Layout.setShape(btnStop, 133, 17, 50, 14);
  124.  
  125.         tfStatusBox = new TextField ("");
  126.         m_Parent.add(tfStatusBox);
  127.         m_Layout.setShape(tfStatusBox, 82, 73, 155, 13);
  128.  
  129.         IDC_STATIC2 = new Label ("Status:", Label.LEFT);
  130.         m_Parent.add(IDC_STATIC2);
  131.         m_Layout.setShape(IDC_STATIC2, 82, 62, 23, 8);
  132.  
  133.         btnAnswer = new Button ("Answer");
  134.         m_Parent.add(btnAnswer);
  135.         m_Layout.setShape(btnAnswer, 83, 42, 50, 14);
  136.  
  137.         btnReject = new Button ("Reject");
  138.         m_Parent.add(btnReject);
  139.         m_Layout.setShape(btnReject, 133, 42, 50, 14);
  140.  
  141.         btnHangup = new Button ("Hangup");
  142.         m_Parent.add(btnHangup);
  143.         m_Layout.setShape(btnHangup, 187, 42, 50, 14);
  144.  
  145.         m_fInitialized = true;
  146.         return true;
  147.     }
  148. }
  149.