I have a problem that when I load the buttons with the SQLite data when adding them to the panel with a While traversing the DB, I do not add them to them in the form of a vertical list, nor does it expand them to the size of the JPanel. contains, Even though I put what is necessary .. Can someone help me? If so, thank you in advance ..
Here's the While:
public void cargarBtnCustomers(){
try{
Connection miConexion = DriverManager.getConnection("jdbc:sqlite:customers_1.db");
Statement miStatement = miConexion.createStatement();
ResultSet miResultSet = miStatement.executeQuery("SELECT * FROM customers_1");
while(miResultSet.next()){
//pnlIns.add(new JButton(new PersonAction(new Person(miResultSet.getString("name"), miResultSet.getString("identification")))).setBackground(Color.yellow));
Person p = new Person(miResultSet.getString("name"),
miResultSet.getString("ruc"), miResultSet.getString("repLegal"),
miResultSet.getString("nombreContactoEmpresa"), miResultSet.getString("correoContactoEmpresa"),
miResultSet.getString("numeroContacto"), miResultSet.getString("cedulaRepLegal"),
miResultSet.getString("avisoOperaciones"), miResultSet.getString("nit"),
miResultSet.getString("noContribuyenteMuniPa"), miResultSet.getString("contraMuniPa"),
miResultSet.getString("obligacionFiscal"));
// create a PersonAction with the recently created person as parameter
PersonAction pa = new PersonAction(p);
// create the JButton passing the PersonAction as parameter
myBtn jb = new myBtn(pa);
// set the background of the JButton
jb.setText(miResultSet.getString("name"));
//DESDE AQUI EMPIEZAN MIS PROBLEMAS
GridBagConstraints c = new GridBagConstraints();
iterador++;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 2.0;
c.weighty = 2.0;
c.ipadx = 930;
//c.gridwidth = 3;
c.anchor = GridBagConstraints.LINE_START;
//c.insets = new Insets(0,5,0,5);
c.gridx = iterador;
c.gridy = 1;
pnlClientes.add(jb, c);
pnlClientes.revalidate();
pnlClientes.repaint();
c = new GridBagConstraints();
}
}catch(Exception e){
System.out.println(e);
}
}