Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8102881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:21:45+00:00 2026-06-05T23:21:45+00:00

For my second programming assignment in my Java class, we have to create a

  • 0

For my second programming assignment in my Java class, we have to create a Pizza Shop menu GUI. Everything appears on my GUI (including choices, boxes, radio buttons, etc.) except for the button (“Process Selection”) you are supposed to click for calculating the total cost. The following is my code:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class PizzaShop extends JFrame {

    private Topping t;
    private PizzaSize ps;
    private PizzaType pt;
    private JPanel buttonPanel;
    private JButton ProcessSelection;

    public PizzaShop() {
        super("Welcome To Home Pizza Shop");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLayout(new BorderLayout());
        t = new Topping();
        ps = new PizzaSize();
        pt = new PizzaType();
        createPanel();
        add(t, BorderLayout.NORTH);
        add(ps, BorderLayout.WEST);
        add(pt, BorderLayout.CENTER);
        setVisible(true);
    }

    private void createPanel() {
        buttonPanel = new JPanel();
        ProcessSelection = new JButton("Process Selection");
        ProcessSelection.addActionListener(new calButton());
        buttonPanel.add(ProcessSelection);
    }

    private class calButton implements ActionListener {

        public void actionPerformed(ActionEvent e) {
            double subtotal;
            subtotal = t.getTopping() + ps.getPizzaSize();
            JOptionPane.showMessageDialog(null, "Your Order \n" + "Pizza Type" + pt.getPizzaType() + "\n" + "Amount Due" + subtotal);
        }
    }

    private class ExitButtonListener implements ActionListener {

        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    }
}

Did I forget to do add some code somewhere? I’m boggled.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:21:46+00:00Added an answer on June 5, 2026 at 11:21 pm

    You are not adding the buttonPanel to the main view

    UPDATE: you should do this:

    private void createPanel() {
        buttonPanel = new JPanel();
        ProcessSelection = new JButton("Process Selection");
        ProcessSelection.addActionListener(new calButton());
        buttonPanel.add(ProcessSelection);
        add(buttonPanel, BorderLayout.SOUTH);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a programming student in my second OOP class. Is it possible have
I have a java class and I want to Load a class inside a
I'm learning programming with Java. This is my solution to the second problem in
I'm working on a java assignment for a class and I'm unsure how to
I am a programming student in my second OOP class, which is taught in
I'm a programming student in my second OOP class, my first class was taught
I have experience programming in C#, but I'm taking a C++ class this semester,
I am starting on a network-programming assignment I have. The instructions are as follows:
In 'Programming in Scala, Second Edition' at page 410 you can find class Simulation
We are programming a new web application framework ( Second WAF ). I was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.