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);
  }
예제 #2
0
  public void paint(Graphics g, JComponent c) {
    AbstractButton b = (AbstractButton) c;
    ButtonModel model = b.getModel();

    String text = layout(b, SwingUtilities2.getFontMetrics(b, g), b.getWidth(), b.getHeight());

    clearTextShiftOffset();

    // perform UI specific press action, e.g. Windows L&F shifts text
    if (model.isArmed() && model.isPressed()) {
      paintButtonPressed(g, b);
    }

    // Paint the Icon
    if (b.getIcon() != null) {
      paintIcon(g, c, iconRect);
    }

    if (text != null && !text.equals("")) {
      View v = (View) c.getClientProperty(BasicHTML.propertyKey);
      if (v != null) {
        v.paint(g, textRect);
      } else {
        paintText(g, b, textRect, text);
      }
    }

    if (b.isFocusPainted() && b.hasFocus()) {
      // paint UI specific focus
      paintFocus(g, b, viewRect, textRect, iconRect);
    }
  }
예제 #3
0
 public Dimension getMaximumSize(JComponent c) {
   Dimension d = getPreferredSize(c);
   View v = (View) c.getClientProperty(BasicHTML.propertyKey);
   if (v != null) {
     d.width += v.getMaximumSpan(View.X_AXIS) - v.getPreferredSpan(View.X_AXIS);
   }
   return d;
 }
예제 #4
0
  /**
   * This looks at the client property VERTICAL_POSITION to return on the constants in this class
   * (POS_TOP, POS_MIDDLE, POS_BOTTOM or POS_ONLY).
   *
   * <p>This returns POS_ONLY if a shape is defined, because in this context a position doesn't make
   * sense.
   */
  protected static int getVerticalPosition(JComponent b) {
    if (b == null) return POS_ONLY;

    Shape shape = (Shape) b.getClientProperty(SHAPE);
    if (shape != null) {
      return POS_ONLY;
    }

    String s = (String) b.getClientProperty(VERTICAL_POSITION);
    if (s == null) s = "only";
    if (s.equalsIgnoreCase("top")) return POS_TOP;
    if (s.equalsIgnoreCase("middle")) return POS_MIDDLE;
    if (s.equalsIgnoreCase("bottom")) return POS_BOTTOM;
    return POS_ONLY;
  }
예제 #5
0
 /**
  * Returns an enum indicating how the baseline of the component changes as the size changes.
  *
  * @throws NullPointerException {@inheritDoc}
  * @see javax.swing.JComponent#getBaseline(int, int)
  * @since 1.6
  */
 public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c) {
   super.getBaselineResizeBehavior(c);
   if (c.getClientProperty(BasicHTML.propertyKey) != null) {
     return Component.BaselineResizeBehavior.OTHER;
   }
   switch (((AbstractButton) c).getVerticalAlignment()) {
     case AbstractButton.TOP:
       return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
     case AbstractButton.BOTTOM:
       return Component.BaselineResizeBehavior.CONSTANT_DESCENT;
     case AbstractButton.CENTER:
       return Component.BaselineResizeBehavior.CENTER_OFFSET;
   }
   return Component.BaselineResizeBehavior.OTHER;
 }
예제 #6
0
 public static boolean hasActiveSpeedSearch(JComponent component) {
   SpeedSearchBase speedSearch =
       (SpeedSearchBase) component.getClientProperty(SPEED_SEARCH_COMPONENT_MARKER);
   return speedSearch != null
       && speedSearch.mySearchPopup != null
       && speedSearch.mySearchPopup.isVisible();
 }
  private void assertTabCount(Content content) {
    //        PluginSettingsBean bean = (PluginSettingsBean)
    // SharedObjectPool.getUserData(SharedConstants.PLUGIN_SETTINGS);
    PluginSettingsBean bean = PluginKeys.PLUGIN_SETTINGS.getData();

    if (bean == null) {
      bean = new PluginSettingsBean();
    }

    int max = bean.getNumberOfTabs();

    if (max <= getTabComponent(content).getTabCount()) {
      // remove the oldest tab
      JTabbedPane tabbedPane = getTabComponent(content);
      long lastMin = Long.MAX_VALUE;
      int index = 0;
      for (int i = 0; i < tabbedPane.getTabCount(); i++) {
        JComponent tab = (JComponent) tabbedPane.getTabComponentAt(i);
        Long time = (Long) tab.getClientProperty(CREATE_TIME);
        if (time != null && lastMin < time) {
          lastMin = time;
          index = i;
        }
      }

      tabbedPane.remove(index);
    }
  }
