Serialcek said:
WindDC for the example that I did this solution works great:
removeAll();
initComponents();
But for my true problem where I have threads for example it doesn't work properly. If you have any other idea in this way in would be great :)
Norm the code is more than 300 lines because it's done in Netbeans and Netbeans generate a lot of (not significant to understand the problem) code .
To understand the problem what I'm trying to do is my example good enough.
For the missing package you have to put in Eclipse in build path/external archives this two files:
[ATTACH]4527[/ATTACH]
[ATTACH]4528[/ATTACH]
Make sure that the removeAll and initcomponents is called on the right class.
If, for example, the card was in "Druga_stran" and not in "Prva_Stran" (where the refresh button is). Then I would need to do the removeall and initcomponents on the Prva_Stran instance.
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
druga_stran.removeAll();
druga_stran.initComponents();
}
You need a druga_stran instance for that:
public class Prva_Stran extends javax.swing.JPanel {
private Druga_stran druga_stran;
/** Creates new form Prva_Stran */
public Prva_Stran(Druga_stran druga_stran) {
this.druga_stran = druga_stran;
initComponents();
}
MainFrame's initcomponents:
druga_stran1 = new layers.Druga_stran();
prva_Stran1 = new layers.Prva_Stran(druga_stran1);
Druga_stran initcomponents must be public then:
public void initComponents() {
These are the required changes if the card is in fact not in the same class as the refresh button.