001/**
002 * 
003 */
004package icy.gui.component;
005
006import javax.swing.JTable;
007import javax.swing.ListSelectionModel;
008import javax.swing.table.TableColumnModel;
009import javax.swing.table.TableModel;
010
011/**
012 * Basically a JTable component with minor improvement.
013 * 
014 * @author Stephane
015 */
016public class IcyTable extends JTable
017{
018    /**
019     * 
020     */
021    private static final long serialVersionUID = -3434771353006383970L;
022
023    /**
024     * @see JTable#JTable(int, int)
025     */
026    public IcyTable(int numRows, int numColumns)
027    {
028        super(numRows, numColumns);
029    }
030
031    /**
032     * @see JTable#JTable(Object[][], Object[])
033     */
034    public IcyTable(Object[][] rowData, Object[] columnNames)
035    {
036        super(rowData, columnNames);
037    }
038
039    /**
040     * @see JTable#JTable(TableModel, TableColumnModel, ListSelectionModel)
041     */
042    public IcyTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)
043    {
044        super(dm, cm, sm);
045    }
046
047    /**
048     * @see JTable#JTable(TableModel, TableColumnModel)
049     */
050    public IcyTable(TableModel dm, TableColumnModel cm)
051    {
052        super(dm, cm);
053    }
054
055    /**
056     * @see JTable#JTable(TableModel)
057     */
058    public IcyTable(TableModel dm)
059    {
060        super(dm);
061    }
062
063    @Override
064    public boolean getScrollableTracksViewportWidth()
065    {
066        final boolean result = super.getScrollableTracksViewportWidth();
067
068        if (result)
069            return getPreferredSize().width < getParent().getWidth();
070
071        return result;
072    }
073}