Java Code Examples for javax.swing.JTable#addKeyListener()

The following examples show how to use javax.swing.JTable#addKeyListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListLocationBrowserUI.java    From pumpernickel with MIT License 5 votes vote down vote up
public ListLocationBrowserUI(LocationBrowser b) {
	super(b);

	tableModel.addColumn("Name");
	tableModel.addColumn("Date Modified");
	table = new JTable(tableModel) {
		private static final long serialVersionUID = 1L;

		@Override
		public boolean editCellAt(int row, int col,
				java.util.EventObject obj) {
			// TODO: edit this to let the user double-click to edit file
			// names
			// (if we want that.)
			return false;
		}
	};

	TableCellRenderer renderer = getTableCellRenderer();
	table.getColumnModel().getColumn(0).setCellRenderer(renderer);
	table.getColumnModel().getColumn(1).setCellRenderer(renderer);
	table.setRowHeight(18);

	table.addMouseListener(mouseListener);
	table.addKeyListener(enterKeyListener);
	// TODO: reinstate, but make abstract/codified. See IOLocationTileList
	// table.addKeyListener(typingListener);

	scrollPane = new JScrollPane(table);

	table.getSelectionModel().addListSelectionListener(guiListener);
}
 
Example 2
Source File: Search.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
private JScrollPane makeTable(TableModel model, Project project) {
	JTable table = new Results(model, project);
	// java 1.6.0 only!! //table.setAutoCreateRowSorter(true);
	table.addMouseListener(new DisplayableListListener());
	table.addKeyListener(kl);
	JScrollPane jsp = new JScrollPane(table);
	jsp.setPreferredSize(new Dimension(500, 500));
	return jsp;
}
 
Example 3
Source File: TableListener.java    From hortonmachine with GNU General Public License v3.0 3 votes vote down vote up
public TableListener(JTable table) {

        this.table = table;
        table.getTableHeader().addKeyListener(new PasteKeyListener(this));
        table.addKeyListener(new PasteKeyListener(this));

    }