Hi all,
I have an image which I want to display on the center of the frame . Please let
me know how can I do that, here is the gist of the code that I have writtten.
final JFrame f = new JFrame("BlackAndWhite");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setLocation(100,100);
Container cp = f.getContentPane();
cp.add(image);
f.pack();
SwingUtilities.invokeLater(new Runnable(){
public void run() {
f.setSize(1000,1000);
f.setLocation(100,100);
f.setVisible(true);
}
});
When I run this code the image in the content pane is displayed at the top left
corner.
Please help.
[Message sent by forum member 'pranabi' (pranabi)]
http://forums.java.net/jive/thread.jspa?messageID=146318
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".