예제 #8
0
  /**
   * This looks at the client properties "JButton.segmentPosition" and HORIZONTAL_POSITION to return
   * on the constants in this class (LEFT_POS, POS_MIDDLE, RIGHT_POS or POS_ONLY).
   *
   * <p>This returns POS_ONLY if a shape is defined, because in this context a position doesn't make
   * sense.
   */
  protected static int getHorizontalPosition(JComponent b) {
    if (b == null) return POS_ONLY;

    Shape shape = (Shape) b.getClientProperty(SHAPE);
    if (shape != null) {
      return POS_ONLY;
    }

    String s = (String) b.getClientProperty("JButton.segmentPosition");
    if (s == null) s = (String) b.getClientProperty(HORIZONTAL_POSITION);
    if (s == null) s = "only";
    if (s.equalsIgnoreCase("first") || s.equalsIgnoreCase("left")) return POS_LEFT;
    if (s.equalsIgnoreCase("middle")) return POS_MIDDLE;
    if (s.equalsIgnoreCase("last") || s.equalsIgnoreCase("right")) return POS_RIGHT;
    return POS_ONLY;
  }
 @Override
 public Dimension getMinimumSize(JComponent c) {
   AbstractButton b = (AbstractButton) c;
   String style = (String) c.getClientProperty("Quaqua.Button.style");
   if (style == null) {
     style = "push";
   }
   if (style.equals("help")) {
     return getPreferredSize(c);
   }
   Dimension d = super.getMinimumSize(c);
   if (isFixedHeight(c)) {
     Dimension p = getPreferredSize(c);
     if (d != null && p != null) {
       d.height = Math.max(d.height, p.height);
     }
   }
   if (!QuaquaUtilities.isSmallSizeVariant(c)
       && style.equals("push") //
       && b.getIcon() == null
       && b.getText() != null) {
     if (d != null) {
       d.width = Math.max(d.width, UIManager.getInt("Button.minimumWidth"));
     }
   }
   return d;
 }
 private synchronized State getState(JComponent component, Part part) {
   State rv = null;
   Object tmpObject = component.getClientProperty(PartUIClientPropertyKey.getKey(part));
   if (tmpObject instanceof State) {
     rv = (State) tmpObject;
   }
   return rv;
 }
예제 #11
0
 private Insets getVisualMargin(JComponent component) {
   String uid = component.getUIClassID();
   String style = null;
   if (uid == "ButtonUI" || uid == "ToggleButtonUI") {
     style = (String) component.getClientProperty("JButton.buttonType");
   } else if (uid == "ProgressBarUI") {
     style =
         (((JProgressBar) component).getOrientation() == JProgressBar.HORIZONTAL)
             ? "horizontal"
             : "vertical";
   } else if (uid == "SliderUI") {
     style =
         (((JSlider) component).getOrientation() == JProgressBar.HORIZONTAL)
             ? "horizontal"
             : "vertical";
   } else if (uid == "TabbedPaneUI") {
     switch (((JTabbedPane) component).getTabPlacement()) {
       case JTabbedPane.TOP:
         style = "top";
         break;
       case JTabbedPane.LEFT:
         style = "left";
         break;
       case JTabbedPane.BOTTOM:
         style = "bottom";
         break;
       case JTabbedPane.RIGHT:
         style = "right";
         break;
     }
   }
   Insets gap = getInsets(VISUAL_MARGINS, uid, style, 0);
   // Take into account different positions of the button icon
   if (uid == "RadioButtonUI" || uid == "CheckBoxUI") {
     switch (((AbstractButton) component).getHorizontalTextPosition()) {
       case SwingConstants.RIGHT:
         gap = new Insets(gap.top, gap.right, gap.bottom, gap.left);
         break;
       case SwingConstants.CENTER:
         gap = new Insets(gap.top, gap.right, gap.bottom, gap.right);
         break;
         /*
         case SwingConstants.LEFT :
             break;
              */
       default:
         gap = new Insets(gap.top, gap.left, gap.bottom, gap.right);
     }
     if (component.getBorder() instanceof EmptyBorder) {
       gap.left -= 2;
       gap.right -= 2;
       gap.top -= 2;
       gap.bottom -= 2;
     }
   }
   return gap;
 }
