R
Rene
Can someone please confirm the following bug.
Compile and run the code below. Iconify the frame and
deiconify, or make it repaint some other way.
On my system, I get garbadge, while it was
correct the first time.
System is: Windows XP, Java 1.4.2_05
Thanks a lot!
----------------------------------
import java.awt.*;
import java.awt.event.*;
class BroadPanel extends Panel
{ Image I;
public void paint (Graphics g)
{ int h=getSize().height;
if (I==null)
{ I=createImage(10*h,h);
Graphics ig=I.getGraphics();
ig.clearRect(0,0,10*h,h);
ig.setColor(Color.black);
ig.drawLine(0,0,10*h-1,h-1);
ig.dispose();
}
g.drawImage(I,0,0,this);
}
}
public class Bug
extends Frame
{ public Bug ()
{ setLayout(new BorderLayout());
add("Center",new BroadPanel());
setSize(500,500);
setVisible(true);
addWindowListener(new WindowAdapter()
{ public void windowClosing (WindowEvent e)
{ setVisible(false); dispose();
}
}
);
}
public static void main(String[] args)
{ new Bug();
}
}
Compile and run the code below. Iconify the frame and
deiconify, or make it repaint some other way.
On my system, I get garbadge, while it was
correct the first time.
System is: Windows XP, Java 1.4.2_05
Thanks a lot!
----------------------------------
import java.awt.*;
import java.awt.event.*;
class BroadPanel extends Panel
{ Image I;
public void paint (Graphics g)
{ int h=getSize().height;
if (I==null)
{ I=createImage(10*h,h);
Graphics ig=I.getGraphics();
ig.clearRect(0,0,10*h,h);
ig.setColor(Color.black);
ig.drawLine(0,0,10*h-1,h-1);
ig.dispose();
}
g.drawImage(I,0,0,this);
}
}
public class Bug
extends Frame
{ public Bug ()
{ setLayout(new BorderLayout());
add("Center",new BroadPanel());
setSize(500,500);
setVisible(true);
addWindowListener(new WindowAdapter()
{ public void windowClosing (WindowEvent e)
{ setVisible(false); dispose();
}
}
);
}
public static void main(String[] args)
{ new Bug();
}
}