私のクラスで 'シンボルを見つけることができません'というエラーが発生しています。変数はスーパークラスではっきりと宣言されていますが、サブクラスはそれを見ることができません。サブクラスRecordViewer
のJLabel
という新しいコンストラクタ以外はエラーが発生しません。Javaクラスのサブクラス変数参照
class RecordViewer extends JDialog{
private JButton next;
private JButton prev;
private JLabel label;
private int current;
public RecordViewer(CDinventoryItem [] array){
super();
current = 0;
final CDinventoryItem [] items = array;
label = new JLabel(items[getCurrent()]);
私CDinventoryItemクラスから定義済みのtoStringは...
@Override public String toString(){
// Decimal foramting for the inventory values
NumberFormat dformat = new DecimalFormat("#0.00");
// Formatting for the inventory output
StringBuilder ouput = new StringBuilder();
String New_Line = System.getProperty("line.separator");
ouput.append("The product number of my CD is: ").append(iPitemNumber).append (New_Line);
ouput.append("The title of the CD is: ").append(sPtitle).append (New_Line);
ouput.append("I have ").append(iPnumberofUnits).append(" units in stock.").append (New_Line);
ouput.append("The total value of my inventory on this product is: ").append(dformat.format(stockValue())).append (New_Line);
return ouput.toString();
}
エラーメッセージ全体を入力してください。 – adamax