Question

In: Computer Science

In Java Develop, test, and execute a graphics application for simulations using Java. Create a Java...

In Java

  1. Develop, test, and execute a graphics application for simulations using Java.
  2. Create a Java application.
  3. Given a set of events, choose the resulting programming actions.
  4. Understand the principles behind Java.
  5. Understand the basic principles of object-oriented programming including classes and inheritance.

Deliverables

  • .java files as requested below.

Requirements

  1. Create all the panels.
  2. Create the navigation between them.
    1. Start navigation via the intro screen.
    2. The user makes a confirmation to enter the main panel.
    3. The user goes to the main panel and from the main panel the user can go to each game panel and back to the main panel.
    4. The user can go to the game over panel.
  3. Many panels will be very simple at the beginning, playing just the role of a placeholder.
    1. For instance, game 1 might just a panel with a button saying "game 1 will be here" and a button to go back to the main map.

Solutions

Expert Solution

Sample Output:

Code to Copy:

Intro.java

// import the necessary package.
import javax.swing.*;
import java.awt.event.*;

// Declare the class.
public class Intro extends JPanel {

   static JFrame frame;

   // Declare the constructor.
   public Intro() {
       initComponents();
   }

   @SuppressWarnings("unchecked")
  
   // declare method.
   private void initComponents() {

       jLabel1 = new JLabel();
       mainMap = new JButton();
       options = new JButton();
       instructions = new JButton();
       credits = new JButton();
      
       // Display text message.
       jLabel1.setText("Welcome to Game");

       // Set the text.
       mainMap.setText("Main Map");
      
       // Action listener to the main Map
       mainMap.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               mainMapActionPerformed(evt);
           }
       });
      
       // set the text and call the action listener
       options.setText("Options");
       options.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               optionsActionPerformed(evt);
           }
       });
      
       // set the text and call the action listener
       instructions.setText("Instructions");
       instructions.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               instructionsActionPerformed(evt);
           }
       });
      
       // set the text and call the action listener
       credits.setText("Credits");
       credits.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               creditsActionPerformed(evt);
           }
       });
      
       // Set the layout of the panel.
       GroupLayout layout = new GroupLayout(this);
       this.setLayout(layout);
       layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
               .addGroup(layout.createSequentialGroup()
                       .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                               .addGroup(layout.createSequentialGroup().addGap(157, 157, 157).addComponent(jLabel1))
                               .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(mainMap)
                                       .addGap(37, 37, 37).addComponent(options).addGap(35, 35, 35)
                                       .addComponent(instructions).addGap(39, 39, 39).addComponent(credits)))
               .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
       layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
               .addGroup(layout.createSequentialGroup().addGap(45, 45, 45).addComponent(jLabel1).addGap(52, 52, 52)
                       .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(mainMap)
                               .addComponent(options).addComponent(instructions).addComponent(credits))
               .addContainerGap(36, Short.MAX_VALUE)));
   }
  
   // Definition of the method.
   private void mainMapActionPerformed(ActionEvent evt) {
      
       Intro.frame.dispose();
       new MainMap(Intro.frame);
   }
  
   // definition of the method.
   private void creditsActionPerformed(ActionEvent evt) {
       Intro.frame.dispose();
       new CreditsPanel(Intro.frame);

   }
  
   // definition of the method.
   private void instructionsActionPerformed(ActionEvent evt) {
       Intro.frame.dispose();
       new InstructionsPanel(Intro.frame);
   }
  
   // definition of the method.
   private void optionsActionPerformed(ActionEvent evt) {
       Intro.frame.dispose();
       new OptionsPanel(Intro.frame);
   }

   // Start the main method.
   public static void main(String[] args) {
       frame = new JFrame();
       frame.setContentPane(new Intro());
       frame.setSize(500, 200);
       frame.setLocationRelativeTo(null);
       frame.setVisible(true);
       frame.setTitle("Game Introduction");
       frame.setResizable(false);
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   }

   // declare variables.
   private JButton credits;
   private JButton instructions;
   private JLabel jLabel1;
   private JButton mainMap;
   private JButton options;
}

MainMap.java

//import the necessary package.
import javax.swing.*;
import java.awt.event.*;

