Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA, how to save the data of the Jtable on a txt.file? and any changes made on execution are also made on the txt file

JAVA, how to save the data of the Jtable on a txt.file? and any changes made on execution are also made on the txt file and updated later.

import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable;

public class JTableExamples { // frame JFrame f; // Table JTable j;

// Constructor JTableExamples() { // Frame initiallization f = new JFrame();

// Frame Title f.setTitle("JTable Example");

// Data to be displayed in the JTable String[][] data = { { "Kundan Kumar Jha", "4031", "CSE" }, { "Anand Jha", "6014", "IT" } };

// Column Names String[] columnNames = { "Name", "Roll Number", "Department" };

// Initializing the JTable j = new JTable(data, columnNames); j.setBounds(30, 40, 200, 300);

// adding it to JScrollPane JScrollPane sp = new JScrollPane(j); f.add(sp); // Frame Size f.setSize(500, 200); // Frame Visible = true f.setVisible(true); }

// Driver method public static void main(String[] args) { new JTableExamples(); } }

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

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

Define Administration and Management

Answered: 1 week ago

Question

Define organisational structure

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago

Question

Define the process of communication

Answered: 1 week ago

Question

Explain the importance of effective communication

Answered: 1 week ago

Question

5. Understand how cultural values influence conflict behavior.

Answered: 1 week ago