Skip to main content

JTable in NetBeans

1 reply [Last post]
bigbob1000
Offline
Joined: 2010-09-10

I'm a learning to use Netbeans to make a desktop Data Table. I have the following issue. As long as I do not have more then 1000 line entries I do not get any errors. If I have more then 1000 line entries, I get the following error code when I press the refresh button.

Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 9749, Size: 8359

Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 16310, Size: 670

The index and size size varies depending where I high lite the table before I do refresh. As I mentioned, if I have less then 1000 entries in the table I do not get this error. Only once I exceed 1000 line entries. Any ideas?

The following is more information on the program.
1. Java Utility Code
Problem: The following exception is thrown for when the 'Refresh' key is pressed. This failure occurs only for large data tables, say over 16000 records from MySql. Small tables work fine without error with the same generated code.

Other functions, 'Add', 'Delete' work fine and refresh correctly.

The application was generated with the standard Netbeans 6.9 Java Database application template.

This error is repeatable on more than one computer running Netbeans 6.9.1.

This is the offending code from the java.util library.

private void RangeCheck(int index) {
if (index >= size)
throw new IndexOutOfBoundsException(
"Index: "+index+", Size: "+size);

note: at the point this code fires, the variable 'index' = 16341 and
'size' = 3270.

'index' is equal to the number of the record in the database that is being displayed in the jTable at the time that the 'refresh' key is pressed and this number is correct for the database in use.

It is not clear why 'size' = 3270. Different numbers are returned for 'size' each time the program is run.

2.Java Source Code
/*
* Member5View.java
*/

package member5;

import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import org.jdesktop.application.Task;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.RollbackException;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.jdesktop.beansbinding.AbstractBindingListener;
import org.jdesktop.beansbinding.Binding;
import org.jdesktop.beansbinding.PropertyStateEvent;

/**
* The application's main frame.
*/
public class Member5View extends FrameView {

public Member5View(SingleFrameApplication app) {
super(app);

initComponents();

// status bar initialization - message timeout, idle icon and busy animation, etc
ResourceMap resourceMap = getResourceMap();
int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
messageTimer = new Timer(messageTimeout, new ActionListener() {
public void actionPerformed(ActionEvent e) {
statusMessageLabel.setText("");
}
});
messageTimer.setRepeats(false);
int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
for (int i = 0; i < busyIcons.length; i++) {
busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
}
busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
public void actionPerformed(ActionEvent e) {
busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
}
});
idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
statusAnimationLabel.setIcon(idleIcon);
progressBar.setVisible(false);

// connecting action tasks to status bar via TaskMonitor
TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
if ("started".equals(propertyName)) {
if (!busyIconTimer.isRunning()) {
statusAnimationLabel.setIcon(busyIcons[0]);
busyIconIndex = 0;
busyIconTimer.start();
}
progressBar.setVisible(true);
progressBar.setIndeterminate(true);
} else if ("done".equals(propertyName)) {
busyIconTimer.stop();
statusAnimationLabel.setIcon(idleIcon);
progressBar.setVisible(false);
progressBar.setValue(0);
} else if ("message".equals(propertyName)) {
String text = (String)(evt.getNewValue());
statusMessageLabel.setText((text == null) ? "" : text);
messageTimer.restart();
} else if ("progress".equals(propertyName)) {
int value = (Integer)(evt.getNewValue());
progressBar.setVisible(true);
progressBar.setIndeterminate(false);
progressBar.setValue(value);
}
}
});

// tracking table selection
masterTable.getSelectionModel().addListSelectionListener(
new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
firePropertyChange("recordSelected", !isRecordSelected(), isRecordSelected());
}
});

// tracking changes to save
bindingGroup.addBindingListener(new AbstractBindingListener() {
@Override
public void targetChanged(Binding binding, PropertyStateEvent event) {
// save action observes saveNeeded property
setSaveNeeded(true);
}
});

// have a transaction started
entityManager.getTransaction().begin();
}