예제 #12
0
 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());
 }
예제 #13
0
 /**
  * Checks whether the specified component or one of its ancestors has the specified client
  * property set to {@link Boolean#TRUE}.
  *
  * @param c Component.
  * @param clientPropName Client property name.
  * @return <code>true</code> if the specified component or one of its ancestors has the
  *     specified client property set to {@link Boolean#TRUE}, <code>false</code> otherwise.
  */
 private boolean hasClientPropertySetToTrue(Component c, String clientPropName) {
   while (c != null) {
     if (c instanceof JComponent) {
       JComponent jc = (JComponent) c;
       if (Boolean.TRUE.equals(jc.getClientProperty(clientPropName))) return true;
     }
     c = c.getParent();
   }
   return false;
 }
예제 #14
0
파일: TMSchema.java 프로젝트: erdrix/GameC
 public String getControlName(Component component) {
   String str = "";
   if (component instanceof JComponent) {
     JComponent c = (JComponent) component;
     String subAppName = (String) c.getClientProperty("XPStyle.subAppName");
     if (subAppName != null) {
       str = subAppName + "::";
     }
   }
   return str + control.toString();
 }
  @Nullable
  private Editor validateCurrentEditor() {
    Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    if (focusOwner instanceof JComponent) {
      final JComponent jComponent = (JComponent) focusOwner;
      if (jComponent.getClientProperty("AuxEditorComponent") != null)
        return null; // Hack for EditorSearchComponent
    }

    return myEditor;
  }
예제 #16
0
  /** Installs the UI delegate for the specified component */
  public void installUI(JComponent c) {
    super.installUI(c);

    Object paletteProp = c.getClientProperty(IS_PALETTE);
    if (paletteProp != null) {
      setPalette(((Boolean) paletteProp).booleanValue());
    }

    Container content = frame.getContentPane();
    stripContentBorder(content);
    // c.setOpaque(false);
  }
예제 #17
0
  private Insets getPreferredGap(JComponent component, int type, int sizeStyle) {
    Map gapMap;

    switch (type) {
      case INDENT:
        gapMap = INDENT_GAPS;
        break;
      case RELATED:
        gapMap = RELATED_GAPS;
        break;
      case UNRELATED:
      default:
        gapMap = UNRELATED_GAPS;
        break;
    }

    String uid = component.getUIClassID();
    String style = null;
    // == is ok here as Strings from Swing get interned, if for some reason
    // need .equals then must deal with null.
    if (uid == "ButtonUI" || uid == "ToggleButtonUI") {
      style = (String) component.getClientProperty("JButton.buttonType");
    } else if (uid == "ProgressBarUI") {
      style =
          (((JProgressBar) component).getOrientation() == JProgressBar.HORIZONTAL)
              ? "horizontal"
              : "vertical";
    } else if (uid == "SliderUI") {
      style =
          (((JSlider) component).getOrientation() == JProgressBar.HORIZONTAL)
              ? "horizontal"
              : "vertical";
    } else if (uid == "TabbedPaneUI") {
      switch (((JTabbedPane) component).getTabPlacement()) {
        case JTabbedPane.TOP:
          style = "top";
          break;
        case JTabbedPane.LEFT:
          style = "left";
          break;
        case JTabbedPane.BOTTOM:
          style = "bottom";
          break;
        case JTabbedPane.RIGHT:
          style = "right";
          break;
      }
    } else if (uid == "ComboBoxUI") {
      style = ((JComboBox) component).isEditable() ? "editable" : "uneditable";
    }
    return getInsets(gapMap, uid, style, sizeStyle);
  }
