Article View: cn.bbs.comp.lang.java
Article #24082Re: ���������� 3���������Ϲ����𰸣�
From: ��
Date: Sat, 20 Jun 1998 00:00
Date: Sat, 20 Jun 1998 00:00
93 lines
3421 bytes
3421 bytes
> [1;36m==> Qin_Qin(��) ˵��: [37;40m[0m
> �� �� �� �� �� �� �ϣ�
> Lili, Female, Birthday: 1980/8/30
> Wang, Male, Birthday: 1977/5/9
> Lee, Male, Birthday: 1979/2/26
> �� �� д һ �� ͼ �� �� �� �� �� �� �� �� �� �� �� ��
> Ҫ �� �� �� �� �� ͨ �� ѡ �� �� �� �� ѡ �� �ϣ� �� �� ��
> �� �� �� �� �� һ �ˡ� �� �� һ �ˡ� ǰ һ �ˡ� �� һ ��
> �� �� �ϡ�
�� �� �� ��:
import java.awt.*;
class CardBox extends Panel{
CardBox(){
setLayout(new CardLayout());
setBackground(Color.blue);
setForeground(Color.white);
add("Lili",new Label("Lili, Female, Birthday: 1980/8/30",Label.CENTER));
add("Wang",new Label("Wang, Male, Birthday: 1977/5/9",Label.CENTER));
add("Lee", new Label("Lee, Male, Birthday: 1979/2/26",Label.CENTER));
}
public Dimension preferredSize(){
return (new Dimension(100,200));
}
}
public class CardPanel extends Frame{
CardBox cards;
CardPanel(){
setLayout(new BorderLayout());
add("Center",cards=new CardBox());
Panel p=new Panel();
p.setLayout(new FlowLayout());
p.setBackground(Color.gray);
add("North",p);
p.add(new Button("First"));
p.add(new Button("Next"));
Choice c=new Choice();
c.addItem("Lili");
c.addItem("Wang");
c.addItem("Lee");
p.add(c);
p.add(new Button("Previous"));
p.add(new Button("Last"));
p.add(new Button("Close"));
}
public boolean action(Event e, Object arg){
if ("Close".equals(arg)|e.id==Event.WINDOW_DESTROY) System.exit(0);
if (e.target instanceof Choice){
((CardLayout)cards.getLayout()).show(cards,(String)arg);
}else{
if ("First".equals(arg)){
((CardLayout)cards.getLayout()).first(cards);
}else if ("Next".equals(arg)){
((CardLayout)cards.getLayout()).next(cards);
}else if ("Previous".equals(arg)){
((CardLayout)cards.getLayout()).previous(cards);
}else if ("Last".equals(arg)){
((CardLayout)cards.getLayout()).last(cards);
}else{
((CardLayout)cards.getLayout()).show(cards,(String)arg);
}
}
return true;
}
public static void main(String args[]){
CardPanel mypanel=new CardPanel();
mypanel.setTitle("Personal Information Cards");
mypanel.resize(400,200);
mypanel.show();
}
}
--
�� ��Դ: �й�ƴ�BBSվ [bbs.ustc.edu.cn]
Technical Details
Message-ID:
<980620.ynJLa$PBBS@bbs.ustc.edu.cn>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: Chinese,GB X-Google-Thread: f6cb0,dd754cc8db359825 X-Google-Attributes: gidf6cb0,public From: Qin_Qin@bbs.ustc.edu.cn (��) Subject: Re: ���������� 3���������Ϲ����𰸣� Date: 1998/06/20 Message-ID: <980620.ynJLa$PBBS@bbs.ustc.edu.cn> X-Deja-AN: 364458102 Organization: �й�ƴ�BBSվ Newsgroups: cn.bbs.comp.lang.java