import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class GoodEveningApplet extends Applet {
boolean isStandalone = false;
BorderLayout borderLayout1 = new BorderLayout();
BorderLayout borderLayout2 = new BorderLayout();
CardLayout cardLayout1 = new CardLayout();
CardLayout cardLayout2 = new CardLayout();
Panel upper = new Panel();
Panel lower = new Panel();
Panel panel1 = new Panel();
Panel panel2 = new Panel();
Panel panel3 = new Panel();
Panel panel4 = new Panel();
Panel panel5 = new Panel();
List list1 = new List();
Label label1 = new Label();
Label label2 = new Label();
Label label3 = new Label();
Label label4 = new Label();
Label label5 = new Label();
Label label6 = new Label();
FlowLayout flowLayout1 = new FlowLayout();
FlowLayout flowLayout2 = new FlowLayout();
FlowLayout flowLayout3 = new FlowLayout();
FlowLayout flowLayout4 = new FlowLayout();
FlowLayout flowLayout5 = new FlowLayout();
Button button1 = new Button();
Choice choice1 = new Choice();
//Construct the applet
public GoodEveningApplet() {
}
//Initialize the applet
public void init() {
choice1.addItem("English");
choice1.addItem("German");
choice1.addItem("Italian");
choice1.addItem("French");
choice1.addItem("Dutch");
try {
jbInit();
}
catch (Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
this.setLayout(borderLayout2);
upper.setBackground(Color.orange);
lower.setBackground(Color.magenta);
lower.setLayout(cardLayout1);
//panel1到panel5安排在lower中
panel1.setBackground(Color.yellow);
panel1.setLayout(flowLayout5);
panel2.setBackground(Color.magenta);
panel2.setLayout(flowLayout4);
panel3.setLayout(flowLayout3);
panel3.setBackground(Color.cyan);
panel4.setLayout(flowLayout2);
panel4.setBackground(Color.pink);
panel5.setBackground(Color.white);
panel5.setLayout(flowLayout1);
// panel1到panel5各个面板上使用的label问候语
label1.setBackground(Color.black);
label1.setFont(new java.awt.Font("Dialog", Font.BOLD, 20));
label1.setForeground(Color.blue);
label1.setText("Select a language");
label2.setFont(new java.awt.Font("Dialog", Font.BOLD, 24));
label2.setText("Good Evening!");
label3.setFont(new java.awt.Font("Dialog", Font.BOLD, 24));
label3.setText("Guten abend!");
label4.setFont(new java.awt.Font("Dialog", Font.BOLD, 24));
label4.setText(" Buona sera!");
label5.setFont(new java.awt.Font("Dialog", Font.BOLD, 24));
label5.setText("Bonsoir !");
label6.setFont(new java.awt.Font("Dialog", Font.BOLD, 24));
label6.setText("Goede avond!");
//在整个界面的北部添加upper组件,并添加upper中的组件:button和choice
this.add(upper, java.awt.BorderLayout.NORTH);
button1.setLabel("Push me");
button1.addActionListener(new GoodEveningApplet_button1_actionAdapter(this));
choice1.addItemListener(new GoodEveningApplet_choice1_itemAdapter(this));
upper.add(label1);
upper.add(choice1);
//在整个界面的中心添加lower面板,并将添加panel1-panel5到lower中
this.add(lower, java.awt.BorderLayout.CENTER);
lower.add(panel1, "panel1");
lower.add(panel2, "panel2");
lower.add(panel3, "panel3");
lower.add(panel4, "panel4");
lower.add(panel5, "panel5");
//在整个界面的南端添加list组件
this.add(list1, java.awt.BorderLayout.SOUTH);
//分别添加各标签到panel1-panel5面板中
panel5.add(label6, null);
panel4.add(label5, null);
panel3.add(label4, null);
panel2.add(button1);
panel2.add(label3, null);
panel1.add(label2, null);
}
//Start the applet
public void start() {
}
//Stop the applet
public void stop() {
}
//Destroy the applet
public void destroy() {
}
//Get Applet information
public String getAppletInfo() {
return "Applet Information";
}
// choice组件的事件处理函数
public void choice1_itemStateChanged(ItemEvent e) {
if ("English".equals(choice1.getSelectedItem())) {
cardLayout1.show(lower, "panel1");
}
else if ("German".equals(choice1.getSelectedItem())) {
cardLayout1.show(lower, "panel2");
}
else if ("Italian".equals(choice1.getSelectedItem())) {
cardLayout1.show(lower, "panel3");
}
else if ("French".equals(choice1.getSelectedItem())) {
cardLayout1.show(lower, "panel4");
}
else if ("Dutch".equals(choice1.getSelectedItem())) {
cardLayout1.show(lower, "panel5");
}
}
// button1组件的事件处理函数
public void button1_actionPerformed(ActionEvent e) {
label3.setForeground(new Color(255,255,0));
}
}
// choice组件的事件适配器
class GoodEveningApplet_choice1_itemAdapter implements ItemListener {
private GoodEveningApplet adaptee;
GoodEveningApplet_choice1_itemAdapter(GoodEveningApplet adaptee) {
this.adaptee = adaptee;
}
public void itemStateChanged(ItemEvent e) {
adaptee.choice1_itemStateChanged(e);
}
}
// button1组件的事件适配器
class GoodEveningApplet_button1_actionAdapter implements ActionListener {
private GoodEveningApplet adaptee;
GoodEveningApplet_button1_actionAdapter(GoodEveningApplet adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.button1_actionPerformed(e);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
深入浅出Java 2入门、进阶与应用实例 光盘源代码 (323个子文件)
Name.java.bak 379B
WebUse.java.bak 365B
WebUse.class 2KB
User.class 751B
Name.class 738B
WebUse.class 689B
PackageUse.class 529B
NameFactory.class 400B
Thumbs.db 5KB
studentable.frm 8KB
draw.GIF 11KB
AppletUse.html 243B
draw.html 241B
ThreadUseApplet.html 175B
ThreadUseApplet.html 175B
ThreadUseApplet.html 173B
ThreadUseApplet.html 173B
ThreadUseApplet.html 173B
sayhello.html 169B
AppletUse.html 163B
GoodEveningApplet.html 119B
AppletUse.html 111B
AppletUse.html 109B
GoodEveningApplet.java 6KB
GUIUse.java 5KB
IOUse.java 4KB
GUIUse.java 4KB
GUIUse.java 4KB
GUIUse.java 3KB
JDBCUse.java 3KB
JDBCUse.java 3KB
GUIUse.java 2KB
GUIUse.java 2KB
GUIUse.java 2KB
ArrayUse.java 2KB
ThreadUse.java 2KB
GUIUse.java 2KB
ThreadUse.java 2KB
GUIUse.java 2KB
WebUse.java 2KB
ThreadUse.java 2KB
ExceptionUse.java 2KB
ExceptionUse.java 2KB
MyClient.java 2KB
ThreadUse.java 2KB
WebUse.java 2KB
ThreadUse.java 2KB
ThreadUse.java 2KB
GUIUse.java 2KB
MyServer.java 2KB
GUIUse.java 2KB
GUIUse.java 1KB
FlowControl.java 1KB
ArrayUse.java 1KB
ArrayUse.java 1KB
FlowControl.java 1KB
CanvasTest.java 1KB
HostResolver.java 1KB
GUIUse.java 1KB
JDBCUse.java 1KB
AppletUse.java 1KB
AppletUse.java 1KB
IOUse.java 1KB
ThreadUse.java 1KB
FlowControl.java 1KB
ArrayUse.java 1KB
ThreadUseApplet.java 1KB
IOUse.java 1KB
GUIUse.java 1KB
ThreadUse.java 1KB
ExceptionUse.java 1KB
InterfaceUse.java 1KB
ArrayUse.java 1KB
CoinMake.java 1KB
InterfaceUse.java 1KB
SuperUse.java 1KB
SuperUse.java 1KB
IOUse.java 1KB
CircleApp.java 1KB
WebUse.java 1KB
AppletUse.java 1KB
GUIUse.java 1KB
ExceptionUse.java 1003B
GUIUse.java 998B
ExceptionUse.java 985B
GUIUse.java 983B
InterfaceUse.java 949B
IdentifierUse.java 944B
FlowControl.java 925B
ExpressionUse.java 925B
ExpressionUse.java 924B
ThreadUseApplet.java 915B
Shadow.java 909B
Name.java 904B
ExceptionUse.java 903B
IOUse.java 898B
ThisAndSuperUse.java 887B
ExceptionUse.java 879B
ExceptionUse.java 867B
IOUse.java 854B
共 323 条
- 1
- 2
- 3
- 4
资源评论
- travelstarmzl2012-07-10正是我想要的,和书本原来附带的一致
v522zy
- 粉丝: 4
- 资源: 23
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- mosquitto-2.018-install-windows-x64
- FTPServer FTP 服务器,绿色免安装,单文件
- 梦畅语音点名软件,上课点名
- 利用ADNI数据集和标签,在tensorflow框架上使用tensorlayer接口,通过架构u-net实现海马体的分割
- Kutools for Word v9.0 office word 插件
- 修复Windows 10 LTSC 2021资源占用率高
- Hash工具,小巧绿色hash校验工具,免费hash工具
- 重启进行BIOS快捷方式,不需要开机按BIOS键
- 鸭子开车记(儿童绘本)
- 威纶通触摸屏编程软件Easy builder pro V6.09.01.556安装包(2024.04).txt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功