예제 #18
0
  protected void deleteCurrentPanel() {
    JComponent tabPane = (JComponent) tabbedPane.getSelectedComponent();
    if (tabPane == null) return;

    WMSPanel wmsPanel = (WMSPanel) tabPane.getClientProperty(Constants.FEATURE_OWNER_PROPERTY);

    if (tabbedPane.getTabCount()
        > 2) // actually remove the tab only if there is more than one (plus the "+" tab)
    tabbedPane.remove(tabPane);
    else tabbedPane.setTitleAt(1, "New Server");

    if (wmsPanel != null) wmsPanel.clearPanel();
  }
 @Override
 public Dimension getMaximumSize(JComponent c) {
   String style = (String) c.getClientProperty("Quaqua.Button.style");
   if (style != null && style.equals("help")) {
     return getPreferredSize(c);
   }
   Dimension d = super.getMaximumSize(c);
   if (isFixedHeight(c)) {
     Dimension p = getPreferredSize(c);
     d.height = Math.max(d.height, p.height);
   }
   return d;
 }
예제 #20
0
  // installs a private instance of GestureHandler, if necessary
  static void addGestureListenerTo(final JComponent component, final GestureListener listener) {
    final Object value = component.getClientProperty(CLIENT_PROPERTY);
    if (value instanceof GestureHandler) {
      ((GestureHandler) value).addListener(listener);
      return;
    }

    if (value != null) return; // some other garbage is in our client property

    final GestureHandler newHandler = new GestureHandler();
    newHandler.addListener(listener);
    component.putClientProperty(CLIENT_PROPERTY, newHandler);
  }
예제 #21
0
  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();
  }
예제 #22
0
  public void assertIsDispatchThread(@Nullable final JComponent component) {
    if (component == null) return;

    Thread curThread = Thread.currentThread();
    if (ourDispatchThread == curThread) {
      return;
    }

    if (Boolean.TRUE.equals(component.getClientProperty(WAS_EVER_SHOWN))) {
      assertIsDispatchThread();
    } else {
      final JRootPane root = component.getRootPane();
      if (root != null) {
        component.putClientProperty(WAS_EVER_SHOWN, Boolean.TRUE);
        assertIsDispatchThread();
      }
    }
  }
  @Override
  public void paint(Graphics g, JComponent c) {

    String style = (String) c.getClientProperty("Quaqua.Button.style");
    if (style != null && style.equals("help")) {
      Insets insets = c.getInsets();
      UIManager.getIcon("Button.helpIcon").paintIcon(c, g, insets.left, insets.top);
      return;
    }

    Object oldHints = QuaquaUtilities.beginGraphics((Graphics2D) g);
    if (((AbstractButton) c).isBorderPainted()) {
      Border b = c.getBorder();
      if (b != null && b instanceof BackgroundBorder) {
        ((BackgroundBorder) b)
            .getBackgroundBorder()
            .paintBorder(c, g, 0, 0, c.getWidth(), c.getHeight());
      }
    }
    super.paint(g, c);
    QuaquaUtilities.endGraphics((Graphics2D) g, oldHints);
    Debug.paint(g, c, this);
  }
