java - Reading Button Names from a File -
i have 3 buttons , need set names reading file. here's have far:
bufferedreader inputfile = new bufferedreader (new filereader ("buttonnames.txt")); string buttonname = ""; int startline = 1; int endline = 3; (int = startline; < endline + 1; i++) { buttonname = inputfile.readline(); } button1 = new jbutton(buttonname); buttonpanel.add(button1, borderlayout.line_start);
this set button name last line in file. how set button1's name first line, button2's second line, etc. i'm thinking need use array, i'm not sure how implement that.
put code @ bottom inside of loop.
for (int = startline; < endline + 1; i++) { buttonname = inputfile.readline(); button1 = new jbutton(buttonname); buttonpanel.add(button1, borderlayout.line_start); }
Comments
Post a Comment