How can i add items to java text file through GUI combo box(netbeans) -
How can i add items to java text file through GUI combo box(netbeans) -
i have defined items in combo box within gui. happens im trying add together entry programme text file , says: incompatible types int cannot converted string. having problems setlocation
, setskills
.
private void buttonaddactionperformed(java.awt.event.actionevent evt) { resort p = new resort(); p.setname(nametextfield.gettext().replaceall("[^a-z.]", "")); p.setlocation(comboresortlocation.getselectedindex()); p.setskillsbyindex(comboresortskill.getselectedindex()); txtfile.addresort(p); addedconfirm confirmed = new addedconfirm(); confirmed.setvisible(true); this.setvisible(false); }
and part of code other file.
public void setskillsbyindex (string skills) { this.skills = skills; }
got fixed already. had alter them strings , utilize getselecteditem instead:
p.setlocationbyindex((string) comboresortlocation.getselecteditem()); p.setskillsbyindex((string) comboresortskill.getselecteditem());
and other file:
public void setlocationbyindex (string location) { this.location = location;
}
public void setskillsbyindex (string skills) { this.skills = skills;
}
java netbeans combobox text-files
Comments
Post a Comment