-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSizedFrameTest.java
More file actions
28 lines (26 loc) · 939 Bytes
/
SizedFrameTest.java
File metadata and controls
28 lines (26 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.awt.*;
import javax.swing.*;
public class SizedFrameTest {
public static void main(String args[]){
EventQueue.invokeLater(()->{
JFrame frame=new SizedFrame();
frame.setTitle("SizedFrame");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
});
}
}
class SizedFrame extends JFrame{
public SizedFrame(){
Toolkit kit=Toolkit.getDefaultToolkit();
Dimension screenSize=kit.getScreenSize();
int screenHeight=screenSize.height;
int screenWidth=screenSize.width;
setSize(screenWidth/2,screenHeight/2);
setLocationByPlatform(true);
Image img=new ImageIcon("vectorisonline.png").getImage();
setIconImage(img);
}
}
//Here in this program we tried to ask the browser to give the height and width using Toolkit class
// and tried to give the icon to out java swing