notepad to JTable

Joined
Mar 3, 2013
Messages
2
Reaction score
0
Help Please.
How to put text in notepad to Jtable with spit in "-" ? I would like the exact column and row.

Column Code:
Code:
private String col []= {"Account No.","PinCode","First Name",
		"Last Name", "MI","BirthDate","Sex","E-mail","Location"};

This is my reader:
Code:
try{

			BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("Database.txt"))));

			String line;
			int j = 0;

			line = br.readLine();
			String data[] = line.split("-");

			String matrix[][] = new String[data.length][];


			model = new DefaultTableModel(matrix, col);
			table = new JTable(model){
			public boolean isCellEditable(int row, int column){
			return false;
				}
			};

		}
		catch (IOException ex){
		ex.printStackTrace();
		}

And this is my textfile in Notepad:
Code:
07-12345-wilson-dacles-t.-February 1, [email protected]
21-1234-wilson-dacles-t.-February 1, [email protected]
0721-070707-rommellyn-dacles-m-March 7, [email protected]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top