| |

VerySource

 Forgot password?
 Register
Search
View: 679|Reply: 1

A mistake, seek expert guidance!

[Copy link]

3

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-12-16 18:00:01
| Show all posts |Read mode
Error message:
Uncaught error fetching image:
java.lang.NullPointerException
at sun.awt.image.URLImageSource.getConnection(URLImageSource.java:97)
at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:106)
at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:240)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:172)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
Source code:
    private void jbInit() throws Exception {
        setIconImage(Toolkit.getDefaultToolkit().createImage(Frame3.class.getResource("logo.gif")));
        contentPane = (JPanel) getContentPane();
        contentPane.setLayout(borderLayout1);
        this.setJMenuBar(jMenuBar1);
        setSize(new Dimension(400, 300));
        setTitle("Main Menu");
        jMenu1.setText("sdfsd");
        jMenuItem1.setText("ssdfsdf");
        jMenuItem2.setText("sdf");
        jMenuItem3.setText("sd");
        jMenuItem4.setText("sdfsdf");
        jMenuBar1.setOpaque(false);
        jMenuBar1.add(jMenu1);
        jMenu1.add(jMenuItem1);
        jMenu1.add(jMenuItem2);
        jMenu1.add(jMenuItem3);
        jMenu1.add(jMenuItem4);
    }
Reply

Use magic Report

1

Threads

51

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-12-18 06:15:01
| Show all posts
setIconImage(Toolkit.getDefaultToolkit().createImage(Frame3.class.getResource("logo.gif"))); This sentence is incorrect
ImageIcon=new ImageIcon(getClass().getResource("logo.gif"));
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list