Skip to content

Commit 19d51bc

Browse files
committed
Swing 예제
1 parent 41145d1 commit 19d51bc

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

20211212/java/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.class
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"editor.tabSize": 4,
3+
"editor.rulers": [
4+
80
5+
],
6+
"trailing-spaces.trimOnSave": true,
7+
"java.project.referencedLibraries": [
8+
"lib/**/*.jar"
9+
]
10+
}

20211212/java/HelloWorld.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import java.awt.event.ActionEvent;
2+
import java.awt.event.ActionListener;
3+
4+
import javax.swing.JButton;
5+
import javax.swing.JFrame;
6+
import javax.swing.JLabel;
7+
import javax.swing.JPanel;
8+
import javax.swing.JTextField;
9+
10+
public class HelloWorld {
11+
public static void main(String[] args) {
12+
JFrame frame = new JFrame("My application");
13+
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
14+
frame.setSize(400, 200);
15+
16+
JLabel label = new JLabel("Hello, world!");
17+
frame.add(label);
18+
19+
frame.setVisible(true);
20+
}
21+
}

20211212/java/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Swing 예제
2+
3+
- <https://docs.oracle.com/javase/tutorial/uiswing/index.html>
4+
- <https://docs.oracle.com/javase/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start/HelloWorldSwing.java>
5+
6+
```bash
7+
javac -d out HelloWorld.java
8+
9+
java --class-path out HelloWorld
10+
```

0 commit comments

Comments
 (0)