I can´t scroll my jtable although i have a scrollpane

66 Views Asked by At

what could be the reason that i cant scroll down my jtable? .. i also have a scrollPane.

i can see my table filled with data from the database, but i cant click on any row or scroll down or up why?

CONTROLLER

public void controllActionListenerShowEquipmentTable() {
    main.setActionListenerShowEquipmentTable(new ActionListener(){
        @Override
        public void actionPerformed(ActionEvent action) {
            if(action.getSource()== main.getShowEquipmentTable()){
                equ = new EquipmentDAO();
                try {
                    ResultSet re = equ.show();
                    main.showEquipmentTable(re);
                    main.showPanel("8");
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }   
        }
    });
}

MAIN

public void showEquipmentTable(ResultSet res){
    table = new JTable();
    scrollPane = new JScrollPane();
    scrollPane.setBounds(10,84,645,402);
    scrollPane.setBackground(new Color (0,0,0,50));
    showEquipment.add(scrollPane);
    scrollPane.setViewportView(table);
    table.setModel(DbUtils.resultSetToTableModel(res));
}

EQUIPMENT DAO CLASS IMPLEMENTS DAOINTERFACE

public class EquipmentDAO implements DaoInterface{

private Connection con;
private java.sql.PreparedStatement sta;
private Statement std;
private ResultSet res;
private DatabaseHandler handle;
private String query;

@Override
public ResultSet show() throws SQLException{
    handle = new DatabaseHandler();
    Connection con = handle.buildConnectionToServer();
    String query = "select EID as ID, EquipmentName as Name, EquipmentSection as Section, EquipmentType as Type, EquipmentValue as Value, EquipmentAmount as Amount from Equipment";
    sta = con.prepareStatement(query);
    res = sta.executeQuery(query);
    return res;
}
0

There are 0 best solutions below