Class CharTableModel

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.table.TableModel

    public class CharTableModel
    extends javax.swing.table.AbstractTableModel
    Character table table model
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      CharTableModel​(java.lang.String data)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void allowOnlyUnique()
      leave only unique characters in the data string.
      void appendChar​(java.lang.Character c, boolean checkUnique)
      Append a new character to the data.
      int getColumnCount()  
      java.lang.String getColumnName​(int column)  
      java.lang.String getData()  
      int getRowCount()  
      java.lang.Object getValueAt​(int rowIndex, int columnIndex)  
      java.awt.Point modifyPoint​(java.awt.Point p)
      Prevent the use of invalid points in the table (beyond data string length).
      void removeSelection​(int row1, int col1, int row2, int col2)
      Remove the selected characters from the model.
      boolean setData​(java.lang.String data)
      set the data to a selected string
      • Methods inherited from class javax.swing.table.AbstractTableModel

        addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CharTableModel

        public CharTableModel​(java.lang.String data)
    • Method Detail

      • setData

        public boolean setData​(java.lang.String data)
        set the data to a selected string
        Parameters:
        data - the new string
        Returns:
        true if the data have been replaced.
      • getData

        public java.lang.String getData()
      • allowOnlyUnique

        public void allowOnlyUnique()
        leave only unique characters in the data string.
      • appendChar

        public void appendChar​(java.lang.Character c,
                               boolean checkUnique)
        Append a new character to the data.
        Parameters:
        c - the character
        checkUnique - check for being unique or not
      • removeSelection

        public void removeSelection​(int row1,
                                    int col1,
                                    int row2,
                                    int col2)
        Remove the selected characters from the model.
        Parameters:
        row1 - from row
        col1 - from column
        row2 - to row
        col2 - to column
      • getRowCount

        public int getRowCount()
      • getColumnCount

        public int getColumnCount()
      • getValueAt

        public java.lang.Object getValueAt​(int rowIndex,
                                           int columnIndex)
      • getColumnName

        public java.lang.String getColumnName​(int column)
        Specified by:
        getColumnName in interface javax.swing.table.TableModel
        Overrides:
        getColumnName in class javax.swing.table.AbstractTableModel
      • modifyPoint

        public java.awt.Point modifyPoint​(java.awt.Point p)
        Prevent the use of invalid points in the table (beyond data string length).
        Parameters:
        p - the point in question
        Returns:
        the modified point.