0

I would like to resize an image inside a cell on JTable. I am using that code to print the image, it works but without resizing.

do {
    Object[] fila = new Object[numcolumnas];
    for (int i = 0; i < numcolumnas; i++) {
        fila[i] = rs.getObject(i + 1);

        byte[] imagedataCover = rs.getBytes("Poster");
        format = new ImageIcon(imagedataCover);

        fila[0] = new JLabel(format);

    }
    model.addRow(fila);
    setAnchoColumnas();
} while (rs.next());
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
user3325719
  • 75
  • 4
  • 14
  • 2
    First figure out how to resize an image, no table involved. If still having problems. 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example). 2) One way to get image(s) for an example is to hot-link to the images seen in [this answer](http://stackoverflow.com/a/19209651/418556). – Andrew Thompson May 19 '14 at 19:15
  • Thanks .Andrew Thompson. – user3325719 May 19 '14 at 19:20
  • What does resizing mean to you? Do you just want an image at a fixed size to fit in the table, or do you want the image to dynamically scale to fill the width of the column as the column width changes? – camickr May 19 '14 at 19:37
  • Hi camickr,i want a fixed size with the width and height of the cell. – user3325719 May 19 '14 at 20:19
  • @user3325719, what if the user changes the width of the cell? Do you want the image to stretch/shrink as the width changes? Or did you disable the column resize functionality. – camickr May 19 '14 at 23:29
  • resize column is disabled. – user3325719 May 20 '14 at 13:46

0 Answers0