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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:25:07+00:00 2026-05-12T12:25:07+00:00

I have the following button in my swing interface private void solveButtonMouseClicked(java.awt.event.MouseEvent evt) {

  • 0

I have the following button in my swing interface

    private void solveButtonMouseClicked(java.awt.event.MouseEvent evt) {                                         


    step1(); 


}   

which calls step1();

   private void step1(){

//step 1 solving the white cross around the yellow middle
        while( (!(F2.getBackground().equals(white))) & (!(F4.getBackground().equals(white))) & (!(F6.getBackground().equals(white))) & (!(F8.getBackground().equals(white)))){


         textArea.append("cnt");

        //top three pieces solved
        if(F2.getBackground().equals(white) && F4.getBackground().equals(white) && F6.getBackground().equals(white)){
            //solve F8 
            while(!(F8.getBackground().equals(white))){

                //check right side
                if(R2.getBackground().equals(white)){right(); right(); downinv(); rightinv(); rightinv();}
                else if(R4.getBackground().equals(white)){rightinv(); downinv(); right();}
                else if(R6.getBackground().equals(white)){right(); downinv(); rightinv();}
                else if(R8.getBackground().equals(white)){downinv();}
                //check left side
                else if(L2.getBackground().equals(white)){left(); left(); down(); leftinv(); leftinv();}
                else if(L4.getBackground().equals(white)){leftinv(); down(); left();}
                else if(L6.getBackground().equals(white)){left(); down(); leftinv();}
                else if(L8.getBackground().equals(white)){down();}
                //check back side
                else if(B2.getBackground().equals(white)){back(); back(); down(); down();}
                else if(B4.getBackground().equals(white)){backinv(); down(); down();}
                else if(B6.getBackground().equals(white)){back(); down(); down();}
                else if(B8.getBackground().equals(white)){down(); down();}
                //check up side
                else if(U2.getBackground().equals(white)){frontinv(); up(); rightinv(); upinv();}
                else if(U4.getBackground().equals(white)){frontinv(); up(); up(); rightinv(); upinv(); upinv();}
                else if(U6.getBackground().equals(white)){frontinv(); rightinv();}
                else if(U8.getBackground().equals(white)){front();}
                //check down side
                else if(D2.getBackground().equals(white)){down(); frontinv(); right();}
                else if(D4.getBackground().equals(white)){front(); right();}
                else if(D6.getBackground().equals(white)){frontinv(); leftinv();}
                else if(D8.getBackground().equals(white)){downinv(); frontinv(); right();}
            }//end while
        }//end if

        //top two pieces solved
        if(F2.getBackground().equals(white) && F4.getBackground().equals(white)){
            //solve F6
            while(!(F6.getBackground().equals(white))){
                //chech front side
                if(F8.getBackground().equals(white)){front();}
                //check right side
                else if(R2.getBackground().equals(white)){frontinv(); up(); front();}
                else if(R4.getBackground().equals(white)){right(); frontinv(); up(); front();}
                else if(R6.getBackground().equals(white)){rightinv(); frontinv(); up(); front();}
                else if(R8.getBackground().equals(white)){right(); right(); frontinv(); up(); front();}
                //check left side
                else if(L2.getBackground().equals(white)){frontinv(); upinv(); front();}
                else if(L4.getBackground().equals(white)){frontinv(); left(); upinv(); leftinv(); front();}
                else if(L6.getBackground().equals(white)){frontinv(); leftinv(); upinv(); left(); front();}
                else if(L8.getBackground().equals(white)){frontinv(); left(); left(); upinv(); left(); left(); front();}
                //check back side
                else if(B2.getBackground().equals(white)){frontinv(); up(); up(); front();}
                else if(B4.getBackground().equals(white)){frontinv(); backinv(); up(); up(); front();}
                else if(B6.getBackground().equals(white)){frontinv(); back(); up(); up(); front();}
                else if(B8.getBackground().equals(white)){frontinv(); back(); back(); up(); up(); front();}
                //check up side
                else if(U2.getBackground().equals(white)){up();rightinv();upinv();}
                else if(U4.getBackground().equals(white)){up(); up();rightinv(); upinv(); upinv();}
                else if(U6.getBackground().equals(white)){rightinv();}
                else if(U8.getBackground().equals(white)){upinv(); rightinv(); up();}
                //check down side
                else if(D2.getBackground().equals(white)){down(); right();}
                else if(D4.getBackground().equals(white)){down(); down(); right();}
                else if(D6.getBackground().equals(white)){right();}
                else if(D8.getBackground().equals(white)){downinv(); right();}
            }//end while
            textArea.append("\nstep 1a (75% complete)\n");
        }//end if

        //top piece solved
        if( (F2.getBackground().equals(white)) && (!(F4.getBackground().equals(white))) ){
            //solve F4
            while(!(F4.getBackground().equals(white))){
                //check front side
                if(F6.getBackground().equals(white)){frontinv();}
                //check right side
                else if(R2.getBackground().equals(white)){front(); up(); frontinv();}
                else if(R4.getBackground().equals(white)){right(); front(); up(); frontinv();}
                else if(R6.getBackground().equals(white)){rightinv(); front(); up(); frontinv();}
                else if(R8.getBackground().equals(white)){right(); right(); front(); up(); frontinv();}
                //check left side
                else if(L2.getBackground().equals(white)){front(); upinv(); frontinv();}
                else if(L4.getBackground().equals(white)){front(); left(); upinv(); frontinv();}
                else if(L6.getBackground().equals(white)){front(); leftinv(); upinv(); frontinv();}
                else if(L8.getBackground().equals(white)){front(); left(); left(); upinv(); frontinv();}
                //check back side
                else if(B2.getBackground().equals(white)){front(); up(); up(); frontinv();}
                else if(B4.getBackground().equals(white)){front(); backinv(); up(); up(); frontinv();}
                else if(B6.getBackground().equals(white)){front(); back(); up(); up(); frontinv();}
                else if(B8.getBackground().equals(white)){front(); back(); back(); up(); up(); frontinv();}
                //check up side
                else if(U2.getBackground().equals(white)){front(); front(); up(); rightinv(); frontinv(); frontinv();}
                else if(U4.getBackground().equals(white)){left();}
                else if(U6.getBackground().equals(white)){front(); front(); rightinv(); frontinv(); frontinv();}
                else if(U8.getBackground().equals(white)){front(); front(); upinv(); rightinv(); frontinv(); frontinv();}
                //check down side
                else if(D2.getBackground().equals(white)){downinv(); leftinv();}
                else if(D4.getBackground().equals(white)){leftinv();}
                else if(D6.getBackground().equals(white)){downinv(); downinv(); leftinv();}
                else if(D8.getBackground().equals(white)){down(); leftinv();}
            }//end while
            textArea.append("\nstep 1a (50% complete)\n");
        }//end if

        if(!(F2.getBackground().equals(white))){ 
            //solve top piece

          while(!(F2.getBackground().equals(white))){
                if(F4.getBackground().equals(white)){front();}
                else if(F6.getBackground().equals(white)){frontinv();}
                else if(F8.getBackground().equals(white)){front(); front();}
                //check right side
                else if(R2.getBackground().equals(white)){up();}
                else if(R4.getBackground().equals(white)){right(); up();}
                else if(R6.getBackground().equals(white)){rightinv(); up();}
                else if(R8.getBackground().equals(white)){right(); right(); up();}
                //check left side
                else if(L2.getBackground().equals(white)){upinv();}
                else if(L4.getBackground().equals(white)){left(); up();}
                else if(L6.getBackground().equals(white)){leftinv(); up();}
                else if(L8.getBackground().equals(white)){left(); left(); upinv();}
                //check back side
                else if(B2.getBackground().equals(white)){up(); up();}
                else if(B4.getBackground().equals(white)){backinv(); up(); up();}
                else if(B6.getBackground().equals(white)){back(); up(); up();}
                else if(B8.getBackground().equals(white)){back(); back(); up(); up();}
                //check up side
                else if(U2.getBackground().equals(white)){up(); rightinv(); frontinv();}
                else if(U4.getBackground().equals(white)){up(); up(); rightinv(); frontinv();}
                else if(U6.getBackground().equals(white)){rightinv();frontinv();}
                else if(U8.getBackground().equals(white)){upinv(); rightinv(); frontinv();}
                //check down side
                else if(D2.getBackground().equals(white)){down(); right(); frontinv();}
                else if(D4.getBackground().equals(white)){down(); down(); right(); frontinv();}
                else if(D6.getBackground().equals(white)){right(); frontinv();}
                else if(D8.getBackground().equals(white)){downinv(); right(); frontinv();}


           }//end while
           textArea.append("\nStep 1a (25% complete)\n");
        }//end else
    }//end while
}//end step 1

The problem seems to be the outermost while loop in step1(). It is supposed to keep running until all the condition are met but it just stops after one iteration and I can’t figure out why. If I remove the outer while loop step1() proceeds exactly as it should going through each step on multiple presses of the button. Help!

  • 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-12T12:25:07+00:00Added an answer on May 12, 2026 at 12:25 pm

    You mention that you want to keep looping until all the comparisons are true.

    The way it’s coded now will drop out of the loop if any condition becomes true.

    Rather than

    while ( !boolean1 && !boolean2 && !boolean3) {
    

    Try

    while ( ! (boolean1 && boolean2 && boolean3) ) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 191k
  • Answers 191k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I might be tempted to make the API explicit and… May 12, 2026 at 6:10 pm
  • Editorial Team
    Editorial Team added an answer This is going to sound odd, but you need to… May 12, 2026 at 6:10 pm
  • Editorial Team
    Editorial Team added an answer Yes, if you open d3d9.h you will see # include… May 12, 2026 at 6:10 pm

Related Questions

I had a huge file for creating this GUI and I have shortened it
I have the following button style in Themes/Generic.xaml and I want it to apply
I am trying to make a UIButton that grows when pressed. Currently i have
I have the following code in my aspx page: <asp:Button runat=server ID=myButton Text=hello />

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.