예제 #24
0
 protected void paintText(Graphics g, JComponent c, String text, Rectangle textRect) {
   View v = (View) c.getClientProperty(BasicHTML.propertyKey);
   if (v != null) {
     v.paint(g, textRect);
   } else {
     AbstractButton b = (AbstractButton) c;
     ButtonModel model = b.getModel();
     int mnemIndex = -1;
     if (JTattooUtilities.getJavaVersion() >= 1.4) {
       mnemIndex = b.getDisplayedMnemonicIndex();
     } else {
       mnemIndex = JTattooUtilities.findDisplayedMnemonicIndex(b.getText(), model.getMnemonic());
     }
     Font f = c.getFont();
     g.setFont(f);
     FontMetrics fm = g.getFontMetrics();
     if (model.isEnabled()) {
       Color fc = b.getForeground();
       if (AbstractLookAndFeel.getTheme().isTextShadowOn() && ColorHelper.getGrayValue(fc) > 128) {
         g.setColor(Color.black);
         JTattooUtilities.drawStringUnderlineCharAt(
             c, g, text, mnemIndex, textRect.x + 1, textRect.y + 1 + fm.getAscent());
       }
       g.setColor(fc);
       JTattooUtilities.drawStringUnderlineCharAt(
           c, g, text, mnemIndex, textRect.x, textRect.y + fm.getAscent());
     } else {
       g.setColor(Color.black);
       JTattooUtilities.drawStringUnderlineCharAt(
           c, g, text, mnemIndex, textRect.x + 1, textRect.y + 1 + fm.getAscent());
       g.setColor(AbstractLookAndFeel.getDisabledForegroundColor());
       JTattooUtilities.drawStringUnderlineCharAt(
           c, g, text, mnemIndex, textRect.x, textRect.y + fm.getAscent());
     }
   }
 }
 public BindingComponent getBindingComponent(JComponent component) {
   return (BindingComponent) component.getClientProperty(BindingComponent.ATTR_BND);
 }
 protected static boolean isComboButton(JComponent c) {
   return c instanceof AbstractButton && c.getClientProperty("styleCombo") == Boolean.TRUE;
 }
  @Override
  public void paint(Graphics g, JComponent c) {
    if (!(c.getBorder() instanceof MacIntelliJButtonBorder) && !isComboButton(c)) {
      super.paint(g, c);
      return;
    }
    int w = c.getWidth();
    int h = c.getHeight();
    if (isHelpButton(c)) {
      Icon icon = MacIntelliJIconCache.getIcon("helpButton", false, c.hasFocus());
      int x = (w - icon.getIconWidth()) / 2;
      int y = (h - icon.getIconHeight()) / 2;
      icon.paintIcon(c, g, x, y);
    } else {
      AbstractButton b = (AbstractButton) c;
      String text = layout(b, SwingUtilities2.getFontMetrics(b, g), b.getWidth(), b.getHeight());

      boolean isFocused = c.hasFocus();
      if (isSquare(c)) {
        Icon icon = MacIntelliJIconCache.getIcon("browseButton");
        int x = (c.getWidth() - icon.getIconWidth()) / 2;
        int y = (c.getHeight() - icon.getIconHeight()) / 2;
        icon.paintIcon(c, g, x, y);
        return;
      } else {
        int x = isFocused ? 0 : 2;
        int y = isFocused ? 0 : (h - viewRect.height) / 2;
        Icon icon;
        icon = getLeftIcon(b);
        icon.paintIcon(b, g, x, y);
        x += icon.getIconWidth();
        int stop = w - (isFocused ? 0 : 2) - (getRightIcon(b).getIconWidth());
        Graphics gg = g.create(0, 0, w, h);
        gg.setClip(x, y, stop - x, h);
        icon = getMiddleIcon(b);
        while (x < stop) {
          icon.paintIcon(b, gg, x, y);
          x += icon.getIconWidth();
        }
        gg.dispose();
        icon = getRightIcon(b);
        icon.paintIcon(b, g, stop, y);

        clearTextShiftOffset();
      }

      // Paint the Icon
      if (b.getIcon() != null) {
        paintIcon(g, c, iconRect);
      }

      if (text != null && !text.isEmpty()) {
        View v = (View) c.getClientProperty(BasicHTML.propertyKey);
        if (v != null) {
          v.paint(g, textRect);
        } else {
          UISettings.setupAntialiasing(g);
          paintText(g, b, textRect, text);
        }
      }
    }
  }
