Bonjour à tous,
J'ai un probleme pour afficher une Jtable sur plusieurs JPanel.
En résumé.
JPanel PrintTab
JPanel Mod_database
JPanel Mod_stock
JFrame Ma_Main
Dans "Ma_Main" j'ai des JMenu et quand je clique sur un des menus il m'affiche soit Mod_database soit Mod_stock.
Mod_database contient PrintTab
Mod_stock contient PrintTab
public class PrintTab extends JPanel{
public static JFileChooser dialogue = new JFileChooser(".");
public static PrintWriter ecrivain = null;
public static File fichier= null;
public static String VERSION = "0.0.4";
public static String nomFichier = "";
public static DataFileTableModel model;
public static JTable table = new JTable();
public PrintTab(){
this.setLayout(new BorderLayout());
JScrollPane scrollpane=new JScrollPane(table);
this.add(scrollpane,BorderLayout.CENTER);
this.setBackground(Color.BLUE);
}
}
Dans JFrame /* ce n'est pas tout le code*/
public class Ma_Main extends JFrame
{
Mod_database mod_database = new Mod_database();
Mod_stock mod_stock = new Mod_stock();
public Ma_Main(String title){
this.getContentPane().add(mod_database); mod_database.setVisible(false);
this.getContentPane().add(mod_stock); mod_stock.setVisible(false);
}
}
Le probleme est que quand je vais dans le menu et que je choisis mod_database il affiche bien le JPanel avec la JTable mais quand je vais dans mod_stock il affiche le JPanel mais n'affiche rien dans la JTable. Et Quand je tape
Mod_stock mod_stock = new Mod_stock();
Mod_database mod_database = new Mod_database();
c'est stock qui s'affiche bien et database n'affiche rien ...
Quelqu'un a une solution ?
Merci pour votre aide :)
DOS-chkdsk-2K6