i have this code that when i click the jtable, the picture from my database will display in my interface. but every time i click malformedUrlexception pop up. can please somebody help me?
private void recordTBLMouseClicked (java.awt.event.MouseEvent evt){
String click = (recordTBL.getModel().getValueAt(row, 0).toString());
try {
clsConnect c = new clsConnect();
Connection conn = c.makeConnection();
String sql = "Select image from employeetbl where idnum = '" + click + "'";
pst = conn.prepareStatement(sql);
rs = pst.executeQuery();
while (rs.next()) {
URL imagedate = new URL("image");
BufferedImage bufferedimage1 = ImageIO.read(imagedate);
finalimage = new ImageIcon(resize(bufferedimage1, imageL.getWidth(), imageL.getHeight()));
imageL.setIcon(finalimage);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
}
This line is your problem:
URL imagedate = new URL("image");
"image" is not a URL. You need to pass a valid URL to the URL constructor. e.g. "http://www.stackoverflow.com"