Delimiters
-
How do I separate my input with a tokenizer and delimiter?
import java.io.BufferedWriter;
import java.io.FileWriter;import javax.swing.JFrame;
import javax.swing.JPanel;/*******************************************************************************************
Program Name: ClientInformation.java
Programmer's Name: Elizabeth Conklin
Program Description: This program will accept user input and save the input to a file.
*******************************************************************************************/
public class WClientTest {public static void main(String\[\] args) { WClient myWClient = new WClient(); myWClient.setDefaultCloseOperation(JFrame.EXIT\_ON\_CLOSE); myWClient.setSize(650, 175); myWClient.setTitle("Client Information"); myWClient.setVisible(true); }
}
import java.awt.*;
import java.awt.event.*;import javax.swing.*;
import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;public class WClient extends JFrame {
JLabel labelName; JLabel labelID; JLabel labelStartingBalance; JLabel labelClosingBalance; JTextField textName; JTextField textID; JTextField textStartingBalance; JTextField textClosingBalance; JButton buttonSave; public WClient() { setLayout(new GridLayout(0,4)); labelName = new JLabel("Client Name: "); add(labelName); textName = new JTextField(10); add(textName); labelID = new JLabel("Client ID: "); add(labelID); textID = new JTextField(10); add(textID); labelStartingBalance = new JLabel("Starting Balance: "); add(labelStartingBalance); textStartingBalance = new JTextField(10); add(textStartingBalance); labelClosingBalance = new JLabel("Closing Balance: "); add(labelClosingBalance); textClosingBalance = new JTextField(10); add(textClosingBalance); buttonSave = new JButton("SAVE"); add(buttonSave); event e = new event(); buttonSave.addActionListener(e);} public class event implements ActionListener{ public void actionPerformed(ActionEvent e) { try { String name = textName.getText(); String ID = textID.getText(); String startingBalance = textStartingBalance.getText(); String closingBalance = textClosingBalance.getText(); textName.setText(""); textID.setText(""); textStartingBalance.setText(""); textClosingBalance.setText(""); BufferedWriter outfile = new BufferedWriter(new FileWriter("client.txt", true)); outfile
-
How do I separate my input with a tokenizer and delimiter?
import java.io.BufferedWriter;
import java.io.FileWriter;import javax.swing.JFrame;
import javax.swing.JPanel;/*******************************************************************************************
Program Name: ClientInformation.java
Programmer's Name: Elizabeth Conklin
Program Description: This program will accept user input and save the input to a file.
*******************************************************************************************/
public class WClientTest {public static void main(String\[\] args) { WClient myWClient = new WClient(); myWClient.setDefaultCloseOperation(JFrame.EXIT\_ON\_CLOSE); myWClient.setSize(650, 175); myWClient.setTitle("Client Information"); myWClient.setVisible(true); }
}
import java.awt.*;
import java.awt.event.*;import javax.swing.*;
import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;public class WClient extends JFrame {
JLabel labelName; JLabel labelID; JLabel labelStartingBalance; JLabel labelClosingBalance; JTextField textName; JTextField textID; JTextField textStartingBalance; JTextField textClosingBalance; JButton buttonSave; public WClient() { setLayout(new GridLayout(0,4)); labelName = new JLabel("Client Name: "); add(labelName); textName = new JTextField(10); add(textName); labelID = new JLabel("Client ID: "); add(labelID); textID = new JTextField(10); add(textID); labelStartingBalance = new JLabel("Starting Balance: "); add(labelStartingBalance); textStartingBalance = new JTextField(10); add(textStartingBalance); labelClosingBalance = new JLabel("Closing Balance: "); add(labelClosingBalance); textClosingBalance = new JTextField(10); add(textClosingBalance); buttonSave = new JButton("SAVE"); add(buttonSave); event e = new event(); buttonSave.addActionListener(e);} public class event implements ActionListener{ public void actionPerformed(ActionEvent e) { try { String name = textName.getText(); String ID = textID.getText(); String startingBalance = textStartingBalance.getText(); String closingBalance = textClosingBalance.getText(); textName.setText(""); textID.setText(""); textStartingBalance.setText(""); textClosingBalance.setText(""); BufferedWriter outfile = new BufferedWriter(new FileWriter("client.txt", true)); outfile