📄 idr_menu2.java
字号:
//------------------------------------------------------------------------------
// IDR_MENU2.java:
// Implementation for menu creation class IDR_MENU2
//
// 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 is use to create a menu on a Frame object. 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 Frame that will use it:
//
// import IDR_MENU2;
//
// 2) Create an instance of this class in your Applet's 'main' member, and call
// CreateMenu() through this object:
//
// IDR_MENU2 menu = new IDR_MENU2 (frame);
// menu.CreateMenu();
//
// 3) To process events generated from user action on the menu, implement
// the 'handleEvent' member for your Frame:
//
// public boolean handleEvent (Event evt)
// {
//
// }
//
//------------------------------------------------------------------------------
import java.awt.*;
public class IDR_MENU2
{
Frame m_Frame = null;
boolean m_fInitialized = false;
// MenuBar definitions
//--------------------------------------------------------------------------
MenuBar mb;
// Menu and Menu item definitions
//--------------------------------------------------------------------------
Menu m1; // &File
MenuItem IDM_SUBOPEN; // &Open
Menu m3; // &View
MenuItem IDM_CHANGEMAIN; // &Change to First Menu
MenuItem IDM_COLORSUB; // &Modify Window Color
Menu m6; // &Help
MenuItem IDM_SUBABOUT; // &About
// Constructor
//--------------------------------------------------------------------------
public IDR_MENU2 (Frame frame)
{
m_Frame = frame;
}
// Initialization.
//--------------------------------------------------------------------------
public boolean CreateMenu()
{
// Can only init controls once
//----------------------------------------------------------------------
if (m_fInitialized || m_Frame == null)
return false;
// Create menubar and attach to the frame
//----------------------------------------------------------------------
mb = new MenuBar();
m_Frame.setMenuBar(mb);
// Create menu and menu items and assign to menubar
//----------------------------------------------------------------------
m1 = new Menu("&File");
mb.add(m1);
IDM_SUBOPEN = new MenuItem("&Open");
m1.add(IDM_SUBOPEN);
m3 = new Menu("&View");
mb.add(m3);
IDM_CHANGEMAIN = new MenuItem("&Change to First Menu");
m3.add(IDM_CHANGEMAIN);
IDM_COLORSUB = new MenuItem("&Modify Window Color");
m3.add(IDM_COLORSUB);
m6 = new Menu("&Help");
mb.add(m6);
IDM_SUBABOUT = new MenuItem("&About");
m6.add(IDM_SUBABOUT);
m_fInitialized = true;
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -