Oct 29

You need to add your JList (or any component) to a JScrollPane. Easiest way to do this is to pass your component to the JScrollPane’s constructor. You then add the JScrollPane to your component hierarchy (instead of adding your JList).

JScrollPane scrollPne = new JScrollPane(mylist);

written by objects \\ tags: ,

Oct 27

The executeUpdate() method of Statement class returns the number of rows affected

   in rows = staement.executeUpdate(sql);

written by objects \\ tags: ,

Oct 19

You need to read all bytes from source stream to the destination. The read() method will return -1 when eof is reached, otherwise it returns the number of bytes read.

public static void copy(InputStream in, OutputStream out
   int bufferSize)
   throws IOException
   // Read bytes and write to destination until eof

   byte[] buf = new byte[bufferSize];
   int len = 0;
   while ((len = in.read(buf)) >= 0)
      out.write(buf, 0, len);

written by objects \\ tags: , , ,