프레임,패널 질문드려요 ㅜㅜ 소스좀 봐주세요~
갅지삘여우
이렇게 만들고싶은데요 일딴 패널로 나눠나서 그런지 너무 딱딱 떨어지는 구조가 되버렸네요...
어디서 중요한걸 놓치고 잇는거 같은데......
뭐가 문제일가요...??????
import java.awt.*;
import java.applet.*;
public class Exam extends Frame {
private Dimension dimen,dimen1;
private int xpos,ypos;
public Exam(){
super(Awt컴포넌트와 Frame);
this.init();
this.start();
this.setSize(250,200);
dimen=Toolkit.getDefaultToolkit().getScreenSize();
dimen1=this.getSize();
xpos=(int)(dimen.getWidth()/2-dimen1.getWidth()/2);
ypos=(int)(dimen.getHeight()/2-dimen1.getHeight()/2);
this.setLocation(xpos,ypos);
this.setVisible(true);}
public void init(){
Panel s; //에플릿의 서브페널
Panel pa,pb; //s 의 서브 패널
Panel pa1; //pa의 서브 패널Backspace,CE,C);
Panel num; //pb의 서브 패널 ,숫자버튼 넣을 패널
Panel pb1,pb2; //pb의 서브패널 =, 사칙연산 합칠패널;
s=new Panel();
s.setLayout(new GridLayout(2,1)); //pa의 배치관리자
s.setBackground(Color.black);
add(s);////Backspace,CE 넣을 패널 pa//
pa=new Panel();
pa.setLayout(new GridLayout(1,1)); //pa의 배치관리자
pa.setBackground(Color.black);//Backspace,CE,C 넣을 패널//
pa1=new Panel();
pa1.setLayout(new GridLayout(1,3,2,2));
pa.setBackground(Color.gray);
Button a1,a2,a3;
a1=new Button(Backspace);
a2=new Button(CE);
a3=new Button(C);
pa1.add(a1);
pa1.add(a2);
pa1.add(a3);
pa.add(pa1);
s.add(pa);//숫자패드,=,계산패드 넣을 패널 pb//
pb=new Panel();
pb.setLayout(new GridLayout(1,2,2,2));
pb.setBackground(Color.black);//숫자패드 넣을 패널 //
num=new Panel();
num.setLayout(new GridLayout(4,3,2,2));
num.setBackground(Color.gray);
Button n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11;
n0=new Button(0);
n1=new Button(1);
n2=new Button(2);
n3=new Button(3);
n4=new Button(4);
n5=new Button(5);
n6=new Button(6);
n7=new Button(7);
n8=new Button(8);
n9=new Button(9);
n10=new Button(+/-);
n11=new Button(.);
num.add(n0);
num.add(n1);
num.add(n2);
num.add(n3);
num.add(n4);
num.add(n5);
num.add(n6);
num.add(n7);
num.add(n8);
num.add(n9);
num.add(n10);
num.add(n11);
pb.add(num);
s.add(pb);
//=버튼//
pb1=new Panel();
pb1.setLayout(new GridLayout(1,2));
pb1.setBackground(Color.gray);
Button e;
e=new Button(=);
pb1.add(e);
pb.add(pb1);
s.add(pb);
//+,-,*,/버튼//
pb2=new Panel();
pb2.setLayout(new GridLayout(4,1));
pb2.setBackground(Color.gray);
Button c1,c2,c3,c4;
c1=new Button(+);
c2=new Button(-);
c3=new Button(*);
c4=new Button(/);
pb2.add(c1);
pb2.add(c2);
pb2.add(c3);
pb2.add(c4);
pb1.add(pb2);
}public void start(){
//Event 나 Thread 처리할 부분
}
public static void main(String ar[]){
Exam mf=new Exam();
}
}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2696504 | 플래시 위에 div 올리기 (5) | 큰꽃늘 | 2025-05-30 |
2696458 | 제가 만든 소스 한번 봐주시고 수정 할 꺼 있으면 말해주세요. (실행은 되지만 깜빡거리네요) | 이플 | 2025-05-29 |
2696434 | 퍼센트 레이아웃 질문인데요.. | 나츠 | 2025-05-29 |
2696372 | %=open_main%, %=open_sub% 가 뭘까요? (9) | 행복녀 | 2025-05-29 |
2696347 | 콘솔 프로그램 질문 | 상큼한캔디 | 2025-05-28 |
2696320 | c언어 scanf 함수를 이요해 문자열 입력 받을 시 질문 있습니다. | 슬아라 | 2025-05-28 |
2696292 | 익스플로러9이상에서만 이상한 보더가 보이는데 삭제할수 있나요? | 망고 | 2025-05-28 |
2696263 | 프로그래밍 공부시작 질문 (6) | 진이 | 2025-05-28 |
2696206 | SK2의 플래시를 밴치마킹하려고하는데요.. (1) | 비내리던날 | 2025-05-27 |
2696179 | ie7에서 사라지지가 않네요. (2) | 빛길 | 2025-05-27 |
2696150 | div에 스크롤 생기게 하려면... (2) | 에드가 | 2025-05-27 |
2696123 | 자료구조론 공부중인데 | 김자영 | 2025-05-26 |
2696094 | exe 파일 | 제철 | 2025-05-26 |
2696043 | 제이쿼리 .scroll() 관련 질문드립니다 | 이거이름임 | 2025-05-26 |
2695984 | 마크업상으로 하단에 있으나 우선적으로 이미지파일을 다운로드받는 방법 (1) | 들꿈 | 2025-05-25 |
2695934 | tr 속성값 (9) | 새 | 2025-05-25 |
2695905 | ASP로 개발됐을 때 css가 달라져요 ㅠㅠ (4) | 슬아라 | 2025-05-24 |
2695878 | form을 이용한 다른 페이지로 넘기는 방법을 알려주세요 (1) | 핫파랑 | 2025-05-24 |
2695844 | 저기 암호화 및 복호화 프로그램.. 만들어볼려는대 (2) | 한빛 | 2025-05-24 |
2695814 | [질문] PDA에서 애플릿이 가능한가요? (1) | 봄시내 | 2025-05-24 |