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); }
protected void setupAnnotationAttributes(Annotation annotation) { java.awt.Color transparentBlack = new java.awt.Color(0, 0, 0, 0); AnnotationAttributes defaultAttribs = new AnnotationAttributes(); defaultAttribs.setAdjustWidthToText(AVKey.SIZE_FIXED); defaultAttribs.setBackgroundColor(transparentBlack); defaultAttribs.setBorderColor(transparentBlack); defaultAttribs.setBorderWidth(0); defaultAttribs.setCornerRadius(0); defaultAttribs.setDrawOffset(new java.awt.Point(0, 0)); defaultAttribs.setHighlightScale(1); defaultAttribs.setInsets(new java.awt.Insets(0, 0, 0, 0)); defaultAttribs.setImageScale(1); defaultAttribs.setImageOffset(new java.awt.Point(0, 0)); defaultAttribs.setImageOpacity(1); defaultAttribs.setImageRepeat(AVKey.REPEAT_NONE); defaultAttribs.setLeader(AVKey.SHAPE_NONE); defaultAttribs.setSize(new java.awt.Dimension(0, 0)); annotation.setPickEnabled(false); annotation.getAttributes().setDefaults(defaultAttribs); }