//Declare the class.
public class MainMap extends JPanel {

   JFrame introScreen;
   JFrame frame;

   // Declare the constructor.
   public MainMap(JFrame introScreen) {
       this.introScreen = introScreen;
       frame = new JFrame();
       frame.setContentPane(this);
       frame.setSize(500, 200);
       frame.setLocationRelativeTo(null);
       frame.setVisible(true);
       frame.setTitle("Main Game");
       frame.setResizable(false);
       frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
       initComponents();
   }

   @SuppressWarnings("unchecked")
   // declare method.
   private void initComponents() {

       jButton1 = new JButton();
       jButton2 = new JButton();
       jButton3 = new JButton();
       jButton5 = new JButton();
       jButton6 = new JButton();

       // Set the text and call the action listener
       jButton1.setText("Game 1");
       jButton1.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               jButton1ActionPerformed(evt);
           }
       });
      
       // Set the text and call the action listener
       jButton2.setText("Game 2");
       jButton2.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               jButton2ActionPerformed(evt);
           }
       });

       // Set the text and call the action listener
       jButton3.setText("Game 3");
       jButton3.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {

               jButton3ActionPerformed(evt);
           }
       });

       // Set the text and call the action listener
       jButton5.setText("Go Home");
       jButton5.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               jButton5ActionPerformed(evt);
           }
       });

       // Set the text and call the action listener
       jButton6.setText("Game Over");
       jButton6.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               jButton6ActionPerformed(evt);
           }
       });

       // Set the layout of the panel.
       GroupLayout layout = new GroupLayout(this);
       this.setLayout(layout);
       layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
               .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jButton1)
                       .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                       .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                               .addGroup(layout.createSequentialGroup().addComponent(jButton5).addGap(35, 35, 35)
                                       .addComponent(jButton6).addGap(0, 0, Short.MAX_VALUE))
                               .addGroup(layout.createSequentialGroup().addComponent(jButton2).addGap(18, 18, 18)
                                       .addComponent(jButton3).addGap(18, 18, 18)
                                       .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,
                                               GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
               .addContainerGap()));
       layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
               .addGroup(layout.createSequentialGroup().addGap(80, 80, 80)
                       .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                               .addComponent(jButton1).addComponent(jButton2).addComponent(jButton3))
               .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
               .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(jButton5)
                       .addComponent(jButton6)).addContainerGap(44, Short.MAX_VALUE)));
   }

   // Definition of the method.
   private void jButton1ActionPerformed(ActionEvent evt) {
      
       frame.setVisible(false);
       new Game1(frame);
   }

   // Definition of the method.
   private void jButton5ActionPerformed(ActionEvent evt) {
      
       frame.dispose();
       introScreen.setVisible(true);
   }

   // Definition of the method.
   private void jButton2ActionPerformed(ActionEvent evt) {
      
       frame.setVisible(false);
       new Game2(frame);
   }

   // Definition of the method.
   private void jButton3ActionPerformed(ActionEvent evt) {
  
       frame.setVisible(false);
       new Game3(frame);
   }

   // Definition of the method.
   private void jButton6ActionPerformed(ActionEvent evt) {
       frame.setVisible(false);
       new GameOver(frame);
   }

   // Declare variables.
   private JButton jButton1;
   private JButton jButton2;
   private JButton jButton3;
   private JButton jButton5;
   private JButton jButton6;
}

Game1.java


//import the necessary package.
import javax.swing.*;
import java.awt.event.*;

public class Game1 extends JPanel {

   JFrame mainFrame;
   JFrame frame;

   // Declare the constructor.
   public Game1(JFrame mainFrame) {
       this.mainFrame = mainFrame;
       frame = new JFrame();
       frame.setContentPane(this);
       frame.setSize(300, 200);
       frame.setLocationRelativeTo(null);
       frame.setVisible(true);
       frame.setTitle("Game 1");
       frame.setResizable(false);
       frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
       initComponents();
   }

   @SuppressWarnings("unchecked")
  
   private void initComponents() {

       jButton1 = new JButton();
       jLabel1 = new JLabel();
      
       // Set the text and call the action listener
       jButton1.setText("Main Map");
       jButton1.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               jButton1ActionPerformed(evt);
           }
       });

       jLabel1.setText("Game 1 will be here");

       // Set the layout of the panel.
       GroupLayout layout = new GroupLayout(this);
       this.setLayout(layout);
       layout.setHorizontalGroup(
               layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                       .addGroup(layout.createSequentialGroup()
                               .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                       .addGroup(layout.createSequentialGroup().addGap(58, 58, 58)
                                               .addComponent(jButton1))
                       .addGroup(layout.createSequentialGroup().addGap(47, 47, 47).addComponent(jLabel1)))
               .addContainerGap(260, Short.MAX_VALUE)));
       layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
               .addGroup(layout.createSequentialGroup().addGap(44, 44, 44).addComponent(jLabel1).addGap(33, 33, 33)
                       .addComponent(jButton1).addContainerGap(186, Short.MAX_VALUE)));
   }

   // Definition of the method.
   private void jButton1ActionPerformed(ActionEvent evt) {
       frame.dispose();
       mainFrame.setVisible(true);
   }

   // Declare variables.
   private JButton jButton1;
   private JLabel jLabel1;
  
}

Game2.java

//import the necessary package.
import javax.swing.*;
import java.awt.event.*;

public class Game2 extends JPanel {

   JFrame mainFrame;
   JFrame frame;

   // Declare the constructor.
   public Game2(JFrame mainFrame) {
       this.mainFrame = mainFrame;
       frame = new JFrame();
       frame.setContentPane(this);
       frame.setSize(300, 200);
       frame.setLocationRelativeTo(null);
       frame.setVisible(true);
       frame.setTitle("Game 2");
       frame.setResizable(false);
       frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
       initComponents();
   }

   @SuppressWarnings("unchecked")
  
   private void initComponents() {

       jButton1 = new JButton();
       jLabel1 = new JLabel();

       // Set the text and call the action listener
       jButton1.setText("Main Map");
       jButton1.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               jButton1ActionPerformed(evt);
           }
       });

       jLabel1.setText("Game 2 will be here");
      
       // Set the layout of the panel.
       GroupLayout layout = new GroupLayout(this);
       this.setLayout(layout);
       layout.setHorizontalGroup(
               layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                       .addGroup(layout.createSequentialGroup()
                               .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                       .addGroup(layout.createSequentialGroup().addGap(58, 58, 58)
                                               .addComponent(jButton1))
                       .addGroup(layout.createSequentialGroup().addGap(47, 47, 47).addComponent(jLabel1)))
               .addContainerGap(260, Short.MAX_VALUE)));
       layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
               .addGroup(layout.createSequentialGroup().addGap(44, 44, 44).addComponent(jLabel1).addGap(33, 33, 33)
                       .addComponent(jButton1).addContainerGap(186, Short.MAX_VALUE)));
   }

   // Definition of the method.
   private void jButton1ActionPerformed(ActionEvent evt) {

       frame.dispose();
       mainFrame.setVisible(true);
   }
   // Declare variables.
   private JButton jButton1;
   private JLabel jLabel1;

}

Game3.java


//import the necessary package.
import javax.swing.*;
import java.awt.event.*;

public class Game3 extends JPanel {

   JFrame mainFrame;
   JFrame frame;

   // Declare the constructor.
   public Game3(JFrame mainFrame) {
       this.mainFrame = mainFrame;
       frame = new JFrame();
       frame.setContentPane(this);
       frame.setSize(300, 200);
       frame.setLocationRelativeTo(null);
       frame.setVisible(true);
       frame.setTitle("Game 3");
       frame.setResizable(false);
       frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
       initComponents();
   }

   private void initComponents() {

       jButton1 = new JButton();
       jLabel1 = new JLabel();

       // Set the text and call the action listener
       jButton1.setText("Main Map");
       jButton1.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               jButton1ActionPerformed(evt);
           }
       });

       jLabel1.setText("Game 3 will be here");

       // Set the layout of the panel.
       GroupLayout layout = new GroupLayout(this);
       this.setLayout(layout);
       layout.setHorizontalGroup(
               layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                       .addGroup(layout.createSequentialGroup()
                               .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                       .addGroup(layout.createSequentialGroup().addGap(58, 58, 58)
                                               .addComponent(jButton1))
                       .addGroup(layout.createSequentialGroup().addGap(47, 47, 47).addComponent(jLabel1)))
               .addContainerGap(260, Short.MAX_VALUE)));
       layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
               .addGroup(layout.createSequentialGroup().addGap(44, 44, 44).addComponent(jLabel1).addGap(33, 33, 33)
                       .addComponent(jButton1).addContainerGap(186, Short.MAX_VALUE)));
   }

   // Definition of the method.
   private void jButton1ActionPerformed(ActionEvent evt) {

       frame.dispose();
       mainFrame.setVisible(true);
   }

   // Declare variables.
   private JButton jButton1;
   private JLabel jLabel1;
}

GameOver.java


//import the necessary package.
import javax.swing.*;
import java.awt.event.*;

public class GameOver extends JPanel {

   JFrame mainFrame;
   JFrame frame;

   // Declare the constructor.
   public GameOver(JFrame mainFrame) {
       this.mainFrame = mainFrame;
       frame = new JFrame();
       frame.setContentPane(this);
       frame.setSize(300, 200);
       frame.setLocationRelativeTo(null);
       frame.setVisible(true);
       frame.setTitle("Game 1");
       frame.setResizable(false);
       frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
       initComponents();
   }


   private void initComponents() {

       jButton1 = new JButton();
       jLabel1 = new JLabel();
      
       // Set the text and call the action listener
       jButton1.setText("Main Map");
       jButton1.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               jButton1ActionPerformed(evt);
           }
       });

       jLabel1.setText("Game Over Panel");

       // Set the layout of the panel.
       GroupLayout layout = new GroupLayout(this);
       this.setLayout(layout);
       layout.setHorizontalGroup(
               layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                       .addGroup(layout.createSequentialGroup()
                               .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                       .addGroup(layout.createSequentialGroup().addGap(58, 58, 58)
                                               .addComponent(jButton1))
                       .addGroup(layout.createSequentialGroup().addGap(47, 47, 47).addComponent(jLabel1)))
               .addContainerGap(265, Short.MAX_VALUE)));
       layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
               .addGroup(layout.createSequentialGroup().addGap(44, 44, 44).addComponent(jLabel1).addGap(33, 33, 33)
                       .addComponent(jButton1).addContainerGap(186, Short.MAX_VALUE)));
   }

   // Definition of the method.
   private void jButton1ActionPerformed(ActionEvent evt) {
       frame.dispose();
       mainFrame.setVisible(true);
   }

   // Declare variables.
   private JButton jButton1;
   private JLabel jLabel1;
  
}

OptionsPanel.Java


//import the necessary package.
import javax.swing.*;
import java.awt.event.*;

public class OptionsPanel extends JPanel {

   JFrame introScreen;
   JFrame frame;

   // Declare the constructor.
   public OptionsPanel(JFrame introScreen) {
       this.introScreen = introScreen;
       frame = new JFrame();
       frame.setContentPane(this);
       frame.setSize(300, 200);
       frame.setLocationRelativeTo(null);
       frame.setVisible(true);
       frame.setTitle("Game Options");
       frame.setResizable(false);
       frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
       initComponents();
   }

  
   private void initComponents() {

       jLabel1 = new JLabel();
       jButton1 = new JButton();

       jLabel1.setText("Options Screen");

       // Set the text and call the action listener
       jButton1.setText("Go Home");
       jButton1.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               jButton1ActionPerformed(evt);
           }
       });

       // Set the layout of the panel.
       GroupLayout layout = new GroupLayout(this);
       this.setLayout(layout);
       layout.setHorizontalGroup(
               layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                       .addGroup(
                               layout.createSequentialGroup().addGap(99, 99, 99)
                                       .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                               .addGroup(layout.createSequentialGroup().addGap(15, 15, 15)
                                                       .addComponent(jLabel1))
                                               .addComponent(jButton1))
                                       .addContainerGap(213, Short.MAX_VALUE)));
       layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
               .addGroup(layout.createSequentialGroup().addGap(60, 60, 60).addComponent(jLabel1).addGap(18, 18, 18)
                       .addComponent(jButton1).addContainerGap(185, Short.MAX_VALUE)));
   }

   // Definition of the method.
   private void jButton1ActionPerformed(ActionEvent evt) {
       frame.dispose();
       introScreen.setVisible(true);
   }

   // Declare variables.
   private JButton jButton1;
   private JLabel jLabel1;
  
}

