Skip to main content

JTable problem

No replies
Joined: 2010-07-16


I'm new here, I don't know if this is the correct place to post this. I have a problem with showing data in JTable, and I'm using Netbeans 6.8. I have a little application where a user can store events in a specified genre. (no database, just write it in a file). So when it starts its showing a JCombobox with all the types of genres, and it’s the goal to show the events related to that genre in a JTable when it starts. And off course buttons to add new events, but that already works fine.
I’ve writed a method “toonEvenementen” to try to show the events of the selected item of the JCombobox. I get the the good results, tested it with System.out.println.
But the problem I have is that I end up in a never ending loop, I that’s the part where it goes wrong. I don’t understand it, it has to stop when it he has run over all the events of that type of genre, but he doesn’t. It’s the second line of the for loop that brings the error.
I’ve put here my code for that specific method. I hope someone could help me. Thanks!

public class Hoofdscherm extends javax.swing.JFrame {

public void toonEvenementen(){
ArrayList evenementenLijst = new ArrayList();
String geselecteerdGenre = (String)cmbxGenres.getSelectedItem();
Genre g = o.getGenre(geselecteerdGenre);

try {
catch (Exception e){
System.out.println("Er kunnen geen evenementen opgehaald worden, tabel blijft leeg");
for (int i=0; i evenementen;
String[] columnNames = {"Plaats","Evenement","Datum","Prijs" };

public void voegEvenementToe(String pl, String e, String d, double pr) {
Evenement evenement = new Evenement(pl, e, d, pr);

public int getRowCount() {
if (evenementen == null) {
return 0;
else {
return evenementen.size();

public int getColumnCount() {
return columnNames.length;

public String getColumnName(int column) {
return columnNames[column];

public Object getValueAt(int rowOndex, int columnIndex) {
String terugkeerWaarde = null;
switch(columnIndex) {
case 0: terugkeerWaarde = " "+((evenementen.get(rowOndex))).getPlaats();
case 1: terugkeerWaarde = " "+((evenementen.get(rowOndex))).getEvenement();
case 2: terugkeerWaarde = " "+((evenementen.get(rowOndex))).getDatum();
case 3: terugkeerWaarde = " "+((evenementen.get(rowOndex))).getPrijs();
return terugkeerWaarde;