import java.awt.*;import javax.swing.*;import java.awt.event.*; class MyProgram extends JFrame implements ActionListener { public JCheckBox bp, tchips,csoup, cpasta, gbread; public JTextField itemcost; public JTextArea itemdesc; public JLabel idesc, icost,extras; public JButton checkButton =new JButton("Check"); public MyProgram() { Container pane =getContentPane(); pane.setLayout(null); setPreferredSize(newDimension(250, 250)); pane.add(extras = newJLabel("Extras")); extras.setBounds(34, 50,70, 20); pane.add(bp = newJCheckBox("Baked Potato")); bp.setBounds(30, 80, 150,20); bp.setOpaque(false); //baked potatodescription: oven baked potato halves //item cost: $4.00 pane.add(tchips = newJCheckBox("Tortilla Chips")); tchips.setBounds(30, 110,150, 20); tchips.setOpaque(false); //Tortilla Chipsdescription: light & crispy corn chips //item cost: $10.90 pane.add(csoup = newJCheckBox("Chicken Soup")); pane.add(checkButton); checkButton.setBounds(30,170, 150, 20); csoup.setBounds(30, 140,150, 20); csoup.setOpaque(false); //chicken soupdescription: with checkButton.addActionListener(this); pack(); } @Override public voidactionPerformed(ActionEvent e) { if (tchips.isSelected()){ JOptionPane.showMessageDialog(null,"Tortilla chips cost: $10.90\nDescription: light & crispy cornchips"); } } public static voidmain(String[] args) { MyProgram gui = newMyProgram(); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setVisible(true); }}
Comments
Dear visitor, Please submit your question to some online fileshare storage and provide us with the link to your source code.
(continue) steamed chicken and white soup //item cost: $4.90 pane.add(cpasta=new JCheckBox("Chicken Pasta")); cpasta.setBounds(30,170,150,20); cpasta.setOpaque(false); //chicken pasta description: chicken strips and roasted peanuts //item cost: $6.00 pane.add(gbread=new JCheckBox("Garlic Bread")); gbread.setBounds(30,200,150,20); gbread.setOpaque(false); //garlic bread description: baked oven sprinkled garlic //item cost: $4.98 pane.add(icost=new JLabel("Extras cost")); icost.setBounds(160,50,100