Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Programming The image pasted below called LabFileDump.jar shows how the file dump utility will work. You can use it to get an idea for

Java Programming

  1. The image pasted below called LabFileDump.jar shows how the file dump utility will work. You can use it to get an idea for how the program will eventually work. There is no code for this .jar to show.
  2. The file FileDumpExample.java is a Swing based GUI that contains Swing GUI components and Swing event handlers. This file will be the basis for completing the lab assignment. The FileDumpExample.java file does not contain any code for the event handlers. This code will be added in another assignment.
  3. Your task for the assignment is to convert the Swing based FileDumpExample.java to a JavaFX based file named FileDump.java.
  4. The FileDump.java file should provide a JavaFX based user interface and the basic event handlers. The event handlers do not need to have any code written for them.

LabFileDump.jar

image text in transcribed

FileDumpExample.java (Code Below)

import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.text.*; public class FileDumpExample extends JFrame { // set up the menu private JMenu menuFile = new JMenu("File"); private JMenuItem menuFileOpen = new JMenuItem("Open"); private JMenuItem menuFileExit = new JMenuItem("Exit"); private JMenu menuHelp = new JMenu("Help"); private JMenuItem menuHelpAbout = new JMenuItem("About"); private JMenuBar mb = new JMenuBar(); // set up north panel private JPanel northPanel = new JPanel(); private JLabel fileName = new JLabel(""); // set up east panel private JPanel eastPanel = new JPanel(); private JButton up = new JButton("Up"); private JButton down = new JButton("Down"); // set up south panel private JPanel southPanel = new JPanel(); private JButton resetButton = new JButton("Reset"); private JButton exitButton = new JButton("Exit"); private JPanel centerPanel = new JPanel(); private JTextArea offsetArea = new JTextArea(8, 6); private JTable dataTable = new JTable(); private JTextArea asciiArea = new JTextArea(8, 18); private RandomAccessFile file = null; private int fileIndex; private int fileOffset; private File choosenFile; public FileDumpExample(String str) { super(str); Container cp = getContentPane(); cp.setLayout(new BorderLayout()); setSize(620, 330); menuFileOpen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // FILE OPEN CODE HERE } } ); menuFile.add(menuFileOpen); menuFileExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // EXIT APPLICATION CODE HERE } } ); menuFile.add(menuFileExit); mb.add(menuFile); menuHelpAbout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // HELP MENU CODE HERE } } ); menuHelp.add(menuHelpAbout); mb.add(menuHelp); setJMenuBar(mb); // set up the north panel fileName.setBorder(BorderFactory.createTitledBorder("Open File:")); fileName.setText("No file currently open"); northPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); northPanel.add(fileName); cp.add(northPanel, BorderLayout.NORTH); // set up the east panel eastPanel.setLayout(new GridLayout(5, 1)); up.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // UP BUTTON CODE HERE } } ); eastPanel.add(up); down.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // DOWN BUTTON CODE HERE } } ); eastPanel.add(down); cp.add(eastPanel, BorderLayout.EAST); // set up the center border region Font fixedFont = new Font("Courier", Font.PLAIN, 12); centerPanel.setLayout(new BorderLayout()); offsetArea.setEditable(false); offsetArea.setFont(fixedFont); centerPanel.add(offsetArea, BorderLayout.WEST); dataTable.setShowGrid(false); centerPanel.add(dataTable, BorderLayout.CENTER); asciiArea.setEditable(false); asciiArea.setFont(fixedFont); centerPanel.add(asciiArea, BorderLayout.EAST); cp.add(centerPanel); // set up the south panel southPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); resetButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // RESET BUTTON CODE HERE } } ); southPanel.add(resetButton); exitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // EXIT BUTTON CODE HERE } } ); southPanel.add(exitButton); cp.add(southPanel, BorderLayout.SOUTH); // set up window listener addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { // WINDOW CLOSE BUTTON CODE HERE } } ); // disable controls until file opened up.setEnabled(false); down.setEnabled(false); resetButton.setEnabled(false); } private void displayData() { // CODE TO DISPLAY DATA HERE } public static void main(String[] args) { FileDumpExample fileDump = new FileDumpExample("File Dump Utility"); fileDump.setVisible(true); } }
- O X File Dump Utility File Help Open File: No file currently open Up Down Reset Exit

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

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

How are members held accountable for serving in the assigned roles?

Answered: 1 week ago

Question

Have roles been defined and assigned?

Answered: 1 week ago