idd_dialogabout.java

来自「有关java的源程序,为讲授java程序设计课程使用」· Java 代码 · 共 123 行

JAVA
123
字号
//------------------------------------------------------------------------------
// IDD_DIALOGABOUT.java:
//		Implementation for container control initialization class IDD_DIALOGABOUT
//
// WARNING: Do not modify this file.  This file is recreated each time its
//          associated .rct/.res file is sent through the Java Resource Wizard!
//
// This class can be use to create controls within any container, however, the
// following describes how to use this class with an Applet.  For addtional
// information on using Java Resource Wizard generated classes, refer to the
// Visual J++ 1.1 documention.
//
// 1) Import this class in the .java file for the Applet that will use it:
//
//      import IDD_DIALOGABOUT;
//
// 2) Create an instance of this class in your Applet's 'init' member, and call
//    CreateControls() through this object:
//
//      IDD_DIALOGABOUT ctrls = new IDD_DIALOGABOUT (this);
//      ctrls.CreateControls();
//
// 3) To process events generated from user action on these controls, implement
//    the 'handleEvent' member for your applet:
//
//      public boolean handleEvent (Event evt)
//      {
//
//      }
//
//------------------------------------------------------------------------------
import java.awt.*;
import DialogLayout;

public class IDD_DIALOGABOUT
{
	Container    m_Parent       = null;
	boolean      m_fInitialized = false;
	DialogLayout m_Layout;

	// Control definitions
	//--------------------------------------------------------------------------
	Label         IDC_STRING1;
	Label         IDC_STRING22;
	Button        IDOK;
	Label         IDC_STRING23;
	TextField     IDCTIME;


	// Constructor
	//--------------------------------------------------------------------------
	public IDD_DIALOGABOUT (Container parent)
	{
		m_Parent = parent;
	}

	// Initialization.
	//--------------------------------------------------------------------------
	public boolean CreateControls()
	{
		// Can only init controls once
		//----------------------------------------------------------------------
		if (m_fInitialized || m_Parent == null)
			return false;

		// Parent must be a derivation of the Container class
		//----------------------------------------------------------------------
		if (!(m_Parent instanceof Container))
			return false;

		// Since there is no way to know if a given font is supported from
		// platform to platform, we only change the size of the font, and not
		// type face name.  And, we only change the font if the dialog resource
		// specified a font.
		//----------------------------------------------------------------------
		Font OldFnt = m_Parent.getFont();
		
		if (OldFnt != null)
		{
			Font NewFnt = new Font(OldFnt.getName(), OldFnt.getStyle(), 14);
			m_Parent.setFont(NewFnt);
		}

		// All position and sizes are in Dialog Units, so, we use the
		// DialogLayout manager.
		//----------------------------------------------------------------------
		m_Layout = new DialogLayout(m_Parent, 247, 116);
		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
		//----------------------------------------------------------------------
		IDC_STRING1 = new Label ("This Is MicroSoft Visual Java Demo Help Menu, Please", Label.LEFT);
		m_Parent.add(IDC_STRING1);
		m_Layout.setShape(IDC_STRING1, 34, 21, 187, 8);

		IDC_STRING22 = new Label ("Prease Left Mouse Key Down On \"OK\"  Button.", Label.LEFT);
		m_Parent.add(IDC_STRING22);
		m_Layout.setShape(IDC_STRING22, 35, 37, 183, 8);

		IDOK = new Button ("OK");
		m_Parent.add(IDOK);
		m_Layout.setShape(IDOK, 96, 87, 50, 14);

		IDC_STRING23 = new Label ("Current Time:", Label.LEFT);
		m_Parent.add(IDC_STRING23);
		m_Layout.setShape(IDC_STRING23, 70, 58, 45, 10);

		IDCTIME = new TextField ("");
		m_Parent.add(IDCTIME);
		m_Layout.setShape(IDCTIME, 119, 57, 43, 13);

		m_fInitialized = true;
		return true;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?