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

📄 editor.java.old

📁 java xml 应用开发
💻 OLD
字号:
import java.awt.Color;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.File;

import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.WindowConstants;

import org.cip4.jdflib.core.JDFAudit;

/**
 * @author AnderssA ThunellE
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
public class Editor
{
    private static Editor my_Editor;
    JDFFrame my_Frame;
    private static String filePath; 
    
//  set buildJar to true  if you want to build a .jar file
//  set buildJar to false if you want to start the editor in eclipse
    public static boolean buildJar = true; 
    
    public static ImageIcon getImageIcon(Class myClass, String resString)
    {
        return Editor.buildJar
                    ? new ImageIcon(myClass.getResource(resString))
                    : new ImageIcon("."+resString);
    }

    
    public static void main(String[] args)
    {
        filePath = (args.length >= 1) ? args[0] : null;
        new Editor();
    }

    public Editor()
    {
        my_Editor = this;
        init();
    }

    /**
     * Method init.
     * instanciate the editor window
     */
    public void init()
    {
        my_Frame = new JDFFrame();
        try
        {
            my_Frame.drawWindow();
            my_Frame.setBackground(Color.white);
            my_Frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
            final WindowListener winLis = new WindowAdapter()
            {
                public void windowClosing(WindowEvent e)
                {
                    if(my_Frame.saveFileQuestion() != JOptionPane.CANCEL_OPTION)
                    {
                        my_Frame.writeToINI();
                        System.exit(0);
                    }
                }
            };
            my_Frame.addWindowListener(winLis);
            
            //this is only for the PC version
            if(filePath != null && !filePath.endsWith(".prop"))
            {
                final File file = new File(filePath);
                my_Frame.setFileToSave(file);
                my_Frame.readFile(file);
                my_Frame.updateRecentFilesMenu(file.toString());
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
    
    /**
     * Method getEditor.
     * @return Editor
     */
    public static Editor getEditor()
    {
        return my_Editor;
    }
    /**
     * Method getFrame.
     * @return JDFFrame
     */
    public JDFFrame getFrame()
    {
        return my_Frame;
    }
    
    /**
     * 
     * @return
     */
    public static String getEditorName(){
    	return "CIP4 JDF Editor -- Copyright 

⌨️ 快捷键说明

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