/*
* @(#)JTable.java 1.292 08/05/30
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package javax.swing;
import java.util.*;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
import java.beans.*;
import java.io.Serializable;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.io.IOException;
import javax.accessibility.*;
import javax.swing.event.*;
import javax.swing.plaf.*;
import javax.swing.table.*;
import javax.swing.border.*;
import java.text.NumberFormat;
import java.text.DateFormat;
import java.text.MessageFormat;
import javax.print.attribute.*;
import javax.print.PrintService;
import sun.swing.SwingUtilities2;
import sun.swing.SwingUtilities2.Section;
import static sun.swing.SwingUtilities2.Section.*;
import sun.swing.PrintingStatus;
/**
* The <code>JTable</code> is used to display and edit regular two-dimensional tables
* of cells.
* See <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/table.html">How to Use Tables</a>
* in <em>The Java Tutorial</em>
* for task-oriented documentation and examples of using <code>JTable</code>.
*
* <p>
* The <code>JTable</code> has many
* facilities that make it possible to customize its rendering and editing
* but provides defaults for these features so that simple tables can be
* set up easily. For example, to set up a table with 10 rows and 10
* columns of numbers:
* <p>
* <pre>
* TableModel dataModel = new AbstractTableModel() {
* public int getColumnCount() { return 10; }
* public int getRowCount() { return 10;}
* public Object getValueAt(int row, int col) { return new Integer(row*col); }
* };
* JTable table = new JTable(dataModel);
* JScrollPane scrollpane = new JScrollPane(table);
* </pre>
* <p>
* Note that if you wish to use a <code>JTable</code> in a standalone
* view (outside of a <code>JScrollPane</code>) and want the header
* displayed, you can get it using {@link #getTableHeader} and
* display it separately.
* <p>
* To enable sorting and filtering of rows, use a
* {@code RowSorter}.
* You can set up a row sorter in either of two ways:
* <ul>
* <li>Directly set the {@code RowSorter}. For example:
* {@code table.setRowSorter(new TableRowSorter(model))}.
* <li>Set the {@code autoCreateRowSorter}
* property to {@code true}, so that the {@code JTable}
* creates a {@code RowSorter} for
* you. For example: {@code setAutoCreateRowSorter(true)}.
* </ul>
* <p>
* When designing applications that use the <code>JTable</code> it is worth paying
* close attention to the data structures that will represent the table's data.
* The <code>DefaultTableModel</code> is a model implementation that
* uses a <code>Vector</code> of <code>Vector</code>s of <code>Object</code>s to
* store the cell values. As well as copying the data from an
* application into the <code>DefaultTableModel</code>,
* it is also possible to wrap the data in the methods of the
* <code>TableModel</code> interface so that the data can be passed to the
* <code>JTable</code> directly, as in the example above. This often results
* in more efficient applications because the model is free to choose the
* internal representation that best suits the data.
* A good rule of thumb for deciding whether to use the <code>AbstractTableModel</code>
* or the <code>DefaultTableModel</code> is to use the <code>AbstractTableModel</code>
* as the base class for creating subclasses and the <code>DefaultTableModel</code>
* when subclassing is not required.
* <p>
* The "TableExample" directory in the demo area of the source distribution
* gives a number of complete examples of <code>JTable</code> usage,
* covering how the <code>JTable</code> can be used to provide an
* editable view of data taken from a database and how to modify
* the columns in the display to use specialized renderers and editors.
* <p>
* The <code>JTable</code> uses integers exclusively to refer to both the rows and the columns
* of the model that it displays. The <code>JTable</code> simply takes a tabular range of cells
* and uses <code>getValueAt(int, int)</code> to retrieve the
* values from the model during painting. It is important to remember that
* the column and row indexes returned by various <code>JTable</code> methods
* are in terms of the <code>JTable</code> (the view) and are not
* necessarily the same indexes used by the model.
* <p>
* By default, columns may be rearranged in the <code>JTable</code> so that the
* view's columns appear in a different order to the columns in the model.
* This does not affect the implementation of the model at all: when the
* columns are reordered, the <code>JTable</code> maintains the new order of the columns
* internally and converts its column indices before querying the model.
* <p>
* So, when writing a <code>TableModel</code>, it is not necessary to listen for column
* reordering events as the model will be queried in its own coordinate
* system regardless of what is happening in the view.
* In the examples area there is a demonstration of a sorting algorithm making
* use of exactly this technique to interpose yet another coordinate system
* where the order of the rows is changed, rather than the order of the columns.
* <p>
* Similarly when using the sorting and filtering functionality
* provided by <code>RowSorter</code> the underlying
* <code>TableModel</code> does not need to know how to do sorting,
* rather <code>RowSorter</code> will handle it. Coordinate
* conversions will be necessary when using the row based methods of
* <code>JTable</code> with the underlying <code>TableModel</code>.
* All of <code>JTable</code>s row based methods are in terms of the
* <code>RowSorter</code>, which is not necessarily the same as that
* of the underlying <code>TableModel</code>. For example, the
* selection is always in terms of <code>JTable</code> so that when
* using <code>RowSorter</code> you will need to convert using
* <code>convertRowIndexToView</code> or
* <code>convertRowIndexToModel</code>. The following shows how to
* convert coordinates from <code>JTable</code> to that of the
* underlying model:
* <pre>
* int[] selection = table.getSelectedRows();
* for (int i = 0; i < selection.length; i++) {
* selection[i] = table.convertRowIndexToModel(selection[i]);
* }
* // selection is now in terms of the underlying TableModel
* </pre>
* <p>
* By default if sorting is enabled <code>JTable</code> will persist the
* selection and variable row heights in terms of the model on
* sorting. For example if row 0, in terms of the underlying model,
* is currently selected, after the sort row 0, in terms of the
* underlying model will be selected. Visually the selection may
* change, but in terms of the underlying model it will remain the
* same. The one exception to that is if the model index is no longer
* visible or was removed. For example, if row 0 in terms of model
* was filtered out the selection will be empty after the sort.
* <p>
* J2SE 5 adds methods to <code>JTable</code> to provide convenient access to some
* common printing needs. Simple new {@link #print()} methods allow for quick
* and easy addition of printing support to your application. In addition, a new
* {@link #getPrintable} method is available for more advanced printing needs.
* <p>
* As for all <code>JComponent</code> classes, you can use
* {@link InputMap} and {@link ActionMap} to associate an
* {@link Action} object with a {@link KeyStroke} and execute the
* action under specified conditions.
* <p>
* <strong>Warning:</strong> Swing is not thread safe. For more
* information see <a
* href="package-summary.html#threading">Swing's Threading
* Policy</a>.
* <p>
* <strong>Warning:</s
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
java源码 api all interface or class code (7209个子文件)
java.c 61KB
java_md.c 32KB
parse_manifest.c 17KB
wildcard.c 12KB
version_comp.c 9KB
splashscreen_stubs.c 2KB
jli_util.c 1KB
manifest_info.h 5KB
java.h 2KB
java_md.h 1KB
version_comp.h 491B
splashscreen.h 443B
wildcard.h 393B
jli_util.h 375B
JTable.java 353KB
Component.java 342KB
ORBUtilSystemException.java 315KB
Character.java 212KB
BaseRowSet.java 210KB
XPathParser.java 203KB
JComponent.java 194KB
ResultSet.java 192KB
NimbusDefaults.java 190KB
JTree.java 187KB
Pattern.java 183KB
JTextComponent.java 177KB
XMLSchemaValidator.java 171KB
Container.java 163KB
Arrays.java 163KB
Formatter.java 154KB
DatabaseMetaData.java 150KB
BasicTabbedPaneUI.java 149KB
XMLCipher.java 146KB
BasicTreeUI.java 140KB
BigDecimal.java 139KB
GroupLayout.java 139KB
Collections.java 136KB
JList.java 136KB
DecimalFormat.java 135KB
OMGSystemException.java 133KB
ComponentColorModel.java 131KB
XMLDocumentFragmentScannerImpl.java 131KB
XSDHandler.java 129KB
RegularExpression.java 127KB
RelationService.java 127KB
HTMLDocument.java 124KB
AffineTransform.java 124KB
KeyboardFocusManager.java 123KB
Window.java 121KB
Class.java 121KB
XSSimpleTypeDecl.java 119KB
XMLEntityManager.java 118KB
URI.java 116KB
ImageReader.java 115KB
XIncludeHandler.java 115KB
WindowsLookAndFeel.java 115KB
SynthPainterImpl.java 114KB
CallableStatement.java 114KB
String.java 113KB
XSLTErrorResources_ja.java 113KB
ConcurrentSkipListMap.java 111KB
ObjectInputStream.java 111KB
XMLGregorianCalendarImpl.java 110KB
DTDGrammar.java 108KB
ToStream.java 108KB
BigInteger.java 107KB
XSLTErrorResources_ko.java 107KB
StyleSheet.java 107KB
MetalLookAndFeel.java 106KB
ResourceBundle.java 104KB
Toolkit.java 104KB
JOptionPane.java 104KB
AbstractButton.java 103KB
TextLayout.java 102KB
GregorianCalendar.java 101KB
Font.java 100KB
RowSet.java 100KB
AbstractDOMParser.java 100KB
AbstractDocument.java 99KB
XSLTErrorResources_zh_TW.java 99KB
XSLTErrorResources_zh_CN.java 99KB
BasicListUI.java 98KB
CSS.java 98KB
Scanner.java 98KB
Path2D.java 97KB
SynthPainter.java 96KB
XSLTErrorResources_de.java 96KB
XSLTErrorResources_fr.java 96KB
Calendar.java 96KB
XSLTErrorResources_es.java 96KB
JPEGMetadata.java 96KB
CoreDocumentImpl.java 96KB
IIOPInputStream.java 95KB
X509CertSelector.java 95KB
XSLTErrorResources_it.java 95KB
BasicLookAndFeel.java 94KB
DTMDocumentImpl.java 93KB
ParsedSynthStyle.java 92KB
XSAttributeChecker.java 92KB
FileChooserPainter.java 92KB
共 7209 条
- 1
- 2
- 3
- 4
- 5
- 6
- 73
Tyler_Cheung
- 粉丝: 8
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于keras+fasterRCNN,在VOC格式的口罩数据集上训练,检测人群中有无戴口罩python源码+模型
- 基于opencv+qt5机器视觉的传统缺陷检测, 即采用标准图片和待测图片进行pixel to pixel的XOR操作源码+文档
- 管道内检测缺陷数据库管理系统源码+文档说明+sln
- 毕业设计-低功耗STM32F411开发板(原理图+PCB源文件+官方例程+驱动等)源码+文档说明+截图
- 基于yolov5-tensorRT检测+发动机缸体内壁缺陷检测系统源码+文档说明
- 基于C++实现的锂电池缺陷检测源码+文档说明
- push_version
- 软件自制图像批量压缩工具
- 经典缺陷检测算法源码整理包含PaDiM(2020ICPR)、PatchCore(2022CVPR)、SimpleNet+文档说明
- 基于深度学习的抗梯度噪声的缺陷检测器python源码+文档说明+模型的预训练
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0