InstructionsPanel.java


//import the necessary package.
import javax.swing.*;
import java.awt.event.*;
public class InstructionsPanel extends JPanel {

   JFrame introScreen;
   JFrame frame;

   // Declare the constructor.
   public InstructionsPanel(JFrame introScreen) {
       this.introScreen = introScreen;
       frame = new JFrame();
       frame.setContentPane(this);
       frame.setSize(300, 200);
       frame.setLocationRelativeTo(null);
       frame.setVisible(true);
       frame.setTitle("Game Instructions");
       frame.setResizable(false);
       frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
       initComponents();
   }

  
   private void initComponents() {

       jButton1 = new JButton();
       jLabel1 = new JLabel();

       // Set the text and call the action listener
       jButton1.setText("Go Home");
       jButton1.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               jButton1ActionPerformed(evt);
           }
       });

       jLabel1.setText("Instructions");

       // Set the layout of the panel.
       GroupLayout layout = new GroupLayout(this);
       this.setLayout(layout);
       layout.setHorizontalGroup(
               layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                       .addGroup(layout.createSequentialGroup().addGap(97, 97, 97)
                               .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                       .addComponent(jButton1).addGroup(layout.createSequentialGroup()
                                               .addGap(19, 19, 19).addComponent(jLabel1)))
               .addContainerGap(100, Short.MAX_VALUE)));
       layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
               .addGroup(layout.createSequentialGroup().addGap(55, 55, 55).addComponent(jLabel1).addGap(42, 42, 42)
                       .addComponent(jButton1).addContainerGap(69, Short.MAX_VALUE)));
   }

   // Definition of the method.
   private void jButton1ActionPerformed(ActionEvent evt) {
      
       frame.dispose();
       introScreen.setVisible(true);
   }

   // Declare variables.
   private JButton jButton1;
   private JLabel jLabel1;
}

CreditsPanel.java


//import the necessary package.
import javax.swing.*;
import java.awt.event.*;

public class CreditsPanel extends JPanel {

   JFrame introScreen;
   JFrame frame;

   // Declare the constructor.
   public CreditsPanel(JFrame introScreen) {
       this.introScreen = introScreen;
       frame = new JFrame();
       frame.setContentPane(this);
       frame.setSize(300, 200);
       frame.setLocationRelativeTo(null);
       frame.setVisible(true);
       frame.setTitle("Game Credits");
       frame.setResizable(false);
       frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
       initComponents();
   }

   @SuppressWarnings("unchecked")
   private void initComponents() {

       jLabel1 = new JLabel();
       jButton1 = new JButton();

      
       jLabel1.setText(" Game Credits");
       // Set the text and call the action listener
       jButton1.setText("Go Home");
       jButton1.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               jButton1ActionPerformed(evt);
           }
       });

       // Set the layout of the panel.
       GroupLayout layout = new GroupLayout(this);
       this.setLayout(layout);
       layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
               .addGroup(layout.createSequentialGroup().addGap(109, 109, 109)
                       .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                               .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 82,
                                       GroupLayout.PREFERRED_SIZE)
                               .addComponent(jButton1))
                       .addContainerGap(91, Short.MAX_VALUE)));
       layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
               .addGroup(layout.createSequentialGroup().addGap(37, 37, 37)
                       .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 44,
                               GroupLayout.PREFERRED_SIZE)
                       .addGap(18, 18, 18).addComponent(jButton1).addContainerGap(44, Short.MAX_VALUE)));
   }

   // Definition of the method.
   private void jButton1ActionPerformed(ActionEvent evt) {
       frame.dispose();
       introScreen.setVisible(true);
   }

   // Declare variables.
   private JButton jButton1;
   private JLabel jLabel1;
}


Related Solutions

