Hi,
I'm creating an application and I'm having issues getting a jpanel with textfields to align to columns in a jtable.
The application is basically a jtable with 9 columns, from left to right they are;
Description,MonthSales,SameMonthLastYear,Difference,Percentage,YearSales,LastYearSales,Difference,Percentage.
Beneath the jtable i have created a jpanel of the same width as the table. and in this I have placed 9 textfields, to act as total boxes for the respective columns (the textfield below the Description column just says Totals). I can get the textfields to display the correct values, the only thing I cannot do is get the textfields to line up directly below the corresponding jtable column.
I have a function which gets the width of the Description column, and sets the first jtextfield to the same width, the problem I have got is that the width of the jtextfield doesnt match the width of the jtable column, its out by almost half.
I've checked the font and font size, they're all the same, so I'm baffled why my textfield.setWidth function isnt setting the textfield to the same width as the jtable column.
The application was created using Netbeans, and I've just created a panel and dragged in the textfields.
I've tried Free Layout and Box Layout, so I've not sure if its a layout issue, netbeans and me not understanding the width on a jtable is different to a width on a textfield