private void updateInformation() { information.setText( "<html><font color=\"#8DC63F\"><b>" + transposedSpreadsheetSubform.getScrollTable().getColumnCount() + "</b></font> records annotated with <font color=\"#8DC63F\"><b>" + transposedSpreadsheetModel.getFields().size() + "</b></font> metadata fields</html>"); }
public void scrollToColumnLocation(int colIndex) { JTable scrollTable = transposedSpreadsheetSubform.getScrollTable(); scrollTable.setColumnSelectionInterval(colIndex, colIndex); JViewport scrollPane = transposedSpreadsheetSubform.getFrozenTable().getViewport(); Rectangle rect = scrollTable.getCellRect(1, colIndex, true); Point p = scrollPane.getViewPosition(); rect.setLocation(rect.x - p.x, rect.y - p.y); scrollPane.scrollRectToVisible(rect); Map<Integer, Color> columnToColor = new HashMap<Integer, Color>(); columnToColor.put(colIndex, new Color(28, 117, 188, 70)); transposedSpreadsheetSubform.changeTableRenderer( transposedSpreadsheetSubform.getScrollTable(), new SubFormCellRenderer( UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, null, columnToColor)); transposedSpreadsheetSubform.validate(); transposedSpreadsheetSubform.repaint(); }
private void goToColumn(JTextField field) { int index; try { index = Integer.valueOf(field.getText()); if (index > 0 && index <= transposedSpreadsheetSubform.getScrollTable().getColumnCount()) { scrollToColumnLocation(index - 1); } else { field.setText("invalid"); } } catch (NumberFormatException nfe) { field.setText("invalid"); } }