Witam, mam problem z odświeżaniem tabeli. Tabele można zerować, dodawać liczby do danej kolumny i wiersza i dodawać losowe liczy. Problem polega na tym ze choć program zapisuje liczby to tablicy, tabela ich nie wyświetla ,do odświeżania używam metody setZeroTable() . W konstruktorze mam funkcje która ma wyzerować wszystkie wiersze i jest to jedyny moment kiedy wyświetla się to co ma się wyświetlać ,każda inna próba dodania liczb lub wyzerowania ich nie przynosi skutku nie wyrzuca liczb do tabeli. Na dole umieszczam cały kod

Model

public class AplikacjaModel extends AbstractTableModel
	{

		private static final long serialVersionUID = 1L;
		private final int countRowTable = 5;
		private final int countColumnTable = 5;
		private Integer[][] data = new Integer[countRowTable][countColumnTable];
		private String[] colName = {"1","2","3","4","5"};
		
		public AplikacjaModel() {
			super();
			setZeroTable();
		}
		public int getColumnCount() {
			return countColumnTable;
		}
		public int getRowCount(){
			return countColumnTable;
		}
		public Object getValueAt(int row, int col) {
			Object object = (Object) data[row][col];
			return object;
		}
		public Integer[][] getIntegerValuesTable() {
			return data;
		}
		public String getStringValuesTable(){
			String str = "";
			for(int i=0; i<countRowTable; i++)
				for(int j=0; j<countColumnTable; j++){
					str = str + data[i][j] +" ";
				}
			return str;
		}
		public String getColumnName(int col){
			return colName[col];
		}
		public String[] getColumnNames(){ 
			return colName;
		}



		public void setValue(Integer value, int row, int col){
			data[row][col] = value;
			fireTableDataChanged();	
		}
		public void setRandomTable() {
			Random random = new Random();
			for(int i=0; i<countRowTable; i++)
				for(int j=0; j<countColumnTable; j++) {
					// ograniczenie znaku liczby i zakresu do 10000
					data[i][j] = Math.abs(random.nextInt()) % 10000;
				}
			fireTableDataChanged();
		}
		public void setZeroTable() {
			for(int i=0; i<countRowTable; i++)
				for(int j=0; j<countColumnTable; j++) {
					data[i][j] = new Integer(0);
				}
			fireTableDataChanged();
		}



		public Integer calculateSum() {
			Integer sum = new Integer(0);
			for(int i=0; i<countRowTable; i++)
				for(int j=0; j<countColumnTable; j++) {
					sum = sum + data[i][j];
				}
			return sum;
		}
		public Float calculateAverage() {
			Float avg = new Float(0.0);
			Integer sum = calculateSum();
			if(sum > 0) avg = (sum.floatValue())/(countRowTable*countColumnTable);
			return avg;
		}	

		public int calculateMax() // oblicza liczbe max
		{
			int maximum = data[0][0];
			int minimum = data[0][0];
			
			for(int i=0; i<data.length; i++)
			{
				for(int j=0; j<data.length; j++)
				if(data[i][j]>maximum) 
				{
					maximum=data[i][j];	
				}
				else if(data[i][j]<minimum) 
				{
					minimum=data[i][j];	
				}	
			}
			return maximum;
		}

			public int calculateMin()  //oblicza liczbe min
			{
				int maximum = data[0][0];
				int minimum = data[0][0];
				
				for(int i=0; i<data.length; i++)
				{
					for(int j=0; j<data.length; j++)
					if(data[i][j]>maximum) 
					{
						maximum=data[i][j];	
					}
					else if(data[i][j]<minimum) 
					{
						minimum=data[i][j];	
					}	
				}
				return minimum;
			}
					
	}

View

public class AplikacjaView extends JFrame
{
	
