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; }
/** * Initializing constructor. * * @param name the name of this layer */ public SurfShapesLayer(String name) { // properties of layer setName(name); setEnabled(true); // painting attributes for shapes attr.setOutlineMaterial(Material.ORANGE); attr.setOutlineWidth(1.5); Material intMat = new Material(Color.ORANGE.brighter().brighter()); attr.setInteriorMaterial(intMat); attr.setInteriorOpacity(NORM_INSIDE_OPACITY); // painting attributes for hihglighted shapes attrHigh.setOutlineMaterial(Material.BLACK); attrHigh.setOutlineWidth(2); attrHigh.setInteriorMaterial(Material.WHITE); attrHigh.setInteriorOpacity(HIGHL_INSIDE_OPACITY); // popup annotation attributes AnnotationAttributes attrAnno = new AnnotationAttributes(); attrAnno.setAdjustWidthToText(AVKey.SIZE_FIT_TEXT); attrAnno.setFrameShape(AVKey.SHAPE_RECTANGLE); attrAnno.setCornerRadius(3); attrAnno.setDrawOffset(new Point(0, 8)); attrAnno.setLeaderGapWidth(8); attrAnno.setTextColor(Color.BLACK); attrAnno.setBackgroundColor(new Color(1f, 1f, 1f, .85f)); attrAnno.setBorderColor(new Color(0xababab)); attrAnno.setInsets(new Insets(3, 3, 3, 3)); attrAnno.setVisible(false); popupAnnotation.setAttributes(attrAnno); popupAnnotation.setAlwaysOnTop(true); addRenderable(popupAnnotation); }