Class JTableRow

All Implemented Interfaces:
ActionListener, MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
EditableJTableRow, StringImageTableViewer

public class JTableRow extends JPanel implements ActionListener, MouseListener
A class to handle a 2 dimension Table with fixed row name and column name, also supports multipage printing.
See Also:
  • Field Details

    • wT

      protected int wT
    • hT

      protected int hT
    • editable

      protected boolean editable
    • theFont

      protected Font theFont
    • currentFile

      protected File currentFile
    • tableView

      protected JScrollPane tableView
    • theTable

      protected JTable theTable
    • dm

      protected TableRowModel dm
    • theData

      protected Object[][] theData
    • colName

      protected String[] colName
    • rowPanel

      protected JPanel rowPanel
    • cornerPanel

      protected JPanel cornerPanel
    • rowTable

      protected JTable rowTable
    • dmr

      protected TableModel dmr
    • rowData

      protected Object[][] rowData
    • tableMenu

      protected JPopupMenu tableMenu
    • selectAllMenuItem

      protected JMenuItem selectAllMenuItem
    • selectNoneMenuItem

      protected JMenuItem selectNoneMenuItem
    • selectColumnMenuItem

      protected JMenuItem selectColumnMenuItem
    • selectRowMenuItem

      protected JMenuItem selectRowMenuItem
    • copyMenuItem

      protected JMenuItem copyMenuItem
    • copyFormatMenuItem

      protected JMenuItem copyFormatMenuItem
    • saveMenuItem

      protected JMenuItem saveMenuItem
    • print1MenuItem

      protected JMenuItem print1MenuItem
    • print2MenuItem

      protected JMenuItem print2MenuItem
    • print3MenuItem

      protected JMenuItem print3MenuItem
    • noDataLabel

      protected static final JLabel noDataLabel
  • Constructor Details

    • JTableRow

      public JTableRow()
      Construction
  • Method Details

    • setEditable

      public void setEditable(boolean b)
      Sets this table editable.
      Parameters:
      b - Editable flag
    • isEditable

      public boolean isEditable()
      Returns:
      true if this table is editable
    • setData

      public void setData(Object[][] data, int startLabelX, int startLabelY)
      Sets the data.
      Parameters:
      data - Handle to data array.
      startLabelX - Horizontal column labeling starting index
      startLabelY - Vertical column labeling starting index
    • setData

      public void setData(Object[][] data, String[] columnNames)
      Sets the data (No row label).
      Parameters:
      data - Handle to data array.
      columnNames - Column name
    • updateTables

      protected void updateTables(int nhT, int nwT)
    • getObjectAt

      public Object getObjectAt(int row, int column)
      Returns the cells at the specified pos or null if the table has no data.
      Parameters:
      row - Row index
      column - Column index
      Returns:
      Cell at the specified pos
    • clearData

      public void clearData()
      Clear the table
    • setFont

      public void setFont(Font f)
      Overrides:
      setFont in class JComponent
    • getFont

      public Font getFont()
      Specified by:
      getFont in interface MenuContainer
      Overrides:
      getFont in class Component
    • adjustSize

      public void adjustSize()
      Adjust the ScrollPane preferredSize according to the table size.
      See Also:
    • adjustColumnSize

      public void adjustColumnSize()
      Adjust column size according to data. Should be called before adjustSize and after setData.
      See Also:
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener
    • saveDataFile

      public void saveDataFile()
    • makeDataString

      protected String makeDataString()
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener
    • createTable

      protected void createTable()
    • updateViewPortView

      protected void updateViewPortView()
    • placeComponent

      protected void placeComponent()
    • makeTabbedString

      protected String makeTabbedString()
    • makeFormatTabbedString

      protected String makeFormatTabbedString()
    • measureColumns

      protected int[] measureColumns(Font f)
    • printTable

      public void printTable(int printSize)
      Display the print dialog and sends the table to the printer.
      Parameters:
      printSize - Font size for printing
      See Also:
    • main

      public static void main(String[] args)