📄 menu.java
字号:
package net.aetherial.gis.our;
import java.awt.*;
import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import net.aetherial.gis.our.auto.CommandAction;
import net.aetherial.gis.our.auto.Dialog.DialogSetPath;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Menu
extends JMenuBar {
private JMenu jMenuFile = new JMenu();
private JMenu jMenuFileImport = new JMenu();
private JMenu jMenuFileOutput = new JMenu();
private JMenu jMenuEdit = new JMenu();
private JMenu jMenuEncript = new JMenu();
private JMenu jMenuCommand = new JMenu();
private JMenuItem itemReset = new JMenuItem();
private JMenuItem itemOpen = new JMenuItem();
private JMenuItem itemImportJWT = new JMenuItem();
private JMenuItem itemOutputJWT = new JMenuItem();
private JMenuItem itemOutputGML = new JMenuItem();
private JMenuItem itemSaveFile = new JMenuItem();
private JMenuItem itemExit = new JMenuItem();
///
private JMenuItem itemShowBetter = new JMenuItem();
private JMenuItem itemCut = new JMenuItem();
private JMenuItem itemLink = new JMenuItem();
///
private JMenuItem itemInputEncript = new JMenuItem();
private JMenuItem itemOutputEncript = new JMenuItem();
///
private JMenuItem itemSetHeader = new JMenuItem();
///
private FrameOur fo = null;
private boolean inputEncript = false, outputEncript = false;
public Menu() {
this.init();
this.addItem();
}
public Menu(FrameOur fo) {
this();
this.fo = fo;
}
public void init(){
//menu
this.jMenuFile.setText("文件");
this.jMenuFileImport.setText("导入文件");
this.jMenuFileOutput.setText("输出文件");
this.jMenuEdit.setText("编辑");
this.jMenuEncript.setText("加密");
this.jMenuCommand.setText("批处理");
///menu file
this.itemReset.setText("重新开始");
this.itemOpen.setText("打开文件");
this.itemImportJWT.setText("经纬通格式");
this.itemOutputJWT.setText("经纬通格式");//
this.itemOutputGML.setText("GML格式");
this.itemSaveFile.setText("保存文件");
this.itemExit.setText("退出");
///menu edit
this.itemShowBetter.setText("航点显示优化");
this.itemCut.setText("切割航迹");
this.itemLink.setText("合并航迹");
///
this.itemInputEncript.setText("输入加密");
this.itemOutputEncript.setText("输出加密");
this.setEncriptItem();
//
this.itemSetHeader.setText("填充所有的市乡镇");
///menu file
this.itemReset.addActionListener(new MenuItem_actionAdapter(this));
this.itemOpen.addActionListener(new MenuItem_actionAdapter(this));
this.itemImportJWT.addActionListener(new MenuItem_actionAdapter(this));
this.itemOutputJWT.addActionListener(new MenuItem_actionAdapter(this));//
this.itemOutputGML.addActionListener(new MenuItem_actionAdapter(this));
this.itemSaveFile.addActionListener(new MenuItem_actionAdapter(this));
this.itemExit.addActionListener(new MenuItem_actionAdapter(this));
///menu edit
this.itemShowBetter.addActionListener(new MenuItem_actionAdapter(this));
this.itemCut.addActionListener(new MenuItem_actionAdapter(this));
this.itemLink.addActionListener(new MenuItem_actionAdapter(this));
///menu encript
this.itemInputEncript.addActionListener(new MenuItem_actionAdapter(this));
this.itemOutputEncript.addActionListener(new MenuItem_actionAdapter(this));
//
this.itemSetHeader.addActionListener(new MenuItem_actionAdapter(this));
}
public void addItem() {
///file
this.add(this.jMenuFile);
this.jMenuFile.add(this.itemReset);
this.jMenuFile.addSeparator();
this.jMenuFile.add(this.itemOpen);
this.jMenuFile.add(this.itemSaveFile);
this.jMenuFile.add(this.jMenuFileImport);
this.jMenuFile.add(this.jMenuFileOutput);
this.jMenuFile.addSeparator();
this.jMenuFile.add(this.itemExit);
///
this.jMenuFileImport.add(this.itemImportJWT);
this.jMenuFileOutput.add(this.itemOutputJWT);
this.jMenuFileOutput.add(this.itemOutputGML);
///
this.add(this.jMenuEdit);
this.jMenuEdit.add(this.itemShowBetter);
this.jMenuEdit.add(this.itemCut);
this.jMenuEdit.add(this.itemLink);
///
this.add(this.jMenuEncript);
this.jMenuEncript.add(this.itemInputEncript);
this.jMenuEncript.add(this.itemOutputEncript);
///
this.add(this.jMenuCommand);
this.jMenuCommand.add(itemSetHeader);
}
public void setEncriptItem() {
if (this.inputEncript == false) {
this.itemInputEncript.setText("输入加密 ×");
}
else {
this.itemInputEncript.setText("输入加密 √");
}
if (this.outputEncript == false) {
this.itemOutputEncript.setText("输出加密 ×");
}
else {
this.itemOutputEncript.setText("输出加密 √");
}
}
public void action(ActionEvent e) {
if(((JMenuItem)e.getSource()).equals(this.itemOpen)){
System.out.println("right test!");
}else if(((JMenuItem)e.getSource()).equals(this.itemSetHeader)){
System.out.println("itemSetHeader....");
//CommandAction ca = new CommandAction(this.fo);
DialogSetPath dp = new DialogSetPath("将市、县、乡填上");
}
}
}
class MenuItem_actionAdapter
implements ActionListener {
private Menu adaptee;
MenuItem_actionAdapter(Menu adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.action(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -