@Override public Dimension getPreferredSize() { final Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); Point p = null; if (focusOwner != null && focusOwner.isShowing()) { p = focusOwner.getLocationOnScreen(); } return computeNotBiggerDimension(super.getPreferredSize().getSize(), p); }
@Override public Balloon getParentBalloonFor(@Nullable Component c) { if (c == null) return null; Component eachParent = c; while (eachParent != null) { if (eachParent instanceof JComponent) { Object balloon = ((JComponent) eachParent).getClientProperty(Balloon.KEY); if (balloon instanceof Balloon) { return (Balloon) balloon; } } eachParent = eachParent.getParent(); } return null; }
public void showUnderneathOf(@NotNull Component aComponent) { show(new RelativePoint(aComponent, new Point(0, aComponent.getHeight()))); }