GUI.java
1.42 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import javax.swing.*;
import java.awt.*;
public class GUI extends JFrame {
JTabbedPane tab = new JTabbedPane();
public GUI() {
super("CESCO");
tab.addTab("png", new PngPane());
tab.addTab("gif",new GifPane());
tab.addTab("jpg",new JpgPane());
add(tab);
setSize(800, 500); // 윈도우의 크기 가로x세로
setVisible(true); // 창을 보여줄떄 true, 숨길때 false
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // x 버튼을 눌렀을때 종료
}
// public static void main(String args[]) {
// new GUI();
// }
}
class PngPane extends JPanel {
public PngPane() {
super();
ImageIcon image = new ImageIcon("data/model.png");
JLabel label = new JLabel("", image, JLabel.CENTER);
setLayout(new BorderLayout());
add(label, BorderLayout.CENTER);
}
}
class GifPane extends JPanel {
public GifPane() {
super();
ImageIcon image = new ImageIcon("data/model.gif");
JLabel label = new JLabel("", image, JLabel.CENTER);
setLayout(new BorderLayout());
add( label, BorderLayout.CENTER );
}
}
class JpgPane extends JPanel {
public JpgPane() {
super();
ImageIcon image = new ImageIcon("data/model.jpg");
JLabel label = new JLabel("", image, JLabel.CENTER);
setLayout(new BorderLayout());
add( label, BorderLayout.CENTER );
}
}