/[classpath]/classpath/javax/swing/text/DefaultEditorKit.java
ViewVC logotype

Diff of /classpath/javax/swing/text/DefaultEditorKit.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7.2.9 by gnu_andrew, Tue Sep 20 18:46:35 2005 UTC revision 1.7.2.10 by gnu_andrew, Wed Nov 2 00:44:02 2005 UTC
# Line 222  public class DefaultEditorKit extends Ed Line 222  public class DefaultEditorKit extends Ed
222              {              {
223                t.getDocument().insertString(t.getCaret().getDot(),                t.getDocument().insertString(t.getCaret().getDot(),
224                                             event.getActionCommand(), null);                                             event.getActionCommand(), null);
               t.getCaret().setDot(Math.min(t.getCaret().getDot() + 1,  
                                            t.getDocument().getEndPosition()  
                                            .getOffset()));  
225              }              }
226            catch (BadLocationException be)            catch (BadLocationException be)
227              {              {
# Line 286  public class DefaultEditorKit extends Ed Line 283  public class DefaultEditorKit extends Ed
283       */       */
284      public void actionPerformed(ActionEvent event)      public void actionPerformed(ActionEvent event)
285      {      {
286          // FIXME: Figure out what this Action is supposed to do. Obviously text
287          // that is entered by the user is inserted through DefaultKeyTypedAction.
288      }      }
289    }    }
290    
# Line 692  public class DefaultEditorKit extends Ed Line 691  public class DefaultEditorKit extends Ed
691     */     */
692    public DefaultEditorKit()    public DefaultEditorKit()
693    {    {
694        // Nothing to do here.
695    }    }
696    
697    /**    /**
# Line 947  public class DefaultEditorKit extends Ed Line 947  public class DefaultEditorKit extends Ed
947     * @param offset the beginning offset from where to write     * @param offset the beginning offset from where to write
948     * @param len the length of the fragment to write     * @param len the length of the fragment to write
949     *     *
950     * @throws BadLocationException if <code>offset</code> or     * @throws BadLocationException if <code>offset</code> is an
951     *         <code>offset + len</code>is an invalid location inside     * invalid location inside <code>document</code>.
    *         <code>document</code>  
952     * @throws IOException if something goes wrong while writing to     * @throws IOException if something goes wrong while writing to
953     *        <code>out</code>     *        <code>out</code>
954     */     */
955    public void write(Writer out, Document document, int offset, int len)    public void write(Writer out, Document document, int offset, int len)
956      throws BadLocationException, IOException        throws BadLocationException, IOException
957    {    {
958      // TODO: Implement this properly.      // Throw a BLE if offset is invalid
959        if (offset < 0 || offset > document.getLength())
960          throw new BadLocationException("Tried to write to invalid location",
961                                         offset);
962    
963        // If they gave an overly large len, just adjust it
964        if (offset + len > document.getLength())
965          len = document.getLength() - offset;
966    
967        out.write(document.getText(offset, len));
968    }    }
969  }  }

Legend:
Removed from v.1.7.2.9  
changed lines
  Added in v.1.7.2.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26