-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleFrameTest.java
More file actions
38 lines (34 loc) · 1.15 KB
/
SimpleFrameTest.java
File metadata and controls
38 lines (34 loc) · 1.15 KB
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
29
30
31
32
33
34
35
36
37
38
import java.awt.*;
import javax.swing.*;
public class SimpleFrameTest{
public static void main(String args[]){
EventQueue.invokeLater(()->{
SimpleFrame frame=new SimpleFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setUndecorated(true);
frame.setVisible(true);
});
}
}
class SimpleFrame extends JFrame{
private static final int DEFAULT_WIDTH=300;
private static final int DEFAULT_HEIGHT=200;
public SimpleFrame(){
setSize(DEFAULT_WIDTH,DEFAULT_HEIGHT);
}
}
//Code Description
/*
Lets look on packages
The javax.swing
Swing classes are placed in javax.swing packages
javax indicates a Java extension package, not a core package
For historical reasons swing is considered an extension.
But now it is present in every Java SE implementation since 1.2
about this piece of code
EventQueue.invokeLater(() ->{
//statements
});
is used to execute statements in the event dispatch thread
you can initialize the user interface in the event dispatch thread or in the main thread
*/