-1
データベースからの値で動的ラベルを作成したいとします。データベースからの値で動的ラベルを作成したい
私は以下のコードを試しましたが、それは私のためには機能しませんでした。
public void Change (KeyEvent event) throws IOException {
String q="select * from Normal_report";
try {
pst=con.prepareStatement(q);
rs=pst.executeQuery();
while(rs.next()){
for (int i=0; i<10; i++){
Label ab=new Label();
Button btn=new Button();
vbox.getChildren().add(ab) ;
vbox.getChildren().add(btn) ;
}
ab.setText(rs.getString("test_id"));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}