?? dictpopupmanager.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; } }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -