List of usage examples for javax.swing ListSelectionModel SINGLE_SELECTION
int SINGLE_SELECTION
To view the source code for javax.swing ListSelectionModel SINGLE_SELECTION.
Click Source Link
From source file:TableFilterDemo.java
public TableFilterDemo() { super();//from ww w. j ava 2 s .com setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // Create a table with a sorter. MyTableModel model = new MyTableModel(); sorter = new TableRowSorter<MyTableModel>(model); table = new JTable(model); table.setRowSorter(sorter); table.setPreferredScrollableViewportSize(new Dimension(500, 70)); table.setFillsViewportHeight(true); // For the purposes of this example, better to have a single // selection. table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // When selection changes, provide user with row numbers for // both view and model. table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { int viewRow = table.getSelectedRow(); if (viewRow < 0) { // Selection got filtered away. statusText.setText(""); } else { int modelRow = table.convertRowIndexToModel(viewRow); statusText.setText(String.format("Selected Row in view: %d. " + "Selected Row in model: %d.", viewRow, modelRow)); } } }); // Create the scroll pane and add the table to it. JScrollPane scrollPane = new JScrollPane(table); // Add the scroll pane to this panel. add(scrollPane); // Create a separate form for filterText and statusText JPanel form = new JPanel(new SpringLayout()); JLabel l1 = new JLabel("Filter Text:", SwingConstants.TRAILING); form.add(l1); filterText = new JTextField(); // Whenever filterText changes, invoke newFilter. filterText.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { newFilter(); } public void insertUpdate(DocumentEvent e) { newFilter(); } public void removeUpdate(DocumentEvent e) { newFilter(); } }); l1.setLabelFor(filterText); form.add(filterText); JLabel l2 = new JLabel("Status:", SwingConstants.TRAILING); form.add(l2); statusText = new JTextField(); l2.setLabelFor(statusText); form.add(statusText); SpringUtilities.makeCompactGrid(form, 2, 2, 6, 6, 6, 6); add(form); }
From source file:logdruid.ui.table.EventRecordingEditorTable.java
/** * @wbp.parser.constructor//w ww. ja v a 2 s. c o m */ @SuppressWarnings("unchecked") public EventRecordingEditorTable(JTextPane textPane) { super(new GridLayout(1, 0)); model = new MyTableModel(data, header); table = new JTable(model); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setFont(new Font("SansSerif", Font.PLAIN, 11)); // table.setPreferredScrollableViewportSize(new Dimension(500, 200)); table.setPreferredScrollableViewportSize(table.getPreferredSize()); table.setFillsViewportHeight(true); this.theLine = textPane.getText(); this.examplePane = textPane; // Create the scroll pane and add the table to it. JScrollPane scrollPane = new JScrollPane(table); // Set up column sizes. initColumnSizes(table); // Fiddle with the type and processing column's cell editors/renderers. setUpTypeColumn(table, table.getColumnModel().getColumn(2)); setUpProcessingColumn(table, table.getColumnModel().getColumn(3)); // Add the scroll pane to this panel. add(scrollPane); Add(); FixValues(); }
From source file:ListSelectionDemo.java
public ListSelectionDemo() { super(new BorderLayout()); String[] listData = { "one", "two", "three", "four", "five", "six", "seven" }; String[] columnNames = { "French", "Spanish", "Italian" }; list = new JList(listData); listSelectionModel = list.getSelectionModel(); listSelectionModel.addListSelectionListener(new SharedListSelectionHandler()); JScrollPane listPane = new JScrollPane(list); JPanel controlPane = new JPanel(); String[] modes = { "SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION", "MULTIPLE_INTERVAL_SELECTION" }; final JComboBox comboBox = new JComboBox(modes); comboBox.setSelectedIndex(2);/*from ww w . jav a 2 s . c o m*/ comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String newMode = (String) comboBox.getSelectedItem(); if (newMode.equals("SINGLE_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } else if (newMode.equals("SINGLE_INTERVAL_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); } else { listSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); } output.append("----------" + "Mode: " + newMode + "----------" + newline); } }); controlPane.add(new JLabel("Selection mode:")); controlPane.add(comboBox); // Build output area. output = new JTextArea(1, 10); output.setEditable(false); JScrollPane outputPane = new JScrollPane(output, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); // Do the layout. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); add(splitPane, BorderLayout.CENTER); JPanel topHalf = new JPanel(); topHalf.setLayout(new BoxLayout(topHalf, BoxLayout.LINE_AXIS)); JPanel listContainer = new JPanel(new GridLayout(1, 1)); listContainer.setBorder(BorderFactory.createTitledBorder("List")); listContainer.add(listPane); topHalf.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); topHalf.add(listContainer); // topHalf.add(tableContainer); topHalf.setMinimumSize(new Dimension(100, 50)); topHalf.setPreferredSize(new Dimension(100, 110)); splitPane.add(topHalf); JPanel bottomHalf = new JPanel(new BorderLayout()); bottomHalf.add(controlPane, BorderLayout.PAGE_START); bottomHalf.add(outputPane, BorderLayout.CENTER); // XXX: next line needed if bottomHalf is a scroll pane: // bottomHalf.setMinimumSize(new Dimension(400, 50)); bottomHalf.setPreferredSize(new Dimension(450, 135)); splitPane.add(bottomHalf); }
From source file:SimpleTableSelectionDemo.java
public SimpleTableSelectionDemo() { super(new GridLayout(1, 0)); final String[] columnNames = { "First Name", "Last Name", "Sport", "# of Years", "Vegetarian" }; final Object[][] data = { { "Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false) }, { "Alison", "Huml", "Rowing", new Integer(3), new Boolean(true) }, { "Kathy", "Walrath", "Knitting", new Integer(2), new Boolean(false) }, { "Sharon", "Zakhour", "Speed reading", new Integer(20), new Boolean(true) }, { "Philip", "Milne", "Pool", new Integer(10), new Boolean(false) } }; final JTable table = new JTable(data, columnNames); table.setPreferredScrollableViewportSize(new Dimension(500, 70)); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); if (ALLOW_ROW_SELECTION) { // true by default ListSelectionModel rowSM = table.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { System.out.println("No rows are selected."); } else { int selectedRow = lsm.getMinSelectionIndex(); System.out.println("Row " + selectedRow + " is now selected."); }/* w w w . j a va2s. c o m*/ } }); } else { table.setRowSelectionAllowed(false); } if (ALLOW_COLUMN_SELECTION) { // false by default if (ALLOW_ROW_SELECTION) { //We allow both row and column selection, which //implies that we *really* want to allow individual //cell selection. table.setCellSelectionEnabled(true); } table.setColumnSelectionAllowed(true); ListSelectionModel colSM = table.getColumnModel().getSelectionModel(); colSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { System.out.println("No columns are selected."); } else { int selectedCol = lsm.getMinSelectionIndex(); System.out.println("Column " + selectedCol + " is now selected."); } } }); } if (DEBUG) { table.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { printDebugData(table); } }); } //Create the scroll pane and add the table to it. JScrollPane scrollPane = new JScrollPane(table); //Add the scroll pane to this panel. add(scrollPane); }
From source file:gui.InboxPanel.java
public void generate() { Message[] arrMsg = GmailAPI.Inbox.toArray(new Message[GmailAPI.Inbox.size()]); InboxList = new JList(arrMsg); InboxList.setCellRenderer(new DefaultListCellRenderer() { // Setting the DefaultListCellRenderer public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Message message = (Message) value; // Using value we are getting the object in JList Map<String, String> map = null; try { map = GmailAPI.getMessageDetails(message.getId()); } catch (MessagingException ex) { Logger.getLogger(InboxPanel.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(InboxPanel.class.getName()).log(Level.SEVERE, null, ex); }/* w ww . j a va 2 s. c om*/ String sub = map.get("subject"); if (map.get("subject").length() > 22) { sub = map.get("subject").substring(0, 20) + "..."; } setText(sub); // Setting the text //setIcon( shape.getImage() ); // Setting the Image Icon return this; } }); InboxList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); InboxList.setLayoutOrientation(JList.VERTICAL); InboxList.setVisibleRowCount(-1); jScrollPane1.setViewportView(InboxList); InboxList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { try { JList list = (JList) evt.getSource(); int index = list.locationToIndex(evt.getPoint()); String id = arrMsg[index].getId(); curId = id; Map<String, String> map = GmailAPI.getMessageDetails(id); jTextField1.setText(map.get("from")); jTextField2.setText(map.get("subject")); dateTextField.setText(map.get("senddate")); BodyTextPane.setText(map.get("body")); //BodyTextPane.setContentType("text/html"); //BodyTextArea.setCo } catch (IOException ex) { Logger.getLogger(InboxPanel.class.getName()).log(Level.SEVERE, null, ex); } catch (MessagingException ex) { Logger.getLogger(InboxPanel.class.getName()).log(Level.SEVERE, null, ex); } } }); }
From source file:au.com.jwatmuff.eventmanager.gui.admin.WithdrawPlayerDialog.java
/** Creates new form WithdrawPlayerDialog */ public WithdrawPlayerDialog(java.awt.Frame parent, boolean modal, Database database, TransactionNotifier notifier) {/* w ww . ja va 2s. c o m*/ super(parent, modal); initComponents(); setLocationRelativeTo(null); this.database = database; this.notifier = notifier; divisionTableModel = new DivisionTableModel(); divisionTableModel.updateFromDatabase(); divisionTable.setModel(divisionTableModel); divisionTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); divisionTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { playerTableModel.updateFromDatabase(); } }); notifier.addListener(divisionTableModel, Pool.class); playerTableModel = new PlayerTableModel(); playerTable.setModel(playerTableModel); playerTable.setSelectionModel(new NullSelectionModel()); // disable selection // set up cell editor for status column // see PlayerTableModel.setValueAt() for how edits to cells are handled playerTable.getColumnModel().getColumn(1) .setCellEditor(new DefaultCellEditor(new JComboBox<Status>(statuses))); playerTable.getColumnModel().getColumn(1).setCellRenderer(new ComboBoxCellRenderer(Status.values())); // sort by name playerTable.getRowSorter().setSortKeys(Arrays.asList(new RowSorter.SortKey(0, SortOrder.ASCENDING))); notifier.addListener(playerTableModel, PlayerPool.class); }
From source file:com.mirth.connect.connectors.vm.ChannelWriter.java
public ChannelWriter() { parent = PlatformUI.MIRTH_FRAME;/*from w w w . j av a 2 s. co m*/ initComponents(); channelIdField.setToolTipText("<html>The destination channel's unique global id.</html>"); channelIdField.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { updateField(); } @Override public void removeUpdate(DocumentEvent e) { updateField(); } @Override public void changedUpdate(DocumentEvent e) { updateField(); } }); class CustomTableCellEditor extends TextFieldCellEditor { @Override protected boolean valueChanged(String value) { if ((value.length() == 0 || checkUniqueProperty(value))) { return false; } parent.setSaveEnabled(true); return true; } protected boolean checkUniqueProperty(String property) { boolean exists = false; for (int rowIndex = 0; rowIndex < mapVariablesTable.getRowCount(); rowIndex++) { if (mapVariablesTable.getValueAt(rowIndex, 0) != null && ((String) mapVariablesTable.getValueAt(rowIndex, 0)).equalsIgnoreCase(property)) { exists = true; } } return exists; } } mapVariablesTable.getColumnModel().getColumn(0).setCellEditor(new CustomTableCellEditor()); mapVariablesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); mapVariablesTable.setToolTipText( "The following map variables will be included in the source map of the destination channel's message."); mapVariablesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { if (mapVariablesTable.getRowCount() > 0) { deleteButton.setEnabled(true); } else { deleteButton.setEnabled(false); } } }); }
From source file:simx.profiler.info.application.MessagesInfoTopComponent.java
public MessagesInfoTopComponent() { initComponents();/* w ww . ja v a2 s . c om*/ setName(Bundle.CTL_MessagesInfoTopComponent()); setToolTipText(Bundle.HINT_MessagesInfoTopComponent()); this.content = new InstanceContent(); this.associateLookup(new AbstractLookup(this.content)); this.profilingData = ProfilingData.getLoadedProfilingData(); this.messagesDataSet = new DefaultPieDataset(); this.createPieChart(this.messagesDataSet, this.graphicalPanel); final ListSelectionModel listSelectionModel = this.messageTypeInformationTable.getSelectionModel(); listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listSelectionModel.addListSelectionListener((final ListSelectionEvent e) -> { if (messageTypeInformationTable.getSelectedRow() != -1) { final List<Map.Entry<MessageType, Integer>> data = new ArrayList<>( communicationData.getCommunicationData().entrySet()); final MessageType messageType = data.get(messageTypeInformationTable.getSelectedRow()).getKey(); content.set(Collections.singleton(messageType), null); } }); }
From source file:de.juwimm.cms.gui.admin.PanUnitGroupPerUser.java
public PanUnitGroupPerUser() { ActionHub.addExitListener(this); try {//from w w w .j a v a 2 s .com setDoubleBuffered(true); jbInit(); tblUser.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tblUser.getSelectionModel().addListSelectionListener(new UserListSelectionListener(this)); } catch (Exception exe) { log.error("Initialization Error: ", exe); } }
From source file:lu.lippmann.cdb.ext.hydviga.ui.GapsOverviewPanel.java
public void refresh(final Instances dataSet, final int dateIdx) { final Instances gapsDescriptionsDataset = GapsUtil.buildGapsDescription(gcp, dataSet, dateIdx); final JXTable gapsDescriptionsTable = new JXTable(); final InstanceTableModel gapsDescriptionsTableModel = new InstanceTableModel(false); gapsDescriptionsTableModel.setDataset(gapsDescriptionsDataset); gapsDescriptionsTable.setModel(gapsDescriptionsTableModel); gapsDescriptionsTable.setEditable(true); gapsDescriptionsTable.setShowHorizontalLines(false); gapsDescriptionsTable.setShowVerticalLines(false); gapsDescriptionsTable.setVisibleRowCount(5); gapsDescriptionsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); gapsDescriptionsTable.setSortable(false); gapsDescriptionsTable.packAll();//from w ww. j a va 2s.c o m gapsDescriptionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); gapsDescriptionsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { int modelRow = gapsDescriptionsTable.getSelectedRow(); if (modelRow < 0) modelRow = 0; final String attrname = gapsDescriptionsTableModel.getValueAt(modelRow, 1).toString(); final Attribute attr = dataSet.attribute(attrname); final int gapsize = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 5).toString()).doubleValue(); final int position = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 6).toString()).doubleValue(); try { final ChartPanel cp = GapsUIUtil.buildGapChartPanel(dataSet, dateIdx, attr, gapsize, position); visualOverviewPanel.removeAll(); visualOverviewPanel.add(cp, BorderLayout.CENTER); geomapPanel.removeAll(); geomapPanel.add(gcp.getMapPanel(Arrays.asList(attrname), new ArrayList<String>(), false)); jxp.updateUI(); } catch (Exception ee) { ee.printStackTrace(); } } } }); gapsDescriptionsTable.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(final MouseEvent e) { final InstanceTableModel instanceTableModel = (InstanceTableModel) gapsDescriptionsTable.getModel(); final int row = gapsDescriptionsTable.rowAtPoint(e.getPoint()); //final int row=gapsDescriptionsTable.getSelectedRow(); final int modelRow = gapsDescriptionsTable.convertRowIndexToModel(row); //final int modelRow=(int)Double.valueOf(instanceTableModel.getValueAt(row,0).toString()).doubleValue(); //System.out.println(row+" "+modelRow); final String attrname = instanceTableModel.getValueAt(modelRow, 1).toString(); final Attribute attr = dataSet.attribute(attrname); final int gapsize = (int) Double.valueOf(instanceTableModel.getValueAt(modelRow, 5).toString()) .doubleValue(); final int position = (int) Double.valueOf(instanceTableModel.getValueAt(modelRow, 6).toString()) .doubleValue(); if (!e.isPopupTrigger()) { // nothing? } else { final JPopupMenu jPopupMenu = new JPopupMenu("feur"); final JMenuItem interactiveFillMenuItem = new JMenuItem("Fill this gap (interactively)"); interactiveFillMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final GapFillingFrame jxf = new GapFillingFrame(atv, dataSet, attr, dateIdx, GapsUtil.getCountOfValuesBeforeAndAfter(gapsize), position, gapsize, gcp, false); jxf.setSize(new Dimension(900, 700)); //jxf.setExtendedState(Frame.MAXIMIZED_BOTH); jxf.setLocationRelativeTo(jPopupMenu); jxf.setVisible(true); //jxf.setResizable(false); } }); jPopupMenu.add(interactiveFillMenuItem); final JMenuItem lookupInKnowledgeDBMenuItem = new JMenuItem( "Show the most similar cases from KnowledgeDB"); lookupInKnowledgeDBMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final double x = gcp.getCoordinates(attrname)[0]; final double y = gcp.getCoordinates(attrname)[1]; final String season = instanceTableModel.getValueAt(modelRow, 3).toString() .split("/")[0]; final boolean isDuringRising = instanceTableModel.getValueAt(modelRow, 11).toString() .equals("true"); try { final Calendar cal = Calendar.getInstance(); final String dateAsString = instanceTableModel.getValueAt(modelRow, 2).toString() .replaceAll("'", ""); cal.setTime(FormatterUtil.DATE_FORMAT.parse(dateAsString)); final int year = cal.get(Calendar.YEAR); new SimilarCasesFrame(dataSet, dateIdx, gcp, attrname, gapsize, position, x, y, year, season, isDuringRising); } catch (Exception e1) { e1.printStackTrace(); } } }); jPopupMenu.add(lookupInKnowledgeDBMenuItem); final JMenuItem mExport = new JMenuItem("Export this table as CSV"); mExport.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final JFileChooser fc = new JFileChooser(); fc.setAcceptAllFileFilterUsed(false); final int returnVal = fc.showSaveDialog(gapsDescriptionsTable); if (returnVal == JFileChooser.APPROVE_OPTION) { try { final File file = fc.getSelectedFile(); WekaDataAccessUtil.saveInstancesIntoCSVFile(gapsDescriptionsDataset, file); } catch (Exception ee) { ee.printStackTrace(); } } } }); jPopupMenu.add(mExport); jPopupMenu.show(gapsDescriptionsTable, e.getX(), e.getY()); } } }); final int tableWidth = (int) gapsDescriptionsTable.getPreferredSize().getWidth() + 30; final JScrollPane scrollPane = new JScrollPane(gapsDescriptionsTable); scrollPane.setPreferredSize(new Dimension(Math.min(tableWidth, 500), 500)); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); this.tablePanel.removeAll(); this.tablePanel.add(scrollPane, BorderLayout.CENTER); this.visualOverviewPanel.removeAll(); /* automatically compute the most similar series and the 'rising' flag */ new AbstractSimpleAsync<Void>(false) { @Override public Void execute() throws Exception { final int rc = gapsDescriptionsTableModel.getRowCount(); for (int i = 0; i < rc; i++) { final int modelRow = i; try { final String attrname = gapsDescriptionsTableModel.getValueAt(modelRow, 1).toString(); final Attribute attr = dataSet.attribute(attrname); final int gapsize = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 5).toString()) .doubleValue(); final int position = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 6).toString()) .doubleValue(); /* most similar */ gapsDescriptionsTableModel.setValueAt("...", modelRow, 7); final int cvba = GapsUtil.getCountOfValuesBeforeAndAfter(gapsize); Instances gapds = WekaDataProcessingUtil.buildFilteredDataSet(dataSet, 0, dataSet.numAttributes() - 1, Math.max(0, position - cvba), Math.min(position + gapsize + cvba, dataSet.numInstances() - 1)); final String mostsimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(gapds, attr, WekaTimeSeriesUtil.getNamesOfAttributesWithoutGap(gapds), false); gapsDescriptionsTableModel.setValueAt(mostsimilar, modelRow, 7); /* 'rising' flag */ gapsDescriptionsTableModel.setValueAt("...", modelRow, 11); final List<String> attributeNames = WekaDataStatsUtil.getAttributeNames(dataSet); attributeNames.remove("timestamp"); final String nearestStationName = gcp.findNearestStation(attr.name(), attributeNames); final Attribute nearestStationAttr = dataSet.attribute(nearestStationName); //System.out.println(nearestStationName+" "+nearestStationAttr); final boolean isDuringRising = GapsUtil.isDuringRising(dataSet, position, gapsize, new int[] { dateIdx, attr.index(), nearestStationAttr.index() }); gapsDescriptionsTableModel.setValueAt(isDuringRising, modelRow, 11); gapsDescriptionsTableModel.fireTableDataChanged(); } catch (Exception e) { gapsDescriptionsTableModel.setValueAt("n/a", modelRow, 7); gapsDescriptionsTableModel.setValueAt("n/a", modelRow, 11); e.printStackTrace(); } } return null; } @Override public void onSuccess(Void result) { } @Override public void onFailure(Throwable caught) { caught.printStackTrace(); } }.start(); /* select the first row */ gapsDescriptionsTable.setRowSelectionInterval(0, 0); }