Java Code Examples for javax.swing.table.AbstractTableModel#fireTableDataChanged()

The following examples show how to use javax.swing.table.AbstractTableModel#fireTableDataChanged() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DrawProbabilityPanel.java    From MtgDesktopCompanion with GNU General Public License v3.0 6 votes vote down vote up
private void initDeck() {
	model = new AbstractTableModel() {

		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;

		@Override
		public String getColumnName(int t) {
			if (t == 0)
				return "Card";
			else
				return "Turn " + t;
		}

		@Override
		public Object getValueAt(int r, int c) {
			if (c == 0) {
				return d.getUniqueCards().get(r);
			} else {
				return UITools.roundDouble(calc.getProbability(d,c - 1, d.getUniqueCards().get(r)));
			}
		}

		@Override
		public int getRowCount() {
			return d.getMain().keySet().size();
		}

		@Override
		public int getColumnCount() {
			return maxTurn + 1;
		}
	};

	table.setModel(model);
	model.fireTableDataChanged();
	table.packAll();
}