だから私はかなり低レベルのJavaプログラミングでプログラムを作っています。これは私が問題を抱えているものです:
//The String fillText is given a value earlier in the program
if ("".equals(txa1.getText()))
{
txa1.setText(fillText);
txa1.setVisible(true);
}
else if ("".equals(txa2.getText()))
{
txa2.setText(fillText);
txa2.setVisible(true);
}
else if ("".equals(txa3.getText()))
{
txa3.setText(fillText);
txa3.setVisible(true);
}
else if ("".equals(txa4.getText()))
{
txa4.setText(fillText);
txa4.setVisible(true);
}
else if ("".equals(txa5.getText()))
{
txa5.setText(fillText);
txa5.setVisible(true);
}
...
このコードは、常にすべてのテキストエリア (txaX) を fillText で埋めるように見えます。true を返した最初のステートメントのみを実行し、if-else ステートメントから抜け出すことを期待していました。
スイッチケースでやろうとしたのですが、プログラムの実行中に文字列が変更されるため失敗しました。
なにが問題ですか?
前もって感謝します!