1 /* 2 * @(#)BadLocationException.java 1.20 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 package javax.swing.text; 8 9 /** 10 * This exception is to report bad locations within a document model 11 * (that is, attempts to reference a location that doesn't exist). 12 * <p> 13 * <strong>Warning:</strong> 14 * Serialized objects of this class will not be compatible with 15 * future Swing releases. The current serialization support is 16 * appropriate for short term storage or RMI between applications running 17 * the same version of Swing. As of 1.4, support for long term storage 18 * of all JavaBeans<sup><font size="-2">TM</font></sup> 19 * has been added to the <code>java.beans</code> package. 20 * Please see {@link java.beans.XMLEncoder}. 21 * 22 * @author Timothy Prinzing 23 * @version 1.20 12/19/03 24 */ 25 public class BadLocationException extends Exception 26 { 27 /** 28 * Creates a new BadLocationException object. 29 * 30 * @param s a string indicating what was wrong with the arguments 31 * @param offs offset within the document that was requested >= 0 32 */ 33 public BadLocationException(String s, int offs) { 34 super(s); 35 this.offs = offs; 36 } 37 38 /** 39 * Returns the offset into the document that was not legal. 40 * 41 * @return the offset >= 0 42 */ 43 public int offsetRequested() { 44 return offs; 45 } 46 47 private int offs; 48 } 49