Please help I am unable to do this and its due today 111416

Please help I am unable to do this and it\'s due today 11/14/16

Part2: .. max 41 points

Fig 1                                                                           Fig 2                  Fig 3

Above you can see how the finished gui should look like.

Fig 1 shows the gui when you first open the program. Clicking the Toggle button toggles the background between white and yellow. Clicking the Explode button explodes the ball. The explosion can happen with white or yellow background and the background color does not change during the explosion. After the explosion the toggling no longer works and nothing can bring back the ball.

Getting Started: .. max 8 pts

In package midterm2 create a class called ExerciseGui. It extends JFrame. .. 2 point

Set the size of the window to 500 x 600   .. 2 pts

Style: extract methods as you develop the gui to keep your code clear and easy to maintain .. 3 points use descriptive names for variables and methods .. 1 points

Heads up: When the gui opens It should displays the ball on white background.

Top: .. max 13 pts

Includes two buttons of equal size. One shows the test Toggle the other Explode .. 5 pts

Title text uses a larger font ( Tahoma size 18 )     .. 2 pts

The text color is white .. 2 pts

Title background color is a brown ( e.g. r: 102 g: 51 b: 0 )   .. 2 pts

There is a gap of size 5 between the two buttons. .. -2 points

Center: .. max 7 points

The center displays an image of a button   .. 5 pts

The initial background color should be white   .. 2 pts

Behavior: .. max 13 points

Clicking the toggle button switches the background color between white and yellow. ( 5 points )

Clicking the explode button changes the ball to an explosion. ( 5 points ) The background color remains unchanged by the explosion.

The ball can explode only once. Nothing can bring the ball back

Once the ball has been exploded the toggling should no longer work. (-3 points)

That means the background stays at whatever color it was at the time of the explosion

When you are done submit the code via Canvas, return this instruction sheet and sign out.

Toggle Explode

Solution

****program for gui when you first open the program. Clicking the Toggle button toggles the background between white and yellow. Clicking the Explode button explodes the ball. The explosion can happen with white or yellow background and the background color does not change during the explosion. After the explosion the toggling no longer works and nothing can bring back the ball.

SOLUTION::::

package midterm2; //** package name is midterm2 **//

import java.awt.BorderLayout; //** import package **//

import java.awt.EventQueue; //** import package **//

import javax.swing.JFrame; //** import package **//
import javax.swing.JPanel;   //** import package **//
import javax.swing.border.EmptyBorder; //** import package **//
import java.awt.FlowLayout;   //** import package **//
import java.awt.Color;   //** import package **//
import javax.swing.JToolBar;   //** import package **//
import java.awt.Button;   //** import package **//

import javax.swing.ImageIcon; //** import package **//
import javax.swing.JButton; //** import package **//
import javax.swing.JToggleButton;   //** import package **//
import java.awt.event.ActionListener; //** import package **//
import javax.swing.SwingConstants; //** import package **//
import javax.swing.UIManager; //** import package **//
import java.awt.Image; //** import package **//


public class ExerciseGui extends JFrame

{

   private JPanel contentPane;

   //** creating application.**//


   public static void main(String[] args)

{
       EventQueue.invokeLater(new Runnable()

{
           public void run()

{
               try

{
                   ExerciseGui frame = new ExerciseGui();
                   frame.setVisible(true);
               }

catch (Exception e)

{
                   e.printStackTrace();
               }
           }
       });
   }


   //*Create frame*//


   public ExerciseGui()

{
       setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       setBounds(100, 100, 500, 600);
       contentPane = new JPanel();
       contentPane.setForeground(new Color(160, 40, 40));
       contentPane.setBackground(Color.White);
       contentPane.setBorder(new EmptyBorder(4, 4, 4, 4));
       setContentPane(contentPane);
       contentPane.setLayout(new FlowLayout(FlowLayout.Center, 4, 4));
   }
  
   public void JToggleButton(String text)

{
       JToggleButton btnNewButton = new JToggleButton(\"Toggle\");
  
       contentPane.add(btnNewButton);
      
       JToggleButton button = new JToggleButton(\"click here for Explosion \");
  


       contentPane.add(button);
      
       ImageIcon iconDuke = new ImageIcon(ball);
       }
   }   

//** thank you **//

Please help I am unable to do this and it\'s due today 11/14/16 Part2: .. max 41 points Fig 1 Fig 2 Fig 3 Above you can see how the finished gui should look lik
Please help I am unable to do this and it\'s due today 11/14/16 Part2: .. max 41 points Fig 1 Fig 2 Fig 3 Above you can see how the finished gui should look lik
Please help I am unable to do this and it\'s due today 11/14/16 Part2: .. max 41 points Fig 1 Fig 2 Fig 3 Above you can see how the finished gui should look lik

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site