Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how do I display txt file data to a jtable? here's what I got so far for the text file data to read, but how

how do I display txt file data to a jtable? here's what I got so far for the text file data to read, but how do I get it to display on a table?

the departments.txt file only displays departments like in one row, separated by line like

Marketing

Accounting

Sales

public static void main(String[] args) { // TODO code application logic here try{ FileReader fr = new FileReader("Departments.txt"); BufferedReader br = new BufferedReader(fr); String departmentsTextFile; while ((departmentsTextFile = br.readLine()) != null){ out.println(departmentsTextFile); } br.close(); } catch(IOException e){ out.println("File not found test"); } java.io.File departmentsFile = new java.io.File("Departments.txt"); try { Scanner input = new Scanner(departmentsFile); while(input.hasNext()){ String num = input.nextLine();//grabs line ****HERE IS WHERE I WOULD ADD IT TO THE JTABLE CALLED ASSIGNMENTSTABLE -ONE COLUMN TOTAL } } catch (FileNotFoundException e){ System.err.format("File does not exist");

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

What is the sum of online transactions in Alaska (AK)?

Answered: 1 week ago

Question

=+ a. What is the per-worker production function?

Answered: 1 week ago