수다닷컴

  • 해외여행
    • 괌
    • 태국
    • 유럽
    • 일본
    • 필리핀
    • 미국
    • 중국
    • 기타여행
    • 싱가폴
  • 건강
    • 다이어트
    • 당뇨
    • 헬스
    • 건강음식
    • 건강기타
  • 컴퓨터
    • 프로그램 개발일반
    • C언어
    • 비주얼베이직
  • 결혼생활
    • 출산/육아
    • 결혼준비
    • 엄마이야기방
  • 일상생활
    • 면접
    • 취업
    • 진로선택
  • 교육
    • 교육일반
    • 아이교육
    • 토익
    • 해외연수
    • 영어
  • 취미생활
    • 음악
    • 자전거
    • 수영
    • 바이크
    • 축구
  • 기타
    • 강아지
    • 제주도여행
    • 국내여행
    • 기타일상
    • 애플
    • 휴대폰관련
  • 프로그램 개발일반
  • C언어
  • 비주얼베이직

[java swing] 정말정말 궁금해요 !

나샘

2023.08.21

자바 스윙 공부를 하고 있습니다.

배경 이미지를 넣고 싶은데 안되네요 ㅠ

아직 왕초보라서요 ㅠ

주석부분을 풀면 이미지가 이상하게 되요 ㅠ

고수님들 알려주세요 ~ 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();
}
}

신청하기





COMMENT

댓글을 입력해주세요. 비속어와 욕설은 삼가해주세요.

번호 제 목 글쓴이 날짜
2700142 하단이 붙어있는 가변 레이아웃구조 질문드립니다. 이플 2025-07-02
2700089 이미지를 사다리꼴로 비틀게 하는 액션코드가 있나요? (4) 여름 2025-07-01
2700033 배경에 그라데이션을 넣으려고 하는데요.. (4) 화이티 2025-07-01
2700005 [질문] TextField 객체의 실제 높이 알아오는 방법 ? 천사의눈물 2025-07-01
2699978 FileReferenceList를 이용하여 업로드시 자꾸 실행속도가 느리다는 팝업이... (10) 데이비드 2025-06-30
2699944 자바스크립트가 많은 사이트는... (6) 희나리 2025-06-30
2699918 브라우저마다 다른 input과 텍스트 정렬 (3) 늘봄 2025-06-30
2699887 동적텍스트를 그래픽으로?? (2) 족장 2025-06-30
2699862 scope넣기 (1) 아인 2025-06-29
2699835 exe로 만드는 방법을....알려주세요.. (5) 방방 2025-06-29
2699809 롤오버할때 백그라운드 이미지로할때 alt설명은 어떻게해야하죠?..ㅠ (4) 반혈 2025-06-29
2699757 리스트뷰에 있는 내용을 랜덤으로 추출 세실 2025-06-28
2699725 JMX 질문입니다. (1) 시나브로 2025-06-28
2699695 으으아으ㅏ으ㅏ 정말미쳐버리겟네요 진달래 2025-06-28
2699665 absolute에 대해서 궁금한게 있습니다 (1) 영빈이 2025-06-28
2699629 테마 적용이 잘 안됩니다. ㅠㅜ (2) 서희 2025-06-27
2699601 html코딩 브라우져 확인 할때.. (5) 에드워드 2025-06-27
2699575 [질문] 고수님들...가르쳐주세염....renameTo에 관하여 일본드립 2025-06-27
2699547 [급]레이어보다 object태그가 우선순위가 되는 문제 (5) DevilsTears 2025-06-27
2699518 javaScript중복체크 하는법좀.. 알려주세요 (3) 비 2025-06-26
<<  이전  1 2 3 4 5 6 7 8 9 10  다음  >>

수다닷컴 | 여러분과 함께하는 수다토크 커뮤니티 수다닷컴에 오신것을 환영합니다.
사업자등록번호 : 117-07-92748 상호 : 진달래여행사 대표자 : 명현재 서울시 강서구 방화동 890번지 푸르지오 107동 306호
copyright 2011 게시글 삭제 및 기타 문의 : clairacademy@naver.com