This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Hello All, I need some help with my code. I am using visual age for Java to construct the Gui but have come to a stop now as i'm having trouble. The problem that I have is I want to be able to set the ampunt of rows in my JTable to the size of the file, so if the file has 50 lines going down I want the JTable rows to resize to 50. My code so far, when you click on the browse button the JFilechooser pane shows up. I then read in my file that I want to read in. in this case it is a csv file, but that is as far as I have got. The Jtable rows do not resize to the size of the file. so could someone please be so kind as to direct me in the right direction or even adjust my code to how it should be Thanks Ben
You could just invoke setNumRows() on the JTable's data model (invoke JTable.getModel() to get the TableModel, then cast it to DefaultTableModel). You should look at How to use Tables in the Java Tutorial since you will probably want to add and edit data in the JTable as well.
Hello Joe, Thanks for the reply, That is what i'm having trouble with getting the JTable rows to resize to 8 (the size of the file, I have looked at the link you gave me but I am still having great difficultied with this, could you please help me with the code? Thanks Again Ben [ January 27, 2004: Message edited by: ben riches ]