Represents the table header. The header displays the column header values,
is always visible event if the rest of the table scrolls up and down and
supports column reordering and resizing with mouse.
columnAtPoint
public int columnAtPoint(Point point)
Returns the index of the column at the specified point.
getDraggedColumn
public TableColumn getDraggedColumn()
Get the column that is currently being dragged. This is used when
handling the column reordering with mouse.
- the column being dragged, null if none.
getHeaderRect
public Rectangle getHeaderRect(int column)
Get the rectangle, occupied by the header of the given column.
column
- the column, for that the header area is requested.
getReorderingAllowed
public boolean getReorderingAllowed()
Check if it is possible to reorder the table columns by dragging column
header with mouse. The table reordering is enabled by default, but can be
disabled with
setReorderingAllowed(boolean)
.
- true if reordering is allowed, false otherwise.
getResizingAllowed
public boolean getResizingAllowed()
Check if it is possible to resize the table columns by dragging the column
boundary in the table header with mouse. The resizing is enabled
by default, but can be disabled with
setResizingAllowed(boolean)
.
- true if resizing is allowed, false otherwise.
getResizingColumn
public TableColumn getResizingColumn()
Get the column that is currently being resized. This is used when
handling the column resizing with mouse.
- the column being currently resized, null if none.
getTable
public JTable getTable()
Get the table, having this header.
- the table, having this header.
initializeLocalVars
protected void initializeLocalVars()
Initializes the fields and properties of this class with default values.
This is called by the constructors.
paramString
protected String paramString()
Returns a debugging string representing this component. The string may
be empty but not null.
- paramString in interface JComponent
- a string representing this component
resizeAndRepaint
public void resizeAndRepaint()
Validates the layout of this table header and repaints it. This is
equivalent to revalidate()
followed by
repaint()
.
setDraggedColumn
public void setDraggedColumn(TableColumn draggingIt)
Set the column that is currently being dragged. This is used when
dragging the column with mouse. Setting to null will stop the
dragging session immediately.
draggingIt
- the column being currently dragged, null if none.
setReorderingAllowed
public void setReorderingAllowed(boolean allowed)
Set the table ability to reorder columns by dragging column header
with mouse. The table reordering is enabled by default, but can be
disabled with this method.
allowed
- true if reordering is allowed, false otherwise.
setResizingAllowed
public void setResizingAllowed(boolean allowed)
Set the table ability to resize columns by dragging the column
boundary in the table header with mouse. The resizing is enabled
by default, but can be disabled using this method.
allowed
- true if resizing is allowed, false otherwise.
setResizingColumn
public void setResizingColumn(TableColumn resizingIt)
The the column that is currently being resized. This property is used
when handling table resizing with mouse. Setting to null would stop
the resizing session immediately.
resizingIt
- the column being currently resized
setTable
public void setTable(JTable t)
Set the value of the
table
property.
t
- The new value of the property
JTableHeader.java --
Copyright (C) 2003, 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.