jdk/src/share/classes/javax/swing/text/JTextComponent.java
changeset 21278 ef8a3a2a72f2
parent 21244 7c2ac5ca05a2
child 21982 fd6e5fe509df
equal deleted inserted replaced
21277:bd380b80f9ea 21278:ef8a3a2a72f2
   424      */
   424      */
   425     public void setDocument(Document doc) {
   425     public void setDocument(Document doc) {
   426         Document old = model;
   426         Document old = model;
   427 
   427 
   428         /*
   428         /*
   429          * aquire a read lock on the old model to prevent notification of
   429          * acquire a read lock on the old model to prevent notification of
   430          * mutations while we disconnecting the old model.
   430          * mutations while we disconnecting the old model.
   431          */
   431          */
   432         try {
   432         try {
   433             if (old instanceof AbstractDocument) {
   433             if (old instanceof AbstractDocument) {
   434                 ((AbstractDocument)old).readLock();
   434                 ((AbstractDocument)old).readLock();
  1491             invokeAction("paste", TransferHandler.getPasteAction());
  1491             invokeAction("paste", TransferHandler.getPasteAction());
  1492         }
  1492         }
  1493     }
  1493     }
  1494 
  1494 
  1495     /**
  1495     /**
  1496      * This is a conveniance method that is only useful for
  1496      * This is a convenience method that is only useful for
  1497      * <code>cut</code>, <code>copy</code> and <code>paste</code>.  If
  1497      * <code>cut</code>, <code>copy</code> and <code>paste</code>.  If
  1498      * an <code>Action</code> with the name <code>name</code> does not
  1498      * an <code>Action</code> with the name <code>name</code> does not
  1499      * exist in the <code>ActionMap</code>, this will attemp to install a
  1499      * exist in the <code>ActionMap</code>, this will attempt to install a
  1500      * <code>TransferHandler</code> and then use <code>altAction</code>.
  1500      * <code>TransferHandler</code> and then use <code>altAction</code>.
  1501      */
  1501      */
  1502     private void invokeAction(String name, Action altAction) {
  1502     private void invokeAction(String name, Action altAction) {
  1503         ActionMap map = getActionMap();
  1503         ActionMap map = getActionMap();
  1504         Action action = null;
  1504         Action action = null;
  2906          * If there is no selection, but there is
  2906          * If there is no selection, but there is
  2907          * a caret, the start and end offsets will be the same.
  2907          * a caret, the start and end offsets will be the same.
  2908          * Return 0 if the text is empty, or the caret position
  2908          * Return 0 if the text is empty, or the caret position
  2909          * if no selection.
  2909          * if no selection.
  2910          *
  2910          *
  2911          * @return the index into teh text of the end of the selection &ge; 0
  2911          * @return the index into the text of the end of the selection &ge; 0
  2912          */
  2912          */
  2913         public int getSelectionEnd() {
  2913         public int getSelectionEnd() {
  2914             return JTextComponent.this.getSelectionEnd();
  2914             return JTextComponent.this.getSelectionEnd();
  2915         }
  2915         }
  2916 
  2916