📄 idr_menu1.java
字号:
//------------------------------------------------------------------------------
// IDR_MENU1.java:
// Implementation for menu creation class IDR_MENU1
//
// 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_MENU1;
//
// 2) Create an instance of this class in your Applet's 'main' member, and call
// CreateMenu() through this object:
//
// IDR_MENU1 menu = new IDR_MENU1 (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_MENU1
{
Frame m_Frame = null;
boolean m_fInitialized = false;
// MenuBar definitions
//--------------------------------------------------------------------------
MenuBar mb;
// Menu and Menu item definitions
//--------------------------------------------------------------------------
Menu m1; // &File
MenuItem IDM_OPEN; // &Open...
MenuItem IDM_SAVE; // &Save...
MenuItem IDM_SAVEAS; // S&ave As...
MenuItem IDM_BLINK; // &Blink Text...
MenuItem IDM_EXIT; // E&xit...
Menu m7; // &Edit
MenuItem IDM_CARDLAYOUT; // &CardLayout
MenuItem IDM_COPY; // C&opy
MenuItem IDM_PASTE; // &Paste
MenuItem IDM_DELETE; // &Delete
MenuItem IDM_SELECTALL; // &Select All
MenuItem IDM_FIND; // &Find...
MenuItem IDM_GOTO; // &Go to...
Menu m15; // &View
MenuItem IDM_CHANGESUB; // &Change to Second Menu
MenuItem IDM_COLORMAIN; // &Modify Window Color
Menu m18; // &Window
MenuItem IDM_NEWWINDOW; // &New Window
Menu m20; // &Help
MenuItem IDM_CONTENT; // &Content
MenuItem IDM_SEARCH; // &Search
MenuItem IDM_ABOUT; // &About
// Constructor
//--------------------------------------------------------------------------
public IDR_MENU1 (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_OPEN = new MenuItem("&Open...");
m1.add(IDM_OPEN);
IDM_SAVE = new MenuItem("&Save...");
m1.add(IDM_SAVE);
IDM_SAVEAS = new MenuItem("S&ave As...");
m1.add(IDM_SAVEAS);
IDM_BLINK = new MenuItem("&Blink Text...");
m1.add(IDM_BLINK);
IDM_EXIT = new MenuItem("E&xit...");
m1.add(IDM_EXIT);
m7 = new Menu("&Edit");
mb.add(m7);
IDM_CARDLAYOUT = new MenuItem("&CardLayout");
m7.add(IDM_CARDLAYOUT);
IDM_COPY = new MenuItem("C&opy");
m7.add(IDM_COPY);
IDM_PASTE = new MenuItem("&Paste");
m7.add(IDM_PASTE);
IDM_DELETE = new MenuItem("&Delete");
m7.add(IDM_DELETE);
IDM_SELECTALL = new MenuItem("&Select All");
m7.add(IDM_SELECTALL);
IDM_FIND = new MenuItem("&Find...");
m7.add(IDM_FIND);
IDM_GOTO = new MenuItem("&Go to...");
m7.add(IDM_GOTO);
m15 = new Menu("&View");
mb.add(m15);
IDM_CHANGESUB = new MenuItem("&Change to Second Menu");
m15.add(IDM_CHANGESUB);
IDM_COLORMAIN = new MenuItem("&Modify Window Color");
m15.add(IDM_COLORMAIN);
m18 = new Menu("&Window");
mb.add(m18);
IDM_NEWWINDOW = new MenuItem("&New Window");
m18.add(IDM_NEWWINDOW);
m20 = new Menu("&Help");
mb.add(m20);
IDM_CONTENT = new MenuItem("&Content");
m20.add(IDM_CONTENT);
IDM_SEARCH = new MenuItem("&Search");
m20.add(IDM_SEARCH);
IDM_ABOUT = new MenuItem("&About");
m20.add(IDM_ABOUT);
m_fInitialized = true;
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -