本文整理匯總了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;
}
示例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);
}
}
示例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;
}