Question
The following is the assignment and screen shot, I have to be able to open it through eclipse without any error, I already did most
The following is the assignment and screen shot, I have to be able to open it through eclipse without any error, I already did most of code which is in bottom of the page, finish the code in way that I will be able to put in Eclipse without any error and get the fallowing screen shot :
Assignment:
WebBuy is designing a internal java based application with some administrative features. One of the feature is to print invoices and other documents. Below is a "wire-frame" screen shot of how it should look and you have been tasked to create a JavaFX mock up. Create the following GUI.You do not have to provide any functionality. However, you need to add events handlers for all the buttons on this dialog. You need to handle the event a display a message as to what button was clicked.
My code:
PrinterFrame.java
// Recreate given GUI.
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import javax.swing.Box;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
public final class PrinterFrame extends JFrame {
private final JLabel curPrinter = new JLabel("Printer: MyPrinter", SwingConstants.LEFT);
private final JTextArea left;
private final JCheckBox image;
private final JCheckBox text;
private final JCheckBox code;
private final JTextArea middle;
private final JRadioButton select;
private final JRadioButton all;
private final JRadioButton applet;
private final JTextArea right;
private final JLabel printQuality = new JLabel("Print Quality: ");
private final String[] qualityLevel = {"High", "Medium", "Low"};
private final JComboBox
private final JCheckBox printToFile;
private final JButton ok;
private final JButton cancel;
private final JButton setup;
private final JButton help;
public PrinterFrame() {
super("Printer");
setLayout(new FlowLayout());
final Box info = Box.createVerticalBox();
final JPanel printer = new JPanel(new FlowLayout(FlowLayout.LEFT));
final Box options = Box.createHorizontalBox();
final JPanel extras = new JPanel();
final JPanel buttons = new JPanel(new GridLayout(4,1,5,5));
printer.add(curPrinter);
info.add(printer);
info.add(options);
info.add(extras);
add(info);
add(buttons);
final int height = 4;
final int width = 2;
left = new JTextArea(height,2*width);
options.add(left);
image = new JCheckBox("Image");
text = new JCheckBox("Text");
code = new JCheckBox("Code");
final Box printType = Box.createVerticalBox();
printType.add(image);
printType.add(text);
printType.add(code);
options.add(printType);
middle = new JTextArea(height,width);
options.add(middle);
final ButtonGroup group = new ButtonGroup();
final Box whatToPrint = Box.createVerticalBox();
select = new JRadioButton("Selection");
all = new JRadioButton ("All");
applet = new JRadioButton("Applet");
group.add(select);
group.add(all);
group.add(applet);
whatToPrint.add(select);
whatToPrint.add(all);
whatToPrint.add(applet);
options.add(whatToPrint);
right = new JTextArea(height,2*width);
options.add(right);
quality = new JComboBox
printToFile = new JCheckBox("Print to File");
extras.add(printQuality);
extras.add(quality);
extras.add(printToFile);
ok = new JButton("Ok");
cancel = new JButton("Cancel");
setup = new JButton("Setup...");
help = new JButton("Help");
buttons.add(ok);
buttons.add(cancel);
buttons.add(setup);
buttons.add(help);
}
}
Printer.java
import javax.swing.JFrame;
public final class Printer {
public static void main(String[] args){
final PrinterFrame app = new PrinterFrame();
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
app.setSize(380,180);
app.setResizable(false);
app.setVisible(true);
}
}
Printer: My Printer Image Text Code Print Quality: High Selection All Applet Print to File OK Cancel Setup Help Printer: My Printer Image Text Code Print Quality: High Selection All Applet Print to File OK Cancel Setup HelpStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started