protected void showAnnotationPanel(String annoText) { String text = this.splitLines(annoText); AnnotationAttributes attrs = this.getAnnotationPanelAttributes(text); int yOffset = Math.min(this.controller.getWWPanel().getSize().height - attrs.getSize().height, 250); Point location = new Point(10 + attrs.getSize().width / 2, yOffset); if (this.annotationPanel != null) this.annotationPanel.setAttributes(this.getAnnotationPanelAttributes(text)); else this.annotationPanel = new ScreenAnnotation(annoText, location, getAnnotationPanelAttributes(text)); this.annotationPanel.setScreenPoint(location); this.annotationPanel.setText(text); if (this.annotationLayer == null) { this.annotationLayer = new AnnotationLayer(); this.annotationLayer.setPickEnabled(false); } this.annotationLayer.removeAllAnnotations(); this.annotationLayer.addAnnotation(this.annotationPanel); if (!this.controller.getActiveLayers().contains(this.annotationLayer)) this.controller.addInternalLayer(this.annotationLayer); }
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; }