public boolean isSaveNeeded() {
return saveNeeded;
}

private void setSaveNeeded(boolean saveNeeded) {
if (saveNeeded != this.saveNeeded) {
this.saveNeeded = saveNeeded;
firePropertyChange("saveNeeded", !saveNeeded, saveNeeded);
}
}

public boolean isRecordSelected() {
return masterTable.getSelectedRow() != -1;
}

@Action
public void newRecord() {
member5.Member1 m = new member5.Member1();
entityManager.persist(m);
list.add(m);
int row = list.size()-1;
masterTable.setRowSelectionInterval(row, row);
masterTable.scrollRectToVisible(masterTable.getCellRect(row, 0, true));
setSaveNeeded(true);
}

@Action(enabledProperty = "recordSelected")
public void deleteRecord() {
int[] selected = masterTable.getSelectedRows();
List toRemove = new ArrayList(selected.length);
for (int idx=0; idx merged = new ArrayList(list.size());
for (member5.Member1 m : list) {
merged.add(entityManager.merge(m));
}
list.clear();
list.addAll(merged);
}
return null;
}
@Override protected void finished() {
setSaveNeeded(false);
}
}

/**
* An example action method showing how to create asynchronous tasks
* (running on background) and how to show their progress. Note the
* artificial 'Thread.sleep' calls making the task long enough to see the
* progress visualization - remove the sleeps for real application.
*/
@Action
public Task refresh() {
return new RefreshTask(getApplication());
}

private class RefreshTask extends Task {
RefreshTask(org.jdesktop.application.Application app) {
super(app);
}
@SuppressWarnings("unchecked")
@Override protected Void doInBackground() {
try {
setProgress(0, 0, 4);
setMessage("Rolling back the current changes...");
setProgress(1, 0, 4);
entityManager.getTransaction().rollback();
Thread.sleep(1000L); // remove for real app
setProgress(2, 0, 4);

setMessage("Starting a new transaction...");
entityManager.getTransaction().begin();
Thread.sleep(500L); // remove for real app
setProgress(3, 0, 4);

setMessage("Fetching new data...");
java.util.Collection data = query.getResultList();
for (Object entity : data) {
entityManager.refresh(entity);
}
Thread.sleep(1300L); // remove for real app
setProgress(4, 0, 4);

Thread.sleep(150L); // remove for real app
list.clear();
list.addAll(data);
} catch(InterruptedException ignore) { }
return null;
}
@Override protected void finished() {
setMessage("Done.");
setSaveNeeded(false);
}
}

@Action
public void showAboutBox() {
if (aboutBox == null) {
JFrame mainFrame = Member5App.getApplication().getMainFrame();
aboutBox = new Member5AboutBox(mainFrame);
aboutBox.setLocationRelativeTo(mainFrame);
}
Member5App.getApplication().show(aboutBox);
}

