當前位置: 首頁>>代碼示例>>Java>>正文


Java JToolTip.getInsets方法代碼示例

本文整理匯總了Java中javax.swing.JToolTip.getInsets方法的典型用法代碼示例。如果您正苦於以下問題:Java JToolTip.getInsets方法的具體用法?Java JToolTip.getInsets怎麽用?Java JToolTip.getInsets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JToolTip的用法示例。


在下文中一共展示了JToolTip.getInsets方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getToolTipLocation

import javax.swing.JToolTip; //導入方法依賴的package包/類
/**
 * Positions tool tips to be aligned in the text component, so that the
 * displayed content is shown (almost) exactly where it would be in the
 * editor.
 *
 * @param e The mouse location.
 */
@Override
public Point getToolTipLocation(MouseEvent e) {

	// ToolTipManager requires both location and text to be null to hide
	// a currently-visible tool tip window.  If text is null but location
	// has some value, it will show a tool tip with empty content, the size
	// of its border (!).
	String text = getToolTipText(e);
	if (text==null) {
		return null;
	}

	// Try to overlap the tip's text directly over the code
	Point p = e.getPoint();
	p.y = (p.y/textArea.getLineHeight()) * textArea.getLineHeight();
	p.x = getWidth() + textArea.getMargin().left;
	Gutter gutter = getGutter();
	int gutterMargin = gutter.getInsets().right;
	p.x += gutterMargin;
	JToolTip tempTip = createToolTip();
	p.x -= tempTip.getInsets().left;
	p.y += 16;
	return p;
}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:32,代碼來源:FoldIndicator.java

示例2: paint

import javax.swing.JToolTip; //導入方法依賴的package包/類
/**
 * Paints the specified component.
 *
 * @param context
 *            context for the component being painted
 * @param g
 *            the {@code Graphics} object used for painting
 * @see #update(Graphics,JComponent)
 */
protected void paint(SynthContext context, Graphics g) {
    JToolTip tip = (JToolTip) context.getComponent();

    Insets insets = tip.getInsets();
    View v = (View) tip.getClientProperty(BasicHTML.propertyKey);
    if (v != null) {
        Rectangle paintTextR = new Rectangle(insets.left, insets.top, tip.getWidth() - (insets.left + insets.right), tip.getHeight()
                - (insets.top + insets.bottom));
        v.paint(g, paintTextR);
    } else {
        g.setColor(context.getStyle().getColor(context, ColorType.TEXT_FOREGROUND));
        g.setFont(style.getFont(context));
        context.getStyle().getGraphicsUtils(context).paintText(context, g, tip.getTipText(), insets.left, insets.top, -1);
    }
}
 
開發者ID:khuxtable,項目名稱:seaglass,代碼行數:25,代碼來源:SeaGlassToolTipUI.java

示例3: getToolTipLocation

import javax.swing.JToolTip; //導入方法依賴的package包/類
/**
 * Positions tool tips to be aligned in the text component, so that the
 * displayed content is shown (almost) exactly where it would be in the
 * editor.
 *
 * @param e The mouse location.
 */
public Point getToolTipLocation(MouseEvent e) {

	// ToolTipManager requires both location and text to be null to hide
	// a currently-visible tool tip window.  If text is null but location
	// has some value, it will show a tool tip with empty content, the size
	// of its border (!).
	String text = getToolTipText(e);
	if (text==null) {
		return null;
	}

	// Try to overlap the tip's text directly over the code
	Point p = e.getPoint();
	p.y = (p.y/textArea.getLineHeight()) * textArea.getLineHeight();
	p.x = getWidth() + textArea.getMargin().left;
	Gutter gutter = getGutter();
	int gutterMargin = gutter.getInsets().right;
	p.x += gutterMargin;
	JToolTip tempTip = createToolTip();
	p.x -= tempTip.getInsets().left;
	p.y += 16;
	return p;
}
 
開發者ID:Nanonid,項目名稱:RSyntaxTextArea,代碼行數:31,代碼來源:FoldIndicator.java


注:本文中的javax.swing.JToolTip.getInsets方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。