So now the most significant thing that doesn't work that I care about
is tooltip placement.  I don't see any way to get that without
modifying Pivot sources.  The most straightforward way would seem to
be to modify Component#mapPointToAncestor and add a new Container
method that I can override.

---- Component.java ----

  public Point mapPointToAncestor(Container ancestor, int x, int y) {
    return mapPointToAncestor(ancestor, new Point(x, y));
  }

  public Point mapPointToAncestor(Container ancestor, Point location) {
    if (location == null) {
      throw new IllegalArgumentException();
    }

    if (ancestor == null) {
      throw new IllegalArgumentException("ancestor is null");
    }

    Component component = this;

    if (component != ancestor) {
        Container container = parent;
        while (container != null) {
            location = container.mapChildPointToContainer(component, location);
            if (container == ancestor)
                break;
            component = container;
            container = container.getParent();
        }
    }
    return location;
  }

---- Container.java ----

  public Point mapChildPointToContainer(Component child, Point location) {
    return location.translate(child.getX(), child.getY());
  }

---- end ----

Unlike the current mapPointToAncestor, this one conses, but maybe it's
not used in any place that cares so much about performance?  For
completeness, you'd also need to change mapPointFromAncestor in a
similar way.

I've tested the above, and it does what I want, more or less (the
tooltip isn't scaled, but maybe it's just as well).  As a bonus,
ListButton and CalendarButton pop up in the correct place, though also
not scaled (weird in the case of ListButton anyway).  But I'm guessing
you'd prefer not to make a change like this so deep in the system only
to allow an incomplete implementation of ScalePane to work.  So I
invite other suggestions.

Reply via email to