-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDBKicker.java
More file actions
137 lines (110 loc) · 3.76 KB
/
DBKicker.java
File metadata and controls
137 lines (110 loc) · 3.76 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package DB2025Team09;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import java.awt.Font;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JComboBox;
import java.net.URL;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import java.awt.Image;
//로그인 선택 화면 GUI
public class DKicker extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
DKicker frame = new DKicker();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public DKicker() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
//로그인 라벨
JLabel lblNewLabel = new JLabel("Login");
lblNewLabel.setFont(new Font("Lucida Grande", Font.BOLD, 36));
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
lblNewLabel.setBounds(96, 50, 238, 78);
contentPane.add(lblNewLabel);
// 축구공 이미지 라벨
ImageIcon ballIcon = null;
try {
// 이미지 리소스 경로 (src/DB2025Team09/ball.png 기준)
URL imageUrl = getClass().getClassLoader().getResource("DB2025Team09/ball.png");
// 경로가 유효한지 출력
System.out.println("이미지 경로: " + imageUrl);
if (imageUrl == null) {
throw new Exception("⚠ 이미지 리소스를 찾을 수 없습니다.");
}
// 아이콘 생성
ballIcon = new ImageIcon(imageUrl);
// 유효한 이미지인지 확인
if (ballIcon.getIconWidth() == -1) {
throw new Exception("⚠ 이미지 로딩 실패 (잘못된 이미지 포맷이거나 깨짐)");
}
} catch (Exception e) {
System.out.println("⚠ 이미지 로딩 중 오류: " + e.getMessage());
}
if (ballIcon != null) {
Image scaled = ballIcon.getImage().getScaledInstance(64, 64, Image.SCALE_SMOOTH);
ImageIcon resized = new ImageIcon(scaled);
JLabel leftBall = new JLabel(resized);
leftBall.setBounds(40, 50, 64, 64);
contentPane.add(leftBall);
JLabel rightBall = new JLabel(resized);
rightBall.setBounds(345, 50, 64, 64);
contentPane.add(rightBall);
}
//"선수" 버튼
JButton btnNewButton = new JButton("선수");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new DKicker_player_choose().setVisible(true); dispose();
}
});
btnNewButton.setBounds(96, 207, 117, 29);
contentPane.add(btnNewButton);
//"스태프" 버튼
JButton btnNewButton_1 = new JButton("스태프");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new staff().setVisible(true); dispose();
}
});
btnNewButton_1.setBounds(232, 207, 117, 29);
contentPane.add(btnNewButton_1);
//팀 선택 콤보박스
JComboBox comboBox = new JComboBox();
comboBox.setModel(new DefaultComboBoxModel(new String[] {"팀1", "팀2", "팀3"}));
comboBox.setBounds(96, 168, 253, 27);
contentPane.add(comboBox);
//"팀을 선택하세요"라벨
JLabel lblNewLabel_1 = new JLabel("팀을 선택하세요");
lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER);
lblNewLabel_1.setBounds(96, 140, 253, 16);
contentPane.add(lblNewLabel_1);
}
}