	private JLabel lblNumerKolumny, lblNumerWiersza, lblWprowadzLiczbe, lblWybierzObiczenia;
	private JComboBox comboBoxWiersz, comboBoxKolumna;
	private JSlider sliderKolumna, sliderWiersz;
	private JTextField textField;
	private JTextArea textArea;
	private JTable table;
	private JToolBar toolBar;
	private JButton btnZapisz, btnDodaj, btnWyzeruj, btnWypelnij, btnOblicz;
	private JButton btZapisz, btDodaj, btWyzeruj, btWypelnij, btSuma, btSrednia, btMin, btMax, btOProgramie, btPomoc;
	private JMenuBar menuBar;
	private JMenu mnPlik, mnTabela, mnObliczenia, mnPomoc;
	private JMenuItem mZapisz, mZamknij, mDodaj, mWyzeruj, mWypelnij, mSuma, mSrednia, mMin, mMax, mPomoc, mOProgramie;
	private JScrollPane tableScrollPane;
	private ImageIcon iTDodaj, iZapisz,iPomoc, iOProgramie, iDodaj, iWypelnij, iWyzeruj, iSuma, iSrednia, iMax, iMin, iOblicz;
	
	
 public AplikacjaView()
 {

		setFont(null);
		setForeground(new Color(240, 240, 240));
		setBounds(100, 100, 700, 470);
		getContentPane().setLayout(null);
		setLocationRelativeTo(null);
		
		JPanel panel = new JPanel();
		panel.setBounds(0, 25, 682, 372);
		getContentPane().add(panel);
		panel.setLayout(null);
		
		textField = new JTextField();
		textField.setBounds(119, 10, 116, 22);
		panel.add(textField);
		textField.setColumns(10);
		
		lblWprowadzLiczbe = new JLabel("Wprowadz liczbe");
		lblWprowadzLiczbe.setBounds(12, 13, 104, 16);
		panel.add(lblWprowadzLiczbe);
		
		lblNumerWiersza = new JLabel("Numer wiersza");
		lblNumerWiersza.setBounds(260, 13, 93, 16);
		panel.add(lblNumerWiersza);
		
		lblNumerKolumny = new JLabel("Numer kolumny");
		lblNumerKolumny.setBounds(475, 16, 93, 16);
		panel.add(lblNumerKolumny);	
		
		lblWybierzObiczenia = new JLabel("Wybierz obiczenia: ");
		lblWybierzObiczenia.setBounds(12, 176, 116, 16);
		panel.add(lblWybierzObiczenia);	
		
		textArea = new JTextArea();
		textArea.setEditable(false);
		textArea.setBounds(50, 270, 550, 90);
		panel.add(textArea);
	


	
		table = new JTable(new AplikacjaModel());
		table.setBounds(10, 63, 520, 103);
		panel.add(table);
	


	
		tableScrollPane = new JScrollPane(table);
		tableScrollPane.setBounds(10, 63, 520, 103);
		panel.add(tableScrollPane);
		
		toolBar = new JToolBar();
		toolBar.setBounds(0, 0, 682, 30);
		getContentPane().add(toolBar);
		
		btZapisz = new JButton(iZapisz); 
		toolBar.add(btZapisz);
		
		btDodaj = new JButton("iDodaj");
		toolBar.add(btDodaj);
		
		btWyzeruj = new JButton("iWyzeruj");
		toolBar.add(btWyzeruj);
		
		btWypelnij = new JButton("iWypelnij");
		toolBar.add(btWypelnij);
		
		toolBar.addSeparator();
		
		btSuma = new JButton("iSuma");
		toolBar.add(btSuma);
		
		btSrednia = new JButton("iSrednia");
		toolBar.add(btSrednia);
		
		btMin = new JButton("iMin");
		toolBar.add(btMin);
		
		btMax = new JButton("Max");
		toolBar.add(btMax);
		
		toolBar.addSeparator();
		
		btPomoc = new JButton(iPomoc);
		toolBar.add(btPomoc);
		
		btOProgramie = new JButton(iOProgramie);
		toolBar.add(btOProgramie);
		
		btnDodaj = new JButton(iDodaj);
		btnDodaj.setBounds(620, 58, 30, 30);
		panel.add(btnDodaj);
		
		btnWypelnij = new JButton(iWypelnij);
		btnWypelnij.setBounds(620, 96, 30, 30);
		panel.add(btnWypelnij);
		
		btnWyzeruj = new JButton(iWyzeruj);
		btnWyzeruj.setBounds(620, 134, 30, 30);
		panel.add(btnWyzeruj);
		
		btnZapisz = new JButton(iZapisz);
		btnZapisz.setBounds(620, 172, 30, 30);
		panel.add(btnZapisz);
		
		btnOblicz = new JButton(iOblicz);
		btnOblicz.setBounds(241, 172, 97, 25);
		panel.add(btnOblicz);
		
		iZapisz = new ImageIcon("src/img/zapisz.png");
		iDodaj = new ImageIcon("src/img/dodaj.png");
		iWypelnij = new ImageIcon("src/img/wypelnij.png");
		iWyzeruj = new ImageIcon("src/img/wyzeruj.png");
		iSuma = new ImageIcon("src/img/suma.png");
		iSrednia = new ImageIcon("src/img/srednia.png");
		iMax = new ImageIcon("src/img/max.png");
		iMin = new ImageIcon("src/img/min.png");
		iPomoc = new ImageIcon("src/img/pomoc.png");
		iOProgramie = new ImageIcon("src/img/oprogramie.png"); 
		
		
		//JList list = new JList(new AplikacjaModel());
		//list.setBounds(136, 170, 64, 79);
		//panel.add(list);
				
		sliderWiersz = new JSlider(0, 4, 0);
		sliderWiersz.setBounds(355, 13, 100, 40);
		sliderWiersz.setMajorTickSpacing(1);
		sliderWiersz.setPaintTicks(true);
		sliderWiersz.setPaintLabels(true);
		panel.add(sliderWiersz);
		
		sliderKolumna = new JSlider(0, 4, 0);
		sliderKolumna.setBounds(570, 13, 100, 40);
		sliderKolumna.setMajorTickSpacing(1);
		sliderKolumna.setPaintTicks(true);
		sliderKolumna.setPaintLabels(true);
		panel.add(sliderKolumna);
		
		menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		mnPlik = new JMenu("Plik");
		menuBar.add(mnPlik);
		
		mZapisz = new JMenuItem("Zapisz");
		mnPlik.add(mZapisz);
		
		mZamknij = new JMenuItem("Zamknij");
		mnPlik.add(mZamknij);

		
		mnTabela = new JMenu("Tabela");
		menuBar.add(mnTabela);
		
		mDodaj = new JMenuItem("Dodaj");
		mnTabela.add(mDodaj);
		
		mWypelnij = new JMenuItem("Wypelnij");
		mnTabela.add(mWypelnij);
		
		mWyzeruj = new JMenuItem("Wyzeruj");
		mnTabela.add(mWyzeruj);

		mnObliczenia = new JMenu("Obliczenia");
		menuBar.add(mnObliczenia);
		
		mSuma = new JMenuItem("Suma");
		mnObliczenia .add(mSuma);
		
		mSrednia = new JMenuItem("Srednia");
		mnObliczenia .add(mSrednia);
		
		mMin = new JMenuItem("Min");
		mnObliczenia .add(mMin);
		
		mMax = new JMenuItem("Max");
		mnObliczenia .add(mMax);
		
		mnPomoc = new JMenu("Pomoc");
		menuBar.add(mnPomoc); 
		
		mPomoc = new JMenuItem("Pomoc");
		mnPomoc .add(mPomoc);
		
		mOProgramie = new JMenuItem("O programie");
		mnPomoc .add(mOProgramie);
		
 }
 

