Scrollable.java revision 2362
2362N/A * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * An interface that provides information to a scrolling container 0N/A * like JScrollPane. A complex component that's likely to be used 0N/A * as a viewing a JScrollPane viewport (or other scrolling container) 0N/A * should implement this interface. 0N/A * @author Hans Muller 0N/A * Returns the preferred size of the viewport for a view component. 0N/A * For example, the preferred size of a <code>JList</code> component 0N/A * is the size required to accommodate all of the cells in its list. 0N/A * However, the value of <code>preferredScrollableViewportSize</code> 0N/A * is the size required for <code>JList.getVisibleRowCount</code> rows. 0N/A * A component without any properties that would affect the viewport 0N/A * size should just return <code>getPreferredSize</code> here. 0N/A * @return the preferredSize of a <code>JViewport</code> whose view 0N/A * is this <code>Scrollable</code> 0N/A * @see JViewport#getPreferredSize 0N/A * Components that display logical rows or columns should compute 0N/A * the scroll increment that will completely expose one new row 0N/A * or column, depending on the value of orientation. Ideally, 0N/A * components should handle a partially exposed row or column by 0N/A * returning the distance required to completely expose the item. 0N/A * Scrolling containers, like JScrollPane, will use this method 0N/A * each time the user requests a unit scroll. 0N/A * @param visibleRect The view area visible within the viewport 0N/A * @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL. 0N/A * @return The "unit" increment for scrolling in the specified direction. 0N/A * This value should always be positive. 0N/A * @see JScrollBar#setUnitIncrement 0N/A * Components that display logical rows or columns should compute 0N/A * the scroll increment that will completely expose one block 0N/A * of rows or columns, depending on the value of orientation. 0N/A * Scrolling containers, like JScrollPane, will use this method 0N/A * each time the user requests a block scroll. 0N/A * @param visibleRect The view area visible within the viewport 0N/A * @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL. 0N/A * @return The "block" increment for scrolling in the specified direction. 0N/A * This value should always be positive. 0N/A * @see JScrollBar#setBlockIncrement 0N/A * Return true if a viewport should always force the width of this 0N/A * <code>Scrollable</code> to match the width of the viewport. 0N/A * For example a normal 0N/A * text view that supported line wrapping would return true here, since it 0N/A * would be undesirable for wrapped lines to disappear beyond the right 0N/A * edge of the viewport. Note that returning true for a Scrollable 0N/A * whose ancestor is a JScrollPane effectively disables horizontal 0N/A * Scrolling containers, like JViewport, will use this method each 0N/A * time they are validated. 0N/A * @return True if a viewport should force the Scrollables width to match its own. 0N/A * Return true if a viewport should always force the height of this 0N/A * Scrollable to match the height of the viewport. For example a 0N/A * columnar text view that flowed text in left to right columns 0N/A * could effectively disable vertical scrolling by returning 0N/A * Scrolling containers, like JViewport, will use this method each 0N/A * time they are validated. 0N/A * @return True if a viewport should force the Scrollables height to match its own.