简体   繁体   English

JTable中的java.net.malformedURLexception

[英]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. 我有这段代码,当我单击jtable时,数据库中的图片将显示在我的界面中。 but every time i click malformedUrlexception pop up. 但是每次我单击malformedUrlexception都会弹出。 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. “图像”不是URL。 You need to pass a valid URL to the URL constructor. 您需要将有效的URL传递给URL构造函数。 eg " http://www.stackoverflow.com " 例如“ http://www.stackoverflow.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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