		 public void setSuma(int suma)
		 {
			 textArea.setText(Integer.toString(suma));
		 }
		 
		 public void setSrednia(float srednia)
		 {
			 textArea.setText(Float.toString(srednia));
		 }
		 
		 public void setMin(int min)
		 {
			 textArea.setText(Integer.toString(min));
		 }
		 
		 public void setMax(int max)
		 {
			 textArea.setText(Integer.toString(max));
		 }
		 public String getValue()
		 {
			return textField.getText();
		 }
		 
		 
		
		 public JButton getBtPomoc()
		 {
			 return btPomoc;
		 }
		 public JButton getBtOProgramie()
		 {
			 return btOProgramie;
		 }
		 public JButton getBtMax()
		 {
			 return btMax;
		 }
		 public JButton getBtMin()
		 {
			 return btMin;
		 }
		 public JButton getBtSrednia()
		 {
			 return btSrednia;
		 }
		 public JButton getBtZapsisz()
		 {
			 return btZapisz;
		 }
		 public JButton getBtSuma()
		 {
			 return btSuma;
		 }
		 public JButton getBtWypelnij()
		 {
			 return btWypelnij;
		 }
		 public JButton getBtWyzeruj()
		 {
			 return btWyzeruj;
		 }
		 public JButton getBtDodaj()
		 {
			 return btDodaj;
		 }
		 public JButton getBtZapisz()
		 {
			 return btZapisz;
		 }
		 public JButton getBtnOblicz()
		 {
			 return btnOblicz;
		 }
		 public JButton getBtnWypelnij()
		 {
			 return btnWypelnij;
		 }
		 public JButton getBtnWyzeruj()
		 {
			 return btnWyzeruj;
		 }
		 public JButton getBtnDodaj()
		 {
			 return btDodaj;
		 }
		 public JButton getBtnZapisz()
		 {
			 return btnZapisz;
		 }
		 public JSlider getSliderWiersz()
		 {
			 return sliderWiersz;
		 }
		 public JSlider getSliderKolumna()
		 {
			 return sliderKolumna;
		 }
		 public JTable getTable()
		 {
			 return table;
		 }
		 public JMenuItem getDodaj()
		 {
			 return mDodaj;
		 }
		 public JMenuItem getWypelnij()
		 {
			 return mWypelnij;
		 }
		 public JMenuItem getWyzeruj()
		 {
			 return mWyzeruj;
		 }
		 public JMenuItem getSuma()
		 {
			 return mSuma;
		 }
		 public JMenuItem getSrednia()
		 {
			 return mSrednia;
		 }
		 public JMenuItem getMin()
		 {
			 return mMin;
		 }
		 public JMenuItem getMax()
		 {
			 return mMax;
		 }
		 public JMenuItem getZapisz()
		 {
			 return mZapisz;
		 }
		 public JMenuItem getZamkinij()
		 {
			 return mZamknij;
		 }
		 public JMenuItem getPomoc()
		 {
			 return mPomoc;
		 }
		 public JMenuItem getOProgramie()
		 {
			 return mOProgramie;
		 }
		 


		 
		 void addCalculateListener(ActionListener listenForCalcButton)
		 {
			 btnZapisz.addActionListener(listenForCalcButton);
			 btnDodaj.addActionListener(listenForCalcButton);
			 btnWyzeruj.addActionListener(listenForCalcButton);
			 btnWypelnij.addActionListener(listenForCalcButton);
			 btnOblicz.addActionListener(listenForCalcButton);
			 btSuma.addActionListener(listenForCalcButton);
			 btZapisz.addActionListener(listenForCalcButton);
			 btDodaj.addActionListener(listenForCalcButton);
			 btWyzeruj.addActionListener(listenForCalcButton);
			 btWypelnij.addActionListener(listenForCalcButton);
			 btSrednia.addActionListener(listenForCalcButton);
			 btMin.addActionListener(listenForCalcButton);
			 btMax.addActionListener(listenForCalcButton);
			 btOProgramie.addActionListener(listenForCalcButton);
			 btPomoc.addActionListener(listenForCalcButton);	
			 mDodaj.addActionListener(listenForCalcButton);
			 mWyzeruj.addActionListener(listenForCalcButton);
			 mWypelnij.addActionListener(listenForCalcButton);
			 mSuma.addActionListener(listenForCalcButton);
			 mSrednia.addActionListener(listenForCalcButton);
			 mMin.addActionListener(listenForCalcButton);
			 mMax.addActionListener(listenForCalcButton);
			 mZapisz.addActionListener(listenForCalcButton);
			 mZamknij.addActionListener(listenForCalcButton);
			 mOProgramie.addActionListener(listenForCalcButton);
			 mPomoc.addActionListener(listenForCalcButton);
		 }
		 
	 
		void displayErrorMessage(String errorMessage)
			 {
			
				 JOptionPane.showMessageDialog( null, this, errorMessage, 0);
			 }

}

