xbookmark.java

来自「java写的浏览器」· Java 代码 · 共 74 行

JAVA
74
字号
/****************************************************************
*              XBrowser  -  eXtended web Browser                *
*                                                               *
*           Copyright (c) 2000-2001  Armond Avanes              *
*     Refer to ReadMe & License files for more information      *
*                                                               *
*                                                               *
*                      By: Armond Avanes                        *
*       Armond555@yahoo.com     &    Armond333@yahoo.com        *
*                http://xbrowser.sourceforge.net/               *
*****************************************************************/
package xbrowser.bookmark;

import java.awt.*;
import java.awt.datatransfer.*;
import javax.swing.*;

import xbrowser.*;

/** XBrowser's bookmark; specified by URL, implements opening and copying. */
public class XBookmark extends XAbstractBookmark
{
	/** Create bookmark with hyperlink specified, but with empty title and description. */
	public XBookmark(String href)
	{
		setHRef(href);
	}

	/** Create bookmark with hyperlink, title and description specified. */
	public XBookmark(String href, String title, String desc)
	{
		super(title, desc);
		setHRef(href);
	}

	/** Change bookmark's hyperlink. */
	public void setHRef(String new_href)
	{
	String old_href = href;

		href = new_href;
		propChangeSupport.firePropertyChange("HRef",old_href,new_href);
	}

	/** Return bookmark's hyperlink. */
	public String getHRef()
	{
		return href;
	}

	/** Open bookmark in same window. */
	public void openInSamePage()
	{
		XBrowser.getBrowser().openInActiveDocument(this);
	}

	/** Open bookmark in new window. */
	public void open()
	{
		XBrowser.getBrowser().openInNewDocument(this);
	}

	/** Put bookamrk's url in system clipboard. */
	public void copy()
	{
	StringSelection str_sel = new StringSelection(href);

		Toolkit.getDefaultToolkit().getSystemClipboard().setContents(str_sel,str_sel);
	}

// Attributes:
	private String href = "";
}

⌨️ 快捷键说明

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