From a11239213ba953587dddd771b11bb9a85c01d186 Mon Sep 17 00:00:00 2001 From: prashantmore277 Date: Fri, 2 Oct 2020 17:08:36 +0530 Subject: [PATCH] Fixed bugs --- Puzzle Game/puzzleGame.java | 40 ++++++++++++++++++++++++++++++++----- README.md | 5 +++++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/Puzzle Game/puzzleGame.java b/Puzzle Game/puzzleGame.java index 5195b9c..684d800 100644 --- a/Puzzle Game/puzzleGame.java +++ b/Puzzle Game/puzzleGame.java @@ -1,10 +1,12 @@ + + import java.awt.*;   import javax.swing.*;   import java.awt.event.*;   public class puzzle extends JFrame implements ActionListener{   JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,next;   puzzle(){   -super("Puzzle Game by rahulhgdev");   +super("Puzzle Game - JavaTpoint");    b1=new JButton("1");    b2=new JButton(" ");    b3=new JButton("3");   @@ -20,16 +22,21 @@ b2.setBounds(70,30,50,40);   b3.setBounds(130,30,50,40);   b4.setBounds(10,80,50,40);   -b5.setBounds(70,800,50,40);   +b5.setBounds(70,80,50,40);   b6.setBounds(130,80,50,40);   -b7.setBounds(10,130,500,40);   +b7.setBounds(10,130,50,40);   b8.setBounds(70,130,50,40);   b9.setBounds(130,130,50,40);   next.setBounds(70,200,100,40);        -add(b1);add(b2);add(b3);add(b4).  +add(b1);add(b2);add(b3);add(b4);add(b5);add(b6);add(b7);add(b8);add(b9); add(next);   b1.addActionListener(this);   -b2.addActionListener(this);    +b2.addActionListener(this);   +b3.addActionListener(this);   +b4.addActionListener(this);   +b5.addActionListener(this);   +b6.addActionListener(this);   +b7.addActionListener(this);   b8.addActionListener(this);   b9.addActionListener(this);   next.addActionListener(this);   @@ -88,6 +95,29 @@ else if(b8.getLabel().equals(" ")){ b8.setLabel(s); b5.setLabel(" ");}    }//end of if      +if(e.getSource()==b6){   +   +String s=b6.getLabel();   +if(b9.getLabel().equals(" ")){ b9.setLabel(s); b6.setLabel(" ");}   +else if(b3.getLabel().equals(" ")){ b3.setLabel(s); b6.setLabel(" ");}   +else if(b5.getLabel().equals(" ")){ b5.setLabel(s); b6.setLabel(" ");}   +   + }//end of if   +   +if(e.getSource()==b7){   +String s=b7.getLabel();   +if(b4.getLabel().equals(" ")){ b4.setLabel(s); b7.setLabel(" ");}   +else if(b8.getLabel().equals(" ")){ b8.setLabel(s); b7.setLabel(" ");}   +   + }//end of if   +   +if(e.getSource()==b8){   +String s=b8.getLabel();   +if(b7.getLabel().equals(" ")){ b7.setLabel(s); b8.setLabel(" ");}   +else if(b9.getLabel().equals(" ")){ b9.setLabel(s); b8.setLabel(" ");}   +else if(b5.getLabel().equals(" ")){ b5.setLabel(s); b8.setLabel(" ");}   +   + }//end of if      if(e.getSource()==b9){   String s=b9.getLabel();   diff --git a/README.md b/README.md index 9ca08be..bb92509 100644 --- a/README.md +++ b/README.md @@ -1 +1,6 @@ # Puzzle-Game-In-Java- + +UserName: prashantmore277 +Name : Prashant More + +- I fixed some major issues.