i need able set icons jtree individual nodes. example, have jtree , need nodes have custom icons represent are. (wrench icon) settings (bug icon) debug (smiley face icon) fun stuff ... and on. have tried several sources , got 1 working, messed tree events so, no cigar. in advance. as requested: class country { private string name; private string flagicon; country(string name, string flagicon) { this.name = name; this.flagicon = flagicon; } public string getname() { return name; } public void setname(string name) { this.name = name; } public string getflagicon() { return flagicon; } public void setflagicon(string flagicon) { this.flagicon = flagicon; } } class countrytreecellrenderer implements treecellrenderer { private jlabel label; countrytreecellrenderer() { label = new jlabel(); } public component gettreecellrenderercomponent(jtree tree, ...
i have made program stores score attached name in .txt file. however, want print alphabetical order of name attached score. when run program come error io.unsupportedoperation: not writable here code: file = open(class_name , 'r') #opens file in 'append' mode don't delete information name = (name) file.write(str(name + " : " )) #writes information file file.write(str(score)) file.write('\n') linelist = file.readlines() line in sorted(linelist): print(line.rstrip()); file.close() you have opened file read only, attempted write it. file left open, attempt read it, if in append mode, file pointer @ end of file. try instead: class_name = "class.txt" name = "joe" score = 1.5 file = open(class_name , 'a') #opens file in 'append' mode don't delete information name = (n...
Comments
Post a Comment