Write a JAVA PROGRAM THAT DOES : There should now be three columns in the projec
ID: 3681513 • Letter: W
Question
Write a JAVA PROGRAM THAT DOES : There should now be three columns in the project GUI: text from an unsorted array, text from a sorted array and text from a sorted linked list. When the program starts, the input file should be read into two arrays, and one of the arrays is then sorted as usual.If the word read is valid (has only letters) put the word into an array (otherwise print it to the console). Each time a word is read from the file, it is inserted in the linked list in the proper position to keep the list in sorted order. When all the words have been read, then the text areas are to be filled and displayed in the GUI. Now your program can start accepting commands. A JOptionPane input dialog should pop up and say “Enter Command:”. The valid commands are ADD, DELETE, and STOP (upper or lower case). The command ADD should be followed by a space, and then a list of one or more words separated by commas. These words are to be added to the arrays and the linked list and displayed in the GUI. The command DELETE should be followed by a space and a single word to be deleted (again, the displays should be updated). Note that the word to be deleted might not be in the arrays or the list! The command STOP means stop the program. Create a single Java Archive (JAR) file containing all the files you wrote for this project (e.g., Project2.java, Project2GUI.java, WordNode.java, WordList.java, etc.).
The text file has: apple, orange, banana, c@t, dog, fi$h, 12345, granite, quartz, lion, tiger, be345a789r, antelope, bear, aardvark, topaz, diamond.
I NEED THIS BEFORE MARCH 26th 12pm EST
Explanation / Answer
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package textprocess1;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.*;
import java.awt.event.*;
import java.swing.*;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
/**
*
* @author Admin
*/
public class TextProcess1 extends JApplet {
JFrame frame1;
JLabel lbl1;
JPanel panel1;
private static final int JFXPANEL_WIDTH_INT = 300;
private static final int JFXPANEL_HEIGHT_INT = 250;
private static JFXPanel fxContainer;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception e) {
}
JFrame frame = new JFrame("JavaFX 2 in Swing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JApplet applet = new TextProcess1();
applet.init();
frame.setContentPane(applet.getContentPane());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
applet.start();
}
});
}
@Override
public void init() {
fxContainer = new JFXPanel();
fxContainer.setPreferredSize(new Dimension(JFXPANEL_WIDTH_INT, JFXPANEL_HEIGHT_INT));
add(fxContainer, BorderLayout.CENTER);
// create JavaFX scene
Platform.runLater(new Runnable() {
@Override
public void run() {
createScene();
}
});
}
private void createScene() {
Button btn = new Button();
btn.setText("Enter Command");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
System.out.println("Enter Command");
}
});
StackPane root = new StackPane();
root.getChildren().add(btn);
fxContainer.setScene(new Scene(root));
} // end function createScene()
JButton btn1 = new JButton("Add/Delete/Stop");
} // end public class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.