I'm trying to make the virtual piano but it's not the program's not creating my world does anyone know how to fix this.
here's my code
public class Piano extends World
{
private String whiteKeys =
{ "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "'", "\\" };
private String whiteNotes =
{ "3c", "3d", "3e", "3f", "3g", "3a", "3b", "4c", "4d", "4e", "4f", "4g" };
private String blackKeys =
{ "W", "E", "", "T", "Y", "U", "", "O", "P", "", "]" };
private String blackNotes =
{ "3c#", "3d#", "", "3f#", "3g#", "3a#", "", "4c#", "4d#", "", "4f#" };
/**
* Make the piano. This means mostly, apart from defining the size,
* making the keys and placing them into the world.
*/
public Piano()
{
super(800, 340, 1);
makeKeys();
showMessage();
}
public void showMessage()
{
showText("Click 'Run and start to play", 400, 320);
}
/**
* Create the piano keys (white and black) and place them in the world.
*/
private void makeKeys()
{
for(int i = 0; i < whiteKeys.length;)
{
Key key = new Key(whiteKeys, whiteNotes+".wav", "white-key.png", "white-key-down.png");
addObject(key, i*63 + 54, 140);
}
for(int i = 0; i < blackKeys.length;)
{
if( ! blackKeys.equals("") )
{
Key key = new Key(blackKeys, blackNotes+".wav", "black-key.png", "black-key-down.png");
addObject(key, i*63 + 85, 86);
}
}
}
}