I have a question that has been boring me for some days. I'm implementing some swing interfaces that is supposed to load an image:
When i press a button it triggers an event that calls the following method:
private void GetDataPanelGeral()
{
ArrayList<String> Files = new ArrayList<>();
java.util.Date selectedDate = (java.util.Date) this.JDatePickerImpl_GERAL_MUDANÇAS_datePicker_START.getModel().getValue();
java.sql.Date sqlDateINICIO = new java.sql.Date(selectedDate.getTime());
selectedDate = (java.util.Date) this.JDatePickerImpl_GERAL_MUDANÇAS_datePicker_END.getModel().getValue();
java.sql.Date sqlDateFIM = new java.sql.Date(selectedDate.getTime());
//CALL MODULE 5
RunningLoop loop = null;
Thread t = new Thread
(
loop = new RunningLoop(50000,this.StringDBName,this.StringDBDriver,
this.StringDBUser,this.StringDBPass,this.PathToData,
sqlDateINICIO.toString(),
sqlDateFIM.toString(),
true)
);
t.start();
loop.StopLooping();
this.ImageLabelGERALMUNDANCAS.revalidate();
this.ImageLabelGERALMUNDANCAS.repaint();
this.ImageLabelGERALMUNDANCAS = new JLabel(new ImageIcon("this.PathToData+"/Results/Outputs/P5/0.png",""));
this.ImageLabelGERALMUNDANCAS.repaint();
JPanel Aggregator = new JPanel();
Aggregator.add(this.ImageLabelGERALMUNDANCAS);
Aggregator.setBackground(this.color);
//this.Aggregatorr.add(this.ImageLabelGERALMUNDANCAS);
this.JPanel_TABGeral.remove(1);
this.JPanel_TABGeral.add(Aggregator,1);
this.JPanel_TABGeral.revalidate();
this.JPanel_TABGeral.repaint();
Aggregator.revalidate();
Aggregator.repaint();
}
the image loaded in the line this.ImageLabelGERALMUNDANCAS = new JLabel(new ImageIcon("this.PathToData+"/Results/Outputs/P5/0.png",""));
is created by a module called in the lines
//CALL MODULE 5
RunningLoop loop = null;
Thread t = new Thread
(
loop = new RunningLoop(50000,this.StringDBName,this.StringDBDriver,
this.StringDBUser,this.StringDBPass,this.PathToData,
sqlDateINICIO.toString(),
sqlDateFIM.toString(),
true)
);
t.start();
loop.StopLooping();
it seems to be all ok but it does not load the image.. If i try to load another image it works perfectly so i think the problem is the creation of the image in the thread.
Can somebody help me?
Ps: I'm still need to work in some code, currently i'm trying everything to get this work, then i'll worry about better code
Kind regards