-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import javax.swing.*; | ||
import javax.swing.event.*; | ||
import java.awt.*; | ||
import java.awt.event.*; | ||
|
||
class GridTest extends JFrame { | ||
GridTest() { | ||
setTitle("GridTest"); | ||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
Container contentPane = getContentPane(); | ||
contentPane.setLayout(new GridLayout(4,3,5,5)); | ||
contentPane.add(new JButton("7")); | ||
contentPane.add(new JButton("8")); | ||
contentPane.add(new JButton("9")); | ||
contentPane.add(new JButton("4")); | ||
contentPane.add(new JButton("5")); | ||
contentPane.add(new JButton("6")); | ||
contentPane.add(new JButton("1")); | ||
contentPane.add(new JButton("2")); | ||
contentPane.add(new JButton("3")); | ||
contentPane.add(new JButton("0")); | ||
contentPane.add(new JButton(".")); | ||
setSize(250,350); | ||
setVisible(true); | ||
} | ||
public static void main(String[] args) { | ||
new GridTest(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import javax.swing.*; | ||
import java.awt.*; | ||
import javax.swing.event.*; | ||
import java.awt.event.*; | ||
|
||
class MyFrame extends JFrame { | ||
MyFrame() { | ||
setTitle("테스트"); | ||
Container contentPane = getContentPane(); | ||
contentPane.setBackground(Color.CYAN); | ||
contentPane.setLayout(new FlowLayout()); | ||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
contentPane.add(new JButton("1")); | ||
contentPane.add(new JButton("2")); | ||
contentPane.add(new JButton("3")); | ||
setSize(300,300); | ||
setVisible(true); | ||
} | ||
public static void main(String[] args) { | ||
MyFrame f = new MyFrame(); | ||
} | ||
} |