⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 idd_colordialog.java

📁 有关java的源程序,为讲授java程序设计课程使用
💻 JAVA
字号:
//------------------------------------------------------------------------------
// IDD_COLORDIALOG.java:
//		Implementation for container control initialization class IDD_COLORDIALOG
//
// 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_COLORDIALOG;
//
// 2) Create an instance of this class in your Applet's 'init' member, and call
//    CreateControls() through this object:
//
//      IDD_COLORDIALOG ctrls = new IDD_COLORDIALOG (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_COLORDIALOG
{
	Container    m_Parent       = null;
	boolean      m_fInitialized = false;
	DialogLayout m_Layout;

	// Control definitions
	//--------------------------------------------------------------------------
	Label         IDC_STATIC1;
	Label         IDC_STATIC4;
	Scrollbar     IDC_SCROLLBARRED;
	Label         IDC_STATIC6;
	Label         IDC_STATIC2;
	Scrollbar     IDC_SCROLLBARGREEN;
	Label         IDC_STATIC9;
	Label         IDC_STATIC36;
	Scrollbar     IDC_SCROLLBARBLUE;
	Button        IDOK;
	Button        IDCANCEL;
	Label         IDC_STATIC5;
	Label         IDC_STATIC7;
	Label         IDC_STATIC8;
	Label         IDC_STATIC10;


	// Constructor
	//--------------------------------------------------------------------------
	public IDD_COLORDIALOG (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, 272, 136);
		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_STATIC1 = new Label ("Red ", Label.LEFT);
		m_Parent.add(IDC_STATIC1);
		m_Layout.setShape(IDC_STATIC1, 19, 26, 16, 8);

		IDC_STATIC4 = new Label ("0", Label.LEFT);
		m_Parent.add(IDC_STATIC4);
		m_Layout.setShape(IDC_STATIC4, 47, 13, 8, 8);

		IDC_SCROLLBARRED = new Scrollbar (Scrollbar.HORIZONTAL, 0, 1, 0, 99);
		m_Parent.add(IDC_SCROLLBARRED);
		m_Layout.setShape(IDC_SCROLLBARRED, 44, 25, 130, 11);

		IDC_STATIC6 = new Label ("0", Label.LEFT);
		m_Parent.add(IDC_STATIC6);
		m_Layout.setShape(IDC_STATIC6, 46, 41, 13, 8);

		IDC_STATIC2 = new Label ("Green", Label.LEFT);
		m_Parent.add(IDC_STATIC2);
		m_Layout.setShape(IDC_STATIC2, 17, 53, 21, 8);

		IDC_SCROLLBARGREEN = new Scrollbar (Scrollbar.HORIZONTAL, 0, 1, 0, 99);
		m_Parent.add(IDC_SCROLLBARGREEN);
		m_Layout.setShape(IDC_SCROLLBARGREEN, 44, 53, 130, 11);

		IDC_STATIC9 = new Label ("0", Label.LEFT);
		m_Parent.add(IDC_STATIC9);
		m_Layout.setShape(IDC_STATIC9, 47, 68, 13, 8);

		IDC_STATIC36 = new Label ("Blue", Label.LEFT);
		m_Parent.add(IDC_STATIC36);
		m_Layout.setShape(IDC_STATIC36, 17, 81, 16, 8);

		IDC_SCROLLBARBLUE = new Scrollbar (Scrollbar.HORIZONTAL, 0, 1, 0, 99);
		m_Parent.add(IDC_SCROLLBARBLUE);
		m_Layout.setShape(IDC_SCROLLBARBLUE, 44, 80, 130, 11);

		IDOK = new Button ("OK");
		m_Parent.add(IDOK);
		m_Layout.setShape(IDOK, 46, 108, 39, 14);

		IDCANCEL = new Button ("Cancel");
		m_Parent.add(IDCANCEL);
		m_Layout.setShape(IDCANCEL, 152, 107, 39, 14);

		IDC_STATIC5 = new Label ("255", Label.LEFT);
		m_Parent.add(IDC_STATIC5);
		m_Layout.setShape(IDC_STATIC5, 165, 14, 13, 8);

		IDC_STATIC7 = new Label ("255", Label.LEFT);
		m_Parent.add(IDC_STATIC7);
		m_Layout.setShape(IDC_STATIC7, 163, 40, 13, 8);

		IDC_STATIC8 = new Label ("255", Label.LEFT);
		m_Parent.add(IDC_STATIC8);
		m_Layout.setShape(IDC_STATIC8, 162, 68, 13, 8);

		IDC_STATIC10 = new Label ("Color Preview", Label.LEFT);
		m_Parent.add(IDC_STATIC10);
		m_Layout.setShape(IDC_STATIC10, 191, 27, 66, 8);

		m_fInitialized = true;
		return true;
	}
}

⌨️ 快捷键说明

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