Controller

public class AplikacjaController
{
	private static final long serialVersionUID = 1L;
	private AplikacjaModel theModel;
	private AplikacjaView theView;
	
	public AplikacjaController(AplikacjaModel theModel, AplikacjaView theView)
	{
		this.theModel = theModel;
		this.theView = theView;
		
		this.theView.addCalculateListener(new CalculateListener());
	}
	
	class CalculateListener implements ActionListener
	{
		public void actionPerformed(ActionEvent e) 
		{
			Object zrodlo = e.getSource();
			
			// bt
			
			if(zrodlo==theView.getBtSuma() || zrodlo==theView.getSuma())
			{	
				theView.setSuma(theModel.calculateSum());
			}
			else if(zrodlo==theView.getBtMin() || zrodlo==theView.getMin())
			{
				theView.setMin(theModel.calculateMin());
			}
			else if(zrodlo==theView.getBtOProgramie() || zrodlo==theView.getOProgramie())
			{
				//new Autor();
			}
			else if(zrodlo==theView.getBtPomoc() || zrodlo==theView.getPomoc())
			{
				//new Pomoc();
			}
			else if(zrodlo==theView.getBtMax() || zrodlo==theView.getMax())
			{
				theView.setMax(theModel.calculateMax());
			}
			else if(zrodlo==theView.getBtSrednia() || zrodlo==theView.getSrednia())
			{
				theView.setSrednia(theModel.calculateAverage());
			}



			else if(zrodlo==theView.getBtWypelnij() || zrodlo==theView.getBtnWypelnij() || zrodlo==theView.getWypelnij())
			{
				theModel.setRandomTable();
			}
			else if(zrodlo==theView.getBtWyzeruj() || zrodlo==theView.getBtnWyzeruj() || zrodlo==theView.getWyzeruj())
			{
				theModel.setZeroTable();
			}
			else if (zrodlo == theView.getBtnDodaj() || zrodlo == theView.getBtDodaj() || zrodlo==theView.getDodaj())
			{
				try{
					int Wiersz = theView.getSliderWiersz().getValue();
					int Kolumna = theView.getSliderKolumna().getValue();
					String Wartosc = theView.getValue();
					
					theModel.setValue(Integer.parseInt(Wartosc), Wiersz, Kolumna);
				}
							
				catch (NumberFormatException e1){
					JOptionPane.showMessageDialog(null, "Nieprawidłowe dane wejściowe!\nWprowadź ponownie.", "Błąd!", JOptionPane.ERROR_MESSAGE);
				}
			}




			else if (zrodlo==theView.getBtnZapisz() || zrodlo==theView.getBtZapisz() || zrodlo==theView.getZapisz())
			{
				JFileChooser fc = new JFileChooser();
				
				if(fc.showSaveDialog(null)==JFileChooser.APPROVE_OPTION){
					
				File plik = fc.getSelectedFile();
				
					try{
						PrintWriter pw = new PrintWriter(plik);
						
						for(int i=0; i<theModel.getRowCount(); i++){
							
							for(int j=0; j<theModel.getColumnCount(); j++){
						
									float pobierz = (Float)theModel.getValueAt(i, j);
	
									String konwertuj = new String(Float.toString(pobierz));
							
									pw.println(konwertuj);
						}
					}
							
					pw.close();	
					}
				
					catch (FileNotFoundException e1) {
						JOptionPane.showMessageDialog(null, "Nieprawidłowa nazwa pliku.", "Zapisywanie", JOptionPane.WARNING_MESSAGE);
					}
						
					catch (NoSuchElementException e2){ 
						//logger.info("Błąd!", e2);
						JOptionPane.showMessageDialog(null, "Nieprawidłowy plik!", "Błąd!", JOptionPane.ERROR_MESSAGE);
					}
				}
			}
			else if(zrodlo==theView.getZamkinij())
			{
				Object options[] = {"Tak","Nie"};
				int odpowiedz = JOptionPane.showOptionDialog(null, "Czy na pewno chcesz wyjść?", "Zamykanie programu", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,null, options, options[1]); //okno dialogowe z opcją tak lub nie
				
				if(odpowiedz==JOptionPane.YES_OPTION){ 
					
				theView.dispose(); //zakończenie programu
				}
				
				else if(odpowiedz==JOptionPane.NO_OPTION);
				
				else if(odpowiedz == JOptionPane.CLOSED_OPTION);
			}
		}
	}
}


Test

public class AplikacjaTest {

	public static void main(String[] args)
	{
		
		AplikacjaView theView = new AplikacjaView();
		theView.setVisible(true);
		theView.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		AplikacjaModel theModel = new AplikacjaModel();
		AplikacjaController theController = new AplikacjaController(theModel, theView);
		
	}

}