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

📄 libhelper.java

📁 用Java开发的、实现类似Visio功能的应用程序源码
💻 JAVA
字号:
/**
 *    $Id:LibHelper.java $
 *
 *    Copyright 2004 ~ 2005  JingFei International Cooperation LTD. All rights reserved. *
 */


package com.jfimagine.jfdraw.gui.dialog;

import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Container;
import java.awt.Font;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.BorderFactory;
import javax.swing.JTabbedPane;
import javax.swing.JFrame;

import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRootPane;
import javax.swing.JTextArea;
import javax.swing.KeyStroke;
import javax.swing.JOptionPane;
import javax.swing.JButton;
import javax.swing.JEditorPane;

import com.jfimagine.jfdraw.gui.ToolFactory;
import com.jfimagine.jfdraw.gui.resource.CADResource;
import com.jfimagine.jfdraw.gui.GUIConst;
import com.jfimagine.jfdraw.gui.CADPane;
import com.jfimagine.jfdraw.gui.DrawAdapter;  
import com.jfimagine.jfdraw.gui.GUIUtils;


/**
 * LibHelper is a helper class for library dialogs.
 *
 * @author     CookieMaker    
 *
 * @version $Revision: 1.4.1 $
 */
public class LibHelper{

	//library visible type, a dialog library showing model, it's a default type
	public static final int LIBRARY_VISIBLETYPE_DIALOG	=1;  

	//library visible type, an external type, e.g. showing library in other type of containers,
	//in this visible type, a library panel and template panel need to be notified here.
	public static final int LIBRARY_VISIBLETYPE_EXTERNAL	=2;
	
	
	        
        //references to library panels.
    	private LibPanel  m_libraryPanel =null;
    	private LibPanel  m_templatePanel=null;
	
	//library visible type
	private int 	  m_libType	=LIBRARY_VISIBLETYPE_DIALOG;
	public void setLibraryType(int type){
		m_libType	=type;
	}
	public int getLibraryType(){
		return m_libType;
	}

	//library panel	    	
    	public void setLibraryPanel(LibPanel panel){
    		m_libraryPanel	=panel;
	}
    	public LibPanel getLibraryPanel(){
    		switch (m_libType){
    			case LIBRARY_VISIBLETYPE_DIALOG:
    				return  LibDialog.getDialog().getLibraryPanel();
    			case LIBRARY_VISIBLETYPE_EXTERNAL:
    				return m_libraryPanel;
    		}
    		return null;
	}


	//template panel
    	public void setTemplatePanel(LibPanel panel){
    		m_templatePanel	=panel;
	}
    	public LibPanel getTemplatePanel(){
    		switch (m_libType){
    			case LIBRARY_VISIBLETYPE_DIALOG:
    				return  LibDialog.getDialog().getTemplatePanel();
    			case LIBRARY_VISIBLETYPE_EXTERNAL:
    				return m_templatePanel;
    		}
    		return null;
	}

		
	private static LibHelper m_libHelper  =null;	
	//only one instance is allowed for LibHelper.
	public static LibHelper getInstance(){
		if (m_libHelper==null)
			m_libHelper	=new LibHelper();
		return m_libHelper;
	}
	
	/** A private constructor to avoid generating multi instance of this class */	
	private LibHelper(){
	}
				
    	
    	public  void showLibraryDialog(DrawAdapter pane){
    		switch (m_libType){
    			case LIBRARY_VISIBLETYPE_DIALOG:
    				LibDialog.showLibDialog(pane);
    				break;
    			case LIBRARY_VISIBLETYPE_EXTERNAL:
    				//do nothing;
    				break;
    		}    		
    	}



}

⌨️ 快捷键说明

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