home *** CD-ROM | disk | FTP | other *** search
- //------------------------------------------------------------------------------
- // %s.java:
- // Implementation of "control creator" class %s
- //------------------------------------------------------------------------------
- import java.awt.*;
- import DialogLayout;
-
- public class %s
- {
- Container m_Parent = null;
- boolean m_fInitialized = false;
- DialogLayout m_Layout;
-
- // Control definitions
- //--------------------------------------------------------------------------
- %s
-
- // Constructor
- //--------------------------------------------------------------------------
- public %s (Container parent)
- {
- m_Parent = parent;
- }
-
- // Initialization.
- //--------------------------------------------------------------------------
- public boolean CreateControls()
- {
- // CreateControls should be called only once
- //----------------------------------------------------------------------
- if (m_fInitialized || m_Parent == null)
- return false;
-
- // m_Parent must be extended from the Container class
- //----------------------------------------------------------------------
- if (!(m_Parent instanceof Container))
- return false;
-
- // Since a given font may not be supported across all platforms, it
- // is safe to modify only the size of the font, not the typeface.
- //----------------------------------------------------------------------
- Font OldFnt = m_Parent.getFont();
- if (OldFnt != null)
- {
- Font NewFnt = new Font(OldFnt.getName(), OldFnt.getStyle(), %d);
-
- m_Parent.setFont(NewFnt);
- }
-
- // All position and sizes are in dialog logical units, so we use a
- // DialogLayout as our layout manager.
- //----------------------------------------------------------------------
- m_Layout = new DialogLayout(m_Parent, %d, %d);
- m_Parent.setLayout(m_Layout);
- m_Parent.addNotify();
-
- Dimension size = m_Layout.getDialogSize();
- Insets insets = m_Parent.insets();
-
- m_Parent.resize(insets.left + size.width + insets.right,
- insets.top + size.height + insets.bottom);
-
- // Control creation
- //----------------------------------------------------------------------
- %s
-
- m_fInitialized = true;
- return true;
- }
- }
-