📄 jface.java
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class JFace extends JFrame {
static JFrame jface=new JFrame("中英电子词典");
JMenus jms;
public void create(){
jface.setSize(600,500);
jface.setLocationRelativeTo(null);
jface.setResizable(false);
jface.setBackground(Color.white);
jface.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jface.setVisible(true);
JMenuBar jm=new JMenuBar();
JMenu jfile1=new JMenu("文件");
JMenu jedit=new JMenu("编辑");
JMenu recite=new JMenu("轻松背单词");
JMenu jhelp=new JMenu("帮助");
JMenuItem Back=new JMenuItem("备份词库");
JMenuItem Exit=new JMenuItem("退出");
JMenuItem AddWord=new JMenuItem("添加词汇");
JMenuItem AmendWord=new JMenuItem("修改词汇");
JMenuItem DelWord=new JMenuItem("删除词汇");
JMenuItem accrue=new JMenuItem("生词本");
JMenuItem helpmsg=new JMenuItem("帮助文件");
jfile1.add(Back);
jfile1.add(Exit);
jedit.add(AddWord);
jedit.add(AmendWord);
jedit.add(DelWord);
recite.add(accrue);
jhelp.add(helpmsg);
jm.add(jfile1);
jm.add(jedit);
jm.add(recite);
jm.add(jhelp);
Back.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// 备份词库的触发事件
}
});
Exit.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// 退出该窗口
System.exit(0);
}
});
AddWord.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// 添加单词窗口
Addword addword=new Addword();
}
});
AmendWord.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// 修改单词窗口
Modword modword=new Modword();
}
});
DelWord.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
//删除单词窗口
Delword delword=new Delword();
}
});
accrue.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// 查看生词本
Reword reword=new Reword();
}
});
helpmsg.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// 提供帮助信息
}
});
jface.setJMenuBar(jm);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -