javax.swing.JToolTip#getPreferredSize ( )源码实例Demo

下面列出了javax.swing.JToolTip#getPreferredSize ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: TooltipImageTest.java
private static void checkSize(JToolTip tip, int width, int height) {
   Dimension d = tip.getPreferredSize();
   Insets insets = tip.getInsets();
   //6 seems to be the extra width being allocated for some reason
   //for a tooltip window.
   if (!((d.width - insets.right - insets.left - 6) == width) &&
       !((d.height - insets.top - insets.bottom) == height)) {
       throw new RuntimeException("Test case fails: Expected width, height is " + width + ", " + height +
               " whereas actual width, height are " + (d.width - insets.right - insets.left - 6) + " " +
               (d.height - insets.top - insets.bottom));
   }
}
 
源代码2 项目: TencentKona-8   文件: TooltipImageTest.java
private static void checkSize(JToolTip tip, int width, int height) {
   Dimension d = tip.getPreferredSize();
   Insets insets = tip.getInsets();
   //6 seems to be the extra width being allocated for some reason
   //for a tooltip window.
   if (!((d.width - insets.right - insets.left - 6) == width) &&
       !((d.height - insets.top - insets.bottom) == height)) {
       throw new RuntimeException("Test case fails: Expected width, height is " + width + ", " + height +
               " whereas actual width, height are " + (d.width - insets.right - insets.left - 6) + " " +
               (d.height - insets.top - insets.bottom));
   }
}
 
源代码3 项目: openjdk-jdk8u   文件: TooltipImageTest.java
private static void checkSize(JToolTip tip, int width, int height) {
   Dimension d = tip.getPreferredSize();
   Insets insets = tip.getInsets();
   //6 seems to be the extra width being allocated for some reason
   //for a tooltip window.
   if (!((d.width - insets.right - insets.left - 6) == width) &&
       !((d.height - insets.top - insets.bottom) == height)) {
       throw new RuntimeException("Test case fails: Expected width, height is " + width + ", " + height +
               " whereas actual width, height are " + (d.width - insets.right - insets.left - 6) + " " +
               (d.height - insets.top - insets.bottom));
   }
}
 
源代码4 项目: netbeans   文件: FlashingIcon.java
@Override
public Point getToolTipLocation( MouseEvent event ) {

    JToolTip tip = createToolTip();
    tip.setTipText( getToolTipText() );
    Dimension d = tip.getPreferredSize();
    
    
    Point retValue = new Point( getWidth()-d.width, -d.height );
    return retValue;
}
 
源代码5 项目: netbeans   文件: FlashingIcon.java
@Override
public Point getToolTipLocation(MouseEvent event) {

    JToolTip tip = createToolTip();
    tip.setTipText(getToolTipText());
    Dimension d = tip.getPreferredSize();


    Point retValue = new Point(getWidth() - d.width, -d.height);
    return retValue;
}
 
源代码6 项目: visualvm   文件: FlashingIcon.java
@Override
public Point getToolTipLocation( MouseEvent event ) {

    JToolTip tip = createToolTip();
    tip.setTipText( getToolTipText() );
    Dimension d = tip.getPreferredSize();
    
    
    Point retValue = new Point( getWidth()-d.width, -d.height );
    return retValue;
}
 
源代码7 项目: pumpernickel   文件: IOLocationTileList.java
@Override
public Point getToolTipLocation(MouseEvent event) {
	if (event != null) {
		Point p = event.getPoint();
		int index = locationToIndex(p);
		ListCellRenderer r = getCellRenderer();
		Rectangle cellBounds;

		if (index != -1 && (r instanceof BasicTileCellRenderer)
				&& (cellBounds = getCellBounds(index, index)) != null
				&& cellBounds.contains(p.x, p.y)) {
			String text = getToolTipText(event);
			JToolTip tip = new JToolTip();
			tip.setTipText(text);
			Dimension tipSize = tip.getPreferredSize();
			BasicTileCellRenderer btcr = (BasicTileCellRenderer) r;

			int yOffset = cellBounds.height / 2;
			if (btcr.thumbnail.getUI() instanceof ThumbnailLabelUI) {
				ThumbnailLabelUI ui = (ThumbnailLabelUI) btcr.thumbnail
						.getUI();
				yOffset = ui.getTextRect().y;
			}
			return new Point(cellBounds.x + cellBounds.width / 2
					- tipSize.width / 2, cellBounds.y + yOffset);
		}
	}
	return super.getToolTipLocation(event);
}
 
源代码8 项目: jdk8u_jdk   文件: TooltipImageTest.java
private static void checkSize(JToolTip tip, int width, int height) {
   Dimension d = tip.getPreferredSize();
   Insets insets = tip.getInsets();
   //6 seems to be the extra width being allocated for some reason
   //for a tooltip window.
   if (!((d.width - insets.right - insets.left - 6) == width) &&
       !((d.height - insets.top - insets.bottom) == height)) {
       throw new RuntimeException("Test case fails: Expected width, height is " + width + ", " + height +
               " whereas actual width, height are " + (d.width - insets.right - insets.left - 6) + " " +
               (d.height - insets.top - insets.bottom));
   }
}