[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();
}
}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2702287 | c++ 변수 중간값 뽑아내서 비교하는 법 | 헛장사 | 2025-07-21 |
2702258 | AS2,0 함수에서 매개변수의 타입이 각각 다를때는? (5) | 하림 | 2025-07-21 |
2702228 | 이 표현은 무엇인지... 몰라서요. (2) | 도란도란 | 2025-07-21 |
2702197 | dll 인젝션 사용법좀 알려주세요 | 새밝 | 2025-07-21 |
2702147 | dd 안에 div들어가도 되나요? (8) | 꿈 | 2025-07-20 |
2702086 | [질문]세션 박스 질문입니다. (1) | 하연 | 2025-07-20 |
2702057 | 씨언어 숙재좀 풀어주실분 ㅜ.ㅜ (3) | 난슬 | 2025-07-19 |
2702000 | select 사용시 label 문제 질문드립니다. | 김예쁨 | 2025-07-19 |
2701970 | 실행파일의 이름은 어디서 변경하는지요???? | 호빵녀 | 2025-07-19 |
2701856 | 다시 한번 대체텍스트 관련 질문입니다.. (1) | 한샘가온 | 2025-07-18 |
2701803 | 저에게 지식의 자비를~ 베푸소서~!! (4) | 봄바람 | 2025-07-17 |
2701773 | 메모장 파일을 읽고 출력하는 내용에 관한 질문입니다. | 한국드립 | 2025-07-17 |
2701748 | 아이피 변경 부분이요... | 날애 | 2025-07-17 |
2701665 | 자바스크립트 // 왜 if 두개를 쓰면 오류가 나죠? (2) | 글리슨 | 2025-07-16 |
2701636 | 모바일웹 게시판 만들기 조언좀 부탁드려요 ㅜㅜ (2) | 정훈 | 2025-07-16 |
2701610 | [질문] AS3 액션으로 스테이지 사이즈를 조절할 수 있는 방법이 있을까요? (1) | 앵겨쪼 | 2025-07-15 |
2701556 | input text에 한글을 default 하려면.. (3) | 히나 | 2025-07-15 |
2701528 | apmsetup 접속이.... (5) | 곰돌이 | 2025-07-15 |
2701506 | 암호를 *로 (6) | 도도한 | 2025-07-14 |
2701475 | 배열최대값 찾기인데; 소스좀 해석해주세요; | Orange | 2025-07-14 |