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