i am trying to get the input the info so when the choices are chosen and submit is clicked the info is seen for the flower order but getting errors. if you read it you would probably get what i am trying to say but how to get it without the errors.
import javax.swing.*;
//import javax.swing.AbstractButton;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class floralOrderGUI {
JButton SubmitButton = new JButton("Submit");
private JButton Submit;
private SubmitButtonHandler sHandler;
public static void main(String[] args) {
new floralOrderGUI();
//system.exit(Q);
}
public floralOrderGUI(){
JFrame mainFrame = new JFrame ("mobileOrders");
mainFrame.setSize (300, 300);
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setLayout(new GridLayout (0,2));
//create components for the window
JLabel mobileOrdersInputLabel = new JLabel("Menu Choice", SwingConstants.RIGHT);
JLabel floralOrdersInputLabel = new JLabel("Floral Orders", SwingConstants.RIGHT);
JTextField numInput = new JTextField();
numInput.setBackground(new Color (255, 199, 64));
numInput.setForeground(new Color(176, 165, 50));
numInput.setBackground(new Color(184, 120, 85));
numInput.setForeground(new Color(184, 120, 85));
JComboBox menuChoice = new JComboBox();
JComboBox paymentOption = new JComboBox();
JComboBox dFlowerOption = new JComboBox();
JComboBox deliveryOption = new JComboBox();
numInput.setBackground(new Color (255, 199, 64));
numInput.setForeground(new Color(184, 120, 85));
String floralOption[] ={ "Cut Flowers = $15.00","Floral Arrangemen = $25.00t","Coursages = 10.00","None"};
for (int i= 0; i<=3; i++)
menuChoice.addItem(floralOption[i]);
numInput.setBackground(new Color(250, 190, 60));
numInput.setForeground(new Color(180, 129, 80));
//gain access to the window container
//Container c = mainFrame.getContentPane();
String dominantFlower[] = { "Roses = $5.00", "Daisies", "Chrysanthemums", "Irises"};
for (int j= 0; j<=3; j++)
dFlowerOption.addItem(dominantFlower[j]);
numInput.setBackground(new Color(250, 190, 60));
numInput.setForeground(new Color(180, 129, 80));
//gain access to the window container
//Container c = mainFrame.getContentPane();
String payment[] ={ "Cash", "Cheque", "Credit Card"};
for (int k= 0; k<=2; k++)
paymentOption.addItem(payment[k]);
numInput.setBackground(new Color(250, 190, 60));
numInput.setForeground(new Color(180, 129, 80));
//gain access to the window container
//Container c = mainFrame.getContentPane();
String dOption[]= { "Drop Off = $10.00", "Pick Up"};
for (int L= 0; L<=1; L++)
deliveryOption.addItem(dOption[L]);
numInput.setBackground(new Color(250, 190, 60));
numInput.setForeground(new Color(180, 129, 80));
//gain access to the window container
Container c = mainFrame.getContentPane();
//create submit button
Submit = new JButton("Submit");
sHandler = new SubmitButtonHandler();
Submit.addActionListener(sHandler);
//add element to the window container
c.add(mobileOrdersInputLabel);
c.add(floralOrdersInputLabel);
c.add(SubmitButton);
c.add(menuChoice);
c.add(dFlowerOption);
c.add(paymentOption);
c.add(deliveryOption);
mainFrame.setVisible(true);
// c.setVisible(true);
}
private class SubmitButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
String floralOption[] ={ "Cut Flowers = $15.00","Floral Arrangemen = $25.00","Coursages = 10.00","None"};
if (Cut Flowers)
System.out.print("Submit = $15.00");
else
if (Floral Arrangement)
System.out.print("Submit = $25.00");
else
if (Coursage)
System.out.print("$10.00");
else
System.out.print("None");
String dominantFlower[] = { "Roses = $5.00", "Daisies", "Chrysanthemums", "Irises"};
if (roses)
System.out.print("$15.00" + "$5.00" );("$25.00" + "$5.00");("$10.00" + "$5.00");
else
System.out.print("$15.00"); ("$25.00"); ("$10.00");
String dOption[]= { "Drop Off = $10.00", "Pick Up"};
if (Drop Off)
System.out.print("$10.00");
else
ystem.out.print("PickUp");
}
}