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

📄 helpwindow.java

📁 Owing to the applet Gantt chart source yard, already Chinese melt, Gantt chart can demonstrate a Chi
💻 JAVA
字号:
/** *   Copyright 2004 Carlos Silva A. *  *   Licensed under the Apache License, Version 2.0 (the "License"); *   you may not use this file except in compliance with the License.  *   You may obtain a copy of the License at   *  *   http://www.apache.org/licenses/LICENSE-2.0 *  *   Unless required by applicable law or agreed to in writing, software *   distributed under the License is distributed on an "AS IS" BASIS, *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *   See the License for the specific language governing permissions and *   limitations under the License. *  */package jgantt.view;import java.awt.BorderLayout;import java.io.IOException;import java.net.URL;import javax.swing.JEditorPane;import javax.swing.JFrame;import javax.swing.JScrollPane;import javax.swing.JViewport;import javax.swing.event.HyperlinkEvent;import javax.swing.event.HyperlinkListener;import javax.swing.text.html.HTMLDocument;import javax.swing.text.html.HTMLFrameHyperlinkEvent;import jgantt.Messages;/** * HelpWindow despliega el contenido de la ayuda HTML en una ventana. *  * <p>$Date: 2005/05/11 22:10:42 $</p>  * @version $Revision: 1.6 $ * @author Carlos Silva */public class HelpWindow extends JFrame {	/**	 * 	 */	private static final long serialVersionUID = 3256436989241735473L;	JEditorPane html;	/**	 * Inicializa y muestra la ventana de ayuda a partir de 	 * un archivo obtenido usando getResource 	 * @param path	 */	public HelpWindow(String path) {		super(Messages.getString("help.title")); //$NON-NLS-1$		URL url = null;				try {						url = HelpWindow.class.getResource(path); 			//ClassLoader.getSystemResource(path);		} catch (Exception e) {			System.err.println(Messages.getString("help.error.open.failed") + path); //$NON-NLS-1$			url = null;		}		initURL(url);		setSize(500,480);	}	/**	 * Crea una ventana de ayuda a partir de un URL	 * @param url	 */	public HelpWindow(URL url) {		super(Messages.getString("help.title")); //$NON-NLS-1$		initURL(url);		setSize(600,440);	}	private void initURL(URL url) {		try {			if (url != null) {				html = new JEditorPane(url);				html.setEditable(false);				html.addHyperlinkListener(createHyperLinkListener());				JScrollPane scroller = new JScrollPane();				JViewport vp = scroller.getViewport();				vp.add(html);				getContentPane().add(scroller, BorderLayout.CENTER);			}		} catch (Exception e) {			System.out.println(Messages.getString("help.error.init") + e); //$NON-NLS-1$		}			}	public HyperlinkListener createHyperLinkListener() {		return new HyperlinkListener() {			public void hyperlinkUpdate(HyperlinkEvent e) {				if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {					if (e instanceof HTMLFrameHyperlinkEvent) {						((HTMLDocument) html.getDocument()).processHTMLFrameHyperlinkEvent((HTMLFrameHyperlinkEvent) e);					} else {						try {							html.setPage(e.getURL());						} catch (IOException ioe) {							System.out.println(Messages.getString("help.error.follow.link") + ioe); //$NON-NLS-1$						}					}				}			}		};	}		/**	 * Funcion de test	 * @param args	 */	public static void main(String[] args) {		HelpWindow h = new HelpWindow("res/help/kbd.html");				h.setVisible(true);	}}

⌨️ 快捷键说明

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