Hi,
I am developing an application which needs to dynamically show whether a host is up or down.I have used buttons on which i am pasting the icon indicating up or down.So, when a node is down, I am replacing the icon that indicates up with the icon that indicates down using setIcon() function.But instead of changing the icon a NullPointerExce ption is generated.For example,
private JButton c1;
JButton c1 = new JButton();
Icon bug = new ImageIcon("imag e/coms1.gif");//this image is for up
Icon bug3= new ImageIcon("imag e/computer.gif");//for down
c1.setIcon(bug) ;
if(node is down)
c1.setIcon(bug3 );
Thanks for any help.
jerico
I am developing an application which needs to dynamically show whether a host is up or down.I have used buttons on which i am pasting the icon indicating up or down.So, when a node is down, I am replacing the icon that indicates up with the icon that indicates down using setIcon() function.But instead of changing the icon a NullPointerExce ption is generated.For example,
private JButton c1;
JButton c1 = new JButton();
Icon bug = new ImageIcon("imag e/coms1.gif");//this image is for up
Icon bug3= new ImageIcon("imag e/computer.gif");//for down
c1.setIcon(bug) ;
if(node is down)
c1.setIcon(bug3 );
Thanks for any help.
jerico
Comment