I have a button on a JPanel (Calculate), that calculates some values based on user input and enters the results into a JTable (Both the button and the JTable are on the same JPanel). Additionally, it computes a second set of values, now these values are to be placed in JTextFields contained within another JPanel. The values are computed fine, and I can print them out to the command line, thou it doesn't want to update my JTextFields.
The code for the calculate button is as follows:
button_calcSheetTotalsCalculate.addActionListener(
new ActionListener() {
public void actionPerformed (ActionEvent actionEvent) {
Thread t = new Thread() {
Object[] totalsData = null;
CalcSheetSummaryGUI_IF calcSheetSummary = new CalcSheetSummaryGUI();
public void run() {
if (SwingUtilities.isEventDispatchThread()) {
// update the data in the TableModel and on the other panel
tableModel_calcSheetTotals.updateRowTotalsData(totalsData);
// the data is updated with a simple panel_name.updateUI(); method
calcSheetSummary.updateSummaryPanel();
} else {
//compute the new data values
CalcSheetCalculations_IF calcSheetCalculations = new CalcSheetCalculations();
totalsData = calcSheetCalculations.performCalculations();
calcSheetSummary.performSummaryCalculation();
SwingUtilities.invokeLater(this);
}
}
};
t.start();
}
});
Thanks guys/gals.