Create a java Swing GUI application that presents the user with a “fortune”. Create a java...
Create a java Swing GUI application that presents the user with a “fortune”. Create a java Swing GUI application in a new Netbeans project called FortuneTeller. Your project will have a FortuneTellerFrame.java class (which inherits from JFrame) and a java main class: FortuneTellerViewer.java. Your application should have and use the following components: Top panel: A JLabel with text “Fortune Teller” (or something similar!) and an ImageIcon. Find an appropriate non-commercial Fortune Teller image for your ImageIcon. (The JLabel has a...
Develop a Java application using Parboiled library to write aparser for a customer form. Your...
Develop a Java application using Parboiled library to write a parser for a customer form. Your program should include a grammar for the parser and display the parse tree with no errors.The customer form should include the following structure:First name, middle name (optional), last nameStreet address, city, state (or province), countryPhone numberRules• First name, middle name and last name should start with an uppercase letter followed by lower case letters. Middle name is an optional input meaning such an input...
Create a project plan on the game or application you are creating. Using java programming. The...
Create a project plan on the game or application you are creating. Using java programming. The project plan should include the following: A description of the game or application The IDE or game engine your plan to use to create the game or app and information on how you are going to develop the game or app If you choose to create a game, how are you going to approach the game design and game development process or if you...
***IN C# ONLY, USING WINDOWS FORMS*** --NO JAVA--. Create a GUI application in C# that calculates...
***IN C# ONLY, USING WINDOWS FORMS*** --NO JAVA--. Create a GUI application in C# that calculates and displays the total travel expenses of a business person on a trip. Here is the information that the user must provide: • Number of days on the trip • Amount of airfare, if any • Amount of car rental fees, if any • Number of miles driven, if a private vehicle was used • Amount of parking fees, if any • Amount of...
Using Java create an application that will read a tab-delimited file that displays the MLB standings...
Using Java create an application that will read a tab-delimited file that displays the MLB standings Below: League AL East Tampa Bay 37 20 NY Yankees 32 24 Toronto 29 27 Baltimore 23 33 Boston 22 34 League AL Central Minnesota 35 22 Chi White Sox 34 23 Cleveland 33 24 Kansas City 23 33 Detroit 22 32 League AL West Oakland 34 21 Houston 28 28 LA Angels 26 31 Seattle 25 31 Texas 19 37 League NL East...
Java Please comment code Create an Interactive JavaFX Application Create an application with the following controls:...
Java Please comment code Create an Interactive JavaFX Application Create an application with the following controls: A Label control with the following text displayed: "First Number:" A Label control with the following text displayed: "Second Number:" An empty TextField control beside the First Number label. An empty TextField control beside the Second Number label. Five buttons: Button 1 labeled + Button 2 labeled - Button 3 labeled * Button 4 labeled / Button 5 labeled = An empty Label control...
Develop a Java application which implements an application for a store chain that has three types...
Develop a Java application which implements an application for a store chain that has three types of stores which are Book, Music, and Movie stores. Your application should have an Item abstract class which should be extended by the Book and Multimedia classes. Item class has abstract priceAfterTax method, you need to implement this method in derived classes. Multimedia class is a superclass for Music and Movie classes. Your project should also include the IPromotion interface, which should be implemented...
Using any existing 2D or 3D graphics library ( Java 2D, Java 3D, draw a scene...
Using any existing 2D or 3D graphics library ( Java 2D, Java 3D, draw a scene within one of the following categories: Satire or humor Promote a cause You are free to create whatever you choose but it must conform to the following guidelines.   Show evidence of at least four colors. Have a textual composition on the finished product. Imagery or images Scene composition of at least six (6) elements One of the following 1) Shadows or Glows. May be...
Create a Java application that will exhibit concurrency concepts. Your application should create two threads that will act as counters.
JAVACreate a Java application that will exhibit concurrency concepts. Your application should create two threads that will act as counters. One thread should count up to 20. Once thread one reaches 20, then a second thread should be used to count down to 0.
Develop a Java application that determines the gross pay for each of three employees.
(Salary Calculator) Develop a Java application that determines the gross pay for each of three employees. The company pays straight time for the first 40 hours worked by each employee and time and a half for all hours worked in excess of 40. You’re given a list of the employees, their number of hours worked last week and their hourly rates. Your program should input this information for each employee, then determine and display the employee’s gross pay. Use class...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT