I need to print the data in a JTable without any borders around, I have tried to achieve this by using an empty border for the JTable but still it prints a border around the table.
dataTable = new javax.swing.JTable();
dataTable.setBorder(BorderFactory.createEmptyBorder());
dataTable.setShowHorizontalLines(false); dataTable.setShowVerticalLines(false);
dataTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Item ID", "Company Name", "Qty.", "Price", "Total" } ));
jScrollPane1.setViewportView(dataTable);
jScrollPane1.setViewportBorder(BorderFactory.createEmptyBorder());
jScrollPane1.setBorder(BorderFactory.createEmptyBorder());
You can copy the Code from
TablePrintableto a own class (MyPrintable) and remove following lines:And Override the
getPrintable-Method in yourJTable.MyPrintable