witam,
na początek kawałek kodu:
private void buttonSearchActionPerformed(java.awt.event.ActionEvent evt) {
String searchText = searchField.getText();
if(searchText.isEmpty()) {
JOptionPane.showMessageDialog(null, "Musisz wpisać jakąś wartość.", "Błąd!", JOptionPane.ERROR_MESSAGE);
}else {
List<NazwyKomputerow> result = findVairables(searchText);
for (NazwyKomputerow resultElement : result) {
jTable1.setValueAt(a[i],i,0);
String imie = resultElement.getImie();
String nazwisko = resultElement.getNazwisko();
}
}
private List<NazwyKomputerow> findVairables(String searchText) {
Query query = entityManager1.createNamedQuery("NazwyKomputerow.findByAllVariables");
query.setParameter(1, searchText);
try {
return query.getResultList();
} catch (NoResultException e) {
JOptionPane.showMessageDialog(null, e.getMessage(), "Bład!", JOptionPane.ERROR_MESSAGE);
return null;
}
}
Zastanawiam się jak wepchnąć dane generowane przez for w Evencie do jTable. Może ktoś rzuci mi kawałkiem kodu bądź też nakieruje moje procesy myślowe w odpowiednią stronę.