public ResultSetToJTable(ResultSet resultSet) {

		try {
			ResultSetMetaData metaData = resultSet.getMetaData();
			int columns = metaData.getColumnCount();
			for (int i = 1; i <= columns; i++) {
				String colHeader = metaData.getColumnName(i).replace("_", " ");
				colHeader = colHeader.substring(0, 1).toUpperCase()
						+ colHeader.substring(1);
				if (!colHeader.equals("Employeeid")) {
					colNames.addElement(colHeader);
				}
			}

			ids.clear();
			while (resultSet.next()) {
				Vector<Object> row = new Vector<Object>(columns);
				for (int i = 1; i <= columns; i++) {
					if (i != 1) {
						row.addElement(resultSet.getObject(i));
					} else {
						ids.addElement((Integer) resultSet.getObject(i));
					}
				}
				data.addElement(row);
			}
		} catch (Exception e) {
			System.out.println("Couldn't convert resultset to JTable! "
					+ e.getMessage());
			e.printStackTrace();
		}

		table = new JTable(data, colNames);

		for (int i = 0; i < table.getColumnCount(); i++) {
			column = table.getColumnModel().getColumn(i);
			column.setMaxWidth(250);
		}

		table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
		table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		ListSelectionModel lsm = table.getSelectionModel();
		lsm.addListSelectionListener(new tableSelectionListener());
		scrollPane = new JScrollPane(table);
	}