简体   繁体   中英

java.net.malformedURLexception in JTable

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. eg " http://www.stackoverflow.com "

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM