Hi Everyone, I am writing a program that i want to output some values from the database using a JoptionPane. I have the output using the System.Out.Println(), but i want a JOptionPane.
Would anyone please Help.....???
This is what i have so far;

st1 = con.createStatement();


rs2 = st1.executeQuery("select Block,Room,Bed from hostels where Block like 'Dip%'and Status='Available'");


                 //processing query results
                ResultSetMetaData metaData = rs2.getMetaData();
                int numberOfColumns = metaData.getColumnCount();
                System.out.println("Available Rooms\n");

              for (int i = 1; i <= numberOfColumns; i++) {
                    System.out.printf("%-8s\t", metaData.getColumnName(i));
                }
                System.out.println();


               while (rs2.next()) {
                    for (int i = 1; i <= numberOfColumns; i++) 
                   {   System.out.printf("%-8s\t", metaData.getColumnName(i));
                   //to use JOptionPane for output of the above

                   }
                    System.out.println();
                    }