< prev index next >
src/java.desktop/share/classes/javax/swing/table/JTableHeader.java
Print this page
@@ -43,19 +43,19 @@
import java.io.ObjectInputStream;
import java.io.IOException;
/**
- * This is the object which manages the header of the <code>JTable</code>.
+ * This is the object which manages the header of the {@code JTable}.
* <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™
- * has been added to the <code>java.beans</code> package.
+ * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Alan Chung
* @author Philip Milne
* @see javax.swing.JTable
@@ -72,16 +72,16 @@
//
// Instance Variables
//
/**
* The table for which this object is the header;
- * the default is <code>null</code>.
+ * the default is {@code null}.
*/
protected JTable table;
/**
- * The <code>TableColumnModel</code> of the table header.
+ * The {@code TableColumnModel} of the table header.
*/
protected TableColumnModel columnModel;
/**
* If true, reordering of columns are allowed by the user;
@@ -103,44 +103,44 @@
* If this flag is true, then the header will repaint the table as
* a column is dragged or resized; the default is true.
*/
protected boolean updateTableInRealTime;
- /** The index of the column being resized. <code>null</code> if not resizing. */
+ /** The index of the column being resized. {@code null} if not resizing. */
protected transient TableColumn resizingColumn;
- /** The index of the column being dragged. <code>null</code> if not dragging. */
+ /** The index of the column being dragged. {@code null} if not dragging. */
protected transient TableColumn draggedColumn;
/** The distance from its original position the column has been dragged. */
protected transient int draggedDistance;
/**
- * The default renderer to be used when a <code>TableColumn</code>
- * does not define a <code>headerRenderer</code>.
+ * The default renderer to be used when a {@code TableColumn}
+ * does not define a {@code headerRenderer}.
*/
private TableCellRenderer defaultRenderer;
//
// Constructors
//
/**
- * Constructs a <code>JTableHeader</code> with a default
- * <code>TableColumnModel</code>.
+ * Constructs a {@code JTableHeader} with a default
+ * {@code TableColumnModel}.
*
* @see #createDefaultColumnModel
*/
public JTableHeader() {
this(null);
}
/**
- * Constructs a <code>JTableHeader</code> which is initialized with
- * <code>cm</code> as the column model. If <code>cm</code> is
- * <code>null</code> this method will initialize the table header
- * with a default <code>TableColumnModel</code>.
+ * Constructs a {@code JTableHeader} which is initialized with
+ * {@code cm} as the column model. If {@code cm} is
+ * {@code null} this method will initialize the table header
+ * with a default {@code TableColumnModel}.
*
* @param cm the column model for the table
* @see #createDefaultColumnModel
*/
public JTableHeader(TableColumnModel cm) {
@@ -177,11 +177,11 @@
firePropertyChange("table", old, table);
}
/**
* Returns the table associated with this header.
- * @return the <code>table</code> property
+ * @return the {@code table} property
*/
public JTable getTable() {
return table;
}
@@ -204,11 +204,11 @@
/**
* Returns true if the user is allowed to rearrange columns by
* dragging their headers, false otherwise. The default is true. You can
* rearrange columns programmatically regardless of this setting.
*
- * @return the <code>reorderingAllowed</code> property
+ * @return the {@code reorderingAllowed} property
* @see #setReorderingAllowed
*/
public boolean getReorderingAllowed() {
return reorderingAllowed;
}
@@ -232,23 +232,23 @@
/**
* Returns true if the user is allowed to resize columns by dragging
* between their headers, false otherwise. The default is true. You can
* resize columns programmatically regardless of this setting.
*
- * @return the <code>resizingAllowed</code> property
+ * @return the {@code resizingAllowed} property
* @see #setResizingAllowed
*/
public boolean getResizingAllowed() {
return resizingAllowed;
}
/**
* Returns the dragged column, if and only if, a drag is in
- * process, otherwise returns <code>null</code>.
+ * process, otherwise returns {@code null}.
*
* @return the dragged column, if a drag is in
- * process, otherwise returns <code>null</code>
+ * process, otherwise returns {@code null}
* @see #getDraggedDistance
*/
public TableColumn getDraggedColumn() {
return draggedColumn;
}
@@ -267,14 +267,14 @@
return draggedDistance;
}
/**
* Returns the resizing column. If no column is being
- * resized this method returns <code>null</code>.
+ * resized this method returns {@code null}.
*
* @return the resizing column, if a resize is in process, otherwise
- * returns <code>null</code>
+ * returns {@code null}
*/
public TableColumn getResizingColumn() {
return resizingColumn;
}
@@ -296,39 +296,39 @@
public boolean getUpdateTableInRealTime() {
return updateTableInRealTime;
}
/**
- * Sets the default renderer to be used when no <code>headerRenderer</code>
- * is defined by a <code>TableColumn</code>.
+ * Sets the default renderer to be used when no {@code headerRenderer}
+ * is defined by a {@code TableColumn}.
* @param defaultRenderer the default renderer
* @since 1.3
*/
public void setDefaultRenderer(TableCellRenderer defaultRenderer) {
this.defaultRenderer = defaultRenderer;
}
/**
- * Returns the default renderer used when no <code>headerRenderer</code>
- * is defined by a <code>TableColumn</code>.
+ * Returns the default renderer used when no {@code headerRenderer}
+ * is defined by a {@code TableColumn}.
* @return the default renderer
* @since 1.3
*/
@Transient
public TableCellRenderer getDefaultRenderer() {
return defaultRenderer;
}
/**
- * Returns the index of the column that <code>point</code> lies in, or -1 if it
+ * Returns the index of the column that {@code point} lies in, or -1 if it
* lies out of bounds.
*
- * @param point if this <code>point</code> lies within a column, the index of
+ * @param point if this {@code point} lies within a column, the index of
* that column will be returned; otherwise it is out of bounds
* and -1 is returned
*
- * @return the index of the column that <code>point</code> lies in, or -1 if it
+ * @return the index of the column that {@code point} lies in, or -1 if it
* lies out of bounds
*/
public int columnAtPoint(Point point) {
int x = point.x;
if (!getComponentOrientation().isLeftToRight()) {
@@ -336,17 +336,17 @@
}
return getColumnModel().getColumnIndexAtX(x);
}
/**
- * Returns the rectangle containing the header tile at <code>column</code>.
- * When the <code>column</code> parameter is out of bounds this method uses the
- * same conventions as the <code>JTable</code> method <code>getCellRect</code>.
+ * Returns the rectangle containing the header tile at {@code column}.
+ * When the {@code column} parameter is out of bounds this method uses the
+ * same conventions as the {@code JTable} method {@code getCellRect}.
*
* @param column index of the column
*
- * @return the rectangle containing the header tile at <code>column</code>
+ * @return the rectangle containing the header tile at {@code column}
* @see JTable#getCellRect
*/
public Rectangle getHeaderRect(int column) {
Rectangle r = new Rectangle();
TableColumnModel cm = getColumnModel();
@@ -427,11 +427,11 @@
/**
* Returns the preferred size of the table header.
* This is the size required to display the header and requested for
* the viewport.
- * The returned {@code Dimension} {@code width} will always be calculated by
+ * The returned {@code Dimension width} will always be calculated by
* the underlying TableHeaderUI, regardless of any width specified by
* {@link JComponent#setPreferredSize(java.awt.Dimension)}
*
* @return the size
*/
@@ -450,34 +450,34 @@
//
/**
* Returns the look and feel (L&F) object that renders this component.
*
- * @return the <code>TableHeaderUI</code> object that renders this component
+ * @return the {@code TableHeaderUI} object that renders this component
*/
public TableHeaderUI getUI() {
return (TableHeaderUI)ui;
}
/**
* Sets the look and feel (L&F) object that renders this component.
*
- * @param ui the <code>TableHeaderUI</code> L&F object
+ * @param ui the {@code TableHeaderUI} L&F object
* @see UIDefaults#getUI
*/
public void setUI(TableHeaderUI ui){
if (this.ui != ui) {
super.setUI(ui);
repaint();
}
}
/**
- * Notification from the <code>UIManager</code> that the look and feel
+ * Notification from the {@code UIManager} that the look and feel
* (L&F) has changed.
* Replaces the current UI object with the latest version from the
- * <code>UIManager</code>.
+ * {@code UIManager}.
*
* @see JComponent#updateUI
*/
public void updateUI(){
setUI((TableHeaderUI)UIManager.getUI(this));
@@ -507,16 +507,16 @@
// Managing models
//
/**
- * Sets the column model for this table to <code>newModel</code> and registers
+ * Sets the column model for this table to {@code newModel} and registers
* for listener notifications from the new column model.
*
* @param columnModel the new data source for this table
* @exception IllegalArgumentException
- * if <code>newModel</code> is <code>null</code>
+ * if {@code newModel} is {@code null}
* @see #getColumnModel
* @beaninfo
* bound: true
* description: The object governing the way columns appear in the view.
*/
@@ -536,14 +536,14 @@
resizeAndRepaint();
}
}
/**
- * Returns the <code>TableColumnModel</code> that contains all column information
+ * Returns the {@code TableColumnModel} that contains all column information
* of this table header.
*
- * @return the <code>columnModel</code> property
+ * @return the {@code columnModel} property
* @see #setColumnModel
*/
public TableColumnModel getColumnModel() {
return columnModel;
}
@@ -554,11 +554,11 @@
/**
* Invoked when a column is added to the table column model.
* <p>
* Application code will not use these methods explicitly, they
- * are used internally by <code>JTable</code>.
+ * are used internally by {@code JTable}.
*
* @param e the event received
* @see TableColumnModelListener
*/
public void columnAdded(TableColumnModelEvent e) { resizeAndRepaint(); }
@@ -566,11 +566,11 @@
/**
* Invoked when a column is removed from the table column model.
* <p>
* Application code will not use these methods explicitly, they
- * are used internally by <code>JTable</code>.
+ * are used internally by {@code JTable}.
*
* @param e the event received
* @see TableColumnModelListener
*/
public void columnRemoved(TableColumnModelEvent e) { resizeAndRepaint(); }
@@ -578,11 +578,11 @@
/**
* Invoked when a column is repositioned.
* <p>
* Application code will not use these methods explicitly, they
- * are used internally by <code>JTable</code>.
+ * are used internally by {@code JTable}.
*
* @param e the event received
* @see TableColumnModelListener
*/
public void columnMoved(TableColumnModelEvent e) { repaint(); }
@@ -590,11 +590,11 @@
/**
* Invoked when a column is moved due to a margin change.
* <p>
* Application code will not use these methods explicitly, they
- * are used internally by <code>JTable</code>.
+ * are used internally by {@code JTable}.
*
* @param e the event received
* @see TableColumnModelListener
*/
public void columnMarginChanged(ChangeEvent e) { resizeAndRepaint(); }
@@ -602,16 +602,16 @@
// --Redrawing the header is slow in cell selection mode.
// --Since header selection is ugly and it is always clear from the
// --view which columns are selected, don't redraw the header.
/**
- * Invoked when the selection model of the <code>TableColumnModel</code>
+ * Invoked when the selection model of the {@code TableColumnModel}
* is changed. This method currently has no effect (the header is not
* redrawn).
* <p>
* Application code will not use these methods explicitly, they
- * are used internally by <code>JTable</code>.
+ * are used internally by {@code JTable}.
*
* @param e the event received
* @see TableColumnModelListener
*/
public void columnSelectionChanged(ListSelectionEvent e) { } // repaint(); }
@@ -620,22 +620,22 @@
// Package Methods
//
/**
* Returns the default column model object which is
- * a <code>DefaultTableColumnModel</code>. A subclass can override this
+ * a {@code DefaultTableColumnModel}. A subclass can override this
* method to return a different column model object
*
* @return the default column model object
*/
protected TableColumnModel createDefaultColumnModel() {
return new DefaultTableColumnModel();
}
/**
* Returns a default renderer to be used when no header renderer
- * is defined by a <code>TableColumn</code>.
+ * is defined by a {@code TableColumn}.
*
* @return the default table column renderer
* @since 1.3
*/
protected TableCellRenderer createDefaultRenderer() {
@@ -664,54 +664,54 @@
setDefaultRenderer(createDefaultRenderer());
}
/**
* Sizes the header and marks it as needing display. Equivalent
- * to <code>revalidate</code> followed by <code>repaint</code>.
+ * to {@code revalidate} followed by {@code repaint}.
*/
public void resizeAndRepaint() {
revalidate();
repaint();
}
/**
- * Sets the header's <code>draggedColumn</code> to <code>aColumn</code>.
+ * Sets the header's {@code draggedColumn} to {@code aColumn}.
* <p>
* Application code will not use this method explicitly, it is used
* internally by the column dragging mechanism.
*
- * @param aColumn the column being dragged, or <code>null</code> if
+ * @param aColumn the column being dragged, or {@code null} if
* no column is being dragged
*/
public void setDraggedColumn(TableColumn aColumn) {
draggedColumn = aColumn;
}
/**
- * Sets the header's <code>draggedDistance</code> to <code>distance</code>.
+ * Sets the header's {@code draggedDistance} to {@code distance}.
* @param distance the distance dragged
*/
public void setDraggedDistance(int distance) {
draggedDistance = distance;
}
/**
- * Sets the header's <code>resizingColumn</code> to <code>aColumn</code>.
+ * Sets the header's {@code resizingColumn} to {@code aColumn}.
* <p>
* Application code will not use this method explicitly, it
* is used internally by the column sizing mechanism.
*
- * @param aColumn the column being resized, or <code>null</code> if
+ * @param aColumn the column being resized, or {@code null} if
* no column is being resized
*/
public void setResizingColumn(TableColumn aColumn) {
resizingColumn = aColumn;
}
/**
- * See <code>readObject</code> and <code>writeObject</code> in
- * <code>JComponent</code> for more
+ * See {@code readObject} and {@code writeObject} in
+ * {@code JComponent} for more
* information about serialization in Swing.
*/
private void writeObject(ObjectOutputStream s) throws IOException {
s.defaultWriteObject();
if ((ui != null) && (getUIClassID().equals(uiClassID))) {
@@ -726,20 +726,20 @@
}
return super.getWidth();
}
/**
- * Returns a string representation of this <code>JTableHeader</code>. This method
+ * Returns a string representation of this {@code JTableHeader}. This method
* is intended to be used only for debugging purposes, and the
* content and format of the returned string may vary between
* implementations. The returned string may be empty but may not
- * be <code>null</code>.
+ * be {@code null}.
* <P>
- * Overriding <code>paramString</code> to provide information about the
+ * Overriding {@code paramString} to provide information about the
* specific new aspects of the JFC components.
*
- * @return a string representation of this <code>JTableHeader</code>
+ * @return a string representation of this {@code JTableHeader}
*/
protected String paramString() {
String reorderingAllowedString = (reorderingAllowed ?
"true" : "false");
String resizingAllowedString = (resizingAllowed ?
@@ -778,21 +778,21 @@
// *** should also implement AccessibleSelection?
// *** and what's up with keyboard navigation/manipulation?
//
/**
* This class implements accessibility support for the
- * <code>JTableHeader</code> class. It provides an implementation of the
+ * {@code JTableHeader} class. It provides an implementation of the
* Java Accessibility API appropriate to table header user-interface
* elements.
* <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™
- * has been added to the <code>java.beans</code> package.
+ * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
protected class AccessibleJTableHeader extends AccessibleJComponent {
@@ -895,12 +895,12 @@
/**
* Constructs an AccessiblJTableHeaaderEntry
* @since 1.4
*
* @param c the column index
- * @param p the parent <code>JTableHeader</code>
- * @param t the table <code>JTable</code>
+ * @param p the parent {@code JTableHeader}
+ * @param t the table {@code JTable}
*/
public AccessibleJTableHeaderEntry(int c, JTableHeader p, JTable t) {
parent = p;
column = c;
table = t;
< prev index next >