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

  • SEARCH
  • Home
  • 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 857695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:26:14+00:00 2026-05-15T08:26:14+00:00

Java is complaining! cannot find symbol symbol : constructor Bar() location: class Bar JPanel

  • 0

Java is complaining!

cannot find symbol
symbol  : constructor Bar()
location: class Bar
         JPanel panel = new Bar();
                        ^

QUESTION: Why am I getting this error?…everything seems to be correct.

this is the coding:

    public class JFrameWithPanel
    {
      public static void main(String[] args)
      {
           JPanel panel = new Bar();
      }
    }

Bar( ) is

public class Bar extends JPanel
{
    public Bar(final JFrame frame)
    {
        super(new BorderLayout());
        String[] tests = { "A+ Certification", "Network+ Certification", "Security+ Certification", "CIT Full Test Package" };
        JComboBox comboBox = new JComboBox(tests);
        TextArea text = new TextArea(5, 10);
        add(new JLabel("Welcome to the CIT Test Program "));
        add(new JLabel("Please select which Test Package from the list below."));

        JMenuBar menuBar = new JMenuBar();
        JMenu fileMenu = new JMenu("File");
        JMenu editMenu = new JMenu("Edit");
        JMenu helpMenu = new JMenu("Help");
        menuBar.add(fileMenu);
        menuBar.add(editMenu);
        menuBar.add(helpMenu);
        JMenuItem newMenu = new JMenuItem("New  (Ctrl+N)");
        JMenuItem openMenu = new JMenuItem("Open  (Ctrl+O)");
        JMenuItem saveMenu = new JMenuItem("Save  (Ctrl+S)");
        JMenuItem exitMenu = new JMenuItem("Exit  (Ctrl+W)");
        JMenuItem cutMenu = new JMenuItem("Cut  (Ctrl+X)");
        JMenuItem copyMenu = new JMenuItem("Copy  (Ctrl+C)");
        JMenuItem pasteMenu = new JMenuItem("Paste  (Ctrl+V)");
        JMenuItem infoMenu = new JMenuItem("Help  (Ctrl+H)");
        fileMenu.add(newMenu);
        fileMenu.add(openMenu);
        fileMenu.add(saveMenu);
        fileMenu.add(exitMenu);
        editMenu.add(cutMenu);
        editMenu.add(copyMenu);
        editMenu.add(pasteMenu);
        helpMenu.add(infoMenu);
        this.add(comboBox, BorderLayout.NORTH);
        this.add(text, BorderLayout.SOUTH);
        frame.setJMenuBar(menuBar);
        add(new JButton("Select")
        {
            {
                addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        frame.dispose();
                        JOptionPane.showMessageDialog(frame, "IT WORKS!");

                    }
                });
            }
        });

    }
}
  • 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-05-15T08:26:15+00:00Added an answer on May 15, 2026 at 8:26 am

    The problem is that you have a constructor that expects a JFrame:

    public Bar(final JFrame frame)
    

    but you care calling it with no arguments:

    JPanel panel = new Bar();
    

    You need to pass Bar an instance of a JFrame.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I have a class with a constructor like this: public FilterList(Set<Integer> labels) {
I have multiple constructor in a Java class. public class A{ public A(){...} public
I'm new to Java and Android development so bear with on this... I'm trying
Java noob question: Consider the following C array and initializer code: struct { int
Java newbie here, I am trying to find the output of the following chunk
I'm trying to run an application with java 1.7.2 and its complaining it needs
I asked this same question on javaprogrammingforums.com but it seems their website is down
We're using fortify to scan java source code & it is complaining below error:
I have an HTTP client in Java that I getting an SSLHandshakeException with a
I want to declare an array of strings but Java is complaining when I

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.