예제 #28
0
 public boolean getFillColumn(JComponent c) {
   Boolean b = (Boolean) c.getClientProperty("VariableGridLayout.fillColumn");
   return (b != null) ? b : fillColumns;
 }
예제 #29
0
 // asks the installed GestureHandler to remove it's listener (does not uninstall the
 // GestureHandler)
 static void removeGestureListenerFrom(
     final JComponent component, final GestureListener listener) {
   final Object value = component.getClientProperty(CLIENT_PROPERTY);
   if (!(value instanceof GestureHandler)) return;
   ((GestureHandler) value).removeListener(listener);
 }
  @Nullable
  private Point createToolTipImage(@NotNull KeyType key) {
    UIUtil.putClientProperty(myComponent, EXPANDED_RENDERER, true);
    Pair<Component, Rectangle> rendererAndBounds = getCellRendererAndBounds(key);
    UIUtil.putClientProperty(myComponent, EXPANDED_RENDERER, null);
    if (rendererAndBounds == null) return null;

    JComponent renderer = ObjectUtils.tryCast(rendererAndBounds.first, JComponent.class);
    if (renderer == null) return null;
    if (renderer.getClientProperty(DISABLE_EXPANDABLE_HANDLER) != null) return null;

    if (UIUtil.getClientProperty((JComponent) rendererAndBounds.getFirst(), USE_RENDERER_BOUNDS)
        == Boolean.TRUE) {
      rendererAndBounds.getSecond().translate(renderer.getX(), renderer.getY());
      rendererAndBounds.getSecond().setSize(renderer.getSize());
    }

    myKeyItemBounds = rendererAndBounds.second;

    Rectangle cellBounds = myKeyItemBounds;
    Rectangle visibleRect = getVisibleRect(key);

    if (cellBounds.y < visibleRect.y) return null;

    int cellMaxY = cellBounds.y + cellBounds.height;
    int visMaxY = visibleRect.y + visibleRect.height;
    if (cellMaxY > visMaxY) return null;

    int cellMaxX = cellBounds.x + cellBounds.width;
    int visMaxX = visibleRect.x + visibleRect.width;

    Point location = new Point(visMaxX, cellBounds.y);
    SwingUtilities.convertPointToScreen(location, myComponent);

    Rectangle screen =
        !Registry.is("ide.expansion.hints.on.all.screens")
            ? ScreenUtil.getScreenRectangle(location)
            : ScreenUtil.getAllScreensRectangle();

    int borderWidth = isPaintBorder() ? 1 : 0;
    int width = Math.min(screen.width + screen.x - location.x - borderWidth, cellMaxX - visMaxX);
    int height = cellBounds.height;

    if (width <= 0 || height <= 0) return null;

    Dimension size = getImageSize(width, height);
    myImage = UIUtil.createImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);

    Graphics2D g = myImage.createGraphics();
    g.setClip(null);
    doFillBackground(height, width, g);
    g.translate(cellBounds.x - visMaxX, 0);
    doPaintTooltipImage(renderer, cellBounds, g, key);

    CustomLineBorder border = null;
    if (borderWidth > 0) {
      border = new CustomLineBorder(getBorderColor(), borderWidth, 0, borderWidth, borderWidth);
      location.y -= borderWidth;
      size.width += borderWidth;
      size.height += borderWidth + borderWidth;
    }

    g.dispose();
    myRendererPane.remove(renderer);

    myTipComponent.setBorder(border);
    myTipComponent.setPreferredSize(size);
    return location;
  }