-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
6.0, 7
-
x86
-
windows
Consider following code (in attachment, MyClipboardTest.zip):
public class ImageTransferGUI {
TestFrame frame1;
JButton copy;
Image image1;
public ImageTransferGUI() {
image1 = Toolkit.getDefaultToolkit().getImage((new java.io.File(System.getProperty("test.src", "."), "duke_swim.gif")).toString());
frame1=new TestFrame(true,image1);
System.out.println("Inside contrucor...");
copy=new JButton("copy");
frame1.getContentPane().add("South",copy);
frame1.setBounds(10,350,200,200);
frame1.setVisible(true);
}
public static void main(String[] args){
new ImageTransferGUI();//.frame1.toFront();
}
//The frame class used in the test
class TestFrame extends JFrame {
boolean show;
Image img;
public TestFrame(boolean show,Image img){
this.show=show;
this.img=img;
}
public void paint( Graphics g ){
try {
if(this.show)
g.drawImage( this.img, 30, 30, this );
} catch(NullPointerException eN){}
}
}
}
Well, we have a JFrame subclass (TestFrame), and it's paint method doesn't call super.paint, so components layed out on that frame do not get shown (a button, in our case). This is OK. However, when you move mouse to the spot the button should be, the button gets visible and other painted stuff dissapears (an image, in our case).
This is a regression. What happens with JDK 1.5.0 FCS is button gets visible when you point with mouse at it, but the drawn image stays on the frame.
This doesn't happen with Frame component (instead of JFrame).
public class ImageTransferGUI {
TestFrame frame1;
JButton copy;
Image image1;
public ImageTransferGUI() {
image1 = Toolkit.getDefaultToolkit().getImage((new java.io.File(System.getProperty("test.src", "."), "duke_swim.gif")).toString());
frame1=new TestFrame(true,image1);
System.out.println("Inside contrucor...");
copy=new JButton("copy");
frame1.getContentPane().add("South",copy);
frame1.setBounds(10,350,200,200);
frame1.setVisible(true);
}
public static void main(String[] args){
new ImageTransferGUI();//.frame1.toFront();
}
//The frame class used in the test
class TestFrame extends JFrame {
boolean show;
Image img;
public TestFrame(boolean show,Image img){
this.show=show;
this.img=img;
}
public void paint( Graphics g ){
try {
if(this.show)
g.drawImage( this.img, 30, 30, this );
} catch(NullPointerException eN){}
}
}
}
Well, we have a JFrame subclass (TestFrame), and it's paint method doesn't call super.paint, so components layed out on that frame do not get shown (a button, in our case). This is OK. However, when you move mouse to the spot the button should be, the button gets visible and other painted stuff dissapears (an image, in our case).
This is a regression. What happens with JDK 1.5.0 FCS is button gets visible when you point with mouse at it, but the drawn image stays on the frame.
This doesn't happen with Frame component (instead of JFrame).
- relates to
-
JDK-7182821 Image doesn't appear on JPanel when window is brought to foreground under the classic theme
-
- Closed
-