/** Updates the location of the color edit panel (if shown). */
 private void updateColorPanelPosition() {
   if (editPanel != null && colorOverlay != null) {
     int colorPanelX = (int) editPanel.getLocationOnScreen().getX() + colorButton.getX();
     int colorPanelY =
         (int) (editPanel.getLocationOnScreen().getY() + editPanel.getBounds().getHeight());
     colorOverlay.setBounds(
         colorPanelX, colorPanelY, EDIT_COLOR_PANEL_WIDTH, EDIT_COLOR_PANEL_HEIGHT);
   }
 }
Exemplo n.º 2
0
    public void mouseMoved(MouseEvent e) {
      if (geoDisplayPopup != null) {
        geoDisplayPopup.hide();
      }

      String pointMessage = "";

      x = e.getX();
      y = e.getY();
      double minDist = -1;
      if (geoPoints == null || geoPoints.size() == 0) {
        return;
      }
      for (GeoPoint p : geoPoints) {
        double dist = p.distance(x, y);
        if (minDist > dist || minDist < 0) {
          pointMessage = p.getMessage();
          minDist = dist;
        }
      }
      if (minDist > 2.5) {
        return;
      }
      geoPanel = GeoPolygonPanel.this;
      message.setText(pointMessage);
      PopupFactory factory = PopupFactory.getSharedInstance();
      geoDisplayPopup =
          factory.getPopup(
              owner,
              message,
              (int) geoPanel.getLocationOnScreen().getX() + x,
              (int) geoPanel.getLocationOnScreen().getY() + y - 15);
      geoDisplayPopup.show();
    }