private void maybeShowFor(Component c, MouseEvent me) { if (!(c instanceof JComponent)) return; JComponent comp = (JComponent) c; Window wnd = SwingUtilities.getWindowAncestor(comp); if (wnd == null) return; if (!wnd.isActive()) { if (JBPopupFactory.getInstance().isChildPopupFocused(wnd)) return; } String tooltipText = comp.getToolTipText(me); if (tooltipText == null || tooltipText.trim().isEmpty()) return; boolean centerDefault = Boolean.TRUE.equals(comp.getClientProperty(UIUtil.CENTER_TOOLTIP_DEFAULT)); boolean centerStrict = Boolean.TRUE.equals(comp.getClientProperty(UIUtil.CENTER_TOOLTIP_STRICT)); int shift = centerStrict ? 0 : centerDefault ? 4 : 0; // Balloon may appear exactly above useful content, such behavior is rather annoying. if (c instanceof JTree) { TreePath path = ((JTree) c).getClosestPathForLocation(me.getX(), me.getY()); if (path != null) { Rectangle pathBounds = ((JTree) c).getPathBounds(path); if (pathBounds != null && pathBounds.y + 4 < me.getY()) { shift += me.getY() - pathBounds.y - 4; } } } queueShow(comp, me, centerStrict || centerDefault, shift, -shift, -shift); }
protected void installDefaults() { // Installs the text cursor on the component super.installDefaults(); JComponent c = getComponent(); Object clientProperty = c.getClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES); if (clientProperty == null || clientProperty == localFalse) { c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, localTrue); } updateStyle((JTextComponent) getComponent()); }
protected void uninstallDefaults() { SynthContext context = getContext(getComponent(), ENABLED); JComponent c = getComponent(); c.putClientProperty("caretAspectRatio", null); style.uninstallDefaults(context); context.dispose(); style = null; Object clientProperty = c.getClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES); if (clientProperty == localTrue) { getComponent().putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.FALSE); } super.uninstallDefaults(); }