Question: GUI Design. Create a wireframe(s) for the GUI program below. Create an algorithm for the required program but create it as a flow chart for

GUI Design. Create a wireframe(s) for the GUI program below.

Create an algorithm for the required program but create it as a flow chart for the below Program .

package application; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths;

import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.Label; import javafx.scene.control.TextArea; import javafx.scene.layout.VBox; import javafx.stage.FileChooser; import javafx.stage.Stage;

public class BinaryDataReader extends Application {

private TextArea dataTextArea = new TextArea(); private CheckBox decryptCheckBox = new CheckBox("Decrypt"); private Label byteCountLabel = new Label();

@Override public void start(Stage primaryStage) throws Exception { Button fileChooserButton = new Button("Choose File"); fileChooserButton.setOnAction(e -> chooseFile());

VBox root = new VBox(10, fileChooserButton, decryptCheckBox, dataTextArea, byteCountLabel); root.setPadding(new Insets(10));

primaryStage.setScene(new Scene(root)); primaryStage.show(); }

private void chooseFile() { FileChooser fileChooser = new FileChooser(); File file = fileChooser.showOpenDialog(null); if (file != null) { try { byte[] fileData = readFile(file.toPath()); displayData(fileData); } catch (IOException e) { e.printStackTrace(); } } }

private byte[] readFile(Path path) throws IOException { return Files.readAllBytes(path); }

private void displayData(byte[] data) { StringBuilder sb = new StringBuilder(); int byteCount = 0; boolean decrypt = decryptCheckBox.isSelected(); for (int i = 0; i < data.length; i++) { byte b = data[i]; if (decrypt) { b -= 5; } char c = (b > 31 && b < 127) ? (char) b : '.'; sb.append(c); sb.append(" "); byteCount++; if (byteCount % 16 == 0) { sb.append(" "); } } byteCountLabel.setText("Total Bytes: " + byteCount); dataTextArea.setText(sb.toString()); }

public static void main(String[] args) { launch(args); }

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!