私はこのJava ComboBox Different Value to Nameのようなかなり似た問題を抱えています
私はすでにコードを変更しているので、Employee
-Object を取得します (上記のリンクのクラス名は であるため、クラス名を変更しましたEmployee
)。
私の場合、toString()
上書きしたくないメソッドが既にあります。(別の場所で必要です)
しかし、私はこのtoString()
メソッドをJCombobox
. しかし、それは自動的に行います。
文字列を返したくない! オブジェクトが必要です。
JCombobox の作成中に「別のtoString()
方法を使用してみましょう」と言う方法はありますか?toStringDifferent()
this.comboEmployees = new JComboBox(new EmployeeComboboxModel(getEmployees()));
// this will give me the toString-method's return-value of the Employee object.
// But i want the toStringDifferent() method's result.
ありがとう!