< prev index next >

src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java

Print this page

        

*** 44,71 **** * * <dl> * <dt><b>Newlines</b> * <dd> * There are two properties which deal with newlines. The ! * system property, <code>line.separator</code>, is defined to be * platform-dependent, either "\n", "\r", or "\r\n". There is also ! * a property defined in <code>DefaultEditorKit</code>, called ! * <a href=#EndOfLineStringProperty><code>EndOfLineStringProperty</code></a>, * which is defined automatically when a document is loaded, to be * the first occurrence of any of the newline characters. ! * When a document is loaded, <code>EndOfLineStringProperty</code> * is set appropriately, and when the document is written back out, the ! * <code>EndOfLineStringProperty</code> is used. But while the document * is in memory, the "\n" character is used to define a * newline, regardless of how the newline is defined when * the document is on disk. Therefore, for searching purposes, * "\n" should always be used. When a new document is created, ! * and the <code>EndOfLineStringProperty</code> has not been defined, * it will use the System property when writing out the * document. ! * <p>Note that <code>EndOfLineStringProperty</code> is set ! * on the <code>Document</code> using the <code>get/putProperty</code> * methods. Subclasses may override this behavior. * * </dl> * * @author Timothy Prinzing --- 44,71 ---- * * <dl> * <dt><b>Newlines</b> * <dd> * There are two properties which deal with newlines. The ! * system property, {@code line.separator}, is defined to be * platform-dependent, either "\n", "\r", or "\r\n". There is also ! * a property defined in {@code DefaultEditorKit}, called ! * <a href=#EndOfLineStringProperty>{@code EndOfLineStringProperty}</a>, * which is defined automatically when a document is loaded, to be * the first occurrence of any of the newline characters. ! * When a document is loaded, {@code EndOfLineStringProperty} * is set appropriately, and when the document is written back out, the ! * {@code EndOfLineStringProperty} is used. But while the document * is in memory, the "\n" character is used to define a * newline, regardless of how the newline is defined when * the document is on disk. Therefore, for searching purposes, * "\n" should always be used. When a new document is created, ! * and the {@code EndOfLineStringProperty} has not been defined, * it will use the System property when writing out the * document. ! * <p>Note that {@code EndOfLineStringProperty} is set ! * on the {@code Document} using the {@code get/putProperty} * methods. Subclasses may override this behavior. * * </dl> * * @author Timothy Prinzing
*** 80,90 **** } /** * Gets the MIME type of the data that this * kit represents support for. The default ! * is <code>text/plain</code>. * * @return the type */ public String getContentType() { return "text/plain"; --- 80,90 ---- } /** * Gets the MIME type of the data that this * kit represents support for. The default ! * is {@code text/plain}. * * @return the type */ public String getContentType() { return "text/plain";
*** 571,581 **** * @see #getActions */ public static final String selectionDownAction = "selection-down"; /** ! * Name of the <code>Action</code> for moving the caret * to the beginning of a word. * @see #getActions */ public static final String beginWordAction = "caret-begin-word"; --- 571,581 ---- * @see #getActions */ public static final String selectionDownAction = "selection-down"; /** ! * Name of the {@code Action} for moving the caret * to the beginning of a word. * @see #getActions */ public static final String beginWordAction = "caret-begin-word";
*** 585,595 **** * @see #getActions */ public static final String endWordAction = "caret-end-word"; /** ! * Name of the <code>Action</code> for moving the caret * to the beginning of a word, extending the selection. * @see #getActions */ public static final String selectionBeginWordAction = "selection-begin-word"; --- 585,595 ---- * @see #getActions */ public static final String endWordAction = "caret-end-word"; /** ! * Name of the {@code Action} for moving the caret * to the beginning of a word, extending the selection. * @see #getActions */ public static final String selectionBeginWordAction = "selection-begin-word";
*** 599,707 **** * @see #getActions */ public static final String selectionEndWordAction = "selection-end-word"; /** ! * Name of the <code>Action</code> for moving the caret to the * beginning of the previous word. * @see #getActions */ public static final String previousWordAction = "caret-previous-word"; /** ! * Name of the <code>Action</code> for moving the caret to the * beginning of the next word. * @see #getActions */ public static final String nextWordAction = "caret-next-word"; /** ! * Name of the <code>Action</code> for moving the selection to the * beginning of the previous word, extending the selection. * @see #getActions */ public static final String selectionPreviousWordAction = "selection-previous-word"; /** ! * Name of the <code>Action</code> for moving the selection to the * beginning of the next word, extending the selection. * @see #getActions */ public static final String selectionNextWordAction = "selection-next-word"; /** ! * Name of the <code>Action</code> for moving the caret * to the beginning of a line. * @see #getActions */ public static final String beginLineAction = "caret-begin-line"; /** ! * Name of the <code>Action</code> for moving the caret * to the end of a line. * @see #getActions */ public static final String endLineAction = "caret-end-line"; /** ! * Name of the <code>Action</code> for moving the caret * to the beginning of a line, extending the selection. * @see #getActions */ public static final String selectionBeginLineAction = "selection-begin-line"; /** ! * Name of the <code>Action</code> for moving the caret * to the end of a line, extending the selection. * @see #getActions */ public static final String selectionEndLineAction = "selection-end-line"; /** ! * Name of the <code>Action</code> for moving the caret * to the beginning of a paragraph. * @see #getActions */ public static final String beginParagraphAction = "caret-begin-paragraph"; /** ! * Name of the <code>Action</code> for moving the caret * to the end of a paragraph. * @see #getActions */ public static final String endParagraphAction = "caret-end-paragraph"; /** ! * Name of the <code>Action</code> for moving the caret * to the beginning of a paragraph, extending the selection. * @see #getActions */ public static final String selectionBeginParagraphAction = "selection-begin-paragraph"; /** ! * Name of the <code>Action</code> for moving the caret * to the end of a paragraph, extending the selection. * @see #getActions */ public static final String selectionEndParagraphAction = "selection-end-paragraph"; /** ! * Name of the <code>Action</code> for moving the caret * to the beginning of the document. * @see #getActions */ public static final String beginAction = "caret-begin"; /** ! * Name of the <code>Action</code> for moving the caret * to the end of the document. * @see #getActions */ public static final String endAction = "caret-end"; /** ! * Name of the <code>Action</code> for moving the caret * to the beginning of the document. * @see #getActions */ public static final String selectionBeginAction = "selection-begin"; --- 599,707 ---- * @see #getActions */ public static final String selectionEndWordAction = "selection-end-word"; /** ! * Name of the {@code Action} for moving the caret to the * beginning of the previous word. * @see #getActions */ public static final String previousWordAction = "caret-previous-word"; /** ! * Name of the {@code Action} for moving the caret to the * beginning of the next word. * @see #getActions */ public static final String nextWordAction = "caret-next-word"; /** ! * Name of the {@code Action} for moving the selection to the * beginning of the previous word, extending the selection. * @see #getActions */ public static final String selectionPreviousWordAction = "selection-previous-word"; /** ! * Name of the {@code Action} for moving the selection to the * beginning of the next word, extending the selection. * @see #getActions */ public static final String selectionNextWordAction = "selection-next-word"; /** ! * Name of the {@code Action} for moving the caret * to the beginning of a line. * @see #getActions */ public static final String beginLineAction = "caret-begin-line"; /** ! * Name of the {@code Action} for moving the caret * to the end of a line. * @see #getActions */ public static final String endLineAction = "caret-end-line"; /** ! * Name of the {@code Action} for moving the caret * to the beginning of a line, extending the selection. * @see #getActions */ public static final String selectionBeginLineAction = "selection-begin-line"; /** ! * Name of the {@code Action} for moving the caret * to the end of a line, extending the selection. * @see #getActions */ public static final String selectionEndLineAction = "selection-end-line"; /** ! * Name of the {@code Action} for moving the caret * to the beginning of a paragraph. * @see #getActions */ public static final String beginParagraphAction = "caret-begin-paragraph"; /** ! * Name of the {@code Action} for moving the caret * to the end of a paragraph. * @see #getActions */ public static final String endParagraphAction = "caret-end-paragraph"; /** ! * Name of the {@code Action} for moving the caret * to the beginning of a paragraph, extending the selection. * @see #getActions */ public static final String selectionBeginParagraphAction = "selection-begin-paragraph"; /** ! * Name of the {@code Action} for moving the caret * to the end of a paragraph, extending the selection. * @see #getActions */ public static final String selectionEndParagraphAction = "selection-end-paragraph"; /** ! * Name of the {@code Action} for moving the caret * to the beginning of the document. * @see #getActions */ public static final String beginAction = "caret-begin"; /** ! * Name of the {@code Action} for moving the caret * to the end of the document. * @see #getActions */ public static final String endAction = "caret-end"; /** ! * Name of the {@code Action} for moving the caret * to the beginning of the document. * @see #getActions */ public static final String selectionBeginAction = "selection-begin";
*** 828,848 **** * some PC keyboards. * <p> * If the event doesn't get filtered, it will try to insert * content into the text editor. The content is fetched * from the command string of the ActionEvent. The text ! * entry is done through the <code>replaceSelection</code> * method on the target text component. This is the * action that will be fired for most text entry tasks. * <p> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#defaultKeyTypedAction * @see DefaultEditorKit#getActions * @see Keymap#setDefaultAction --- 828,848 ---- * some PC keyboards. * <p> * If the event doesn't get filtered, it will try to insert * content into the text editor. The content is fetched * from the command string of the ActionEvent. The text ! * entry is done through the {@code replaceSelection} * method on the target text component. This is the * action that will be fired for most text entry tasks. * <p> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#defaultKeyTypedAction * @see DefaultEditorKit#getActions * @see Keymap#setDefaultAction
*** 898,908 **** * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#insertContentAction * @see DefaultEditorKit#getActions */ --- 898,908 ---- * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#insertContentAction * @see DefaultEditorKit#getActions */
*** 947,957 **** * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#insertBreakAction * @see DefaultEditorKit#getActions */ --- 947,957 ---- * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#insertBreakAction * @see DefaultEditorKit#getActions */
*** 990,1000 **** * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#insertTabAction * @see DefaultEditorKit#getActions */ --- 990,1000 ---- * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#insertTabAction * @see DefaultEditorKit#getActions */
*** 1272,1282 **** * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#cutAction * @see DefaultEditorKit#getActions */ --- 1272,1282 ---- * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#cutAction * @see DefaultEditorKit#getActions */
*** 1309,1319 **** * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#copyAction * @see DefaultEditorKit#getActions */ --- 1309,1319 ---- * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#copyAction * @see DefaultEditorKit#getActions */
*** 1347,1357 **** * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#pasteAction * @see DefaultEditorKit#getActions */ --- 1347,1357 ---- * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#pasteAction * @see DefaultEditorKit#getActions */
*** 1383,1393 **** * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#beepAction * @see DefaultEditorKit#getActions */ --- 1383,1393 ---- * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @see DefaultEditorKit#beepAction * @see DefaultEditorKit#getActions */
*** 1507,1518 **** target.scrollRectToVisible(newVis); } } /** ! * Makes sure <code>y</code> is a valid location in ! * <code>target</code>. */ private int constrainY(JTextComponent target, int y, int vis) { if (y < 0) { y = 0; } --- 1507,1518 ---- target.scrollRectToVisible(newVis); } } /** ! * Makes sure {@code y} is a valid location in ! * {@code target}. */ private int constrainY(JTextComponent target, int y, int vis) { if (y < 0) { y = 0; }
*** 1521,1532 **** } return y; } /** ! * Ensures that <code>offset</code> is a valid offset into the ! * model for <code>text</code>. */ private int constrainOffset(JTextComponent text, int offset) { Document doc = text.getDocument(); if ((offset != 0) && (offset > doc.getLength())) { --- 1521,1532 ---- } return y; } /** ! * Ensures that {@code offset} is a valid offset into the ! * model for {@code text}. */ private int constrainOffset(JTextComponent text, int offset) { Document doc = text.getDocument(); if ((offset != 0) && (offset > doc.getLength())) {
*** 1538,1548 **** return offset; } /** * Returns adjustsed {@code y} position that indicates the location to scroll to ! * after selecting <code>index</code>. */ private int getAdjustedY(JTextComponent text, Rectangle visible, int index) { int result = visible.y; try { --- 1538,1548 ---- return offset; } /** * Returns adjustsed {@code y} position that indicates the location to scroll to ! * after selecting {@code index}. */ private int getAdjustedY(JTextComponent text, Rectangle visible, int index) { int result = visible.y; try {
*** 1562,1572 **** return result; } /** * Adjusts the Rectangle to contain the bounds of the character at ! * <code>index</code> in response to a page up. */ private boolean select; /** * Direction to scroll, 1 is down, -1 is up. --- 1562,1572 ---- return result; } /** * Adjusts the Rectangle to contain the bounds of the character at ! * {@code index} in response to a page up. */ private boolean select; /** * Direction to scroll, 1 is down, -1 is up.
< prev index next >