/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
//
private void initComponents() {
bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

mainPanel = new javax.swing.JPanel();
masterScrollPane = new javax.swing.JScrollPane();
masterTable = new javax.swing.JTable();
memberNoLabel = new javax.swing.JLabel();
titleLabel = new javax.swing.JLabel();
saluteLabel = new javax.swing.JLabel();
frstNameLabel = new javax.swing.JLabel();
middleLabel = new javax.swing.JLabel();
lastNameLabel = new javax.swing.JLabel();
suffixLabel = new javax.swing.JLabel();
addressLabel = new javax.swing.JLabel();
cityLabel = new javax.swing.JLabel();
stateLabel = new javax.swing.JLabel();
zipLabel = new javax.swing.JLabel();
phoneLabel = new javax.swing.JLabel();
memberNoField = new javax.swing.JTextField();
titleField = new javax.swing.JTextField();
saluteField = new javax.swing.JTextField();
frstNameField = new javax.swing.JTextField();
middleField = new javax.swing.JTextField();
lastNameField = new javax.swing.JTextField();
suffixField = new javax.swing.JTextField();
addressField = new javax.swing.JTextField();
cityField = new javax.swing.JTextField();
stateField = new javax.swing.JTextField();
zipField = new javax.swing.JTextField();
phoneField = new javax.swing.JTextField();
saveButton = new javax.swing.JButton();
refreshButton = new javax.swing.JButton();
newButton = new javax.swing.JButton();
deleteButton = new javax.swing.JButton();
menuBar = new javax.swing.JMenuBar();
javax.swing.JMenu fileMenu = new javax.swing.JMenu();
javax.swing.JMenuItem newRecordMenuItem = new javax.swing.JMenuItem();
javax.swing.JMenuItem deleteRecordMenuItem = new javax.swing.JMenuItem();
jSeparator1 = new javax.swing.JSeparator();
javax.swing.JMenuItem saveMenuItem = new javax.swing.JMenuItem();
javax.swing.JMenuItem refreshMenuItem = new javax.swing.JMenuItem();
jSeparator2 = new javax.swing.JSeparator();
javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
javax.swing.JMenu helpMenu = new javax.swing.JMenu();
javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
statusPanel = new javax.swing.JPanel();
javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
statusMessageLabel = new javax.swing.JLabel();
statusAnimationLabel = new javax.swing.JLabel();
progressBar = new javax.swing.JProgressBar();
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(member5.Member5App.class).getContext().getResourceMap(Member5View.class);
entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory(resourceMap.getString("entityManager.persistenceUnit")).createEntityManager(); // NOI18N
query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery(resourceMap.getString("query.query")); // NOI18N
list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(query.getResultList());

mainPanel.setName("mainPanel"); // NOI18N

masterScrollPane.setName("masterScrollPane"); // NOI18N

masterTable.setName("masterTable"); // NOI18N

org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list, masterTable);
org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${memberNo}"));
columnBinding.setColumnName("Member No");
columnBinding.setColumnClass(Long.class);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${title}"));
columnBinding.setColumnName("Title");
columnBinding.setColumnClass(String.class);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${salute}"));
columnBinding.setColumnName("Salute");
columnBinding.setColumnClass(String.class);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${frstName}"));
columnBinding.setColumnName("Frst Name");
columnBinding.setColumnClass(String.class);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${middle}"));
columnBinding.setColumnName("Middle");
columnBinding.setColumnClass(String.class);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${lastName}"));
columnBinding.setColumnName("Last Name");
columnBinding.setColumnClass(String.class);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${suffix}"));
columnBinding.setColumnName("Suffix");
columnBinding.setColumnClass(String.class);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${address}"));
columnBinding.setColumnName("Address");
columnBinding.setColumnClass(String.class);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${city}"));
columnBinding.setColumnName("City");
columnBinding.setColumnClass(String.class);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${state}"));
columnBinding.setColumnName("State");
columnBinding.setColumnClass(String.class);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${zip}"));
columnBinding.setColumnName("Zip");
columnBinding.setColumnClass(String.class);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${phone}"));
columnBinding.setColumnName("Phone");
columnBinding.setColumnClass(String.class);
bindingGroup.addBinding(jTableBinding);

masterScrollPane.setViewportView(masterTable);

memberNoLabel.setText(resourceMap.getString("memberNoLabel.text")); // NOI18N
memberNoLabel.setName("memberNoLabel"); // NOI18N

titleLabel.setText(resourceMap.getString("titleLabel.text")); // NOI18N
titleLabel.setName("titleLabel"); // NOI18N

saluteLabel.setText(resourceMap.getString("saluteLabel.text")); // NOI18N
saluteLabel.setName("saluteLabel"); // NOI18N

frstNameLabel.setText(resourceMap.getString("frstNameLabel.text")); // NOI18N
frstNameLabel.setName("frstNameLabel"); // NOI18N

middleLabel.setText(resourceMap.getString("middleLabel.text")); // NOI18N
middleLabel.setName("middleLabel"); // NOI18N

lastNameLabel.setText(resourceMap.getString("lastNameLabel.text")); // NOI18N
lastNameLabel.setName("lastNameLabel"); // NOI18N

