Ajouter un commentaire

othmani

voici la classe qui me permet de récupérer la table:

public class gest_eq extends JFrame 
{
    private static final long serialVersionUID = 1L;
 
    private JPanel jContentPane = null;
    base b=new base();  //  @jve:decl-index=0:
 
    public gest_eq() {
        super();
        initialize();        
        Vector columnNames = new Vector();
        Vector data = new Vector(); 
        try
        {
          //  Connect to the Database 
          b.connexionBD();          
          //  Read data from a table
 
          String sql = "Select * from MaTable";
          Statement stmt = b.con.createStatement();
            
          ResultSet rs = stmt.executeQuery( sql );
          ResultSetMetaData md = rs.getMetaData();
          int columns = md.getColumnCount();
 
          //  Get column names
          for (int i = 1; i <= columns; i++)
            {
                columnNames.addElement( md.getColumnName(i) );
            }
 
            //  Get row data
            while (rs.next())
            {
                Vector row = new Vector(columns);
 
                for (int i = 1; i <= columns; i++)
                {
                    row.addElement( rs.getObject(i) );
                }
 
                data.addElement( row );
            }
 
            rs.close();
            stmt.close();
        }
        catch(Exception e) {System.out.println( e );}
 
        //  Create table with database data
 
        JTable table = new JTable(data, columnNames);
 
        JScrollPane scrollPane = new JScrollPane( table );
        getContentPane().add( scrollPane );
 
        JPanel buttonPanel = new JPanel();
        getContentPane().add( buttonPanel, BorderLayout.SOUTH );
    }
 
    private void initialize() 
    {
        this.setSize(300, 200);
        this.setContentPane(getJContentPane());
        this.setTitle("JFrame");
    }
 
    private JPanel getJContentPane() 
    {
        if (jContentPane == null) 
        {
            jContentPane = new JPanel();
            jContentPane.setLayout(new BorderLayout());
        }
        return jContentPane;
    }
     public static void main(String[] args)
        {
            gest_eq frame = new gest_eq();
            frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
            frame.pack();
            frame.setVisible(true);
        }
}  

[img]http://C:\imprime_ecran.jpeg[/img]
normalement en cliquant sur "Scanner" la table subit des modifications et donc elle doit etre affichée pour que l'utilisateur soit informé.
je veux l'afficher à droite;

Filtered HTML

Plain text

CAPTCHA
Cette question permet de vérifier que vous n'êtes pas un robot spammeur :-)
 L     L     V     V  EEEE  III 
L L V V E I
L L V V EEE I
L L V V E I
LLLL LLLL V EEEE III