CentreFrameTest in Java Program
CentreFrameTest in Java Program
import javax.Swing.*;
import java.awt.*;
import java.awt.event.*;
public class CenteredFrameTest
{
public Static void main(String[] args)
{
CenteredFrame frame=new CenteredFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();
}
}
class CenteredFrame extends JFrame
{
public CenteredFrame()
{
Toolkit kit=ToolKit.getDefaultToolKit()
Dimension ScreenSize=kit.getScreenSize()
int ScreenHeight=ScreenSize.height;
int ScreenWidth=ScreenSize.width;
setSize(ScreenWidth/2,Screenheight/2);
setLocation(ScreenWidth/4,ScreenHeight/4);
Image img=kit.getImage("1.jpg");
setIconImage(img);
setTitle("CenteredFrame");
}
}
0 coment�rios:
Post a Comment