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

📄 dictpopupmanager.java

📁 用java 实现屏幕取词技术
💻 JAVA
字号:
/* * DictPopupManager.java * * Created on 2007-7-4, 17:13:27 * * To change this template, choose Tools | Templates * and open the template in the editor. */package dyno.swing.beans;import java.awt.Component;import java.awt.Font;import java.awt.Point;import javax.swing.JToolTip;import javax.swing.Popup;import javax.swing.PopupFactory;/** * * @author William Chen */public class DictPopupManager {    static Popup popup;    static Text last;        public static void show(Text text, Component src) {        hide();        last=text;        JToolTip tooltip = new JToolTip();        tooltip.setTipText(last.getTranslation());        tooltip.setFont(new Font("Dialog", 0, 12));        Point p = src.getLocationOnScreen();        int x = p.x + text.getX() + last.getWidth();        int y = p.y + text.getY() + last.getHeight();        popup = PopupFactory.getSharedInstance().getPopup(src, tooltip, x, y);        last.setVisible(true);        popup.show();    }    public static void hide(){        if(popup!=null && last!=null){            popup.hide();            last.setVisible(false);            popup=null;            last=null;        }    }}

⌨️ 快捷键说明

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