Build!
This is a dress rehearsal for final projects.
File Menu:
Open
Save Results
Quit
--------------------------------------------------------------
| ConcordanceViewer: /Users/morrison/war_and_peace.txt.conc |
--------------------------------------------------------------
| |
| |
| |
| |
| |
| |
| |
--------------------------------------------------------------|
| |alpha| |freq| |regex| | (textfield for regex) |
--------------------------------------------------------------
button actions
alpha: sort contents of screen by alphabeetical order
freq: sort contents of screen by frequency
regex:
if no regex is entered in the text field or if it's
crap do nothing
Otherwise, show only words and their frequencies
that match the regex.
This means you get to play with Java's regex facility!
Menu actions
Save window: pops a file chooser and saves contents
of a window to the selected file.
Open: Opens a file, generates a concordance file
(filename + ".conc"), closes test file, and opens the
.conc file for reading.
Quit: calls Platform.exit()
stop:
if the screen contents are unsaved, asks to save them.
Starter Code I did some of the drudge work for you.
/**************************************************
* Author: NAMES HERE
* Date: 17 Nov 202020
**************************************************/
import javafx.application.Application;
import javafx.application.Platform;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.MenuBar;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.control.TextArea;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
public class ConcordanceViewer extends Application
{
TextArea ta;
TextField regexField;
public ConcordanceViewer()
{
ta = new TextArea();
regexField = new TextField();
}
@Override
public void init()
{
}
@Override
public void start(Stage primary)
{
BorderPane bp = new BorderPane();
bp.setTop(buildMenus());
HBox buttonBar = new HBox();
bp.setBottom(buildBottom());
bp.setCenter(ta);
primary.setScene(new Scene(bp, 800,600));
primary.show();
}
@Override
public void stop()
{
}
private MenuBar buildMenus()
{
MenuBar mbar = new MenuBar();
Menu fileMenu = new Menu("File");
mbar.getMenus().addAll(fileMenu);
return mbar;
}
private HBox buildBottom()
{
HBox out = new HBox();
Button alphaButton = new Button("Alpha");
out.getChildren().addAll(alphaButton);
return out;
}
}
Compile it and run it. You will see this.
Pairings
| Partner I | Partner II |
|---|---|
| thomas21g | zhou21a |
| hampton21t | barwick21d |
| delgado21t | grinberg21j |
| bandel21a | obi21n |
| hubbard21k | kitsinian21t |