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 4576178
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:10:07+00:00 2026-05-21T20:10:07+00:00

import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.io.*; import java.util.*; import java.lang.String;

  • 0
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;    
import java.io.*;
import java.util.*;
import java.lang.String;

public class Game extends JFrame
{
    public IntroPanel introduction;
    public InstructPanel instructions;
    public GamePanel gameboard;
    public ScorePanel highscore;
    public QuestionPanel questions;
    public AnswerPanel right;
    public FailPanel wrong;
    public Container c;
    public CardLayout cards;
    private boolean runStandAlone = true;

    public static void main (String [] args)
    {
        Game gem = new Game();
    }

    public Game()
    {
        setVisible(true); // allows JFrame to be seen
        setSize(800, 800); // sets the size
        setTitle("Biopardy"); // sets the title
        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); // Closing is taken care of 
        // by the following WindowListener, there's no default close operation.
        addWindowListener(new WindowAdapter() 
        { // lets the program run without having to import all WindowListener methods
            public void windowClosing(WindowEvent evt) 
            { // this gives the user a chance to stop the close operation
                int response = JOptionPane.showConfirmDialog(null, "Do you really want to quit?");
                if(response == JOptionPane.YES_OPTION) 
                {
                    dispose();
                    if(runStandAlone)
                        System.exit(0);
                }
            }
        });

        c = this.getContentPane();
        cards = new CardLayout();
        c.setLayout(cards);

        introduction = new IntroPanel(); // initializes new panel
        add(introduction, BorderLayout.CENTER); // adds the panel to the center

        instructions = new InstructPanel(); // initializes new panel
        c.add(instructions, "Instructions"); // string identifier (call on panel by using this name)

        gameboard = new GamePanel(); // initializes new panel
        c.add(gameboard, "Start"); // string identifier (call on panel by using this name)

        highscore = new ScorePanel(); // initializes new panel
        c.add(highscore, "High Score"); // string identifier (call on panel by using this name)

        questions = new QuestionPanel(); // initializes new panel

        right = new AnswerPanel(); // initializes new panel

        wrong = new FailPanel(); // initializes new panel
    }

class IntroPanel extends JPanel implements ActionListener
{
    private JButton start, record, instruct;
    private JTextField username;
    private Image jeopardy;

    public IntroPanel(Image jeopardy)
    {
        setBackground(Color.white); // sets background color
        this.setLayout(new FlowLayout());

        this.jeopardy = Toolkit.getDefaultToolkit().getImage("jeopardy.jpg");

        start = new JButton("Start");
        start.addActionListener(this);
        this.add(start);

        instruct = new JButton("Instructions");
        instruct.addActionListener(this);
        this.add(instruct);

        record = new JButton("High Score");
        record.addActionListener(this);
        this.add(record);

        username = new JTextField("User Name");
        username.addActionListener(this);
        this.add(username);
    }

    public void actionPerformed(ActionEvent e)
    {
        String command = e.getActionCommand();
        if(command.equals("Start"))
            cards.show(c, "Start");
        else if(command.equals("Instructions"))
            cards.show(c, "Instructions");
        else if(command.equals("High Score"))
            cards.show(c, "High Score");
    }

    public void WaitForImage(JApplet component, Image image)   
    {
        MediaTracker tracker = new MediaTracker(component);
        try 
        {
            tracker.addImage(image, 0);
            tracker.waitForID(0);
        }
        catch(InterruptedException evt)  
        {
            evt.printStackTrace();   
        }
    }

    public void paintComponent(Graphics g)
    {
        super.paintComponent(g);
        g.drawImage(jeopardy, 0, 0, null);
    }
}
  • 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-21T20:10:07+00:00Added an answer on May 21, 2026 at 8:10 pm

    The only thing I see is that it should be

    this.jeopardy = Toolkit.getDefaultToolkit().getImage("jeopardy.jpg");
    

    You’re just setting the method variable.

    Edit: Also you’re calling the null constructor. Make sure you call the right constructor for your panel.

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

Sidebar

Related Questions

So I've got a JPanel implementing MouseListener and MouseMotionListener : import javax.swing.*; import java.awt.*;
Take the following generics example import java.util.List; import java.util.ArrayList; public class GenericsTest { private
I have this simple Jsp page: <%@ page language=java import=java.awt.Color%> <% Color background =
I have a very simple Java RMI Server that looks like the following: import
import sys words = { 1 : 'one', 2 : 'two', 3 : 'three',
I need to import a csv file into Firebird and I've spent a couple
How can you import a foxpro DBF file in SQL Server?
I want to import an oracle dump into a different tablespace. I have a
How can you automatically import the latest build/revision number in subversion? The goal would
Are there any import and export tools that would let us move projects into

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.