Example #1
0
  private TrackPointAnnotation createHoveredTrackPoint() {

    final TrackPointAnnotation trackPoint =
        new TrackPointAnnotation(UI.EMPTY_STRING, Position.ZERO);

    trackPoint.setAlwaysOnTop(true);

    final AnnotationAttributes attributes = trackPoint.getAttributes();

    attributes.setCornerRadius(TrackSliderLayer.CHART_SLIDER_CORNER_RADIUS);
    attributes.setInsets(
        new Insets(
            TrackSliderLayer.CHART_SLIDER_MARGIN,
            TrackSliderLayer.CHART_SLIDER_MARGIN + 3,
            TrackSliderLayer.CHART_SLIDER_MARGIN,
            TrackSliderLayer.CHART_SLIDER_MARGIN));

    attributes.setDrawOffset(new Point(0, TrackSliderLayer.CHART_SLIDER_DRAW_OFFSET_Y));
    attributes.setLeaderGapWidth(TrackSliderLayer.CHART_SLIDER_LEADER_GAP);
    attributes.setFont(UI.AWT_FONT_ARIAL_BOLD_12);

    // initially hide the annotation
    attributes.setVisible(false);

    return trackPoint;
  }
  protected AnnotationAttributes getAnnotationPanelAttributes(String annoText) {
    AnnotationAttributes attrs = new AnnotationAttributes();

    attrs.setAdjustWidthToText(AVKey.SIZE_FIXED);
    attrs.setSize(this.computePanelSize(annoText));
    attrs.setFrameShape(AVKey.SHAPE_RECTANGLE);
    attrs.setTextColor(Color.WHITE);
    attrs.setBackgroundColor(new Color(0f, 0f, 0f, 0.6f));
    attrs.setCornerRadius(10);
    attrs.setInsets(new Insets(10, 10, 0, 0));
    attrs.setBorderColor(new Color(0xababab));
    attrs.setFont(Font.decode("Arial-PLAIN-12"));
    attrs.setTextAlign(AVKey.LEFT);

    return attrs;
  }