How to print a JTable object in the Java application
Question Now once the data is fetched from the database and shown in the JTable object "table" embedded in the scrollPane, how do we create a print job that makes it possible to print the displayed table as such in A3 sized paper ? My code to fetch the data from the database is shown below: try { Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost/newb","root","pass"); Statement stat=con.createStatement(); ResultSet res=stat.executeQuery("select * from table where name = '"+name+"'"); ResultSetMetaData rsmd = res.getMetaData(); int