suffixLabel.setText(resourceMap.getString("suffixLabel.text")); // NOI18N
suffixLabel.setName("suffixLabel"); // NOI18N

addressLabel.setText(resourceMap.getString("addressLabel.text")); // NOI18N
addressLabel.setName("addressLabel"); // NOI18N

cityLabel.setText(resourceMap.getString("cityLabel.text")); // NOI18N
cityLabel.setName("cityLabel"); // NOI18N

stateLabel.setText(resourceMap.getString("stateLabel.text")); // NOI18N
stateLabel.setName("stateLabel"); // NOI18N

zipLabel.setText(resourceMap.getString("zipLabel.text")); // NOI18N
zipLabel.setName("zipLabel"); // NOI18N

phoneLabel.setText(resourceMap.getString("phoneLabel.text")); // NOI18N
phoneLabel.setName("phoneLabel"); // NOI18N

memberNoField.setName("memberNoField"); // NOI18N

org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.memberNo}"), memberNoField, org.jdesktop.beansbinding.BeanProperty.create("text"));
binding.setSourceUnreadableValue(null);
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), memberNoField, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

titleField.setName("titleField"); // NOI18N

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.title}"), titleField, org.jdesktop.beansbinding.BeanProperty.create("text"));
binding.setSourceUnreadableValue(null);
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), titleField, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

saluteField.setName("saluteField"); // NOI18N

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.salute}"), saluteField, org.jdesktop.beansbinding.BeanProperty.create("text"));
binding.setSourceUnreadableValue(null);
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), saluteField, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

frstNameField.setName("frstNameField"); // NOI18N

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.frstName}"), frstNameField, org.jdesktop.beansbinding.BeanProperty.create("text"));
binding.setSourceUnreadableValue(null);
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), frstNameField, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

middleField.setName("middleField"); // NOI18N

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.middle}"), middleField, org.jdesktop.beansbinding.BeanProperty.create("text"));
binding.setSourceUnreadableValue(null);
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), middleField, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

lastNameField.setName("lastNameField"); // NOI18N

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.lastName}"), lastNameField, org.jdesktop.beansbinding.BeanProperty.create("text"));
binding.setSourceUnreadableValue(null);
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), lastNameField, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

suffixField.setName("suffixField"); // NOI18N

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.suffix}"), suffixField, org.jdesktop.beansbinding.BeanProperty.create("text"));
binding.setSourceUnreadableValue(null);
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), suffixField, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

addressField.setName("addressField"); // NOI18N

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.address}"), addressField, org.jdesktop.beansbinding.BeanProperty.create("text"));
binding.setSourceUnreadableValue(null);
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), addressField, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

cityField.setName("cityField"); // NOI18N

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.city}"), cityField, org.jdesktop.beansbinding.BeanProperty.create("text"));
binding.setSourceUnreadableValue(null);
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), cityField, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

stateField.setName("stateField"); // NOI18N

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.state}"), stateField, org.jdesktop.beansbinding.BeanProperty.create("text"));
binding.setSourceUnreadableValue(null);
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), stateField, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

zipField.setName("zipField"); // NOI18N

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.zip}"), zipField, org.jdesktop.beansbinding.BeanProperty.create("text"));
binding.setSourceUnreadableValue(null);
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), zipField, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

phoneField.setName("phoneField"); // NOI18N

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.phone}"), phoneField, org.jdesktop.beansbinding.BeanProperty.create("text"));
binding.setSourceUnreadableValue(null);
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), phoneField, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(member5.Member5App.class).getContext().getActionMap(Member5View.class, this);
saveButton.setAction(actionMap.get("save")); // NOI18N
saveButton.setName("saveButton"); // NOI18N

refreshButton.setAction(actionMap.get("refresh")); // NOI18N
refreshButton.setName("refreshButton"); // NOI18N

newButton.setAction(actionMap.get("newRecord")); // NOI18N
newButton.setName("newButton"); // NOI18N

