Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a single form interface for a company that sells popcorn tins. Your job i

ID: 3782071 • Letter: D

Question

Design a single form interface for a company that sells popcorn tins. Your job is to create a popcorn order based on user input, so you will need a supporting class to create the popcorn object. Your form should not handle any other information about the order (customer, total order, other food items, etc.). Following are the attributes of the tins that the company sells. Your supporting class should reflect these in the class fields. You may use enumerated types if you are familiar with them, but it is not required. Feel free to constrain user input with combo boxes. size: 1, 2, and 3 gallon sizes color: red, green, or blue flavor: plain, cheese, caramel mixed: two flavors can be mixed, if desired price: the price of the item gift: whether or not the tin is a gift giftMessage: message to paint on the tin You do not need to include any images in your form, unless you want to. Feel free to get creative with your form, as long as the following elements are included to create the popcorn tin object. NOTE: your form needs to create only one object. comboBox – for size,color, and flavor radioButton – for mixed and gift options labels – to identify all controls textField – to enter gift message, if needed button – one to create popcornTin object, one to clear the form return focus to first component textArea – to display the object as created with user choices. earning a 100 will successfully run, and create and display the popcorn object in the text Area. ............... this is what I have so far and I can't get it to work proper.

package assignment1_spring;

/**
*
* @author A
*/import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Assignment1_Spring extends Frame {
public Assignment1_Spring(){
super("Assignment1_Spring");
getContentPane().setLayout(new FlowLayout());
  
String[] colortext = new String[] {"Red","Green","Blue"};
String[] sizetext = new String[] {"1 Gallon","2 Gallon", "3 Gallon"};
String[] flavortext = new String[] {"Plain", "Cheese","Carmel"};
  
Label size = new Label("Size:");
Label color = new Label("Color:");
Label flavor = new Label("Flavor:");
Label mixed = new Label("Mixed:");
Label price = new Label("Price:");
Label gift = new Label("Gift:");
Label giftMessage = new Label("Gift Message:");
  
JComboBox CSize = new JComboBox<>(sizetext);
JComboBox CColor = new JComboBox<>(colortext);
JComboBox CFlavor = new JComboBox<>(flavortext);
  
TextField textField1 = new TextField("",5);
TextField textField2 = new TextField("",15);
  
JRadioButton opt1 = new JRadioButton("Yes");
JRadioButton opt2 = new JRadioButton("No");
JRadioButton opt3 = new JRadioButton("Yes");
JRadioButton opt4 = new JRadioButton("No");
  
final Button create = new Button("Create");
Button clear = new Button("Clear");
  
ButtonGroup group1 = new ButtonGroup();
group1.add(opt1);
group1.add(opt2);
  
ButtonGroup group2 = new ButtonGroup();
group1.add(opt3);
group2.add(opt4);
  
getContentPane().add(BorderLayout.SOUTH, size);
getContentPane().add(CSize);
getContentPane().add(CColor);
getContentPane().add(color);
getContentPane().add(CColor);
getContentPane().add(flavor);
getContentPane().add(CFlavor);
getContentPane().add(mixed);
getContentPane().add(opt1);
getContentPane().add(opt2);
  
getContentPane().add(price);
getContentPane().add(textField1);
getContentPane().add(gift);
getContentPane().add(opt3);
getContentPane().add(opt4);
getContentPane().add(giftMessage);
getContentPane().add(textField2);
  
getContentPane() .add(create);
getContentPane() .add(clear);
  
create .addActionListener(new ActionListener(){
public void actionPerformed (ActionEvent evt)
{
Object src = evt.getSource();
if(src == create)
{
TextArea obj = new TextArea("Object has been created");
getContentPane().add(obj);
}
} });
setSize(400, 600);
setVisible(true);
}   
public static void main(String[] args) {
// TODO code application logic here
}
}

Explanation / Answer

You just have to change one lone of your code , that is

Public class Assignment1_Spring extends JFrame {

.....

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote