Hello! I would like to ask for help. Whenever I compile this code, an error appears.
constructor wait in class DealOrNoDeal.wait cannot be applied to given types;
required: no arguments
found: <null>
reason: actual and formal argument lists differ in length
4 errors
I'm really sorry because the code is messy but I hope that I can get an idea on how to fix this. Thank you!
The error started in this part:
public void displayGif()
{
this.clickable = false;
this.briefcase[this.clickedCase].setVisible(false);
this.gifs.setIcon(this.openingCaseIcon[(this.clickedCase - 1)]);
this.gifs.setVisible(true);
this.opening = true;
this.revealing = false;
this.banker = false;
this.banker2 = false;
this.last = false;
this.timer = new Timer();
this.timer.schedule(new DealOrNoDeal.wait(null), 4000L); //<--- error1
}
public void banker()
{
this.clickable = false;
this.offer = 0.0D;
int x = 0;
for (int i = 0; i < 25; i++)
{
if (this.prize[i].getIcon() == this.prizeIcon[i][0])
{
this.offer += this.originalPrize[i];
x++;
}
}
this.offer = (this.offer / x * this.roundNumber / 10.0D);
this.offerString = Integer.toString((int)Math.round(this.offer));
switch (this.offerString.length())
{
case 5:
case 6:
this.offerString = (Integer.toString((int)Math.round(this.offer / 1000.0D)) + ",000");
break;
case 4:
this.offerString = (Integer.toString((int)Math.round(this.offer / 100.0D)).substring(0, 1) + "," + Integer.toString((int)Math.round(this.offer / 100.0D)).substring(1, 2) + "00");
break;
case 3:
this.offerString = (Integer.toString((int)Math.round(this.offer / 10.0D)) + "0");
}
this.messageBox.setIcon(this.messageBoxIcon[8]);
this.bankerIcon = new ImageIcon(Toolkit.getDefaultToolkit().getImage("D://callingBanker.gif"));
this.gifs.setIcon(this.bankerIcon);
this.gifs.setVisible(true);
this.opening = false;
this.revealing = false;
this.banker = true;
this.banker2 = false;
this.last = false;
this.timer = new Timer();
this.timer.schedule(new DealOrNoDeal.wait(null), 7500L); //<--error2
}
public void lastCase()
{
this.displayOffer.setVisible(false);
this.button[1].setVisible(false);
this.button[2].setVisible(false);
this.button[4].setVisible(true);
this.button[5].setVisible(true);
this.gifs.setIcon(this.keepOrSwitchIcon);
this.messageBox.setIcon(this.messageBoxIcon[10]);
}
public void deal()
{
this.winnings = this.offerString;
this.displayWinnings.setText("<html><body><p style=\"font-size:50px;color:black;font-family:Cambria\">$" + this.winnings + "</p></body></html>");
this.displayWinnings.setHorizontalAlignment(0);
this.displayWinningsScreen.setVisible(true);
this.displayWinnings.setVisible(true);
this.button[3].setVisible(true);
}
public void noDeal()
{
switch (this.roundNumber)
{
case 1:
this.messageBoxState = 5;
break;
case 2:
this.messageBoxState = 4;
break;
case 3:
this.messageBoxState = 3;
break;
case 4:
this.messageBoxState = 2;
break;
case 9:
this.lastCase = true;
case 5:
case 6:
case 7:
case 8:
default:
this.messageBoxState = 1;
}
if (this.lastCase)
{
lastCase();
}
else
{
this.messageBox.setIcon(this.messageBoxIcon[this.messageBoxState]);
this.roundNumber += 1;
this.displayOffer.setVisible(false);
this.button[1].setVisible(false);
this.button[2].setVisible(false);
this.gifs.setVisible(false);
this.clickable = true;
}
}
public void keepCase()
{
this.clickable = false;
this.button[4].setVisible(false);
this.button[5].setVisible(false);
for (this.clickedCase = 1; this.clickedCase < 25; this.clickedCase += 1) {
if (this.briefcase[this.clickedCase].getY() == 473)
{
this.gifs.setIcon(this.openingCaseIcon[(this.clickedCase - 1)]);
break;
}
}
this.opening = true;
this.revealing = false;
this.banker = false;
this.banker2 = false;
this.last = false;
this.timer = new Timer();
this.timer.schedule(new DealOrNoDeal.wait(null), 4000L); //<--error3
}
public void switchCase()
{
this.clickable = false;
this.button[4].setVisible(false);
this.button[5].setVisible(false);
for (this.clickedCase = 1; this.clickedCase < 25; this.clickedCase += 1) {
if ((this.briefcase[this.clickedCase].isVisible()) && (this.briefcase[this.clickedCase].getY() != 473))
{
this.gifs.setIcon(this.openingCaseIcon[(this.clickedCase - 1)]);
break;
}
}
this.opening = true;
this.revealing = false;
this.banker = false;
this.banker2 = false;
this.last = false;
this.timer = new Timer();
this.timer.schedule(new DealOrNoDeal.wait(null), 4000L); //<--error4
}
private class wait extends TimerTask
{
private wait() {}
public void run()
{
if (DealOrNoDeal.this.opening)
{
for (double x : DealOrNoDeal.this.originalPrize) {
if (DealOrNoDeal.this.prizes[(DealOrNoDeal.this.clickedCase - 1)] == x) {
for (int y = 0; y < 26; y++) {
if (DealOrNoDeal.this.prizes[(DealOrNoDeal.this.clickedCase - 1)] == DealOrNoDeal.this.originalPrize[y])
{
DealOrNoDeal.this.offer = x;
DealOrNoDeal.this.gifs.setIcon(DealOrNoDeal.this.revealingPrizeIcon[y]);
}
}
}
}
DealOrNoDeal.this.opening = false;
DealOrNoDeal.this.revealing = true;
DealOrNoDeal.this.banker = false;
DealOrNoDeal.this.banker2 = false;
DealOrNoDeal.this.last = false;
}
else if (DealOrNoDeal.this.revealing)
{
for (double x : DealOrNoDeal.this.originalPrize) {
if (DealOrNoDeal.this.prizes[(DealOrNoDeal.this.clickedCase - 1)] == x) {
for (int y = 0; y < 26; y++) {
if (DealOrNoDeal.this.prizes[(DealOrNoDeal.this.clickedCase - 1)] == DealOrNoDeal.this.originalPrize[y]) {
DealOrNoDeal.this.prize[y].setIcon(DealOrNoDeal.this.prizeIcon[y][1]);
}
}
}
}
if (DealOrNoDeal.this.lastCase)
{
DealOrNoDeal.this.opening = false;
DealOrNoDeal.this.revealing = false;
DealOrNoDeal.this.banker = false;
DealOrNoDeal.this.banker2 = false;
DealOrNoDeal.this.last = true;
}
else if (DealOrNoDeal.this.messageBoxState != 0)
{
DealOrNoDeal.this.gifs.setVisible(false);
DealOrNoDeal.this.clickable = true;
}
else
{
DealOrNoDeal.this.banker();
}
}
else if (DealOrNoDeal.this.banker)
{
DealOrNoDeal.this.displayOffer.setText("<html><body><p style=\"font-size:40px;color:black;font-family:Cambria\">$" + DealOrNoDeal.this.offerString + "</p></body></html>");
DealOrNoDeal.this.displayOffer.setHorizontalAlignment(0);
DealOrNoDeal.this.displayOffer.setVisible(true);
DealOrNoDeal.this.opening = false;
DealOrNoDeal.this.revealing = false;
DealOrNoDeal.this.banker = false;
DealOrNoDeal.this.banker2 = true;
DealOrNoDeal.this.last = false;
}
else if (DealOrNoDeal.this.banker2)
{
DealOrNoDeal.this.gifs.setIcon(DealOrNoDeal.this.acceptIcon);
DealOrNoDeal.this.button[1].setIcon(DealOrNoDeal.this.buttonIcon[1][0]);
DealOrNoDeal.this.button[2].setIcon(DealOrNoDeal.this.buttonIcon[2][0]);
DealOrNoDeal.this.button[1].setVisible(true);
DealOrNoDeal.this.button[2].setVisible(true);
DealOrNoDeal.this.messageBox.setIcon(DealOrNoDeal.this.messageBoxIcon[9]);
}
else if (DealOrNoDeal.this.last)
{
DealOrNoDeal.this.offerString = Integer.toString((int)Math.round(DealOrNoDeal.this.offer));
switch (DealOrNoDeal.this.offerString.length())
{
case 7:
DealOrNoDeal.this.offerString = "$1,000,000";
case 5:
case 6:
DealOrNoDeal.this.offerString = (Integer.toString((int)Math.round(DealOrNoDeal.this.offer / 1000.0D)) + ",000");
break;
case 4:
DealOrNoDeal.this.offerString = (Integer.toString((int)Math.round(DealOrNoDeal.this.offer / 100.0D)).substring(0, 1) + "," + Integer.toString((int)Math.round(DealOrNoDeal.this.offer / 100.0D)).substring(1, 2) + "00");
break;
case 3:
DealOrNoDeal.this.offerString = (Integer.toString((int)Math.round(DealOrNoDeal.this.offer / 10.0D)) + "0");
}
DealOrNoDeal.this.deal();
}
}
}
