DropMode.java revision 10444:f08705540498
1/* 2 * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25package javax.swing; 26 27/** 28 * Drop modes, used to determine the method by which a component 29 * tracks and indicates a drop location during drag and drop. 30 * 31 * @author Shannon Hickey 32 * @see JTable#setDropMode 33 * @see JList#setDropMode 34 * @see JTree#setDropMode 35 * @see javax.swing.text.JTextComponent#setDropMode 36 * @since 1.6 37 */ 38public enum DropMode { 39 40 /** 41 * A component's own internal selection mechanism (or caret for text 42 * components) should be used to track the drop location. 43 */ 44 USE_SELECTION, 45 46 /** 47 * The drop location should be tracked in terms of the index of 48 * existing items. Useful for dropping on items in tables, lists, 49 * and trees. 50 */ 51 ON, 52 53 /** 54 * The drop location should be tracked in terms of the position 55 * where new data should be inserted. For components that manage 56 * a list of items (list and tree for example), the drop location 57 * should indicate the index where new data should be inserted. 58 * For text components the location should represent a position 59 * between characters. For components that manage tabular data 60 * (table for example), the drop location should indicate 61 * where to insert new rows, columns, or both, to accommodate 62 * the dropped data. 63 */ 64 INSERT, 65 66 /** 67 * The drop location should be tracked in terms of the row index 68 * where new rows should be inserted to accommodate the dropped 69 * data. This is useful for components that manage tabular data. 70 */ 71 INSERT_ROWS, 72 73 /** 74 * The drop location should be tracked in terms of the column index 75 * where new columns should be inserted to accommodate the dropped 76 * data. This is useful for components that manage tabular data. 77 */ 78 INSERT_COLS, 79 80 /** 81 * This mode is a combination of <code>ON</code> 82 * and <code>INSERT</code>, specifying that data can be 83 * dropped on existing items, or in insert locations 84 * as specified by <code>INSERT</code>. 85 */ 86 ON_OR_INSERT, 87 88 /** 89 * This mode is a combination of <code>ON</code> 90 * and <code>INSERT_ROWS</code>, specifying that data can be 91 * dropped on existing items, or as insert rows 92 * as specified by <code>INSERT_ROWS</code>. 93 */ 94 ON_OR_INSERT_ROWS, 95 96 /** 97 * This mode is a combination of <code>ON</code> 98 * and <code>INSERT_COLS</code>, specifying that data can be 99 * dropped on existing items, or as insert columns 100 * as specified by <code>INSERT_COLS</code>. 101 */ 102 ON_OR_INSERT_COLS 103} 104