[java swing] 정말정말 궁금해요 !
나샘
자바 스윙 공부를 하고 있습니다.
배경 이미지를 넣고 싶은데 안되네요 ㅠ
아직 왕초보라서요 ㅠ
주석부분을 풀면 이미지가 이상하게 되요 ㅠ
고수님들 알려주세요 ~ import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class MemberFrame extends JFrame implements ActionListener {
//Image img;
//public void paint(Graphics g) {
// g.drawImage(img, 3, -130, this);
// }
public MemberFrame() {
//Image img = Toolkit.getDefaultToolkit().getImage(c:\\apple.gif);
Container cp = getContentPane();
cp.setLayout(new GridLayout(7, 1));
JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
JLabel label = new JLabel(ID:);
JTextField textfield = new JTextField();
textfield.setColumns(10);
JButton button = new JButton(ID 확인);
button.addActionListener(this);
panel.add(label);
panel.add(textfield);
panel.add(button);
cp.add(panel);
panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
label = new JLabel(PASSWORD:);
JPasswordField passwordfield = new JPasswordField();
passwordfield.setColumns(10);
panel.add(label);
panel.add(passwordfield);
cp.add(panel);
panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
label = new JLabel(PASSWORD 확인:);
passwordfield = new JPasswordField();
passwordfield.setColumns(10);
panel.add(label);
panel.add(passwordfield);
cp.add(panel);
panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
label = new JLabel(별명:);
textfield = new JTextField();
textfield.setColumns(10);
panel.add(label);
panel.add(textfield);
cp.add(panel);
panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
label = new JLabel(이메일:);
textfield = new JTextField();
textfield.setColumns(10);
panel.add(label);
panel.add(textfield);
cp.add(panel);
panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
label = new JLabel(주소:);
textfield = new JTextField();
textfield.setColumns(20);
panel.add(label);
panel.add(textfield);
cp.add(panel);
panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
label = new JLabel(전화번호:);
textfield = new JTextField();
textfield.setColumns(10);
panel.add(label);
panel.add(textfield);
panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
button = new JButton(가입);
button.addActionListener(this);
panel.add(button);
cp.add(panel);
}
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
if (command.equals(ID 확인)) {
JOptionPane.showMessageDialog(null, 사용하지 않는 ID입니다.);
} else if (command.equals(가입)) {
int result = JOptionPane.showConfirmDialog(null, 가입하시겠습니까?, 가입 확인, JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION) {
JOptionPane.showMessageDialog(null, 회원 가입을 축하합니다.);
}
}
}
public static void main(String[] args) {
MemberFrame frame = new MemberFrame();
frnbsp; frame.setTitle(회원 가입);
frame.setSize(300, 300);
frame.show();
}
}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2658656 | sublime text2 사용하시는분 (인코딩 질문) | 연블랙 | 2024-06-18 |
2658627 | 윈도우8 데브C 재질문드립니다;; (1) | 이플 | 2024-06-17 |
2658605 | 아스킷코드값 질문이요 | 두바다찬솔 | 2024-06-17 |
2658574 | 접근성 코딩 공부는 어떻게 해야할까요? ㅠ_ㅠ; (6) | 머즌일 | 2024-06-17 |
2658545 | 각각 오브젝트들의 멀티터치 (1) | 에다 | 2024-06-17 |
2658520 | PHP 에서요 | 꽃큰 | 2024-06-16 |
2658491 | 동영상 재생 (4) | 가을바람 | 2024-06-16 |
2658468 | 플래시로 포트폴리오를 만들때.. (1) | 곰돌곰돌 | 2024-06-16 |
2658441 | 상속 문법에 생소한게 있어 질문드립니다. | 도1도캣 | 2024-06-16 |
2658381 | 구글로그인어떻게하나여 아무것도몰라서집어넣기만했는데 ㅜㅜ (1) | 예린 | 2024-06-15 |
2658353 | 엑셀과 연동해서 프로그램 작성 질문좀...??? | Sweeety | 2024-06-15 |
2658327 | 아파치와 톰캣 연동을 했는데요.. (3) | 바르고 | 2024-06-15 |
2658297 | AIR for iOS 에서 실제 디바이스로 테스트 하기에 대해 (2) | 란새 | 2024-06-14 |
2658265 | dl 을 쓸때 (1) | 소윤 | 2024-06-14 |
2658214 | 어떨때 쓰는건지 궁금해요 (4) | 가시 | 2024-06-14 |
2658182 | 하루에 하나 정도는 여기에 올리네요.. ^-^;;..오늘도 자스쪽 질문이에요..스타일 적용 질문요... (5) | 갤투 | 2024-06-13 |
2658160 | 특정페이지만 폰트크기 키울수 있나요? | 해길 | 2024-06-13 |
2658128 | 전에 올렸던 질문을 다시 올려 봅니다. (1) | 머슴밥 | 2024-06-13 |
2658068 | 라이브러리의 이미지에 Linkage 를 걸었을경우에.. allow smoothing 이.. (3) | 시내 | 2024-06-12 |
2658015 | 안녕하세요 몇 가지 좀 물어볼께요 | 은아 | 2024-06-12 |