diff --git a/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/tools/TextAnnotationHandler.java b/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/tools/TextAnnotationHandler.java index dd5571eaf..e3434329a 100644 --- a/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/tools/TextAnnotationHandler.java +++ b/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/tools/TextAnnotationHandler.java @@ -214,7 +214,7 @@ public void mouseReleased(MouseEvent e) { pageInverseTransform); popupAnnotationComponent.setVisible(true); popupAnnotationComponent.getAnnotation().setOpen(true); - + popupAnnotationComponent.focusTextArea(); // set the annotation tool to he select tool if (preferences.getBoolean(ViewerPropertiesManager.PROPERTY_ANNOTATION_TEXT_SELECTION_ENABLED, false)) { documentViewController.getParentController().setDocumentToolMode( diff --git a/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/views/annotations/MarkupAnnotationComponent.java b/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/views/annotations/MarkupAnnotationComponent.java index 10c0161dc..942b97ccf 100644 --- a/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/views/annotations/MarkupAnnotationComponent.java +++ b/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/views/annotations/MarkupAnnotationComponent.java @@ -204,6 +204,9 @@ public void togglePopupAnnotationVisibility() { popup.setOpen(!popup.isOpen()); PopupAnnotationComponent popupComponent = getPopupAnnotationComponent(); popupComponent.setVisible(popup.isOpen()); + if (popupComponent.isVisible()) { + popupComponent.focusTextArea(); + } // make sure the popup is drawn on the page and // not outside the page clip. Rectangle popupBounds = popupComponent.getBounds(); diff --git a/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/views/annotations/PopupAnnotationComponent.java b/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/views/annotations/PopupAnnotationComponent.java index 62910068a..041cad1fe 100644 --- a/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/views/annotations/PopupAnnotationComponent.java +++ b/viewer/viewer-awt/src/main/java/org/icepdf/ri/common/views/annotations/PopupAnnotationComponent.java @@ -454,6 +454,11 @@ private void buildGUI() { buildContextMenu(); } + public void focusTextArea() { + textArea.requestFocusInWindow(); + textArea.setCaretPosition(textArea.getDocument().getLength()); + } + public void setBoundsRelativeToParent(int x, int y, AffineTransform pageInverseTransform) { Rectangle pageBounds = pageViewComponent.getBounds(); // position the new popup on the icon center.