我正在为此创建按钮,当我单击他时.. 没有发生任何事情...当我单击 btn 时,没有调用函数 btnActionPerformed ...如何使其工作?
private void btButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here
int[] ret = new int[SQL.freetables().size()];
Iterator<Integer> iterator = SQL.freetables().iterator();
for (int i = 0; i < ret.length; i++)
{
ret[i] = iterator.next().intValue();
int num=SQL.freetables().size() + 1;
this.btn = new JButton();
this.btn.setText("" + ret[i]);
this.btn.setSize(60,20);
int x = 100+(80*i);
this.btn.setLocation(x, 140);
this.btn.setVisible(true);
this.add(btn);
// }
}
this.revalidate();
this.repaint();
}
private void btnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.out.print("\b Test: " + btn.getText());
}