D
dar7yl
I recently upgraded my personal computer to jre 1.5.0_01-b08 (I was forced
into it, honest).
I was previously running 1.4.2_05-b04.
The problem is that Image Icon loading in applets no longer seems to be
working.
The icon (from a .gif) appears to be loaded, but it does not display,
and it's <width,height> resolve to (-1,-1)
It still works in 1.4, but doesn't work in 5.0/1.5/whatever.
<code>
class MyApp extends JApplet
{
JFrame display = new JFrame("Test load Icons");
JLabel label = new JLabel();
//...
public int init()
{
ImageIcon icon = null;
display.add(label);
java.net.URL imgURL = MyApp.class.getResource( "Images/myicon.gif");
if ( imgURL != null )
{
system.out.println("opening image icon url: " + imgURL );
icon = new ImageIcon( imgURL, "my own, personal icon");
}
if (icon != null)
{
label.setIcon( icon );
int width= icon.getIconWidth();
int height = icon.getIconHeight();
system.out.println("Icon: " + icon + ", width: " + width + ",
height: " + height );
display.setSize( width+100, height+100 );
}
display.show();
}
//...
}
</code>
<trace>
opening image icon url: http://wherever.com/test.jar!/Images/myicon.gif
Icon: my own, personal icon, width: -1, height: -1
</trace>
into it, honest).
I was previously running 1.4.2_05-b04.
The problem is that Image Icon loading in applets no longer seems to be
working.
The icon (from a .gif) appears to be loaded, but it does not display,
and it's <width,height> resolve to (-1,-1)
It still works in 1.4, but doesn't work in 5.0/1.5/whatever.
<code>
class MyApp extends JApplet
{
JFrame display = new JFrame("Test load Icons");
JLabel label = new JLabel();
//...
public int init()
{
ImageIcon icon = null;
display.add(label);
java.net.URL imgURL = MyApp.class.getResource( "Images/myicon.gif");
if ( imgURL != null )
{
system.out.println("opening image icon url: " + imgURL );
icon = new ImageIcon( imgURL, "my own, personal icon");
}
if (icon != null)
{
label.setIcon( icon );
int width= icon.getIconWidth();
int height = icon.getIconHeight();
system.out.println("Icon: " + icon + ", width: " + width + ",
height: " + height );
display.setSize( width+100, height+100 );
}
display.show();
}
//...
}
</code>
<trace>
opening image icon url: http://wherever.com/test.jar!/Images/myicon.gif
Icon: my own, personal icon, width: -1, height: -1
</trace>