deleteButton.setAction(actionMap.get("deleteRecord")); // NOI18N
deleteButton.setName("deleteButton"); // NOI18N

javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(masterScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 427, Short.MAX_VALUE))
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(newButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deleteButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(refreshButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(saveButton))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(memberNoLabel)
.addComponent(titleLabel)
.addComponent(saluteLabel)
.addComponent(frstNameLabel)
.addComponent(middleLabel)
.addComponent(lastNameLabel)
.addComponent(suffixLabel)
.addComponent(addressLabel)
.addComponent(cityLabel)
.addComponent(stateLabel)
.addComponent(zipLabel)
.addComponent(phoneLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(memberNoField, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
.addComponent(titleField, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
.addComponent(saluteField, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
.addComponent(frstNameField, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
.addComponent(middleField, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
.addComponent(lastNameField, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
.addComponent(suffixField, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
.addComponent(addressField, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
.addComponent(cityField, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
.addComponent(stateField, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
.addComponent(zipField, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
.addComponent(phoneField, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE))))
.addContainerGap())
);

mainPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteButton, newButton, refreshButton, saveButton});

mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(masterScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(memberNoLabel)
.addComponent(memberNoField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(titleLabel)
.addComponent(titleField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(saluteLabel)
.addComponent(saluteField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(frstNameLabel)
.addComponent(frstNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(middleLabel)
.addComponent(middleField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lastNameLabel)
.addComponent(lastNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(suffixLabel)
.addComponent(suffixField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(addressLabel)
.addComponent(addressField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cityLabel)
.addComponent(cityField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(stateLabel)
.addComponent(stateField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(zipLabel)
.addComponent(zipField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(phoneLabel)
.addComponent(phoneField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(saveButton)
.addComponent(refreshButton)
.addComponent(deleteButton)
.addComponent(newButton))
.addContainerGap())
);

menuBar.setName("menuBar"); // NOI18N

fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
fileMenu.setName("fileMenu"); // NOI18N

newRecordMenuItem.setAction(actionMap.get("newRecord")); // NOI18N
newRecordMenuItem.setName("newRecordMenuItem"); // NOI18N
fileMenu.add(newRecordMenuItem);

deleteRecordMenuItem.setAction(actionMap.get("deleteRecord")); // NOI18N
deleteRecordMenuItem.setName("deleteRecordMenuItem"); // NOI18N
fileMenu.add(deleteRecordMenuItem);

jSeparator1.setName("jSeparator1"); // NOI18N
fileMenu.add(jSeparator1);

saveMenuItem.setAction(actionMap.get("save")); // NOI18N
saveMenuItem.setName("saveMenuItem"); // NOI18N
fileMenu.add(saveMenuItem);

refreshMenuItem.setAction(actionMap.get("refresh")); // NOI18N
refreshMenuItem.setName("refreshMenuItem"); // NOI18N
fileMenu.add(refreshMenuItem);

jSeparator2.setName("jSeparator2"); // NOI18N
fileMenu.add(jSeparator2);

exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
exitMenuItem.setName("exitMenuItem"); // NOI18N
fileMenu.add(exitMenuItem);

menuBar.add(fileMenu);

helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
helpMenu.setName("helpMenu"); // NOI18N

aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
aboutMenuItem.setName("aboutMenuItem"); // NOI18N
helpMenu.add(aboutMenuItem);

menuBar.add(helpMenu);

statusPanel.setName("statusPanel"); // NOI18N

statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

statusMessageLabel.setName("statusMessageLabel"); // NOI18N

statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

progressBar.setName("progressBar"); // NOI18N

javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
statusPanel.setLayout(statusPanelLayout);
statusPanelLayout.setHorizontalGroup(
statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 447, Short.MAX_VALUE)
.addGroup(statusPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(statusMessageLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 277, Short.MAX_VALUE)
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(statusAnimationLabel)
.addContainerGap())
);
statusPanelLayout.setVerticalGroup(
statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(statusPanelLayout.createSequentialGroup()
.addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(statusMessageLabel)
.addComponent(statusAnimationLabel)
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(3, 3, 3))
);

setComponent(mainPanel);
setMenuBar(menuBar);
setStatusBar(statusPanel);

bindingGroup.bind();
}//

// Variables declaration - do not modify
private javax.swing.JTextField addressField;
private javax.swing.JLabel addressLabel;
private javax.swing.JTextField cityField;
private javax.swing.JLabel cityLabel;
private javax.swing.JButton deleteButton;
private javax.persistence.EntityManager entityManager;
private javax.swing.JTextField frstNameField;
private javax.swing.JLabel frstNameLabel;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JTextField lastNameField;
private javax.swing.JLabel lastNameLabel;
private java.util.List list;
private javax.swing.JPanel mainPanel;
private javax.swing.JScrollPane masterScrollPane;
private javax.swing.JTable masterTable;
private javax.swing.JTextField memberNoField;
private javax.swing.JLabel memberNoLabel;
private javax.swing.JMenuBar menuBar;
private javax.swing.JTextField middleField;
private javax.swing.JLabel middleLabel;
private javax.swing.JButton newButton;
private javax.swing.JTextField phoneField;
private javax.swing.JLabel phoneLabel;
private javax.swing.JProgressBar progressBar;
private javax.persistence.Query query;
private javax.swing.JButton refreshButton;
private javax.swing.JTextField saluteField;
private javax.swing.JLabel saluteLabel;
private javax.swing.JButton saveButton;
private javax.swing.JTextField stateField;
private javax.swing.JLabel stateLabel;
private javax.swing.JLabel statusAnimationLabel;
private javax.swing.JLabel statusMessageLabel;
private javax.swing.JPanel statusPanel;
private javax.swing.JTextField suffixField;
private javax.swing.JLabel suffixLabel;
private javax.swing.JTextField titleField;
private javax.swing.JLabel titleLabel;
private javax.swing.JTextField zipField;
private javax.swing.JLabel zipLabel;
private org.jdesktop.beansbinding.BindingGroup bindingGroup;
// End of variables declaration

private final Timer messageTimer;
private final Timer busyIconTimer;
private final Icon idleIcon;
private final Icon[] busyIcons = new Icon[15];
private int busyIconIndex = 0;

private JDialog aboutBox;

private boolean saveNeeded;
}
3. Java Run time txt
run:
[TopLink Info]: 2010.08.20 02:23:08.555--ServerSession(15628820)--TopLink, version: Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))
[TopLink Info]: 2010.08.20 02:23:08.976--ServerSession(15628820)--file:/C:/Users/Mike/Documents/NetBeansProjects/Member5/build/classes/-POFPU login successful
Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 16341, Size: 3270
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.jdesktop.swingbinding.impl.ListBindingManager$ColumnDescriptionManager.validateBinding(ListBindingManager.java:191)
at org.jdesktop.swingbinding.impl.ListBindingManager.valueAt(ListBindingManager.java:99)
at org.jdesktop.swingbinding.JTableBinding$BindingTableModel.getValueAt(JTableBinding.java:713)
at javax.swing.JTable.getValueAt(JTable.java:2695)
at javax.swing.JTable.prepareRenderer(JTable.java:5712)
at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2069)
at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1971)
at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1767)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:143)
at javax.swing.JComponent.paintComponent(JComponent.java:751)
at javax.swing.JComponent.paint(JComponent.java:1017)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5112)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1475)
at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1406)
at javax.swing.RepaintManager.paint(RepaintManager.java:1220)
at javax.swing.JComponent._paintImmediately(JComponent.java:5060)
at javax.swing.JComponent.paintImmediately(JComponent.java:4870)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:803)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:714)
at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:694)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:125)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Message was edited by: bigbob1000

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
walterln
Offline
Joined: 2007-04-17

Most likely you are not updating your model on the EDT. Search on java swing concurrency for details.